Skip to content

fix(storage): an unreadable keyring is an error, not an empty password (#1303) - #1320

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
fix/1303-secret-store-read-errors
Oct 10, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
fix/1303-secret-store-read-errors

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #1303

Problem: ConnectionSecretsStore.readForConnection / readSshSecretsForConnection caught every error and returned nulls, and the drivers wrapped the read in catch (_) {}.

  1. A locked keyring or a missing secret service looked like a connection with no password: the user saw Authentication failed. Check the username and password and retyped a correct one.
  2. updateConnection read the previous secrets the same way. With the read failing silently, the next write stored the missing password as empty (a delete), so an unrelated edit could erase it.

Fix

  • New SecretsStoreUnavailableException. The reads throw it when the backend throws; an absent key still reads as null. A missing profile id (nothing stored yet) is still "no secrets".
  • PostgreSQL, MySQL, MongoDB and Redis connect paths no longer swallow it: the connect fails with Could not read the saved credentials from the system keyring... Unlock the keyring or start the secret service. mapDatabaseError maps it before the text matching, so it is never an authentication failure.
  • LocalDb.updateConnection reads the previous secrets before touching the row, so it stops without writing; the connections panel's edit flow shows the message in a toast instead of saving.
  • List hydration (getConnections(hydrateSecrets: true)) keeps its tolerance: the row loads without its password and the connect reports the keyring.

Tests: store reads (throws on a failing backend, null for absent keys, SSH too); an edit with an unreadable store changes nothing and the saved password survives; each driver's connect surfaces the keyring error; the mapper keeps it apart from authentication failures. The old test that expected nulls on a failing read now expects the exception.

#1303)

The secure-store reads swallowed every failure and returned nulls, so a
locked keyring or a missing secret service was reported as
Authentication failed, and a following edit could save the missing
password as empty.

- readForConnection / readSshSecretsForConnection throw
  SecretsStoreUnavailableException when the store does not answer; an
  absent secret is still null.
- The drivers let it through instead of connecting without a password,
  and the error text names the keyring, not the credentials.
- Editing a connection stops before any write when the saved secrets
  cannot be read, and says so.
@github-actions github-actions Bot added bug Something isn't working storage Theme parser epic label: storage core Core library logic and services connections Database connections, URI parsing, pools P1 High priority / Core capability labels Oct 10, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 525ae58 into dev Oct 10, 2026
15 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the fix/1303-secret-store-read-errors branch October 11, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working connections Database connections, URI parsing, pools core Core library logic and services P1 High priority / Core capability storage Theme parser epic label: storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant