1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-22 05:10:29 +01:00

Fix Pw History null dates (#4966)

It seemed to have been possible to have `null` date values.
This PR fixes this by setting the epoch start date if either the date does not exists or is not a string.

This should solve sync issues with the new native mobile clients.

Fixes https://github.com/dani-garcia/vaultwarden/pull/4932#issuecomment-2357581292

Signed-off-by: BlackDex <black.dex@gmail.com>
Dieser Commit ist enthalten in:
Mathijs van Veluw 2024-09-18 18:57:08 +02:00 committet von GitHub
Ursprung 6ceed9284d
Commit 1bf85201e7
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -190,11 +190,20 @@ impl Cipher {
.map(|d| { .map(|d| {
// Check every password history item if they are valid and return it. // Check every password history item if they are valid and return it.
// If a password field has the type `null` skip it, it breaks newer Bitwarden clients // If a password field has the type `null` skip it, it breaks newer Bitwarden clients
// A second check is done to verify the lastUsedDate exists and is a string, if not the epoch start time will be used
d.into_iter() d.into_iter()
.filter_map(|d| match d.data.get("password") { .filter_map(|d| match d.data.get("password") {
Some(p) if p.is_string() => Some(d.data), Some(p) if p.is_string() => Some(d.data),
_ => None, _ => None,
}) })
.map(|d| match d.get("lastUsedDate") {
Some(l) if l.is_string() => d,
_ => {
let mut d = d;
d["lastUsedDate"] = json!("1970-01-01T00:00:00.000Z");
d
}
})
.collect() .collect()
}) })
.unwrap_or_default(); .unwrap_or_default();