Skip to content

fix(macos): a shared row's SSH tunnel dials the chain its approval resolved - #4728

Merged
datlechin merged 2 commits into
mainfrom
fix/mac-dial-approved-ssh-chain
Nov 29, 2026
Merged

datlechin merged 2 commits into
mainfrom
fix/mac-dial-approved-ssh-chain

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • ResolvedSSHChain: an SSH configuration with every hop as ~/.ssh/config resolved it, read once.
  • LocalCredentialConsent.check returns the chain it approved for a Team Library or linked-folder row.
  • Connect, Test Connection and both reconnects pass that chain into buildEffectiveConnection.
  • The port forward, SFTP (remote file) and remote SQLite dial that chain: buildAuthenticatedChain, SSHSessionRoute and the tunnel manager take it and no longer read ~/.ssh/config themselves.
  • A shared row is refused (needsPerson) with no approved chain, or when its SSH profile, read again after the SSH secrets, gives another configuration than the approved one. The profile's new secrets never reach the old server.
  • Connect checks a shared row again after the pre-connect script and the password prompt: a chain that changed since the first check asks again.
  • An answer is recorded only when the chain read after it is the one asked about, not only the same uses.
  • An SSH profile use names the server it signs in to (ssh.profile=<id>@<host:port>), so a password profile whose alias moves asks again. A shared row on an SSH profile asks once more after this update.
  • A row of this Mac's own resolves ~/.ssh/config once per dial, for both the session route and the sign-in, instead of twice.
  • A cached SFTP session is reused only for the same resolved hops.
  • SSHTunnelManager.createTunnel takes the chain and credentials instead of each field; SSHTunnelLocalPortTests and the SSH probe harness move to it.

Test plan

  • SharedRowSSHDialTests:
    • a team row dials the server, the ProxyJump first hop and the form jump host its approved chain resolved, through an alias only that chain knows;
    • a team row with no approved chain dials nothing;
    • a row of this Mac's own dials as before.
  • GlobalStateSuites.SharedRowSSHProfileTests:
    • an SSH profile edited after approval is refused, and the new server sees no dial;
    • a password profile whose alias moves asks again.
  • LocalCredentialConsentTests:
    • the check returns the approved chain, ProxyJump hops included, and nothing for an own row;
    • a chain that changes while the question is open asks again though its uses read the same;
    • a chain that changes after a connect's first check asks again before the dial.
  • Local verify.sh --jobs 4:
    • test on LocalCredentialConsentTests, SharedRowSSHDialTests, SSHTunnelLocalPortTests, SSHSessionRouteTests: 51 passed;
    • test on those plus 16 related suites (tunnel, recovery, RDS, approvals, remote file, remote SQLite, jump chain, dialed route, authenticators, local network, linked connections): 260 passed;
    • test on GlobalStateSuites/SharedRowSSHProfileTests, PinnedSSHRouteTests, EnvVarReferenceConsentTests: 24 passed;
    • lint on the 19 changed Swift files: 0 violations.
  • Review: Codex, three rounds (review and security). Fixed: the profile test's global state, secrets read before the profile check, an answer recorded for a moved profile, profile approval bound to its server, ProxyJump hop ids breaking chain equality, the SSH probe harness caller.

Fixes #4667

@datlechin
datlechin merged commit 328c6fb into main Nov 29, 2026
1 check passed
@datlechin
datlechin deleted the fix/mac-dial-approved-ssh-chain branch November 30, 2026 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: dial the SSH chain a shared row's approval covered, not one read again after the check

1 participant