security(slack): isolate room slash auth from DM pairing-store entries#26052
Closed
bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
Closed
security(slack): isolate room slash auth from DM pairing-store entries#26052bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
Conversation
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 slash command authorization in room contexts currently mixes two trust scopes:
channels.slack.allowFrom,channels.slack.channels.<id>.users)readChannelAllowFromStore("slack"))That allows a sender who is only present in DM pairing-store state to be treated as owner-authorized for channel slash commands.
This PR keeps DM pairing-store entries scoped to DM authorization only, and keeps room/channel slash authorization bound to explicit room/owner config.
Change Type
Scope
src/slack/monitor/slash.tssrc/slack/monitor/slash.test.tsSecurity Impact
High (AuthZ boundary bypass on privileged command surface).
Before this patch, a DM-paired user could execute Slack slash commands in channel/group contexts without being in the explicit owner allowlist for room command authorization.
Worst case: unauthorized user can trigger high-privilege native slash commands in shared channels where only explicit owner/channel users should be authorized.
Repro + Verification
Deterministic repro (local):
git checkout 6cde6a641dd20a1b65687218b66000a98795bf98^).pnpm exec vitest run src/slack/monitor/slash.test.ts --maxWorkers=1blocks channel slash commands for senders authorized only via DM pairing storeCommandAuthorized: true.Post-fix verification:
pnpm exec vitest run src/slack/monitor/slash.test.ts --maxWorkers=1Evidence
Dedupe checks:
channels.<id>.usersfail-closed semantics, not DM pairing-store cross-scope authorization:Code-level evidence:
ctx.allowFromonly.allowFrom + pairing-store) to preserve DM pairing behavior.Human Verification
commands.useAccessGroups: truechannels.slack.allowFrom: ["U_OWNER"]U_ATTACKER) exists only in Slack pairing store (not in static allowFrom).U_ATTACKER.Compatibility / Migration
No schema/config migration.
Behavioral change: room/channel slash authorization no longer treats DM pairing-store entries as owner authorization. Operators must use explicit
channels.slack.allowFromand/or per-channelusersallowlists for room authorization.Failure Recovery
If rollback is required, revert this commit to restore prior behavior. The regression test can be kept to document expected secure behavior and prevent accidental reintroduction.
Risks and Mitigations
Risk:
Mitigation:
channels.slack.allowFromand/orchannels.slack.channels.<id>.usersexplicitly.Greptile Summary
This PR fixes a critical authorization boundary bypass in Slack slash command handling. Before this fix, users who were only authorized via DM pairing store could execute slash commands in channel/group contexts where only explicitly configured owner/channel users should be authorized.
The fix introduces a new variable
ownerAllowFromLowerthat is conditionally set based on context:isRoomish): uses only staticctx.allowFromconfigurationeffectiveAllowFromLowerwhich includes both static config and pairing store entriesThis ensures DM pairing-store entries remain scoped to DM authorization only, while room/channel slash authorization is bound exclusively to explicit owner/channel configuration.
The regression test validates the fix by mocking a pairing store entry for
U_ATTACKERwhile setting staticallowFromtoU_OWNER, then verifying thatU_ATTACKERreceives an unauthorized response when attempting to use slash commands in a channel context.Confidence Score: 5/5
Last reviewed commit: 6cde6a6