#22112: fix(doctor): warn when gateway is network-exposed without TLS
commands
size: XS
Cluster:
Security Enhancements and Fixes
Doctor already warns when the gateway is bound to a non-loopback address without authentication. But it doesn't warn about missing TLS, which means credentials and chat data travel in plaintext on the network even when auth is configured.
This is especially relevant for Docker users with `bind: "lan"` who often skip TLS setup, and it's the underlying cause of the internal tool RPC security check blocking legitimate calls (#22104).
**Changes:**
- `doctor-security.ts`: add a TLS check inside the existing `isExposed` block. Warns with specific fix commands (enable TLS or switch to loopback)
- 3 new tests covering: warning shown, suppressed with TLS, suppressed for loopback
The warning only appears for non-loopback binds - loopback users are unaffected.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added TLS security check for network-exposed gateways. When the gateway is bound to a non-loopback address without TLS enabled, doctor now warns users that credentials and chat data travel in plaintext. The warning provides two remediation options: enable TLS or switch to loopback binding.
Key changes:
- Added TLS check in `doctor-security.ts` (lines 74-82) that only triggers for non-loopback binds
- Warning appears alongside existing auth warnings in the `isExposed` block
- Three new test cases cover: warning shown for LAN bind without TLS, suppressed when TLS enabled, and suppressed for loopback binds
- Uses consistent formatting with `formatCliCommand` helper for fix suggestions
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no concerns
- The implementation is well-structured, follows existing code patterns, and has comprehensive test coverage. The TLS check is correctly placed inside the `isExposed` block, ensuring it only triggers for network-exposed gateways. The logic properly handles edge cases (undefined config, TLS enabled, loopback binds), and the warning messages provide clear remediation steps using the established `formatCliCommand` helper.
- No files require special attention
<sub>Last reviewed commit: 48f1db1</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#23735: Gateway: add first-class wss validation and remote TLS guidance
by bmendonca3 · 2026-02-22
78.6%
#22110: fix(tools): prefer loopback for internal tool-to-gateway RPC calls
by pierreeurope · 2026-02-20
76.9%
#21233: docs: clarify bind=lan non-loopback access requires wss or tunnel (...
by saurabhchopade · 2026-02-19
76.2%
#22682: fix(gateway): [P0] status probe ignores gateway.tls.enabled — hardc...
by mahsumaktas · 2026-02-21
75.9%
#21742: fix(doctor): warn on conflicting exec approval config surfaces
by habakan · 2026-02-20
75.3%
#22327: fix(doctor): use gateway health status for memory search key check
by therk · 2026-02-21
74.9%
#15903: fix(doctor): stricter gateway service detection to prevent false po...
by Shuai-DaiDai · 2026-02-14
74.9%
#22056: fix(gateway): use loopback for self-connections regardless of bind ...
by usedhonda · 2026-02-20
74.4%
#21436: fix(gateway): plaintext ws:// blocked for Docker bind=lan (SECURITY...
by xinhuagu · 2026-02-19
74.3%
#21784: fix(security): restrict gateway ports to loopback by default
by smilekyra · 2026-02-20
74.2%