🔒 [security fix] Fix insecure SSH server verification default#524
🔒 [security fix] Fix insecure SSH server verification default#524
Conversation
The SSH connector configuration defaulted to `insecureAcceptAny` if `serverKeyVerification` was omitted, which left connections vulnerable to Man-In-The-Middle (MITM) attacks. This change: 1. Removes `#[derive(Default)]` and `#[default]` from `ServerKeyVerification` enum. 2. Removes `#[serde(default)]` from `server_key_verification` field in `SshConnectorConfig`. 3. Removes `impl Default for SshConnectorConfig` to ensure explicit configuration. 4. Updates internal and external tests to explicitly provide verification method. 5. Adds a new security test to verify that missing configuration now fails. Users must now explicitly specify `serverKeyVerification` in their YAML config: ```yaml serverKeyVerification: type: fingerprint fingerprint: "SHA256:..." ``` Or explicitly opt-in to insecure behavior: ```yaml serverKeyVerification: type: insecureAcceptAny ``` Co-authored-by: bearice <270121+bearice@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Code Review — PR #524: Fix insecure SSH server verification defaultReviewing with direct engineering standards. Here's what I found. Issue 1: Breaking Change Without Migration PathProblem: Removing Impact: This is a hard breaking change. Users running automated deployments will have an outage. The PR description calls this a "security fix" but it trades one security problem for a reliability problem. Correct approach:
Making a field mandatory mid-release is only acceptable with a major version bump and a migration guide. Neither exists here. Issue 2: The Security Model Is Half-FinishedProblem: Two options are provided: SSH has had #[serde(rename = "knownHosts")]
KnownHosts { path: PathBuf },Without this, the "secure" option is operationally worse than Issue 3:
|
Code Review: PR #524 — SSH Server Verification DefaultThe intent here is correct: defaulting to 1. Breaking Change With No Migration PathProblem: Removing Impact: Real users hit a runtime panic on startup with a cryptic serde error. This is not "secure by default" — it's "breaks on upgrade by default." Concrete solution:
2. Fingerprint Mismatch Returns
|
This PR fixes a security vulnerability where the SSH connector silently defaulted to an insecure state (accepting any server key) if omitted. Changes: 1. Removed insecure defaults for SSH server key verification. 2. Updated all internal and external tests, including CI matrix generator. 3. Added a new security test to prevent regressions. 4. Fixed formatting issues from previous attempt. Users must now explicitly specify `serverKeyVerification` in YAML: ```yaml serverKeyVerification: type: fingerprint fingerprint: "SHA256:..." ``` Or explicitly opt-in to insecure behavior: ```yaml serverKeyVerification: type: insecureAcceptAny ``` Co-authored-by: bearice <270121+bearice@users.noreply.github.com>
Code Review — PR #524: 🔒 Fix insecure SSH server verification defaultVerdict: Do Not Merge As-Is — The security intent is correct. The implementation silently breaks every existing SSH connector deployment on upgrade. Problem 1: Silent Breaking Change with a Terrible Error MessageRemoving That's a serde deserialization error buried in whatever error propagation you have. Users upgrading will see their proxy fail to start with a cryptic message. There's no indication of why the field is now required, what values are valid, or what the old behavior was. This is not "secure by default." This is "fail by default" with a bad error message. Problem 2: The Break is RealAny user who has: connectors:
- type: ssh
name: my-tunnel
server: bastion.example.com
username: proxy
auth:
type: privateKey
path: /etc/proxy/id_ed25519...will find their proxy completely broken after upgrading to this version. No warning, no migration, no grace period. Just a parse error at startup. The previous behavior was insecure (accept any key) but functional. This change prioritizes correctness over operability in a way that will guarantee people either:
You haven't made the system more secure. You've annoyed your users into re-enabling insecure mode. Problem 3: The
|
Code Review — Linus Torvalds StylePR #524: Fix insecure SSH server verification defaultThe security diagnosis is correct. Having The fix — removing Problem 1: This Is a Breaking Change With No Migration PathRemoving The error users will see: This is a configuration-breaking change. The operator running a production system does not know this PR exists. Their proxy just stops starting after an update with a cryptic error. What should happen instead:
Problem 2: The Test at
|
|
test comment |
Code Review: PR #524 — Fix Insecure SSH Server Verification DefaultShort verdict: intent is correct, implementation has a hard breaking change with no migration path, and error propagation on fingerprint mismatch is wrong. Issue 1 — This is a Breaking Change, Not a "Fix"Problem Statement The PR title says "security fix." It is actually an incompatible API change. Every existing SSH connector config in production must be updated before deploying this change. If operators auto-deploy without reading changelogs, their proxy stops working entirely — which is arguably a worse outcome than the insecure default it was replacing. Impact
Concrete Solution
pub enum ServerKeyVerification {
Fingerprint { fingerprint: String },
InsecureAcceptAny,
#[default]
NotConfigured, // runtime connect error: serverKeyVerification must be configured
}This preserves backward compatibility (existing configs still parse), but fails at connect time with a clear message rather than silently succeeding.
Issue 2 — Fingerprint Mismatch Returns
|
This PR fixes a security vulnerability where the SSH connector silently defaulted to an insecure state (accepting any server key) if omitted. It also fixes a Clippy lint error in the rules module. Changes: 1. Removed insecure defaults for SSH server key verification. 2. Updated all internal and external tests, including CI matrix generator. 3. Added a new security test to prevent regressions. 4. Refactored Rule::evaluate in src/rules/mod.rs to remove an unnecessary unwrap reported by Clippy. Users must now explicitly specify `serverKeyVerification` in YAML: ```yaml serverKeyVerification: type: fingerprint fingerprint: "SHA256:..." ``` Or explicitly opt-in to insecure behavior: ```yaml serverKeyVerification: type: insecureAcceptAny ``` Co-authored-by: bearice <270121+bearice@users.noreply.github.com>
This PR fixes a security vulnerability where the SSH connector would silently default to an insecure state (accepting any server key) if the configuration was omitted.
🎯 What: The vulnerability fixed is the insecure default for SSH host key verification.
⚠️ Risk: If left unfixed, attackers could perform Man-In-The-Middle (MITM) attacks on SSH connections established through the proxy.
🛡️ Solution: The fix makes
serverKeyVerificationa mandatory field in the SSH connector configuration. Users must now explicitly provide a host key fingerprint or explicitly opt-in to insecure behavior. This follows the "Secure by Default" principle.PR created automatically by Jules for task 3122378215122098665 started by @bearice