security(allowlist): scope pairing-store operations to accountId#26693
security(allowlist): scope pairing-store operations to accountId#26693bmendonca3 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Additional Comments (1)
Check Prompt To Fix With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/commands-allowlist.ts
Line: 119
Comment:
While `/allowlist` command mutations are now scoped, the actual runtime authorization checks in channel handlers (Discord, Slack, Signal, iMessage, LINE) still call `readChannelAllowFromStore` without `accountId`, meaning they read unscoped store state and remain vulnerable to cross-account pollution.
Check `src/discord/monitor/message-handler.preflight.ts:183`, `src/slack/monitor/auth.ts:7`, `src/signal/monitor/event-handler.ts:447`, `src/imessage/monitor/monitor-provider.ts:233`, and `src/line/bot-handlers.ts:119` - all missing accountId parameter.
How can I resolve this? If you propose a fix, please make it concise. |
|
Addressed Greptile note: Resolution is covered by channel-specific commits/PR branches:
|
|
This pull request has been automatically marked as stale due to inactivity. |
Summary
/allowlistwhere pairing-store reads/writes ignored account scope./allowlist listnow reads pairing-store entries with the resolvedaccountId./allowlist add|removenow writes/removes pairing-store entries with the resolvedaccountId.Change Type
Scope
src/auto-reply/reply/commands-allowlist.tssrc/auto-reply/reply/commands.test.tsSecurity Impact
/allowliststore mutations were written unscoped, which could pollute shared pairing-store state across accounts.Repro + Verification
/allowlist add dm --store <sender>.accountId) and could affect other account evaluations.accountIdand remain isolated per account.Targeted tests:
pnpm exec vitest run src/auto-reply/reply/commands.test.ts --maxWorkers=1Evidence
/allowlistaccount-scope pairing-store bug):src/auto-reply/reply/commands-allowlist.ts(readChannelAllowFromStore,addChannelAllowFromStoreEntry,removeChannelAllowFromStoreEntry)Human Verification
/allowlist list dmfrom different accounts and confirm paired store entries are account-specific./allowlist add dm --store <id>on account B and verify account A store output is unchanged.Compatibility / Migration
Failure Recovery
Risks and Mitigations
Greptile Summary
This PR correctly scopes
/allowlistcommand-path store mutations toaccountId, preventing cross-account pollution when users manage allowlists via commands. The fix addsaccountIdparameters toreadChannelAllowFromStore,addChannelAllowFromStoreEntry, andremoveChannelAllowFromStoreEntrycalls within the/allowlistcommand handler, and includes regression tests verifying account-scoped behavior.However, the security boundary fix is incomplete. While command-path edits are now scoped, the actual runtime authorization checks in multiple channel handlers (Discord, Slack, Signal, iMessage, LINE) still call
readChannelAllowFromStorewithout passingaccountId. This means:/allowlist add dm --store <sender>to write scoped entries (fixed by this PR)The PR description claims "command-path store reads and mutations are account-scoped" but the command path is only used for management - the actual DM authorization decisions happen in channel-specific message handlers that were not updated.
Confidence Score: 1/5
/allowlistcommand mutations are properly scoped, the runtime authorization checks in all channel handlers (Discord, Slack, Signal, iMessage, LINE) still read unscoped pairing-store state. This means the core vulnerability - cross-account authorization decisions - remains exploitable. The fix addresses symptom (command management) but not the disease (runtime evaluation).readChannelAllowFromStorewithout accountId:src/discord/monitor/message-handler.preflight.ts,src/discord/monitor/native-command.ts,src/discord/monitor/agent-components.ts,src/slack/monitor/auth.ts,src/slack/monitor/slash.ts,src/signal/monitor/event-handler.ts,src/imessage/monitor/monitor-provider.ts,src/line/bot-handlers.ts, andsrc/security/audit-channel.tsLast reviewed commit: 238f0ab