#23735: Gateway: add first-class wss validation and remote TLS guidance
gateway
commands
size: S
trusted-contributor
Cluster:
Security Enhancements and Fixes
## Summary
- add a dedicated TLS gateway e2e test to validate secure `wss://` access and reject plaintext `ws://` on TLS-enabled gateway instances
- extend gateway test helper config overrides so TLS options can be injected in e2e scenarios
- add doctor security warning when gateway is exposed beyond loopback without TLS enabled, with explicit remediation commands
- add doctor e2e coverage for plaintext-warning and TLS-enabled non-warning cases
## Testing
- pnpm check
- pnpm test:e2e src/gateway/server.tls.e2e.test.ts
- pnpm test:e2e src/commands/doctor-security.e2e.test.ts
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR strengthens gateway security by adding comprehensive TLS validation and security warnings across the stack.
**Key changes:**
- Added mandatory TLS requirement for non-loopback gateway connections in all clients (iOS, Android, macOS, web UI)
- Implemented `doctor` command warning when gateway is exposed without TLS, with explicit remediation guidance
- Added dedicated e2e test validating secure `wss://` connections and rejecting plaintext `ws://` on TLS-enabled gateways
- Extended webhook security utilities with improved proxy IP validation using CIDR support and IPv6 normalization
- Added LINE webhook replay protection with event ID deduplication
- Hardened Control UI device auth bypass checks with break-glass env var requirements
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with thorough security hardening and comprehensive test coverage
- The changes are well-architected with extensive test coverage across e2e tests, unit tests for all platforms (iOS, Android, macOS, Node.js), and consistent security patterns. The implementation follows defense-in-depth principles by enforcing TLS at multiple layers. Minor concerns include the complexity of IP normalization logic and CIDR matching which could benefit from additional edge case testing, but existing test coverage is strong.
- Pay close attention to `extensions/voice-call/src/webhook-security.ts` for the CIDR matching logic and IP normalization functions
<sub>Last reviewed commit: fe6f7b3</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23355: Gateway: fail closed on untrusted proxy headers
by bmendonca3 · 2026-02-22
85.2%
#23742: Gateway: add optional mTLS client-cert enforcement for non-loopback...
by bmendonca3 · 2026-02-22
81.5%
#23361: Gateway: reject scope assertions without identity binding
by bmendonca3 · 2026-02-22
80.2%
#23364: Gateway: add risk-ack interlock for dangerous Control UI flags
by bmendonca3 · 2026-02-22
80.1%
#22682: fix(gateway): [P0] status probe ignores gateway.tls.enabled — hardc...
by mahsumaktas · 2026-02-21
79.7%
#23714: Gateway: add websocket ingress limits for DoS hardening
by bmendonca3 · 2026-02-22
79.2%
#7654: feat(security): zero-trust localhost auth with DNS rebinding protec...
by joncode · 2026-02-03
78.6%
#22112: fix(doctor): warn when gateway is network-exposed without TLS
by pierreeurope · 2026-02-20
78.6%
#21964: Security: harden gateway and plugin trust boundaries
by Elormyevu · 2026-02-20
78.1%
#23352: Gateway: enforce origin checks for browser-context WS clients
by bmendonca3 · 2026-02-22
77.8%