fix(doctor): audit WhatsApp bridge at its resolved (HERMES_HOME) dir (#49890)

doctor's npm audit hardcoded PROJECT_ROOT/scripts/whatsapp-bridge. In
read-only Docker installs the bridge deps live in the writable HERMES_HOME
mirror (#49561), so node_modules was never found there and the bridge audit
silently skipped. Resolve the dir through the shared
resolve_whatsapp_bridge_dir() helper so doctor audits where deps actually
install. Falls back to the install-tree path if the helper is unavailable.
This commit is contained in:
Teknium 2026-06-20 19:55:12 -07:00 committed by GitHub
parent 67523fae7c
commit 170ef24c8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1585,11 +1585,20 @@ def run_doctor(args):
# glob (which pulls in Electron, node-pty, etc.) is never resolved
# for a routine security check. The web and ui-tui workspaces are
# audited separately via --workspace flags. See #38772.
# The WhatsApp bridge may live under a writable HERMES_HOME mirror
# instead of the (possibly read-only) install tree in Docker — resolve
# it through the shared helper so we audit the dir that actually holds
# node_modules. See #49561.
try:
from gateway.platforms.whatsapp_common import resolve_whatsapp_bridge_dir
_whatsapp_bridge_dir = resolve_whatsapp_bridge_dir()
except Exception:
_whatsapp_bridge_dir = PROJECT_ROOT / "scripts" / "whatsapp-bridge"
npm_audit_targets = [
(PROJECT_ROOT, "Browser tools (agent-browser)", ["--workspaces=false"]),
(PROJECT_ROOT, "web workspace", ["--workspace", "web"]),
(PROJECT_ROOT, "ui-tui workspace", ["--workspace", "ui-tui"]),
(PROJECT_ROOT / "scripts" / "whatsapp-bridge", "WhatsApp bridge", []),
(_whatsapp_bridge_dir, "WhatsApp bridge", []),
]
for npm_dir, label, audit_extra in npm_audit_targets:
# For workspace-scoped audits run from PROJECT_ROOT the