Bug 2007416 - wipe individual logins on DecryptionErrors #7343
Open
bendk wants to merge 2 commits intomozilla:mainfrom
Open
Bug 2007416 - wipe individual logins on DecryptionErrors #7343bendk wants to merge 2 commits intomozilla:mainfrom
bendk wants to merge 2 commits intomozilla:mainfrom
Conversation
Reworked how we handle `EncryptorDecryptor`: * Don't pass `EncryptorDecryptor` to database functions, this is redundant because the DB has it's own enc_dec arc. * Make `EncryptorDecryptor::decrypt_login` input a `LoginDb`. This enables a future change where we wipe the login on decryption failures. Most of this is just a pure refactor. The one real change is that we need to lock the store to get a `LoginDb` a bit more in the sync engine code.
Also: * Set sync_status in `LoginsDb::touch()` * Handle missing row for LAST_SYNC_META_KEY in `get_last_sync()`
6c5a0c6 to
e8513bf
Compare
bendk
commented
Apr 28, 2026
| named_params! { | ||
| ":now_millis": now_ms, | ||
| ":guid": id, | ||
| ":sync_status": SyncStatus::Changed as u8, |
Contributor
Author
There was a problem hiding this comment.
touch() now also updates the sync_status column. I needed this to make the tests pass, but it seems like the code should have always done that to me. Maybe we were just not using this method enough to notice?
bendk
commented
Apr 28, 2026
| Ok(Some(ServerTimestamp(millis))) | ||
| Ok(db | ||
| .get_meta::<i64>(schema::LAST_SYNC_META_KEY)? | ||
| .map(ServerTimestamp)) |
Contributor
Author
There was a problem hiding this comment.
This also needed changes to make the tests pass, because it seemed like the old code was not correct. Before this would panic if there was no metadata for LAST_SYNC_META_KEY, now it returns None.
bendk
commented
Apr 28, 2026
| self.execute("DELETE FROM loginsM WHERE guid=?", [guid])?; | ||
| // Delete the LAST_SYNC_META_KEY so that we resync the logins data next time | ||
| self.delete_meta(schema::LAST_SYNC_META_KEY)?; | ||
| tx.commit()?; |
Contributor
Author
There was a problem hiding this comment.
There's lots of incidental changes in this PR, but this is the main change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First commit is prep work, without much changes.
Second commit is the actual change.
Pull Request checklist
[ci full]to the PR title.