Skip to content

Fail closed on empty channel allowlists#22

Open
lawyered0 wants to merge 1 commit into
louisho5:mainfrom
lawyered0:codex/fix-channel-open-mode-default
Open

Fail closed on empty channel allowlists#22
lawyered0 wants to merge 1 commit into
louisho5:mainfrom
lawyered0:codex/fix-channel-open-mode-default

Conversation

@lawyered0
Copy link
Copy Markdown

Summary

This PR closes a critical channel-authentication gap by requiring explicit sender allowlists by default.

Critical issue addressed

Telegram and Discord startup previously treated empty allowFrom as open mode, allowing any external user to interact with the bot when enabled.

What changed

  • Added an explicit environment gate in internal/channels/security.go:
    • PICOBOT_ALLOW_PUBLIC_CHANNELS=1 is now required to opt into public/open channel mode.
  • Hardened Telegram startup in internal/channels/telegram.go:
    • startup now fails when allowFrom is empty unless public mode is explicitly enabled.
  • Hardened Discord startup in internal/channels/discord.go:
    • startup now fails when allowFrom is empty unless public mode is explicitly enabled.
  • Added regression tests:
    • internal/channels/telegram_test.go (reject empty allowFrom by default)
    • internal/channels/discord_test.go (reject empty allowFrom by default)
    • internal/channels/security_test.go (env gate behavior)

Validation

  • go test ./internal/channels -count=1
  • go test ./...

Compatibility note

Users relying on implicit open mode must now explicitly set PICOBOT_ALLOW_PUBLIC_CHANNELS=1.

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.

1 participant