fix(gateway): make the WebSocket tunnel opt-in - #3727
Merged
Merged
Conversation
The /_ws_tunnel endpoint pipes a WebSocket into the full gRPC service. On a plaintext loopback gateway any web page could open it, since browsers do not apply CORS to WebSocket upgrades. Mount the tunnel only when enable_websocket_tunnel is set (config file, --enable-websocket-tunnel, or OPENSHELL_ENABLE_WEBSOCKET_TUNNEL; server.enableWebsocketTunnel in Helm). BREAKING CHANGE: gateways behind an authenticating edge proxy must set enable_websocket_tunnel = true for CLI edge-tunnel connections. Signed-off-by: Drew Newberry <anewberry@nvidia.com>
drew
requested review from
a team,
derekwaynecarr,
mrunalp and
sjenning
as code owners
September 25, 2026 23:33
|
🌿 Preview your docs: https://nvidia-preview-pr-3727.docs.buildwithfern.com/openshell |
pimlock
approved these changes
Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR mounts the tunnel only when it is explicitly enabled for edge-proxy deployments.
Related Issue
No issue required: localized hardening of a gateway default.
Changes
enable_websocket_tunnelsetting (defaultfalse):[openshell.gateway]ingateway.toml,--enable-websocket-tunnel, orOPENSHELL_ENABLE_WEBSOCKET_TUNNEL. CLI and environment override the file.http_routermerges thews_tunnelrouter only when the setting is enabled; otherwise/_ws_tunnelreturns 404.server.enableWebsocketTunnel(defaultfalse) rendered intogateway.toml, with chart unit tests.edge_tunnel_e2ekeeps covering it.Testing
mise run pre-commitpassescargo test -p openshell-server --lib(1821 passed; includes a router mount test and CLI/file precedence test) andmise run helm:test(all chart tests pass)Checklist