#6590: Harden Debug UI defaults: loopback-only binding + warnings
channel: whatsapp-web
gateway
size: S
This PR adds guardrails to the Control/Debug UI to reduce accidental exposure.
Changes:
- Default binding changed to 127.0.0.1 (loopback)
- Non-local requests are warned by default
- Optional strict mode rejects non-local requests with HTTP 403 (`strictLoopback`)
- Logs use the subsystem logger for warnings
- Documentation updated to clarify local-only usage
- Tests included for default and strict modes
Related issue: #2245
---
Hi @steipete,
This PR hardens the Debug/Control UI defaults to prevent accidental exposure.
All tests pass and documentation is updated. Let me know if any adjustments are needed — happy to iterate!
All changes are scoped to the Control UI. Default behavior is non-breaking; strict mode is opt-in.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR introduces a new loopback-guard middleware for the Control UI, updates the gateway HTTP handler to invoke it, adds startup warnings when binding the Control UI to non-loopback addresses, and documents the intended local-only posture plus an opt-in strict 403 mode.
The main issues are around wiring and scope: `strictLoopback` is documented and plumbed into `createGatewayHttpServer`, but it isn’t actually read from config/opts or passed from runtime state creation, so strict mode won’t activate. Additionally, the guard is currently executed for all HTTP requests whenever `controlUiEnabled` is true (before any Control UI path matching), which can generate misleading warnings and, in strict mode, incorrectly block non-Control-UI endpoints.
<h3>Confidence Score: 2/5</h3>
- This PR has meaningful behavioral issues that should be addressed before merging.
- While the hardening intent is good, strict mode is currently not wired from config/runtime into the server, and the loopback guard is applied too broadly (can warn/block non-Control-UI endpoints). These are likely to cause confusion and, if strict mode is later enabled, real breakage.
- src/gateway/server-http.ts, src/gateway/server-runtime-state.ts, src/gateway/server-runtime-config.ts, src/gateway/server-startup-log.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#21186: fix(gateway): strict loopback guard for Control UI (v2)
by dinakars777 · 2026-02-19
81.7%
#18845: feat(config): add strictLoopback config option for Debug UI security
by cedillarack · 2026-02-17
79.9%
#21326: Security/UI: harden Control UI gatewayUrl URL overrides
by bmendonca3 · 2026-02-19
78.3%
#22227: fix(security): harden gateway auth — audit logging, pairing, mode v...
by novalis133 · 2026-02-20
76.2%
#23364: Gateway: add risk-ack interlock for dangerous Control UI flags
by bmendonca3 · 2026-02-22
75.7%
#20089: fix(gateway): preserve control-ui scopes when dangerouslyDisableDev...
by vashkartik · 2026-02-18
75.6%
#21100: Security/Gateway: require explicit break-glass env for Control UI b...
by bmendonca3 · 2026-02-19
75.4%
#13960: fix(ui): preserve structured config validation error details
by constansino · 2026-02-11
75.0%
#21120: Security/Gateway: guard dangerous HTTP /tools/invoke re-enables
by bmendonca3 · 2026-02-19
74.4%
#23465: Gateway: strengthen Control UI security headers
by bmendonca3 · 2026-02-22
73.9%