Piyush Kumar
5 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
15 additions and
0 deletions
-
src/api/core/ciphers.rs
|
|
|
@ -565,6 +565,21 @@ pub async fn update_cipher_from_data( |
|
|
|
err!("Data missing") |
|
|
|
}; |
|
|
|
|
|
|
|
// 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.name = data.name; |
|
|
|
cipher.notes = data.notes; |
|
|
|
|