fix(storage): keep connection metadata and secrets consistent on OS store failures (#276) - #286
Merged
Merged
Conversation
…tore failures (#276) - removeConnection always deletes the SQLite row even if secure-store delete fails (e.g. missing key or unavailable libsecret). - addConnection rolls back the SQLite insert (and any partial secrets) when writing to the OS secure store fails. - updateConnection restores the previous SQLite row and previous secrets when a secure-store write fails, then rethrows the original error. - Extend the in-memory secrets backend with failNextWrite/failNextDelete hooks and cover the failure paths with unit tests.
2 tasks
ZhuchkaTriplesix
added a commit
that referenced
this pull request
Jul 27, 2026
…micity fix(storage): keep connection metadata and secrets consistent on OS store failures (#276)
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.
Summary
Fixes #276. Connection metadata in SQLite and secrets in the OS secure store were updated sequentially without rollback, so a Keychain/libsecret failure could leave undeletable connections or desynced passwords.
Changes
removeConnectionalways deletes the SQLite row even ifConnectionSecretsStore.deleteForConnectionfails.addConnectionrolls back the SQLite insert (and cleans up any partial secrets) when the secure-store write fails.updateConnectionrestores the previous SQLite row and previous secrets when the secure-store write fails, then rethrows.failNextWrite/failNextDeletehooks on the in-memory secrets backend and unit tests for the failure paths.Test plan
flutter test test/core/storage/local_db_secrets_test.dartpassesCloses
Closes #276