Repository navigation
fix(whatsapp): thread authDir through command authorization and owner bypass for LID JID resolution - #93379
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 9:25 AM ET / 13:25 UTC. Summary PR surface: Source +6, Tests +51. Total +57 across 4 files. Reproducibility: yes. Current main and v2026.6.11 call getSelfIdentity/getSenderIdentity without authDir at the command authorization and owner-bypass sites, while the existing resolver can map LID JIDs through authDir reverse mapping files; the PR body now adds redacted live after-fix WhatsApp proof. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this plugin-local authDir threading fix after ordinary maintainer review, while leaving broader WhatsApp LID delivery and session isolation work tracked separately. Do we have a high-confidence way to reproduce the issue? Yes. Current main and v2026.6.11 call getSelfIdentity/getSenderIdentity without authDir at the command authorization and owner-bypass sites, while the existing resolver can map LID JIDs through authDir reverse mapping files; the PR body now adds redacted live after-fix WhatsApp proof. Is this the best way to solve the issue? Yes. Passing the existing account.authDir into the existing WhatsApp identity helpers is the narrowest maintainable fix, with no new resolver, config option, or parallel authorization path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be2c4c65abd9. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +6, Tests +51. Total +57 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
… bypass for LID JID resolution WhatsApp group commands (/new, /stop) can be ignored when Baileys reports the sender as a LID JID (@lid) instead of a phone JID (@s.whatsapp.net). The resolveWhatsAppCommandAuthorized() and isOwnerSender() functions called getSelfIdentity/getSenderIdentity without passing authDir, so the LID-to-phone reverse mapping could not happen. Fix: thread account.authDir through both command authorization and group owner-bypass identity resolution paths so that LID JIDs are properly resolved to phone E.164 identities before owner/allowlist checks.
0b37c7e to
845f4d7
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…rrides in LID JID test
|
@clawsweeper re-review Added live WhatsApp/Baileys behavior proof with redacted diagnostics:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
… bypass for LID JID resolution (openclaw#93379) * fix(whatsapp): thread authDir through command authorization and owner bypass for LID JID resolution WhatsApp group commands (/new, /stop) can be ignored when Baileys reports the sender as a LID JID (@lid) instead of a phone JID (@s.whatsapp.net). The resolveWhatsAppCommandAuthorized() and isOwnerSender() functions called getSelfIdentity/getSenderIdentity without passing authDir, so the LID-to-phone reverse mapping could not happen. Fix: thread account.authDir through both command authorization and group owner-bypass identity resolution paths so that LID JIDs are properly resolved to phone E.164 identities before owner/allowlist checks. * fix(whatsapp): replace deprecated top-level fields with admission overrides in LID JID test
… bypass for LID JID resolution (openclaw#93379) * fix(whatsapp): thread authDir through command authorization and owner bypass for LID JID resolution WhatsApp group commands (/new, /stop) can be ignored when Baileys reports the sender as a LID JID (@lid) instead of a phone JID (@s.whatsapp.net). The resolveWhatsAppCommandAuthorized() and isOwnerSender() functions called getSelfIdentity/getSenderIdentity without passing authDir, so the LID-to-phone reverse mapping could not happen. Fix: thread account.authDir through both command authorization and group owner-bypass identity resolution paths so that LID JIDs are properly resolved to phone E.164 identities before owner/allowlist checks. * fix(whatsapp): replace deprecated top-level fields with admission overrides in LID JID test (cherry picked from commit 85f7834)
What Problem This Solves
WhatsApp group commands (
/new,/stop,/status) are silently ignored when Baileys reports the sender as a LID JID (@lid) instead of a phone JID (@s.whatsapp.net), even when the sender is the configured owner.Root cause:
resolveWhatsAppCommandAuthorized()andisOwnerSender()calledgetSelfIdentity()/getSenderIdentity()without passingauthDir, so the LID-to-phone reverse mapping files (lid-mapping-<lid>_reverse.json) in the auth directory could not be found. The sender fell through to unauthorized, and the command was dropped.Fixes #77755
Why This Change Was Made
Thread
account.authDirthrough both command authorization (resolveWhatsAppCommandAuthorized) and group owner-bypass identity resolution (isOwnerSender), enabling proper LID JID → phone E.164 resolution before owner/allowlist checks.This is the narrowest fix: the existing
resolveComparableIdentity()helper already acceptsauthDirand passes it tojidToE164()for LID identity resolution. The only gap was the two call sites that weren't forwarding the parameter.User Impact
Evidence
pnpm test extensions/whatsapp/src/inbound/access-control.test.ts— 16/16 passed (including new LID regression test)node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json— cleanReal behavior proof
Behavior addressed: WhatsApp group commands (e.g.
/status) from the configured owner are properly authorized when Baileys reports the sender as a LID JID (<LID>@lid) instead of a phone JID, via the reverse LID mapping file in the auth directory.Real environment tested: Linux x86_64, Node 24.13.1, branch
fix/issue-77755-whatsapp-lid-authdirat commitf74779fe9a, production WhatsApp config with real Baileys auth directory containing LID reverse mappings.Exact steps after this patch:
Gateway log evidence — WhatsApp connected and listening:
Sending
/statusfrom owner's phone in WhatsApp group. Gateway received and authorized the command:Temporary diagnostic probe confirming LID JID → E.164 resolution path with
authDir:Key facts confirmed by live probe:
<LID>@lid— no phone JID presentgetSenderIdentity()/getSelfIdentity()lid-mapping-<LID>_reverse.json→ owner phoneisOwnerSenderandresolveWhatsAppCommandAuthorizedpathsObserved result after fix: The owner's
/statuscommand in a WhatsApp group, where Baileys reports the sender as<LID>@lid, is correctly resolved to the owner's phone number via the authDir reverse mapping, authorized as owner, and the bot responds normally.What was not tested: The "before" (broken) behavior on
mainwas not reverted and retested on this live setup, as doing so would disrupt the running gateway. The main-branch gap was confirmed by source inspection (see ClawSweeper review evidence:inbound-policy.ts:182andgroup-gating.ts:81on main callgetSenderIdentity(msg)withoutauthDir).