Repository navigation
fix(link): a link with an explicit route reads no ssh_config - #8657
Conversation
The final review of GOAT's disposable-machines groundwork showed with ssh -G
that the owner's ~/.ssh/config and /etc/ssh/ssh_config still apply to a link
enrolled with an explicit exclusive route: list-valued settings (Local, Remote
and Dynamic forwards, SendEnv, IdentityFile, CertificateFile) add to ours,
SetEnv, IdentityAgent, GSSAPI delegation and Tunnel apply, a configured
RemoteCommand makes every exec fail ("Cannot execute command-line and remote
command"), and no command-line option can remove a configured forward from the
tunnel.
The shared option list now starts with -F none when the record carries an
explicit route, for every command such a link runs (tunnel, exec, probe, route
probe, Windows probe). The route already names the transport, user and port, and
the host key is pinned. The tunnel keeps its single -R with ExitOnForwardFailure
and no ClearAllForwardings, which would remove its own forward. Links without an
explicit route keep reading ssh_config; their argv is unchanged.
… key comes from structure/remote-link.md, the Remote Link guide (English and Spanish) and the --proxy-command capability text (with the generated skill reference) now say that a link with an explicit route reads no SSH configuration (-F none), why, and what that takes away: the Home offers only its SSH agent's keys and the default ~/.ssh/id_* keys, so an IdentityFile set in ssh_config is not used, and on macOS UseKeychain and Apple's other defaults stop applying.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 seconds. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
✅ Deterministic PR hygiene checks passed. |
…-empty option list Final review of #8657 (P3): commonOptions added -F none when the route's option list was non-empty, an indirect test for 'this link has an explicit route'; a future route form whose options were empty would silently read ssh_config again. routeOptions now returns {configFile, options}, with configFile ["-F", "none"] for every route and placed first in the argv, before every -o. The argv is unchanged; the pinned literal tests and the -F none tests pass.
Final review of #8657 (P3): the effective() helper slices the argv from its first -o and so drops -F none; the test 'an ssh_config edit after enrollment' checks what ssh would use if it read ssh_config, which the code no longer does. It stays as a second line of defence (the route on the command line would still win), now said in its name and a comment.
… offered Final review of #8657 (P3): after the sentence that an IdentityFile from ssh_config is no longer used, the Remote Link guide (English and Spanish) now says what follows when the machine expects another key: an existing link reads failed with reason auth, a new enrollment fails with probe_failed, and the key must be in the Home's agent or a default ~/.ssh/id_* file.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Maintainer integration record for the squash merge a7402e8.
|
One conflict, docs-site/src/content/docs/es/guides/remote-link.md: this branch keeps the journal paragraph before the recover paragraph (the English order), and the recover paragraph is #8661's updated one, with its new alias_linked sentence. capabilities-base.ts carries #8657's -F none sentence once in each of the two --proxy-command flags (probe and add) beside this branch's edits; the skills reference is regenerated on the merged tree (51 declared capabilities).
Summary
A Home-initiated link enrolled with an explicit, exclusive route (
ocx link add <alias> --proxy-command <cmd> --ssh-user <user> --ssh-port <port> --exclusive, which a hub passes for the disposable machines it attaches) still read the owner's~/.ssh/configand/etc/ssh/ssh_config. The route options win on the command line where a setting has a single value. List-valued settings add to them, though, and other settings apply untouched. Shown withssh -Gagainst a hostile config on OpenSSH 9.6:-R. No command-line option can remove a configured forward, andClearAllForwardingswould remove the tunnel's own-Rtoo.SendEnv,SetEnv, extraIdentityFileandCertificateFileentries,IdentityAgent, GSSAPI delegation,TunnelandCanonicalizeHostnameapplied to every command.RemoteCommandmade every exec of the link fail ("Cannot execute command-line and remote command")./etc/ssh/ssh_configalone already addsSendEnv LANG LC_*andGSSAPIAuthentication yes.Now the shared option list in
src/link/ssh-argv.tsstarts with-F nonewhenever the record carries an explicit route. The decision is made from the route itself (routeOptionsreturns the-F nonepart for every route, placed before every-o), not from whether the route produced any options. This applies to every command such a link runs: the tunnel, every exec (enrollment, plant, revoke and purge, platform discovery, Child operations,ocx syncfan-out), the probe and confirm-host, the route probe and the Windows probe. Each one now uses only the route's ProxyCommand, user and port, the pinnedHostKeyAliasand private known_hosts file, and the link's own options.The tunnel keeps a single
-RwithExitOnForwardFailure=yesand noClearAllForwardings. Every link SSH command is built inssh-argv.ts;src/link/remote-windows.tsbuilds only the remote PowerShell command, and the SSH runner passes argv through unchanged.What -F none takes away
ssh then reads no configuration file, so the Home's identity comes only from two places:
SSH_AUTH_SOCKin the OpenCodex process's environment;~/.ssh/id_*key files.An
IdentityFile,CertificateFileorIdentityAgentset in ssh_config is no longer used. On macOS,UseKeychainand Apple's other ssh_config defaults stop applying too. A dev user whose explicit-route link relied on anIdentityFilein ssh_config will see that linkfailedwith reasonauthafter this change, and a new enrollment of such a machine fails withprobe_failed. The key must be in the Home's agent or in a default~/.ssh/id_*file; the guide says so. No release contains explicit routes (#8615 is in no tag; the latest release, v2.100.2, predates it), so nobody on a release is affected. The route carries no identity field in this PR. Notes for that follow-up (link.route/2):IdentitiesOnlystays at its default, so a Home with many agent keys offers all of them. A server with a lowMaxAuthTriesthen answers "Too many authentication failures", which also reads asauth.IdentityFileandIdentitiesOnly yesin ssh_config must load that key into the Home's agent when it uses explicit routes, or the route needs an identity field.What stays unchanged
Links without an explicit route read ssh_config exactly as before: ordinary alias links, which need it for HostName, User, Port, ProxyJump and IdentityFile, plus Child-initiated links and messaging. Their argv is byte-identical to dev, pinned by the literal argv of all five builders in
tests/clients/link-explicit-route.test.ts.ocx link routes addis unaffected, because an exclusive link already refuses added routes.-F noneexists since OpenSSH 7.1, below the client the link options already require (KnownHostsCommandneeds 8.5).-F nonethe same way; no NUL device is involved.Verification
Test-first:
tests/clients/link-explicit-route-no-ssh-config.test.ts(new, registered in the test layout).-F noneexactly once, before the destination. The tunnel has one forward,ExitOnForwardFailure=yesand noClearAllForwardings. Builders without a route contain no-F.ssh -Gcheck: the check intests/clients/link-explicit-route.test.tsstill reads a hostile ssh_config on purpose. It is named and commented as the second line of defence: the route on the command line would win even if ssh_config were read.ssh -G(connects to nothing, never runs the ProxyCommand): a hostile config in a temp directory includes another file and sets forwards, SendEnv, SetEnv, IdentityFile, CertificateFile, IdentityAgent, ControlPersist, GSSAPI with delegation, Tunnel and RemoteCommand. The test first swaps the link's-F nonefor-F <hostile file>and shows that the hostile values appear and that an exec then fails. It then runs the real argv of each builder and shows that none of them appear and that the tunnel's only forward is its own. Skipped on Windows and where ssh is not on PATH.-F none. The two that passed pin behaviour that does not change: the tunnel's single forward, and the absence of-Fwithout a route.Commands on f85f252 (bun 1.4.4,
TMPDIR=/tmp):bun run typecheck→ exit 0bun run privacy:scan→ exit 0bun run structure:check→ exit 0bun run skill:surface:check→ exit 0bun scripts/test.ts --parallel=2over tests/clients/link-, tests/server/link-, tests/cli/cli-link*, the remote messaging tests, the test-layout, layout-tooling, file-size ratchet, structure, skill-ocx, docs-spanish-localization, docs-remote-hub-claims and docs-link-targets tests, and tests/lab/core-link-boundary and core-lab-boundary (128 files) → exit 1: 2126 pass, 23 skip, 3 fail. The 3 failures are the Rust-toolchain cases under NOT RUN; they fail the same way on dev.git merge-tree --write-tree origin/dev HEAD→ exit 0 against dev 6f58f62 (with feat(link): recover a force-revoked ephemeral Child by its link id (ocx-child owner record /2, detach --expect-link, ocx link recover) #8612).NOT RUN:
bun run testsuite (this machine runs focused files only);tests/clients/link-ocx-child-e2e.test.ts(2 cases) and the Rust conformance runner intests/clients/link-ocx-child-conformance.test.ts, which need a Rust toolchain this machine lacks;ssh -Gtest ran on Linux only).Review: an independent read-only reviewer covered the first two commits in one round and reported no findings at any level; it ran the explicit-route test files, the real
ssh -Gcases included (85 pass). The final review then approved with three nits, fixed in the last three commits: the-F nonedecision now follows from the route itself, the olderssh -Gcheck is named as the second line of defence, and the guide says what a user sees when the key is not offered.Docs:
structure/remote-link.md"Explicit route" says why the link reads no ssh_config and what that takes away. The Remote Link guide (English and Spanish) says the same in one paragraph, including what a user sees when the key is not offered. The--proxy-commandcapability text (ocx link probeandocx link add) and its generated skill reference say "the link then reads no ssh_config (-F none): the Home offers its SSH agent's keys or a default ~/.ssh/id_* key".Checklist
devsrc/have focused regression tests in their domain folders, registered in the test layout maps