Skip to content

fix(whatsapp): use account-level dmPolicy instead of channel-level#10082

Merged
steipete merged 2 commits intoopenclaw:mainfrom
mcaxtr:fix/8736-whatsapp-dmpolicy-hierarchy
Feb 14, 2026
Merged

fix(whatsapp): use account-level dmPolicy instead of channel-level#10082
steipete merged 2 commits intoopenclaw:mainfrom
mcaxtr:fix/8736-whatsapp-dmpolicy-hierarchy

Conversation

@mcaxtr
Copy link
Contributor

@mcaxtr mcaxtr commented Feb 6, 2026

Summary

Fixes #8736

  • checkInboundAccessControl() was reading dmPolicy directly from cfg.channels?.whatsapp?.dmPolicy (channel-level config), ignoring account-level overrides
  • Changed to read from account.dmPolicy which is resolved by resolveWhatsAppAccount() with the correct hierarchy: accountCfg?.dmPolicy ?? rootCfg?.dmPolicy
  • This is consistent with line 42 which already uses account.allowFrom (the correct pattern)

Impact: When a WhatsApp account has dmPolicy: "allowlist" but the channel-level default is dmPolicy: "pairing", unauthorized senders would incorrectly receive pairing codes instead of being silently blocked.

Test plan

  • Added test case proving account-level dmPolicy: "allowlist" is ignored when channel-level is "pairing" (test fails before fix)
  • Applied one-line fix: account.dmPolicy instead of cfg.channels?.whatsapp?.dmPolicy
  • Test passes after fix
  • Full CI gate passed locally (pnpm build && pnpm check && pnpm test)

Greptile Overview

Greptile Summary

This PR fixes WhatsApp inbound access control to respect account-level dmPolicy overrides by reading dmPolicy from the resolved WhatsApp account (resolveWhatsAppAccount) instead of directly from the channel-level config. A regression test was added to ensure that when a channel default is dmPolicy: "pairing" but an account overrides to "allowlist", unauthorized senders are silently blocked rather than receiving pairing codes.

This change aligns dmPolicy lookup with the existing pattern used for allowFrom (both now come from the resolved account), and keeps the rest of the inbound gating/pairing logic unchanged.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is a single-source-of-truth fix (switching dmPolicy lookup to the already-resolved account config), and it is covered by a focused regression test that would fail under the previous behavior.
  • No files require special attention

@openclaw-barnacle openclaw-barnacle bot added the channel: whatsapp-web Channel integration: whatsapp-web label Feb 6, 2026
@mcaxtr mcaxtr force-pushed the fix/8736-whatsapp-dmpolicy-hierarchy branch 3 times, most recently from 6cc6fb2 to 3c6326e Compare February 12, 2026 04:19
@mcaxtr mcaxtr force-pushed the fix/8736-whatsapp-dmpolicy-hierarchy branch from 3c6326e to bf4e908 Compare February 13, 2026 02:30
@openclaw-barnacle openclaw-barnacle bot added the trusted-contributor Contributor with 4+ merged PRs label Feb 13, 2026
@mcaxtr mcaxtr force-pushed the fix/8736-whatsapp-dmpolicy-hierarchy branch from bf4e908 to 776a914 Compare February 13, 2026 14:45
@openclaw-barnacle openclaw-barnacle bot added the experienced-contributor Contributor with 10+ merged PRs label Feb 13, 2026
@mcaxtr mcaxtr force-pushed the fix/8736-whatsapp-dmpolicy-hierarchy branch 5 times, most recently from 52e2837 to db1b7d7 Compare February 14, 2026 18:11
@steipete steipete self-assigned this Feb 14, 2026
@steipete steipete force-pushed the fix/8736-whatsapp-dmpolicy-hierarchy branch from db1b7d7 to 9169876 Compare February 14, 2026 18:38
@steipete steipete merged commit d14be84 into openclaw:main Feb 14, 2026
10 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm build && pnpm check && pnpm vitest run --config vitest.unit.config.ts --pool=forks && pnpm vitest run --config vitest.extensions.config.ts --pool=forks && pnpm vitest run --config vitest.gateway.config.ts --pool=forks
  • Land commit: 9169876
  • Merge commit: d14be84

Thanks @mcaxtr!

akoscz pushed a commit to akoscz/openclaw that referenced this pull request Feb 15, 2026
… (thanks @mcaxtr)

Fixes openclaw#10082 (issue openclaw#8736): inbound WhatsApp DM policy now respects account-level dmPolicy overrides.
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
… (thanks @mcaxtr)

Fixes openclaw#10082 (issue openclaw#8736): inbound WhatsApp DM policy now respects account-level dmPolicy overrides.
vincentkoc pushed a commit to vincentkoc/openclaw that referenced this pull request Feb 15, 2026
… (thanks @mcaxtr)

Fixes openclaw#10082 (issue openclaw#8736): inbound WhatsApp DM policy now respects account-level dmPolicy overrides.
snowzlm pushed a commit to snowzlm/openclaw that referenced this pull request Feb 15, 2026
… (thanks @mcaxtr)

Fixes openclaw#10082 (issue openclaw#8736): inbound WhatsApp DM policy now respects account-level dmPolicy overrides.
Benkei-dev pushed a commit to Benkei-dev/openclaw that referenced this pull request Feb 15, 2026
… (thanks @mcaxtr)

Fixes openclaw#10082 (issue openclaw#8736): inbound WhatsApp DM policy now respects account-level dmPolicy overrides.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web experienced-contributor Contributor with 10+ merged PRs size: XS trusted-contributor Contributor with 4+ merged PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: WhatsApp channel-level dmPolicy overrides account-level dmPolicy

2 participants

Comments