Repository navigation
fix: verify server host keys in the ssh client builtin (3.x backport) - #2237
Conversation
* fix: verify server host keys in the ssh client builtin The ssh builtin's default client accepts any server host key, so a swapped endpoint silently captures the credentials the user types. Install an OpenSSH-style known_hosts verifier when the client is still on the accept-all default: match recorded keys, confirm and record unknown keys, refuse changed keys. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P5Bf8mxp6ZPnsCBBC45Hx2 * fix: track verifier installation and create known_hosts parent dir - Use a client property to track whether setupServerKeyVerifier installed the KnownHostsServerKeyVerifier, so an AcceptAllServerKeyVerifier.INSTANCE explicitly set by the caller after our install is not replaced on subsequent calls. - Create the ~/.ssh parent directory (if missing) before constructing the KnownHostsServerKeyVerifier to prevent failures when the path does not exist yet. - Extend callerConfiguredVerifierIsLeftInPlace to verify the AcceptAllServerKeyVerifier.INSTANCE tracking. - Add regression test with tempDir.resolve("missing/.ssh/known_hosts") that verifies the directory is created and the confirmed host key is persisted. --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|



Backport of #2236 to jline-3.x.
The ssh builtin's default client accepts any server host key, so a swapped endpoint silently captures the credentials the user types. This installs an OpenSSH-style known_hosts verifier when the client is still on the accept-all default: match recorded keys, confirm and record unknown keys, refuse changed keys.
Cherry-picked cleanly from 47e16bf.