Repository navigation
fix(backend): dial credential-less machines through the user's own ssh - #100
Merged
flymysql merged 2 commits intoNov 9, 2026
Conversation
A ~/.ssh/config alias whose Host block carries only HostName/User has no credential ssh2 can authenticate with, so dialing it on the native backend reports 「缺少凭据」 for a host `ssh <alias>` reaches fine. The new suite pins the resolution rule: credential-less machines dial through the user's own ssh, and every machine that carries a password/privateKeyPath/agent/ keyboard-interactive (or a stored keychain secret), or that explicitly chose openssh, keeps its backend. All of these fail on the unfixed code (7 of 12). saved-credentials.test.js's negative control is superseded by that rule — a credential-less machine is now handed to the local ssh instead of being refused as missing credentials — so it asserts the new contract; the 缺少凭据 classification stays covered at the pure level in errors.test.js.
Native (ssh2) authenticates only through a password, a privateKeyPath, an agent or keyboard-interactive. A ~/.ssh/config alias whose Host block carries just HostName/User relies on OpenSSH's own default-identity discovery and the agent/keychain, which ssh2 does not implement, so dialing it on native reported 「缺少凭据」 for a host `ssh <alias>` reaches fine. backendFor(m, cfg) now picks the transport from the credentials a machine actually carries: native stays when a password/privateKeyPath/useAgent/ keyboard-interactive or a stored keychain secret exists, or when the machine explicitly chose openssh; otherwise the system-OpenSSH backend hands the alias to the user's own ssh. Applied at every effective-backend site (machine-pool builder, rw_connect ephemeral target, /connect, upsertMachineRecord, from-ssh-config adoption and its upgrade of a pre-fix native record, and the test-connect probe). The missing-credential hint now names the openssh option for a ~/.ssh/config machine whose ssh already works.
Owner
|
Merged. Thorough work — every dial site is covered (pool builder, Suite green on our side as well (1061 pass / 0 fail, |
flymysql
added a commit
that referenced
this pull request
Nov 9, 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.
Why
A
~/.ssh/configalias whose Host block carries only HostName/User has nothing thenative (ssh2) backend can authenticate with: ssh2 implements no default-identity
discovery (id_rsa/id_ed25519, the agent, AddKeysToAgent/UseKeychain).
from-ssh-configpersisted such a machine as
backend: "native", so Connect / 测试连接 returned「缺少凭据」 for a host
ssh <alias>reaches fine. Refs #99.Scope
lib/index.jsgainsnativeUsableCredential(m)andbackendFor(m, cfg): native staysfor a password, a privateKeyPath, useAgent, keyboard-interactive or a stored keychain
secret, or an explicit openssh; otherwise openssh (the user's own
ssh). Applied at themachine-pool builder,
rw_connect's ephemeral target,/dsh-remote/connect,upsertMachineRecord,from-ssh-config(new records default openssh; a pre-fixcredential-less
nativerecord is upgraded in place) and the/test-connectprobe.lib/errors.jsnames the openssh option in the 缺少凭据 hint.Out of scope: no new route, no client/UI change, no change to
~/.ssh/configwrites.Tradeoffs
nativebut carries no credential is still moved toopenssh: native provably cannot connect, so honouring it reproduces the dead end.
/connectroute ignores the exec exit code, so an openssh dial that fails stillanswers
ok:true; existing route behaviour, unchanged.Blast radius
Only the transport default. Credentialed machines keep native; explicit openssh choices
are unchanged. No secrets, argv or config-file paths change.
Verification
node --checkoverlib/*.js→ clean;node check.mjs→ 35 routes, no violations.saved-credentials.test.jscontrol fails test-only and passes fixed.npm test→ exit 0, 0 failures (twice; the serial coverage-style run also passed).npm run test:coverage→ 79.1% weighted. The CI-equivalent gate intermittently breaches per-file floors here, and the pristine upstream worktree breaches them too — pre-existing coverage instability, not this diff.Verbatim commands and output:
upstream-pr/verification.md.