Skip to content

bug: Bot messages blocked by user allowlist even after passing bot gate #604

@rockexe0000

Description

@rockexe0000

Description

When allow_bot_messages = "all" is configured, bot messages correctly pass the bot gate (mode check + trusted_bot_ids), but are then rejected by the user allowlist check at src/discord.rs:474. The user gate does not distinguish between bot and human authors, so bot messages are denied unless the bot's ID is manually added to allowed_users.

This means allow_bot_messages and allowed_users are coupled in a way that contradicts the documented behavior — the bot gate should be sufficient to authorize bot messages.

Steps to Reproduce

  1. Configure config.toml with:
    allow_bot_messages = "all"
    trusted_bot_ids = []
    allow_all_users = false
    allowed_users = ["<your_human_user_id>"]
  2. Have another bot send a message in an allowed channel
  3. Observe that the bot reacts with 🚫 and logs "denied user, ignoring"
  4. Add the other bot's ID to allowed_users → it works

Expected Behavior

Bot messages that pass the bot gate (allow_bot_messages + trusted_bot_ids) should not be blocked by the user allowlist. The user gate should only apply to human (non-bot) messages.

Environment

  • OpenAB version: latest (main branch, commit e914f70)
  • Platform: Discord
  • Relevant code: src/discord.rs line 474–479

Screenshots / Logs

tracing::info!(user_id = %msg.author.id, "denied user, ignoring");

Suggested fix — add !msg.author.bot guard at line 474:

if !msg.author.bot
    && !self.allow_all_users
    && !self.allowed_users.contains(&msg.author.id.get())
{
    ...
}

src/slack.rs may need the same fix if it shares this pattern.


Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions