credentials: distinguish "no backend" from real keyring.Open errors #589

Closed
opened 2026-08-07 18:36:21 +00:00 by the.auditor · 1 comment
Owner

In internal/tpagectl/credentials/credentials.go the open() helper maps every keyring.Open error to ErrUnavailable. A genuinely present-but-broken backend (Secret Service running but dbus disconnected, locked/failed keychain, permission denied) is therefore indistinguishable from "no keychain on this machine", which silently triggers the plaintext config-file fallback (0600).

Prefer checking keyring.ErrNoAvailBackend / the "No suitable keyring backend" condition and returning ErrUnavailable only for that; surface other open errors so callers don't quietly downgrade from secure storage on real failures.

See #588

In `internal/tpagectl/credentials/credentials.go` the `open()` helper maps *every* `keyring.Open` error to `ErrUnavailable`. A genuinely present-but-broken backend (Secret Service running but dbus disconnected, locked/failed keychain, permission denied) is therefore indistinguishable from "no keychain on this machine", which silently triggers the plaintext config-file fallback (0600). Prefer checking `keyring.ErrNoAvailBackend` / the "No suitable keyring backend" condition and returning `ErrUnavailable` only for that; surface other open errors so callers don't quietly downgrade from secure storage on real failures. See https://git.lan.thwap.org/thwap/thwap-pagesd/pulls/588
Owner

Already resolved in PR #588: credentials.open() maps only keyring.ErrNoAvailImpl to ErrUnavailable; genuine keyring Open errors now propagate as open keychain: ..., and Get() propagates non-ErrKeyNotFound read errors. Verified during the CLI-lump pass; closing without further change.

Already resolved in PR #588: `credentials.open()` maps only `keyring.ErrNoAvailImpl` to `ErrUnavailable`; genuine keyring `Open` errors now propagate as `open keychain: ...`, and `Get()` propagates non-`ErrKeyNotFound` read errors. Verified during the CLI-lump pass; closing without further change.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd#589
No description provided.