Repository navigation
fix(connection): stop a locked keyring from deleting the stored password - #526
Merged
Merged
Conversation
The frontend never receives credentials, so on edit it sends them back absent, and the command layer fills them in from the store. It did that with `if let Ok(stored)`, which treats every failure the same way: a keyring that is locked, sandboxed or momentarily unavailable looked exactly like "this profile has no stored password". The field stayed empty, and `save()` reads an empty password as "the user cleared it" and calls `delete_password`. The user edits a profile name, sees a success toast, and the credential is gone. `ConnectionStore::get_existing` now returns `Option`, so the two outcomes have different types and the call site has to decide. A profile that does not exist is `None` — a new profile, where empty really is the intent. Anything else is an error, and the save is refused with a message saying that nothing was written and the stored password is untouched. `test_connection` had the same pattern, where the cost was a false "Access denied" sending the user off to debug credentials that were fine. Also completes #277. Enforcement landed in #522; the other half of that issue is a connection marked read-only being indistinguishable from any other until the executor refuses something. Read-only connections now carry a lock in their tab. Two things found while testing: The mock specifiers in ConnectionTabs.test.tsx resolve relative to the test file, not the component, so `../../stores/connectionStore` pointed at `src/components/stores/…`, which does not exist. None of that file's mocks were ever applied — the tests ran against the real stores and asserted only things that held either way. Fixed, which is what let the new tests render a tab at all. Three ConnectionStore tests were swept up by the blanket #[ignore] in #516. They touch only the store and an in-memory keyring, so they are back on the ordinary test path where they belong; CI has no database services, so a green Test Rust job is the proof they need none. Refs #274, #277
This was referenced Sep 7, 2026
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.
Refs #274, #277.
The keyring wipe (#274, P0)
The frontend never receives credentials — they're
#[serde(skip_serializing)]— so on edit it sends them back absent and the command layer fills them in from the store. It did that with:which treats every failure identically. A keyring that is locked, sandboxed, or momentarily unavailable looked exactly like "this profile has no stored password". The field stayed empty, and
save()reads an empty password as "the user cleared it":So: edit a profile's name, see a success toast, and the credential is gone.
ConnectionStore::get_existingnow returnsOption<ConnectionProfile>, giving the two outcomes different types so the call site has to choose:None, a new profile where empty really is the intenttest_connectionhad the same pattern, where the cost was a falseAccess deniedsending the user off to debug credentials that were fine.Worth noting
get_passwordalready distinguishedNoEntryfrom a backend error correctly — the information was there, and the command layer threw it away.The read-only badge (#277)
Enforcement landed in #522. The other half of that issue is that a read-only connection looks like any other until the executor refuses something — a guard the user can't see is one they meet by surprise. Read-only connections now carry a lock in their tab.
Two things found while testing
ConnectionTabs.test.tsx's mocks were never applying.vi.mockspecifiers resolve relative to the test file, not the component, so"../../stores/connectionStore"pointed atsrc/components/stores/…— which doesn't exist. Every mock in that file was inert; the tests ran against the real stores and asserted only things that held either way. That's why my new test rendered an empty tab bar. Fixed.Three
ConnectionStoretests were over-ignored by my own change in #516. They touch only the store and an in-memory keyring, so the blanket#[ignore]was wrong for them. They're back on the ordinary test path — and since CI's Rust job has no database services, a green run is the proof they need none.Unit tests 71 → 77, integration 66 → 63 (the same three, relocated). 1653 frontend tests. clippy/tsc/dprint clean.
🤖 Generated with Claude Code