security(discord): scope DM component pairing auth to accountId#26671
Closed
bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
Closed
security(discord): scope DM component pairing auth to accountId#26671bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
Conversation
bmendonca3
commented
Feb 25, 2026
Contributor
Author
bmendonca3
left a comment
There was a problem hiding this comment.
Submitting pending review to unblock thread replies.
13 tasks
Member
|
Superceded by existing commits on main |
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 DM component authorization (
agent-components) used channel-level pairing-store reads/writes withoutaccountId. In multi-account setups, this can let pairing approvals from one Discord account influence DM component authorization in another account.This PR scopes the DM component pairing-store read/write calls to the active Discord account.
Change Type
Scope
src/discord/monitor/agent-components.tssrc/discord/monitor/monitor.test.tsSecurity Impact
Repro + Verification
Deterministic repro (local)
accountA,accountB) with DM policypairing.accountA; pair and approve that sender.accountB.accountId.Automated verification
Passes with assertions that the DM component auth path calls:
readChannelAllowFromStore("discord", process.env, accountId)upsertChannelPairingRequest({ ..., accountId })Evidence
#25989) but addresses explicit empty member allowlist fail-closed behavior, not account-scoped component pairing auth.Human Verification
ensureDmComponentAuthorizednow passesctx.accountIdinto both pairing-store read and pairing request upsert.monitor.test.tsfor account-scoped call arguments.Compatibility / Migration
Failure Recovery
openwhile reconciling account-specific pairing approvals.Risks and Mitigations
Greptile Summary
This PR fixes a cross-account authorization boundary issue in Discord DM component interactions. The fix correctly scopes pairing-store reads and pairing request creation to
accountIdinensureDmComponentAuthorized.Key changes:
readChannelAllowFromStorenow receivesctx.accountIdparameterupsertChannelPairingRequestnow includesaccountIdfieldSecurity impact:
The fix addresses the stated vulnerability where pairing approvals from one Discord account could authorize component interactions in another account within multi-account gateway setups. The implementation is correct and test coverage validates the account-scoped behavior.
Scope note:
This PR specifically addresses DM component authorization (
agent-components.ts). Similar unscopedreadChannelAllowFromStoreandupsertChannelPairingRequestcalls exist in:src/discord/monitor/native-command.ts(lines 1364, 1384-1391)src/discord/monitor/message-handler.preflight.ts(lines 183, 202-209)These files handle DM message/command authorization and may have the same cross-account pairing state issue, but are outside this PR's scope. The PR description correctly limits scope to "DM component" auth.
Confidence Score: 4/5
accountIdto pairing functions. Tests verify the account-scoped behavior. Score is 4 (not 5) because similar unscoped pairing calls exist in related Discord DM authorization paths (native-command.ts,message-handler.preflight.ts), suggesting this may be a partial fix of a broader pattern - however, the PR description correctly scopes this to "DM component" auth specifically.Last reviewed commit: 4ed219f