Skip to content

Add Telegram bot user authorization#51

Open
Brad-Edwards wants to merge 1 commit intodevfrom
fix/issue-24-telegram-auth
Open

Add Telegram bot user authorization#51
Brad-Edwards wants to merge 1 commit intodevfrom
fix/issue-24-telegram-auth

Conversation

@Brad-Edwards
Copy link
Copy Markdown
Collaborator

@Brad-Edwards Brad-Edwards commented Mar 7, 2026

Summary

  • New src/bot/auth.ts with authorization middleware
  • Checks ctx.chat.id against TELEGRAM_CHAT_ID (supports comma-separated list)
  • Unauthorized users get "Not authorized." reply, handler chain stops
  • Graceful degradation: allows all users with warning when TELEGRAM_CHAT_ID not set
  • 14 new tests covering auth scenarios

Closes #24

Test plan

  • Run bun test
  • Test bot with authorized and unauthorized chat IDs
  • Verify graceful degradation without TELEGRAM_CHAT_ID

Check incoming messages against TELEGRAM_CHAT_ID (now supports
comma-separated list of allowed chat IDs). Unauthorized users
receive a "Not authorized." reply. When TELEGRAM_CHAT_ID is not
configured, all users are allowed with a logged warning (graceful
degradation per project conventions).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Brad-Edwards Brad-Edwards changed the base branch from main to dev March 7, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRITICAL: Add Telegram bot user authorization

1 participant