Skip to content

fix(whatsapp): load group allowlist from profile env - #79146

Closed
thisisandreeeee wants to merge 1 commit into
NousResearch:mainfrom
thisisandreeeee:fix/whatsapp-adapter-env-allowlist
Closed

thisisandreeeee wants to merge 1 commit into
NousResearch:mainfrom
thisisandreeeee:fix/whatsapp-adapter-env-allowlist

Conversation

@thisisandreeeee

Copy link
Copy Markdown

Summary

  • fall back to profile-scoped WHATSAPP_GROUP_ALLOWED_USERS when no group allowlist key is present in PlatformConfig.extra
  • preserve explicit snake_case/camelCase config precedence, including an intentionally empty list
  • add coverage for environment fallback, explicit config precedence, and explicit-empty fail-closed behavior

Root cause

The Baileys bridge and Python adapter enforce separate inbound gates. Legacy/setup-created configurations may provide group JIDs through WHATSAPP_GROUP_ALLOWED_USERS; unlike the DM path, adapter construction only read group_allow_from / groupAllowFrom from config.extra. After a gateway restart, group_policy: allowlist could therefore start with an empty Python-side group allowlist even though the documented profile environment contained valid groups.

This mirrors the existing DM resolution contract and uses _wenv so multiplexed profiles remain isolated.

Verification

  • tests/gateway/test_whatsapp_group_gating.py: 13 passed
  • relevant tests/gateway/test_pairing_allowlist_bypass.py DM precedence cases: 4 passed
  • git diff --check

@spfcraze

spfcraze commented Aug 5, 2026

Copy link
Copy Markdown

This was generated by AI during triage.

A note on overlap:

This PR and open PR #61924 change the same _group_allow_from resolution in plugins/platforms/whatsapp/adapter.py, with the same precedence — explicit config key first, then a WHATSAPP_GROUP_ALLOWED_USERS fallback.

#61924 also rewrote the DM allow_from line; that DM env fallback has since landed on main, so the overlap left between the two PRs is the group half this PR carries.


Checked against 78393b7 — the tip of fix/whatsapp-adapter-env-allowlist when this was written — and 1be70d6, main at the same moment.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins platform/whatsapp WhatsApp Business adapter labels Aug 5, 2026
@alt-glitch

Copy link
Copy Markdown

This was generated by AI during triage.

Related to #61924: this focused group-allowlist fallback uses the same explicit-config precedence, while #61924 covers both DM and group allowlists.

@kshitijk4poor

Copy link
Copy Markdown

Fixed on main via #115360 (merge 8925c70a1c): the adapter's group list now falls back to the profile-scoped WHATSAPP_GROUP_ALLOWED_USERS (_wenv) exactly as this PR proposed. Earlier submissions of the same fix: #37452 @AhmetArif0, #61924 @iborazzi. Closing as fixed on main; thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/whatsapp WhatsApp Business adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants