#21120: Security/Gateway: guard dangerous HTTP /tools/invoke re-enables
gateway
size: S
## Summary
- add a startup hard guard that blocks dangerous HTTP `/tools/invoke` tool re-enables from `gateway.tools.allow`
- require explicit break-glass env (`OPENCLAW_UNSAFE_ALLOW_GATEWAY_HTTP_DANGEROUS_TOOLS=1`) to allow these re-enables
- add runtime config regression tests for both reject and override paths
## Testing
- `pnpm test src/gateway/server-runtime-config.test.ts` *(fails in this environment: `pnpm` not found)*
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added startup guard that blocks dangerous HTTP `/tools/invoke` re-enables (`sessions_spawn`, `sessions_send`, `gateway`, `whatsapp_login`) from `gateway.tools.allow` unless explicit break-glass env `OPENCLAW_UNSAFE_ALLOW_GATEWAY_HTTP_DANGEROUS_TOOLS=1` is set. This hardens the defense-in-depth against RCE by failing fast at startup rather than just warning in security audit. The guard normalizes tool names (trim + lowercase) before checking against `DEFAULT_GATEWAY_HTTP_TOOL_DENY`, matching the runtime filter behavior in `tools-invoke-http.ts:280-281`. Test coverage includes both reject and override paths with proper env cleanup.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Implementation is security-focused with proper normalization, consistent with existing runtime filter logic, comprehensive test coverage for both reject and override paths, and clear CHANGELOG entry. No logical errors or edge cases found.
- No files require special attention
<sub>Last reviewed commit: c21757b</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23364: Gateway: add risk-ack interlock for dangerous Control UI flags
by bmendonca3 · 2026-02-22
86.5%
#21100: Security/Gateway: require explicit break-glass env for Control UI b...
by bmendonca3 · 2026-02-19
85.0%
#23814: Gateway: block unauthenticated tool-invocation HTTP surfaces
by bmendonca3 · 2026-02-22
82.2%
#21964: Security: harden gateway and plugin trust boundaries
by Elormyevu · 2026-02-20
81.9%
#23355: Gateway: fail closed on untrusted proxy headers
by bmendonca3 · 2026-02-22
81.4%
#21326: Security/UI: harden Control UI gatewayUrl URL overrides
by bmendonca3 · 2026-02-19
80.6%
#23361: Gateway: reject scope assertions without identity binding
by bmendonca3 · 2026-02-22
80.5%
#23780: Gateway: fail closed on insecure state directory permissions
by bmendonca3 · 2026-02-22
80.0%
#22873: fix(tools): enforce global inline-secret blocking for tool inputs
by Kansodata · 2026-02-21
79.2%
#20355: fix(gateway): enforce commands.restart guard for config.apply and c...
by Clawborn · 2026-02-18
78.8%