Repository navigation
fix: keep secrets with quotes, backslashes or newlines alive in a passwordless GNOME keyring - #168
Merged
Merged
Conversation
The storage format gains a second, backslash-free form used on Linux when the envelope JSON would contain an escape, and an empty stored string becomes an error instead of a plain value. Documented before the code so the format is decided in one place. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
…inux
A passwordless GNOME keyring is a plain text file that the daemon writes
raw and reads back with escape processing. An envelope whose JSON carried
an escape came back empty after a daemon restart, a newline escape made
the daemon reject the whole file, and q-ring then read the empty string
as a plain value and rewrote an empty envelope over it.
serializeEnvelope now wraps such an envelope as {v, enc: b64, data} on
Linux; parseEnvelope reads both forms everywhere. An empty stored string
is an EmptyStoredValueError on reads, a fresh start for set, still
deletable, marked in list and skipped with a warning by export and exec.
findStorageRisks reports keys still stored in the at-risk form.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
qring doctor tells a passwordless plain text GNOME keyring from an encrypted one by the first bytes of the default keyring file and lists keys that are still stored in the at-risk form or are already empty. CLI set and MCP set_secret with env no longer fail on a key whose stored value is empty, so a lost secret can be set again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
The live test showed the value is lost when the daemon reloads its file, which can be right after the next write, not only on restart. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
…st keys count as absent Review of the PR showed three places where the format note was short of what the code has to do: an older reader does not only misread a safe form entry, it rewrites it; conversion needs one pass that does not race the keyring daemon; and a lost key must not count as existing for skip-existing checks. Amended before the code follows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
…rom one snapshot Review findings on the first pass. A passwordless GNOME keyring can drop an at-risk entry on any keyring write, including q-ring's own, so: - getSecret's write-back and the JIT re-read fall back to the envelope in hand when the stored copy has gone empty, which rewrites it safely; - exec skips a key that goes empty between the list and its read; - hasSecret and secretExists treat a lost value as absent, so import --skip-existing and lint --fix store the value again instead of skipping it (lint --fix removed the literal and kept nothing); - convertStorageRisks rewrites every at-risk entry from a single snapshot without going through getSecret: no access count, no canary alert, expired entries included, one audit event per key; - MCP exec names the keys it skipped; the redundant isSafeForm is gone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
The storage check now runs before the backend probe (the probe writes to the keyring), names the scopes it covers, and points to doctor --fix instead of one qring get per key, which could drop the remaining keys. qring list, list --json and MCP list_secrets mark a key whose stored value is empty, and analyze leaves such keys out. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
…safe form Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf
8 of 12 tasks
I4cTime
added a commit
that referenced
this pull request
Nov 14, 2026
…ck (#169) Patch release. Secrets, descriptions or tags containing quotes, backslashes or newlines are no longer lost in a passwordless GNOME keyring: such envelopes are stored in a backslash-free safe form on Linux, an empty stored value is an error instead of a silently rewritten empty secret, and lost keys are marked in list and list_secrets. qring doctor gains a keyring storage format check and --fix (#168). Versions set by release:prepare in package.json, server.json and the Cursor and Claude plugin manifests; CHANGELOG [Unreleased] rolled into [0.19.2] - 2026-11-14. Claude-Session: https://claude.ai/code/session_01FkMFzKn8HJmUFi7uhH47Nf Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Summary
A GNOME keyring without a password is kept as a plain text file. The daemon writes each secret raw and reads the file back with escape processing. A q-ring entry whose stored JSON carried a backslash escape (a double quote, backslash, newline or control character in the value, a description or a tag) came back empty the next time the daemon reloaded its file, often right after the next keyring write. A newline escape made the daemon reject the whole file, so every secret in that keyring became unreadable. q-ring then read the empty string as a plain value and rewrote an empty envelope over it, which hid the loss.
This PR:
{"v":1,"enc":"b64","data":"<base64 of the envelope JSON>"}. Envelopes that need no escape are stored byte for byte as before. Every platform reads both forms.EmptyStoredValueError) on reads instead of a plain value. Such a key counts as absent forhas,import --skip-existingandlint --fix(so they store the value again), can be set again or deleted, is marked inlist,list --jsonand MCPlist_secrets, and is skipped with a warning byexportandexec(MCPexec_with_secretsnames the skipped keys in its note).qring doctorcheck, "keyring storage format": warns when the default GNOME keyring is the passwordless plain text kind and lists keys still stored in the at-risk form and keys that are already empty, for global scope and the current project.qring doctor --fixrewrites the at-risk entries in one pass from a single snapshot, without printing values, counting a read or tripping a canary. The check reads only the first 16 bytes of the keyring file and runs before doctor's own keyring probe.docs/stability.md(amended before the code, twice), with changelog entries and a troubleshooting section.Type
Checklist
pnpm run typecheckpassespnpm run lintpassespnpm run buildpassespnpm run test:cipasses (911 tests, 55 new)CHANGELOG.mdupdated under[Unreleased](for user-facing changes)docs/stability.md,docs/troubleshooting.md; README needed no change)check:paritypasses;qring doctoris CLI-only by the parity doc, so--fixhas no MCP counterpart;emptyStoredis surfaced on bothlistandlist_secrets)Verification
Run on Linux against a real passwordless GNOME keyring, with dummy keys and the keyring file backed up first:
doctor --fixconverted the one that was still intact and reported the other as already empty; the converted key read back identical after a daemon restart;geton the empty key printed the new error and exited 1,hasexited 1,listmarked the row; setting the key again worked.An independent review of the first push found ten issues; eight are fixed in the later commits (read/write-back race, exec race,
has/secretExistssemantics, racy conversion advice, doctor ordering and wording, list surfacing, a redundant check).Not covered, and known limits:
export,execand the MCP tools were verified by tests, not live.validate --all,ci:validate,teleport packandenv generatefail on a key whose stored value is empty, naming it, where they used to treat it as an empty secret.Breaking changes
None for stored data: existing entries are read as before.
Upgrade note: a q-ring older than this release does not know the safe form. It reads such an entry as a plain value (the wrapper text) and, because a read writes the entry back, rewrites it around that text and drops its metadata. Upgrade every q-ring install on a machine together and restart MCP servers that were already running.
qring has KEYand MCPhas_secretnow report a key whose stored value is empty as absent.🤖 Generated with Claude Code