Summary
Currently, when allowed_channels is empty ([]) or omitted in config.toml, the bot responds to all channels in the Discord server. This is an "open by default" design that poses security and resource risks in production.
Current Behavior
// discord.rs
let in_allowed_channel =
self.allowed_channels.is_empty() || self.allowed_channels.contains(&channel_id);
Empty = allow all.
Problem
- Users who forget to configure
allowed_channels unknowingly expose the bot to the entire server
- Session pool (
max_sessions = 10) can be exhausted quickly if the bot responds across many channels
- Bot may respond with sensitive content in unintended channels
Proposed Options
Option A: Empty = deny all (secure by default)
- Safest approach
- Downside: new users may be confused when bot does not respond after setup
- Mitigation: clear error log at startup:
ERROR: No allowed_channels configured. Bot will not respond to any messages.
Option B: Empty = allow all + startup warning
- Keep current behavior but log a prominent warning:
⚠️ No allowed_channels configured — bot will respond in ALL channels
- Lower friction for development/testing
Option C: Require at least one channel (fail fast)
- Refuse to start if
allowed_channels is empty
- Clearest signal, zero ambiguity
Recommendation
Option A or C for production safety. The cost of setting one channel ID is trivial compared to the risk of accidental full-server exposure.
References
src/config.rs: allowed_channels: Vec<String> with #[serde(default)]
src/discord.rs: is_empty() check in message handler
Summary
Currently, when
allowed_channelsis empty ([]) or omitted inconfig.toml, the bot responds to all channels in the Discord server. This is an "open by default" design that poses security and resource risks in production.Current Behavior
Empty = allow all.
Problem
allowed_channelsunknowingly expose the bot to the entire servermax_sessions = 10) can be exhausted quickly if the bot responds across many channelsProposed Options
Option A: Empty = deny all (secure by default)
ERROR: No allowed_channels configured. Bot will not respond to any messages.Option B: Empty = allow all + startup warning
Option C: Require at least one channel (fail fast)
allowed_channelsis emptyRecommendation
Option A or C for production safety. The cost of setting one channel ID is trivial compared to the risk of accidental full-server exposure.
References
src/config.rs:allowed_channels: Vec<String>with#[serde(default)]src/discord.rs:is_empty()check in message handler