fix: Signal UUID allowlist entries silently fail when sourceNumber is present#10958
fix: Signal UUID allowlist entries silently fail when sourceNumber is present#10958meaadore1221-afk wants to merge 2 commits intoopenclaw:mainfrom
Conversation
| it("returns phone sender without uuid when sourceUuid is missing", () => { | ||
| const sender = resolveSignalSender({ sourceNumber: "+15550001111" }); | ||
| expect(sender).toEqual({ | ||
| kind: "phone", | ||
| raw: "+15550001111", | ||
| e164: "+15550001111", | ||
| uuid: undefined, | ||
| }); |
There was a problem hiding this comment.
Incorrect expectation for uuid
resolveSignalSender sets uuid with params.sourceUuid?.trim() || undefined, so when sourceUuid is missing it won’t add the uuid property at all. This test currently expects uuid: undefined, which will fail strict toEqual because the actual object won’t have that key. Update the expectation to omit uuid (or use toMatchObject / assert uuid is undefined via optional chaining).
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/signal/identity.test.ts
Line: 18:25
Comment:
**Incorrect expectation for uuid**
`resolveSignalSender` sets `uuid` with `params.sourceUuid?.trim() || undefined`, so when `sourceUuid` is missing it won’t add the `uuid` property at all. This test currently expects `uuid: undefined`, which will fail strict `toEqual` because the actual object won’t have that key. Update the expectation to omit `uuid` (or use `toMatchObject` / assert `uuid` is `undefined` via optional chaining).
How can I resolve this? If you propose a fix, please make it concise.bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Problem
When a Signal envelope contains both
sourceNumberandsourceUuid(which is the common case for registered Signal users),resolveSignalSenderalways returns a sender withkind: "phone"because it prioritizessourceNumber. ThesourceUuidis discarded entirely.This means that any allowlist entry using the
uuid:prefix format (e.g."uuid:cb274c30-17ce-49ee-97c6-55dd9ce14595") will never match a phone-kind sender, becauseisSignalSenderAllowedperforms strict kind-matching: auuidentry only matches auuidsender, and aphoneentry only matches aphonesender.Impact: All DM messages from users whose allowlist entries use
uuid:format are silently dropped — no error, no log, no pairing prompt. The user simply never receives a response.Root Cause
resolveSignalSender(line 35): returns{ kind: "phone" }wheneversourceNumberis present, throwing awaysourceUuid.isSignalSenderAllowed(line 112): only comparesentry.kind === "uuid" && sender.kind === "uuid", so auuid:allowlist entry can never match akind: "phone"sender.Fix
Three targeted changes in
src/signal/identity.ts:SignalSendertype: add optionaluuid?: stringfield to the phone variant, so both identifiers can coexist.resolveSignalSender: whensourceNumberis present, also preservesourceUuidon the returned phone sender.isSignalSenderAllowed: when auuidallowlist entry is checked against aphonesender, also compare againstsender.uuid(cross-kind matching).Testing
src/signal/identity.test.tswith 10 tests covering:resolveSignalSenderpreserves UUID alongside phone numberresolveSignalSenderfalls back to UUID-only when no phoneisSignalSenderAllowedphone-to-phone matching (unchanged)isSignalSenderAlloweduuid-to-uuid matching (unchanged)isSignalSenderAlloweduuid entry vs phone sender with uuid (the fix)isSignalSenderAlloweduuid entry vs phone sender without uuid (rejects correctly)Made with Cursor
Greptile Overview
Greptile Summary
sourceUuidalongsidesourceNumberby extending the phone variant ofSignalSenderwith an optionaluuidfield.resolveSignalSenderto includeuuidon phone senders when present, instead of discarding it.isSignalSenderAllowedto allowuuid:allowlist entries to match phone senders that carry a UUID (cross-kind match).identity.test.tssuite covering sender resolution and allowlist matching, including the cross-kind UUID case.Confidence Score: 4/5
uuid: undefinedkey that the implementation does not emit, which should cause that test to fail. After correcting the test, the change set looks consistent and low-risk.(4/5) You can add custom instructions or style guidelines for the agent here!