Skip to content

Fix Discord allow_from config bridge for gateway auth - #34557

Closed
Que0x wants to merge 2 commits into
NousResearch:mainfrom
Que0x:fix/discord-config-allow-from-env-bridge
Closed

Fix Discord allow_from config bridge for gateway auth#34557
Que0x wants to merge 2 commits into
NousResearch:mainfrom
Que0x:fix/discord-config-allow-from-env-bridge

Conversation

@Que0x

@Que0x Que0x commented May 29, 2026

Copy link
Copy Markdown
Contributor

Summary

config.yaml-based Discord allow_from values were being loaded into PlatformConfig.extra, but they were never bridged to DISCORD_ALLOWED_USERS. Since both the gateway auth layer and the Discord adapter enforce authorization from env-backed allowlists, the config-defined allowlist was effectively ignored.

This PR completes that bridge. discord.allow_from and platforms.discord.extra.allow_from now populate DISCORD_ALLOWED_USERS while preserving existing env-overrides-first behavior. That keeps the current auth model intact and makes the documented config path actually enforce access control.

Changes

  • Bridge discord.allow_from to DISCORD_ALLOWED_USERS
  • Bridge platforms.discord.extra.allow_from to DISCORD_ALLOWED_USERS
  • Preserve env precedence when DISCORD_ALLOWED_USERS is already set
  • Add regression coverage for both config shapes

Validation

  • pytest -o addopts='' -p no:timeout tests/gateway/test_config.py -q -k "discord_allow_from or discord_thread_require_mention or discord_history_backfill or discord_channel_prompts"
    4 passed
  • pytest -o addopts='' -p no:timeout tests/gateway/test_discord_channel_controls.py tests/gateway/test_discord_bot_auth_bypass.py tests/gateway/test_discord_slash_auth.py -q
    55 passed

@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery platform/discord Discord bot adapter area/auth Authentication, OAuth, credential pools area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists labels May 29, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #35329 (#35329). Your commit was cherry-picked onto current main with authorship preserved (6d2727e). Combined with #34565 since both touched gateway/config.py and would have conflicted separately. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools area/config Config system, migrations, profiles comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists platform/discord Discord bot adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants