security(slack): isolate room text-command auth from DM pairing-store entries#26098
Closed
bmendonca3 wants to merge 6 commits intoopenclaw:mainfrom
Closed
security(slack): isolate room text-command auth from DM pairing-store entries#26098bmendonca3 wants to merge 6 commits intoopenclaw:mainfrom
bmendonca3 wants to merge 6 commits intoopenclaw:mainfrom
Conversation
Contributor
Author
|
Security follow-up linked from #26693 (comment) Implemented in
|
Contributor
|
Thanks for the contribution and the security focus here. Closing this as superseded because the relevant auth-boundary hardening has already landed on If you want, we can open a fresh, narrowly-scoped follow-up PR on top of current |
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
Slack room message command authorization still merged DM pairing-store entries into owner authorization checks.
In
prepareSlackMessage, room/group command gating usedallowFrom + readChannelAllowFromStore("slack"), so a user approved only through DM pairing-store state could become command-authorized for channel text commands (for example/new) without being explicitly inchannels.slack.allowFromor per-channelusers.This PR isolates room/group command authorization from DM pairing-store state.
Change Type
Scope
src/slack/monitor/message-handler/prepare.tssrc/slack/monitor/message-handler/prepare.test.tsSecurity Impact
High. This is an AuthZ boundary bypass on a privileged command surface in shared channels.
Before fix:
After fix:
Repro + Verification
Deterministic repro (before patch):
git checkout 58eb15dd000c6aad16211d0492a238ba7f16ae51^pnpm exec vitest run src/slack/monitor/message-handler/prepare.test.ts --maxWorkers=1blocks channel control commands for senders authorized only via DM pairing storeCommandAuthorized: true.Post-fix verification:
pnpm exec vitest run src/slack/monitor/message-handler/prepare.test.ts src/slack/monitor/slash.test.ts --maxWorkers=1Evidence
Dedupe checks:
Code evidence:
prepare.tsnow derives room owner authorization fromctx.allowFromonly.Human Verification
commands.useAccessGroups: truechannels.slack.allowFrom: ["U_OWNER"]U_ATTACKER) is only present in Slack pairing store (not in staticallowFrom)./new).Compatibility / Migration
No config/schema migration.
Behavior change: operators who previously relied on DM pairing-store state for room command authorization must add explicit entries in
channels.slack.allowFromand/orchannels.slack.channels.<id>.users.Failure Recovery
Revert this commit to restore prior behavior if needed. Regression test remains usable to guard against future reintroduction of DM-to-room auth scope bleed.
Risks and Mitigations
Risk:
Mitigation:
channels.slack.allowFromand/or per-channelusersallowlists.Greptile Summary
This PR fixes an authorization boundary bypass where DM pairing-store entries leaked into room/group text-command authorization. Before the fix,
prepareSlackMessageusedresolveSlackEffectiveAllowFrom()(which mergesctx.allowFromwithreadChannelAllowFromStore("slack")) for both DM access checks and room command gating. A user who was only approved through the DM pairing flow could issue privileged channel text commands (e.g.,/new) without being explicitly listed inchannels.slack.allowFromor per-channelusers.The fix introduces
ownerAllowFromLower, derived solely fromctx.allowFromfor room/group contexts, while preserving the full effective allow list for DM policy checks. This correctly scopes DM pairing-store state to DM access only.slash.ts) is tracked separately in PR security(slack): isolate room slash auth from DM pairing-store entries #26052Confidence Score: 5/5
auth.ts,allow-list.ts, andcommand-gating.ts. No regressions are introduced for DM, group DM, or channel message flows.src/slack/monitor/slash.tshas a similar pattern (usingeffectiveAllowFromLowerfor room command auth) which is tracked separately in PR security(slack): isolate room slash auth from DM pairing-store entries #26052.Last reviewed commit: 58eb15d