Skip to content

Commit 6b2684e

Browse files
authored
Bug 2007416 - wipe individual logins on DecryptionErrors (#7343)
Also: * Set sync_status in `LoginsDb::touch()` * Handle missing row for LAST_SYNC_META_KEY in `get_last_sync()`
1 parent 06c391e commit 6b2684e

3 files changed

Lines changed: 29 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# v152.0 (In progress)
22

3+
## ✨ What's New ✨
4+
35
### Breach Alerts
4-
- New component: `breach-alerts` for storing and retrieving breach alert dismissals by breach ID.
6+
* New component: `breach-alerts` for storing and retrieving breach alert dismissals by breach ID.
7+
8+
### Logins
9+
* `run_maintenance()` now optionally deletes undecryptable logins (https://bugzilla.mozilla.org/show_bug.cgi?id=2007416)
510

611
[Full Changelog](In progress)
712

components/logins/src/logins.udl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,16 @@ interface LoginStore {
302302
/// This is intended to be run during idle time and will take steps / to clean up / shrink the
303303
/// database.
304304
[Throws=LoginsApiError]
305-
void run_maintenance();
305+
void run_maintenance(optional RunMaintenanceOptions? options=null);
306306

307307
[Self=ByArc]
308308
void register_with_sync_manager();
309309

310310
[Self=ByArc]
311311
void shutdown();
312312
};
313+
314+
dictionary RunMaintenanceOptions {
315+
// Wipe un-decryptable logins. These will hopefully come back on the next sync.
316+
boolean delete_undecryptable_records_for_remote_replacement=true;
317+
};

components/logins/src/store.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,13 @@ impl LoginStore {
330330
}
331331

332332
#[handle_error(Error)]
333-
pub fn run_maintenance(&self) -> ApiResult<()> {
333+
pub fn run_maintenance(&self, options: Option<RunMaintenanceOptions>) -> ApiResult<()> {
334334
let conn = self.lock_db()?;
335+
let options = options.unwrap_or_default();
335336
run_maintenance(&conn)?;
337+
if options.delete_undecryptable_records_for_remote_replacement {
338+
conn.delete_undecryptable_records_for_remote_replacement(conn.encdec.as_ref())?;
339+
}
336340
Ok(())
337341
}
338342

@@ -364,6 +368,18 @@ impl LoginStore {
364368
}
365369
}
366370

371+
pub struct RunMaintenanceOptions {
372+
pub delete_undecryptable_records_for_remote_replacement: bool,
373+
}
374+
375+
impl Default for RunMaintenanceOptions {
376+
fn default() -> Self {
377+
Self {
378+
delete_undecryptable_records_for_remote_replacement: true,
379+
}
380+
}
381+
}
382+
367383
#[cfg(not(feature = "keydb"))]
368384
#[cfg(test)]
369385
mod tests {

0 commit comments

Comments
 (0)