security(signal): scope pairing approvals to accountId#26639
Closed
bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
Closed
security(signal): scope pairing approvals to accountId#26639bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
bmendonca3 wants to merge 2 commits intoopenclaw:mainfrom
Conversation
nikolasdehor
approved these changes
Feb 25, 2026
nikolasdehor
left a comment
There was a problem hiding this comment.
Clean fix — scoping readChannelAllowFromStore and upsertChannelPairingRequest to accountId is the right approach. Without this, multi-account Signal setups (e.g. "work" and "personal") would share a single pairing store, letting a user who paired with one account access the other. Tests properly assert the account-scoped key propagation in both the read and upsert paths. LGTM.
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
accountIdfor Signal inbound authorization.accountIdso approvals remain isolated per Signal account.Change Type
Scope
src/signal/monitor/event-handler.tssrc/signal/monitor/event-handler.account-scope.test.tsSecurity Impact
Repro + Verification
defaultandwork) on one gateway.Xon accountdefault.Xto accountwork.workcan treatXas allowlisted due to unscoped pairing store reads/writes.workrequires its own approval forX.Targeted verification:
Evidence
reads pairing allow store with account-scoped keystores pairing requests with account-scoped keyHuman Verification
Xon Signal accountA; confirm DMs toAare authorized.Xis blocked or prompted for pairing on Signal accountBuntil approved forB.XonB; confirm DMs toBthen succeed.Compatibility / Migration
Failure Recovery
Risks and Mitigations
Greptile Summary
Adds
accountIdparameter to Signal pairing store read and write operations to isolate pairing approvals between multi-account Signal setups.Changes:
readChannelAllowFromStorenow called withaccountIdparameter (line 447 in event-handler.ts)upsertChannelPairingRequestnow includesaccountIdin the request metadata (line 463)Critical Issue in Underlying Implementation:
While this PR correctly passes
accountIdto the pairing functions, there is a critical bug insrc/pairing/pairing-store.ts:506(not part of this PR) that undermines the security fix:The
upsertChannelPairingRequestfunction finds existing pairing requests using:This matches on
idonly, ignoringaccountId. When the same sender pairs with multiple accounts:Xpairs with accountdefault→ creates{id: X, meta: {accountId: "default"}, code: "AAAA"}Xpairs with accountwork→ finds existing entry byid, updates to{id: X, meta: {accountId: "work"}, code: "AAAA"}defaultis lost — trying to approve codeAAAAfor accountdefaultwill failThe
findIndexshould userequestMatchesAccountId(like the approval flow does on line 590) to ensure pairing requests are isolated per account.Impact:
Confidence Score: 2/5
src/pairing/pairing-store.tsprevents proper account isolation. TheupsertChannelPairingRequestfunction matches pairing requests byidonly (line 506), not byid+accountId, causing the second account's pairing to overwrite the first. Tests pass because they mock the pairing functions and don't catch the real issue. The security fix is incomplete.src/pairing/pairing-store.ts:506(not in this PR) which needs to match pairing requests by bothidandaccountIdusing therequestMatchesAccountIdhelperLast reviewed commit: dc78132