Fix Discord allow_from config bridge for gateway auth - #34557
Closed
Que0x wants to merge 2 commits into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config.yaml-based Discordallow_fromvalues were being loaded intoPlatformConfig.extra, but they were never bridged toDISCORD_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_fromandplatforms.discord.extra.allow_fromnow populateDISCORD_ALLOWED_USERSwhile preserving existing env-overrides-first behavior. That keeps the current auth model intact and makes the documented config path actually enforce access control.Changes
discord.allow_fromtoDISCORD_ALLOWED_USERSplatforms.discord.extra.allow_fromtoDISCORD_ALLOWED_USERSDISCORD_ALLOWED_USERSis already setValidation
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 passedpytest -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 -q55 passed