Browse Source

Merge 6c7c81e52e into 1430a64547

pull/7778/merge
Piyush Kumar 3 days ago
committed by GitHub
parent
commit
0b1829cb87
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 15
      src/api/core/ciphers.rs

15
src/api/core/ciphers.rs

@ -774,6 +774,21 @@ async fn save_cipher_data(
cipher.data = type_data.to_string(); cipher.data = type_data.to_string();
} }
// For SSH keys, ensure the required members are present and non-null.
// Bitwarden's server rejects an sshKey object with a `null`
// privateKey/publicKey/keyFingerprint, but without this check the null
// members are accepted and then silently dropped on read (data loss).
// A presence check (not key-material validation) matches the upstream
// behaviour. See https://github.com/dani-garcia/vaultwarden/issues/7514
if data.r#type == 5 {
for field in ["privateKey", "publicKey", "keyFingerprint"] {
match type_data.get(field) {
Some(value) if value.is_string() => {}
_ => err!(format!("SSH key is missing the required '{field}' field")),
}
}
}
cipher.key = data.key; cipher.key = data.key;
cipher.reprompt = data.reprompt.filter(|r| *r == RepromptType::None as i32 || *r == RepromptType::Password as i32); cipher.reprompt = data.reprompt.filter(|r| *r == RepromptType::None as i32 || *r == RepromptType::Password as i32);

Loading…
Cancel
Save