Repository navigation
fix(ssh): a GatewayPorts yes setting publishes the tunnel on every interface - #1658
Conversation
An ssh_config GatewayPorts yes made an unbound -L listen on every interface, and ownership treated that wildcard listener as loopback. Forwards now bind 127.0.0.1, set GatewayPorts=no, and a wildcard listener fails the ownership check. Signed-off-by: Sebastien Tardif <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 8:07 PM ET / October 7, 2026, 00:07 UTC. ClawSweeper reviewWhat this changesThe PR binds gateway and browser-proxy SSH forwards to 127.0.0.1, overrides GatewayPorts, and rejects wildcard listeners during tunnel ownership checks. Merge readiness✅ Ready for maintainer review This PR remains useful: current main and v2026.9.4 retain the unbound SSH forward. The focused patch has no identified blocking defect, and the supplied Windows before/after output demonstrates the intended listener restriction. Priority: P2 Review scores
Verification
How this fits togetherManaged SSH tunnels let the Windows app reach a remote gateway and its browser-control endpoint through local ports. The connection layer verifies the SSH listener before using that endpoint for authenticated connections. flowchart TD
A[Saved SSH connection] --> B[Build local forwards]
B --> C[OpenSSH process]
C --> D[Loopback listeners]
D --> E[Verify listener ownership]
E --> F[Gateway connection]
D --> G[Browser proxy connection]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep managed gateway and browser-proxy forwards explicitly local, with wildcard rejection as a second check against unintended exposure. Do we have a high-confidence way to reproduce the issue? Yes. Main emits the unbound forward and accepts its wildcard listener; the supplied Windows OpenSSH comparison demonstrates the GatewayPorts yes trigger. The reviewer did not execute that scenario. Is this the best way to solve the issue? Yes. Updating the existing shared builder and ownership validator fixes the local-only contract without introducing a competing tunnel implementation or persisted setting. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 839dad2936c7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Global triage: NEEDS_HUMAN_TEST. Take confidence 55%; recommendation confidence 97%; effort small; risk high. Reviewed exact head Maintainer or proof-pool owner: run every declared Windows proof pool at this exact head and replace blocked or historical evidence with current-head results. This is a triage classification, not a merge action. No branch changes were made. |
|
LGTM, running @shanselman review skill... |
Independent review: approve, no findings at P0–P3Reviewed head MethodShared autoreview helper, branch mode, What I verified beyond the bot
Validation re-run at this head
Notes on prior signals
|
What Problem This Solves
Fixes: an SSH tunnel forward follows
GatewayPorts yesand listens on every interface.User Impact
User impact: the gateway forward and the browser-proxy forward stay on
127.0.0.1. A wildcard listener on that port no longer counts as a successful tunnel.Why This Change Was Made
The forward was
-L <local>:<remote>with no bind address, and ownership treated0.0.0.0and::as loopback. The command now binds127.0.0.1, setsGatewayPorts=no, and rejects a wildcard listener.Evidence
SshTunnelCommandLine.BuildArgumentson head7776b4c1a13ecf45d0c2c046b9b3bb6dd2b3a353reportedbuilt_has_gatewayports_no=True,built_binds_loopback=True, andbuilt_has_unbound_forward=False.A disposable sshd on
127.0.0.1:19293accepted one local forward. The client config setGatewayPorts yes. The previous form-L 19291:127.0.0.1:19290listened on0.0.0.0. The new form-L 127.0.0.1:19292:127.0.0.1:19290withGatewayPorts=nolistened on127.0.0.1. Both processes were running when those addresses were read. The user's.sshdirectory was not changed.Change Type
Scope
winnodeRequired proof pools
none: the changed behavior is the local bind address of an SSH forward. The named pools do not set
GatewayPortsor read that listener.Validation
./build.ps1exit 0 (Shared, Cli, WinNodeCli, SetupEngine, WinUI).dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore: 4262 passed, 33 skipped, 0 failed, 4295 total.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 3990 passed, 0 skipped, 0 failed.dotnet test ./tests/OpenClaw.Connection.Tests/OpenClaw.Connection.Tests.csproj --filter FullyQualifiedName~SshTunnelServiceTests: 23 passed, 0 failed.Real behavior proof
GatewayPorts yeslistened on0.0.0.0. The product forward now listens on127.0.0.1.127.0.0.1:19293. Head7776b4c1a13ecf45d0c2c046b9b3bb6dd2b3a353.-L 19291:127.0.0.1:19290and the new-L 127.0.0.1:19292:127.0.0.1:19290with-o GatewayPorts=no, both under a client config ofGatewayPorts yes.127.0.0.1. The previous forward's listener address was0.0.0.0.ssh_configwas not edited.7776b4c1a13ecf45d0c2c046b9b3bb6dd2b3a353BuildArguments, then the twossh -N -Lprocesses above.new_bind=127.0.0.1andold_bind=0.0.0.0.GatewayPorts yesis set.Security Impact
Yes, explain the risk and mitigation: Local forwards bind127.0.0.1and passGatewayPorts=no. A wildcard listener fails ownership instead of being treated as the tunnel. No keys or tokens were printed.Compatibility and Migration
Review Conversations