Skip to content

fix(keyring): require the Secret Service on Linux instead of the kernel keyring - #273

Merged
leemour merged 1 commit into
mainfrom
fix/keyring-require-secret-service
Oct 20, 2026
Merged

leemour merged 1 commit into
mainfrom
fix/keyring-require-secret-service

Conversation

@leemour

@leemour leemour commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Why

Measured 2026-10-21 on the owner's Linux desktop: the Secret Service answered DBus error: Did not receive a reply (gnome-keyring probably locked). @napi-rs/keyring 2.1.0 then silently fell back to the kernel keyutils store (its README, "Linux backend selection"):

  • reads of existing secrets returned null, so tg said "app credentials missing" for every profile with no reason given;
  • a probe write landed in kernel memory (readable through the binding, invisible to secret-tool), which a reboot clears;
  • nothing threw, so Credentials' auto fallback (warn once, use the 0600 file) never ran.

What

  • systemKeyring builds every Entry with { linux: { store: "secret-service" } } (the binding's LinuxEntryOptions; ignored off Linux). A Secret Service failure now throws, and Credentials warns and uses its file. An absent entry still returns null.
  • The warning no longer says "storing in" on a read. It now reads:
    could not reach the OS keyring — it may be locked, or no keyring service is running (<binding error>); using <file> instead, readable only by you
  • Tests with a fake binding in the require cache: every entry gets the pinned store; a constructor that throws the DBus error makes Credentials warn and use the file. No real keychain touched.
  • Version 0.47.5 and its changelog entry.

Watch for

A Linux machine with no Secret Service but a working kernel keyring now uses the credentials file. A secret written to the kernel keyring by an earlier version is no longer read.

pnpm lint, pnpm typecheck, pnpm test (775 passed) green locally.

🤖 Generated with Claude Code

…el keyring

@napi-rs/keyring 2.1.0 tries the Secret Service first and silently falls back
to the kernel keyutils store when it fails. On 2026-10-21 a locked
gnome-keyring answered "DBus error: Did not receive a reply": reads of stored
secrets returned null with no hint, and a write went to kernel memory that a
reboot clears. Nothing threw, so Credentials never used its file.

systemKeyring now passes { linux: { store: "secret-service" } }, so the
binding throws and Credentials' auto mode warns once and falls back to its
0600 file. The warning now says the keyring could not be reached (locked, or
no keyring service) rather than "storing in", which was wrong on a read.

Release 0.47.5.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@leemour
leemour merged commit 46d9970 into main Oct 20, 2026
7 checks passed
leemour added a commit to WireCatLabs/tg-cli that referenced this pull request Oct 20, 2026
Raises the exact cli-base pin to 0.47.5 (WireCatLabs/cli-base#273): the
Linux keyring uses only the Secret Service; a locked or unreachable
keyring warns and uses the credentials file instead of silently falling
back to kernel memory.

Checked: pnpm why shows one cli-base copy (0.47.5), shared with
cli-core. lint, typecheck, test green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
leemour added a commit to WireCatLabs/max-cli that referenced this pull request Oct 20, 2026
Raises the exact cli-base pin to 0.47.5 (WireCatLabs/cli-base#273): the
Linux keyring uses only the Secret Service; a locked or unreachable
keyring warns and uses the credentials file instead of silently falling
back to kernel memory.

Checked: pnpm why shows one cli-base copy (0.47.5), shared with
cli-core. lint, typecheck, test green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant