fix(gateway): enforce non-empty allowlists for config-driven platform policies - #52533
fix(gateway): enforce non-empty allowlists for config-driven platform policies#52533CryptoByz wants to merge 1 commit into
Conversation
Competing fix for #38638 alongside open #38639. This PR enforces a non-empty allowlist in |
0713b2f to
120a7fa
Compare
|
Thanks for the triage notes! Cron rename isolated: The On the competing approach (#38639): Both PRs target the same vulnerability. The key difference:
I believe the |
|
Thanks for the focused security hardening. This is an automated hermes-sweeper review: the requested fail-closed behavior is already implemented on current main.
Closing as implemented on main. |
Fixes #38638
What changed and why
When config-driven platforms (like QQBot, WeCom, Weixin, Yuanbao, or WhatsApp) are enabled, the gateway runner's authorization check is bypassed under the assumption that the platform adapter has already evaluated caller authorization at intake. However, if the operator selects the allowlist policy but provides an empty or absent user allowlist, the gateway runner incorrectly returns True (authorized), bypassing default-deny security boundaries.
To resolve this, the gateway runner now checks that config-driven adapters configured for the allowlist policy actually provide a non-empty caller allowlist. If the allowlist is empty or absent, the gateway runner correctly defaults to denying access.
Fix
gateway/authz_mixin.py_adapter_has_dm_allowlistand_adapter_has_group_allowlistto check both live adapter instances and config files for non-empty allowlists._is_user_authorizedto require_adapter_has_dm_allowlist/_adapter_has_group_allowlistto return True before trusting config-driven"allowlist"policy checks.What this does NOT change
How to test
Ran the test suite:
Platforms tested
Linux (pure Python fix).