fix(discord): gate component command authorization for guild interactions#26119
Merged
steipete merged 2 commits intoopenclaw:mainfrom Feb 25, 2026
Merged
fix(discord): gate component command authorization for guild interactions#26119steipete merged 2 commits intoopenclaw:mainfrom
steipete merged 2 commits intoopenclaw:mainfrom
Conversation
f2cb7b5 to
00ed58b
Compare
Contributor
|
Landed via temp rebase onto main.
Thanks @bmendonca3! |
steipete
added a commit
to justinhuangcode/openclaw
that referenced
this pull request
Feb 25, 2026
…ions (openclaw#26119) * Discord: gate component command authorization * test: cover allowlisted guild component authorization path (openclaw#26119) (thanks @bmendonca3) --------- Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
Jackson3195
pushed a commit
to Jackson3195/openclaw-with-a-personal-touch
that referenced
this pull request
Feb 25, 2026
…ions (openclaw#26119) * Discord: gate component command authorization * test: cover allowlisted guild component authorization path (openclaw#26119) (thanks @bmendonca3) --------- Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
…ions (openclaw#26119) * Discord: gate component command authorization * test: cover allowlisted guild component authorization path (openclaw#26119) (thanks @bmendonca3) --------- Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
2 tasks
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Feb 27, 2026
…ions (openclaw#26119) * Discord: gate component command authorization * test: cover allowlisted guild component authorization path (openclaw#26119) (thanks @bmendonca3) --------- Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
…ions (openclaw#26119) * Discord: gate component command authorization * test: cover allowlisted guild component authorization path (openclaw#26119) (thanks @bmendonca3) --------- Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…ions (openclaw#26119) * Discord: gate component command authorization * test: cover allowlisted guild component authorization path (openclaw#26119) (thanks @bmendonca3) --------- Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
thebenjaminlee
pushed a commit
to escape-velocity-ventures/openclaw
that referenced
this pull request
Mar 7, 2026
…ions (openclaw#26119) * Discord: gate component command authorization * test: cover allowlisted guild component authorization path (openclaw#26119) (thanks @bmendonca3) --------- Co-authored-by: Brian Mendonca <brianmendonca@Brians-MacBook-Air.local> Co-authored-by: Peter Steinberger <steipete@gmail.com>
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
Discord component/modal interaction events were always dispatched with
CommandAuthorized: true.For guild interactions this incorrectly bypassed command authorization boundaries tied to
allowFrom, channelusers/roles, andcommands.useAccessGroups, allowing non-authorized users to submit component/modal input that downstream command routing could treat as authorized.This PR computes
CommandAuthorizedfor component events using the same Discord authorizer model used by native command handling.Change Type
Scope
src/discord/monitor/agent-components.tsCommandAuthorized: truewith computed authorization for guild component events.commands.useAccessGroupscommand-gating semantics.src/discord/monitor/monitor.test.tsSecurity Impact
commands.allowFromis not explicitly set.Repro + Verification
Deterministic repro (pre-fix)
commands.useAccessGroups: trueandallowFromexcluding a guild user.CommandAuthorized: true(incorrect).Deterministic verification (post-fix)
src/discord/monitor/monitor.test.tsdoes not mark guild modal events as command-authorized for non-allowlisted userspnpm exec vitest run src/discord/monitor/monitor.test.ts --maxWorkers=1Evidence
Dedupe checks (no overlapping open auth fix found)
discord component CommandAuthorized):discord component CommandAuthorized):Local failing->passing signal
expected true to be false).src/discord/monitor/monitor.test.tspasses with 36/36 tests.Human Verification
Compatibility / Migration
Failure Recovery
commands.allowFromif immediate hard owner gating is required.Risks and Mitigations
CommandAuthorizedsemantics may block previously (incorrectly) allowed command-like component payloads.Greptile Summary
This PR fixes a security vulnerability where Discord component/modal interactions were hardcoded with
CommandAuthorized: true, bypassing authorization checks for guild interactions.Key Changes:
resolveComponentCommandAuthorizedfunction insrc/discord/monitor/agent-components.ts:731-780that mirrors the authorization logic from native Discord commandstrue(line 740)commands.useAccessGroupssettingsCommandAuthorized: trueat line 893 with computed valuesrc/discord/monitor/monitor.test.ts:394-424verifying non-allowlisted users getCommandAuthorized: falseAuthorization Logic:
The new function correctly replicates the authorization pattern from
src/discord/monitor/native-command.ts:1410-1432, using the sameresolveCommandAuthorizedFromAuthorizersutility with identical authorizer configuration.Security Impact:
Before this fix, untrusted guild users could submit modal/component interactions that would be treated as command-authorized, potentially allowing execution of privileged operations when
commands.allowFromrestrictions were configured.Confidence Score: 5/5
Last reviewed commit: f2cb7b5