Repository navigation
fix(ssh): answer every MFA stage, stop dialling an unclaimed alias, and say where a clone failed - #17946
Conversation
|
Warning Review limit reachedNext included review available in 2 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe SSH configuration parser now preserves raw host patterns and Match-block presence. Alias detection loads, expands, caches, and evaluates user SSH configuration claims. System SSH arguments use stored endpoint values when an alias is unclaimed. SSH authentication now handles partial-success method queues and supports more keyboard-interactive rounds. New tests cover alias routing, multi-factor authentication, and SSH-specific Git clone failure guidance. Merge Risk: 🟡 Moderate · up to This change improves MFA handling, SSH alias fallback, and clone diagnostics, but a specific combination of wildcard and negated Host patterns can still prevent the fallback and leave some connections using an invalid alias route; the new SSH guidance also bypasses localization. Merge should wait for the alias-matching issue to be resolved or explicitly accepted. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description provides detailed change rationale, linked issue references, scope, exclusions, and verification results. It does not follow the template headings fully and does not explicitly provide the required Visual Proof N/A statement or checklist details. Full details: Linked Issues checkExplanation The implementation satisfies issue ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Team
Run ID: 4ddf4d30-e690-467b-b9fe-010782c7c565
📒 Files selected for processing (11)
src/main/ssh/ssh-config-alias-claim.test.tssrc/main/ssh/ssh-config-alias-claim.tssrc/main/ssh/ssh-config-parser.tssrc/main/ssh/ssh-connection.tssrc/main/ssh/ssh-multi-factor-authentication.test.tssrc/main/ssh/ssh-multi-key-authentication.test.tssrc/main/ssh/ssh-private-key-authentication.tssrc/main/ssh/ssh-system-fallback.test.tssrc/main/ssh/system-ssh-args.tssrc/shared/git-clone-failure-message.test.tssrc/shared/git-clone-failure-message.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
Important
The alias-claim predicate is not sound in the negative direction when a Host block carries a negated pattern: Host * !prod returns false for any alias other than prod, licensing the -o Hostname/Port/User override against a block OpenSSH actually applies. See the inline comment. Everything else reads correct and is well-tested against a real ssh2 server.
Reviewed changes
- MFA partial-success handling —
configurePrivateKeyAuthenticationnow installs Orca's auth queue for every target (not just multi-key), re-arms it on partial success narrowed to the methods the host still offers, and bounds it at four stages;SSH_KEYBOARD_INTERACTIVE_MAX_ROUNDSdoubles to 8. - Unclaimed-alias routing — new
parseSshConfigAliasClaimsandsshConfigMayClaimAliasprove that noHost/Matchblock claims a stored alias, and only then doesbuildSshArgsrestore the storedHostname/Port/User; the verdict is injected fromSshConnectionso the arg builder stays filesystem-free. - Clone failure diagnostics —
getGitCloneFailureMessagenamesBatchMode=yes, points publickey/host-key failures at the machine that runs the clone, and is re-entrant so relay re-parsing can't double-append.
ℹ️ Port-forward scope in the PR body doesn't match the code
The description says "Port-forward processes build their own options and keep today's behaviour", but system-ssh-port-forward-provider.ts:24 passes conn.getSystemSshBuildArgsOptions(), which now includes aliasClaimedByConfig: false. Port-forwards will inherit the unclaimed-alias override; confirm whether that's intended.
Technical details
# Port-forward inherits the alias override despite the PR-body scope claim
## Affected sites
- src/main/ssh/system-ssh-port-forward-provider.ts:24 — forwards `conn.getSystemSshBuildArgsOptions()` into `startSystemSshPortForwardProcess`.
- src/main/ssh/ssh-connection.ts:1307 — `getSystemSshBuildArgsOptions()` now sets `aliasClaimedByConfig = false` when the alias is unclaimed.
- src/main/ssh/system-ssh-forward-process.ts:34 — `buildSshArgs` consumes that option and applies the `-o Hostname/Port/User` override.
## Open questions for the human
- Is applying the override to port-forwards intended (arguably also fixes #11746 for forwards), or should they be excluded as the description states?ℹ️ Nitpicks
SSH_KEYBOARD_INTERACTIVE_MAX_ROUNDS = 8inssh-connection.tsis coupled toMAX_PARTIAL_SUCCESS_STAGES = 4inssh-private-key-authentication.ts, but the two constants live in different modules and neither is derived from the other; a cross-referencing comment would keep them from drifting.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
842c611 to
476c4f0
Compare
There was a problem hiding this comment.
✅ No new issues found. The negated-pattern soundness gap from my prior review is now fixed, and the new HTTPS-detection gate on clone guidance is correct.
Reviewed changes
- Negated
Hostgroups treated as uncertainty —sshConfigMayClaimAliasnow returnstruefor any group carrying a negated pattern (Host * !prod), closing the negative-direction soundness hole in a conservative direction; tests cover both the non-negated (stage) and negated (prod) aliases plus the no-negation absence case. - HTTPS clone guidance gating —
getGitCloneFailureMessageonly appends the SSH host/key note when an SSH-transport diagnostic is present, so an HTTPS auth failure no longer receivesssh-add/BatchModeadvice.
ℹ️ Unrelated formatting churn bundled into the final commit
Commit 476c4f0 also rewraps and re-italicizes ten files outside this PR's scope (docs/reference/*, terminal-attach-cancellation.ts, worktree-create-preparation-pool.ts, UpdateCard.tsx, ssh-docker-transport-drop-recovery.spec.ts). No behavior changes, but it pollutes the diff and will conflict with in-flight work touching those files; splitting it out (or dropping it) would keep the review surface clean.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
ssh2 walks one flat auth-method list exactly once, so keyboard-interactive could only ever be offered a single time. A host running `AuthenticationMethods keyboard-interactive,keyboard-interactive` (or any ladder ending in a second challenge) partial-succeeds the first stage and then finds the list exhausted, which the user sees as "All configured authentication methods failed" — the reports in #8622 and #16820. Orca's own auth handler now runs for every target instead of only multi-key ones, and rebuilds its queue on each SSH_MSG_USERAUTH_FAILURE that carries partial success, narrowed to the methods the host still offers. Narrowing also stops keys being re-offered after the host has moved past publickey, which is what exhausts MaxAuthTries before the challenge is ever shown. Covered by a real ssh2 server fixture that stages partial success.
Clones go through nonInteractiveGitEnv, so `ssh` runs with BatchMode=yes and an emptied SSH_ASKPASS. On a remote or paired-runtime clone that produces `fatal: Could not read from remote repository.` while the same `git clone` typed by hand on that box succeeds — the divergence in #14533. Nothing in the message said the clone ran on the other machine, under its keys, with the prompt deliberately disabled. getGitCloneFailureMessage now appends that fact, and names the two recognisable shapes: a publickey refusal (load the key into an agent there) and a host-key failure (record the key in that machine's known_hosts). Unrecognised SSH failures still get the where-it-ran note; non-SSH failures are untouched. One builder, so the SSH-target relay path and the runtime path both get it.
A wildcard `Host *` block supplies ProxyCommand/ProxyJump for every alias, so shouldUseSystemSshTransport picks the system transport for an alias whose own Host block was renamed or deleted, and buildSshArgs then dials that alias verbatim: no -l, no -p, no Hostname. Orca connects as the wildcard's user to the wildcard's host and discards the endpoint it stored (#11746). The signal #11746 assumed (hostBlockMatch, from the still-open #11707) does not exist, and `ssh -G` cannot supply it — it prints the merged config and answers for unknown aliases too. The config file is the only source of truth, so: - parseSshConfigAliasClaims retains raw Host patterns and flags Match blocks, which parseSshConfig discards because it mints importable targets. - sshConfigMayClaimAlias is sound in the negative direction only: an unreadable file, any Match block, or any non-catch-all pattern that might match all answer "claimed", so absence of evidence is never read as evidence of absence. Only a proven-unclaimed alias licenses an override. - buildSshArgs then states Hostname/Port/User, and only those: the wildcard is still the route, and -o Hostname does not change block selection, so the proxy keeps applying and %h expands to the host we mean. The verdict is injected rather than read inside buildSshArgs, so an arg builder does not answer differently per machine. Default is today's behaviour. Scoped to the system-SSH transport and the connection's own command/transport path. Port-forward processes and the ssh2 transport (#11707) are unchanged.
…H guidance `Host * !prod` applies to every alias but `prod`, yet skipping both the catch-all and the `!` pattern answered "unclaimed" for `stage` — which licences overriding Hostname/Port/User against a block the user wrote. Any negation now makes the whole group uncertain; the function is only sound in the negative direction. Also require an ssh(1) diagnostic beside "could not read from remote repository" before appending the SSH clone note: git prints that same line for the HTTP remote helper, where advice about keys and agents is simply wrong.
476c4f0 to
db8308b
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebased onto current Blocker — negated Fixed — SSH clone guidance fired on a line git also emits for HTTPS. Not fixed — localization of the three new strings. Answered on that thread: the module runs in the main process and on the relay host with no i18n runtime, and translating only these three sentences would staple localized copy onto git's own English stderr and an untranslated pre-existing sibling in the same function. Doing it properly needs an error-code protocol for the clone-failure path, which is its own change. MFA verification against real OpenSSHRe-ran the multi-stage sshd container check. Debian bookworm, The baseline reproduces the bug — ssh2 walks its flat method list once, so the second challenge is never offered and it stops at (Note for anyone reproducing: Verification
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Restored the
activityOptionsi18n key — the single new commit re-addsActivityPrototypePage.activityOptions(and the trailing comma it orphans) toen.json, which the rebase onto a newermainhad dropped; the value and position now matchmainexactly, so the activity-options menu label resolves again.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
…nd say where a clone failed (stablyai#17946) * fix(ssh): answer every MFA stage, not just the first ssh2 walks one flat auth-method list exactly once, so keyboard-interactive could only ever be offered a single time. A host running `AuthenticationMethods keyboard-interactive,keyboard-interactive` (or any ladder ending in a second challenge) partial-succeeds the first stage and then finds the list exhausted, which the user sees as "All configured authentication methods failed" — the reports in stablyai#8622 and stablyai#16820. Orca's own auth handler now runs for every target instead of only multi-key ones, and rebuilds its queue on each SSH_MSG_USERAUTH_FAILURE that carries partial success, narrowed to the methods the host still offers. Narrowing also stops keys being re-offered after the host has moved past publickey, which is what exhausts MaxAuthTries before the challenge is ever shown. Covered by a real ssh2 server fixture that stages partial success. * fix(git): say where a failing clone ran and why nothing could prompt Clones go through nonInteractiveGitEnv, so `ssh` runs with BatchMode=yes and an emptied SSH_ASKPASS. On a remote or paired-runtime clone that produces `fatal: Could not read from remote repository.` while the same `git clone` typed by hand on that box succeeds — the divergence in stablyai#14533. Nothing in the message said the clone ran on the other machine, under its keys, with the prompt deliberately disabled. getGitCloneFailureMessage now appends that fact, and names the two recognisable shapes: a publickey refusal (load the key into an agent there) and a host-key failure (record the key in that machine's known_hosts). Unrecognised SSH failures still get the where-it-ran note; non-SSH failures are untouched. One builder, so the SSH-target relay path and the runtime path both get it. * fix(ssh): stop dialling a bare alias no ssh_config block claims A wildcard `Host *` block supplies ProxyCommand/ProxyJump for every alias, so shouldUseSystemSshTransport picks the system transport for an alias whose own Host block was renamed or deleted, and buildSshArgs then dials that alias verbatim: no -l, no -p, no Hostname. Orca connects as the wildcard's user to the wildcard's host and discards the endpoint it stored (stablyai#11746). The signal stablyai#11746 assumed (hostBlockMatch, from the still-open stablyai#11707) does not exist, and `ssh -G` cannot supply it — it prints the merged config and answers for unknown aliases too. The config file is the only source of truth, so: - parseSshConfigAliasClaims retains raw Host patterns and flags Match blocks, which parseSshConfig discards because it mints importable targets. - sshConfigMayClaimAlias is sound in the negative direction only: an unreadable file, any Match block, or any non-catch-all pattern that might match all answer "claimed", so absence of evidence is never read as evidence of absence. Only a proven-unclaimed alias licenses an override. - buildSshArgs then states Hostname/Port/User, and only those: the wildcard is still the route, and -o Hostname does not change block selection, so the proxy keeps applying and %h expands to the host we mean. The verdict is injected rather than read inside buildSshArgs, so an arg builder does not answer differently per machine. Default is today's behaviour. Scoped to the system-SSH transport and the connection's own command/transport path. Port-forward processes and the ssh2 transport (stablyai#11707) are unchanged. * fix(ssh): read a negated Host group as uncertainty, and gate clone SSH guidance `Host * !prod` applies to every alias but `prod`, yet skipping both the catch-all and the `!` pattern answered "unclaimed" for `stage` — which licences overriding Hostname/Port/User against a block the user wrote. Any negation now makes the whole group uncertain; the function is only sound in the negative direction. Also require an ssh(1) diagnostic beside "could not read from remote repository" before appending the SSH clone note: git prints that same line for the HTTP remote helper, where advice about keys and agents is simply wrong. * fix(i18n): restore the activity-options key the rebase dropped * fix(i18n): union en.json with main so the rebase cannot drop keys

Three connect-path failures. The first two are "the user cannot get in at all".
#8622 + #16820 are the same bug — and were half-fixed yesterday
Both are ssh2 never being told to try keyboard-interactive. It builds
authsAllowedatssh2/lib/client.js:836-844and only pusheskeyboard-interactivewhenconfig.tryKeyboardis set; with the list exhausted it emits the reporters' exact string at:863.Every released tag through v1.4.194 lacks
tryKeyboard. It landed onmaininfbe94ceff68yesterday and is in no tag (git merge-base --is-ancestor fbe94ceff68 v1.4.194fails). So both reporters were right, and both are fixed by an unreleased commit.What was still broken. ssh2 walks one flat method list exactly once (
makeSimpleAuthHandler,client.js:2047-2057), so keyboard-interactive can only ever be offered once per connection. AnAuthenticationMethodsladder ending in a second challenge partial-succeeds stage one and then finds the list empty. Orca's own handler (ssh-private-key-authentication.ts:50) had the same defect — it ignored itspartialSuccessargument entirely, and only ran whenkeys.length > 1.Now it runs for every target, and on a
SSH_MSG_USERAUTH_FAILUREcarrying partial success it rebuilds its queue narrowed to the methods the host still offers (bounded to 4 stages);SSH_KEYBOARD_INTERACTIVE_MAX_ROUNDSgoes 4 → 8 to cover them. No new prompt surface —SshPassphraseDialog.tsx:110already handleskind === 'keyboard-interactive'.Proved against a real ssh2 server, not the mock harness:
#11746 — reproduced by execution, fixed for system-SSH, honestly scoped
Bundled the real modules and ran them against the issue's exact inputs:
buildSshArgsemits["-o","BatchMode=no","-T",…,"--","prod"]— byte-identical to the report. The stored10.0.0.5:2222/deployis discarded because aHost *block makes the target look config-backed.hostBlockMatchdoes not exist anywhere and PR #11707 is still open, so this could not be fixed as written.ssh -Gcannot supply the signal either — it prints the merged config and answers for unknown aliases too. The config file is the only source of truth.Reusing the existing
configHostMatcheswas not safe:parseSshConfigdrops glob'dHost prod.*lines andMatchblocks, so it would call a real config absent. NewparseSshConfigAliasClaimsretains raw patterns and flagsMatch;sshConfigMayClaimAliasis sound in the negative direction only — an unreadable file, anyMatchblock, or any non-catch-all pattern that might match all answer "claimed". Only a proven-unclaimed alias licenses the override, and then onlyHostname/Port/User— never-i,-Jor ProxyCommand.The verdict is injected into
buildSshArgs, not read there: an arg builder that stats~/.ssh/configanswers differently on every machine, including in tests. Default is today's behaviour.The conflicting test did not need rewriting.
ssh-system-fallback.test.ts:249-269passes noresolvedand no verdict, so it now exercises the safe default — and what it was protecting (a realHostblock staying authoritative) is exactly what that default means. It stays green unchanged, with three new sibling cases beside it.Scope: system-SSH transport only, via
getSystemSshBuildArgsOptions()— exec, file transfer, relay deploy, the GitHub probe, the relay transport spawn. Port-forward processes build their own options and keep today's behaviour. The ssh2 half (#11707) is untouched and still live.One consequence to weigh before merge:
-o Hostname=<stored>moves OpenSSH's known_hosts lookup from the alias to the real host. That is stricter — checking the endpoint we actually reach — but a first connection after the fix can prompt.HostKeyAliaswas deliberately not added, since it would pin the check to a name that no longer designates anything.#14533 — the title is wrong; fixed the diagnosis, not the forwarding
SSH_AUTH_SOCK/HOME/PATHare inherited throughorca serve, and no agent forwarding to a paired runtime exists anywhere — because that transport is Orca's own E2EE runtime RPC, with no ssh connection to hangagentForwardoff.The real mechanism:
nonInteractiveGitEnv()setsGIT_SSH_COMMAND='ssh -o BatchMode=yes'plus emptySSH_ASKPASS, so a passphrase-protected key with no agent loaded fails under Orca while the samegit clonetyped by hand on that box succeeds — and the error never says why.Fixed in the one shared builder,
git-clone-failure-message.ts, so the relay path and the runtime path both get it: publickey refusal → name BatchMode and sayssh-addon that machine; host-key failure → point at that machine'sknown_hosts; any other SSH failure → still state where it ran. Non-SSH failures untouched, and the builder is re-entrant so re-parsing a relay message cannot double-append.Not done, deliberately: agent forwarding (a feature and a security decision, worth its own issue), and weakening
BatchMode=yes— making it interactive would trade a clear failure for a silent hang.Verification
Fixes #8622, #16820
Refs #11746, #14533, #11707