Skip to content

fix: log keyring failures#668

Merged
andrinoff merged 1 commit intofloatpane:masterfrom
SAY-5:fix/config-keyring-log-errors
Apr 17, 2026
Merged

fix: log keyring failures#668
andrinoff merged 1 commit intofloatpane:masterfrom
SAY-5:fix/config-keyring-log-errors

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented Apr 17, 2026

Problem

config/config.go has five keyring calls whose errors are swallowed with
_ =:

  • SaveConfig: keyring.Set for acc.Password and acc.Password + ":pgp-pin"
  • Legacy password migration: keyring.Set(rawAcc.Email, rawAcc.Password)
  • RemoveAccount: keyring.Delete for acc.Email and :pgp-pin

If the OS keyring is unavailable, locked, or otherwise unhappy, the
password and PGP PIN silently fail to persist. The user is then asked to
reauthenticate on every restart with no indication that keyring storage
ever failed. Same pattern reported in #616.

Fix

Log a warning on each failure:

if err := keyring.Set(keyringServiceName, acc.Email, acc.Password); err != nil {
    log.Printf("matcha: failed to store password for %s in keyring: %v", acc.Email, err)
}

For the two Delete paths, swallow keyring.ErrNotFound (expected when
the entry never existed or was already cleaned up) and log anything else.

No behaviour change on keyring success. Adds log to the import list.

Fixes #616

config/config.go had five keyring calls whose errors were swallowed via
`_ =`: three keyring.Set paths in SaveConfig and legacy password
migration, and two keyring.Delete paths in RemoveAccount. When the OS
keyring is absent, locked, or otherwise unhappy, the account password
and PGP PIN silently fail to persist; on restart the user is asked to
re-authenticate with no indication that keyring storage failed.

Log a warning on each failure so the misconfiguration surfaces in the
logs. For the Delete paths, swallow keyring.ErrNotFound (expected when
the entry never existed or was already cleaned up) but log anything else.

No behaviour change on keyring success.

Fixes floatpane#616

Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
@SAY-5 SAY-5 requested a review from a team as a code owner April 17, 2026 22:29
@github-actions github-actions bot added the bug Something isn't working label Apr 17, 2026
Copy link
Copy Markdown
Member

@andrinoff andrinoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@andrinoff andrinoff changed the title config: log keyring failures so credential loss is not silent fix: log keyring failures Apr 17, 2026
@andrinoff andrinoff merged commit 1cee418 into floatpane:master Apr 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Keyring operations silently ignore errors

2 participants