Skip to content

Commit eadee40

Browse files
fix: validate SSH key files have valid headers
Only include files in SSH key listing if they contain valid private key headers (BEGIN ... PRIVATE KEY), regardless of whether they have standard key filenames. Co-authored-by: Ellie Huxtable <ellie@users.noreply.github.com>
1 parent 6f1ff3d commit eadee40

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/src/commands/ssh.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ pub async fn list_ssh_keys() -> Result<Vec<SshKeyInfo>, String> {
6969
let is_standard = standard_names.contains(&name.as_str());
7070
let key_type = detect_key_type(&path);
7171

72-
// Only include if it looks like a private key
73-
if key_type.is_some() || is_standard {
72+
// Only include if it has valid private key headers
73+
if key_type.is_some() {
7474
keys.push(SshKeyInfo {
7575
name,
7676
path: path.to_string_lossy().to_string(),

0 commit comments

Comments
 (0)