fix(whatsapp): scrub operator environment from bridge subprocess - #38080
fix(whatsapp): scrub operator environment from bridge subprocess#38080coygeek wants to merge 1 commit into
Conversation
|
Verified the subprocess environment scrubbing — the bridge process now receives only the explicitly whitelisted config values ( |
|
Thanks for identifying the bridge environment boundary. The underlying issue remains present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
Launch the WhatsApp bridge with a sanitized subprocess environment so parent-process credentials and operator-only allowlists are not inherited by the Node bridge. Keep the required WHATSAPP_REPLY_PREFIX bridge configuration by passing it as explicit subprocess-only extra environment, and cover the regression in the WhatsApp connect tests.
9a51d11 to
a28bcac
Compare
|
Addressed the automated review in
Validation: 49 focused WhatsApp tests and 51 sanitizer/blocklist tests passed; scoped Ruff and |
|
Bound to the child-process credential-inheritance class under #83565 (#83565) — same bug class, different surface. WhatsApp bridge subprocess env scrub; Wave E — sibling to #56245 on adapter.py; adjudicate the pair before merging. The EPIC carries the live class table, dedup adjudication, and the dependency-driven merge order. |
Summary
The plugin-based WhatsApp adapter now launches its long-lived Node bridge with the shared sanitized subprocess environment instead of a copy of the full gateway environment.
_sanitize_subprocess_envbefore bridge launch.WHATSAPP_REPLY_PREFIX, the force-prefixedWHATSAPP_ALLOWED_USERSintake allowlist, and the three profile-aware media cache directories.with_hermes_node_path()to the already-sanitized environment so current managed-Node discovery and PATH behavior remain intact.Closes #38079
Review feedback addressed
gateway/platforms/whatsapp.pypath toplugins/platforms/whatsapp/adapter.py.with_hermes_node_path().WHATSAPP_ALLOWED_USERScontract through the sanitizer's force-prefix mechanism.Tests and validation
scripts/run_tests.sh tests/gateway/test_whatsapp_connect.py tests/gateway/test_whatsapp_reply_prefix.py tests/gateway/test_whatsapp_stale_bridge.py— 49 passed, 0 failed.scripts/run_tests.sh tests/tools/test_local_env_blocklist.py— 51 passed, 0 failed.ruff check plugins/platforms/whatsapp/adapter.py tests/gateway/test_whatsapp_connect.py— passed.git diff --check— passed.The bridge regression verifies that provider, gateway, and remote-compute credentials are absent; the WhatsApp reply prefix, allowlist, profile-aware cache paths, and managed Node PATH are retained; and sanitization occurs before Node PATH augmentation.
Rebased onto
477c08b44766ace8b890faa72bf82ecbcf2b3ba8; current head isa28bcac074ad44e2b28363bf357e290a41627a48.