Repository navigation
Description
Finding (RCA, R1) — the credential store disagrees with itself about what a credential IS
Verified live on 2026-11-16 (charly 2026.319.1133, plugin-secrets at v2026.314.0715), then read in
source. Five findings, one cutover: the store resolves one identity per credential, keeps its shadow
index truthful, honours its collection pin, and ships the verb its own messages promise.
1. The same credential has two identities — the config-side parser splits at the FIRST slash, every other parser at the LAST
parseCompositeKey (candy/plugin-secrets/credential_config.go:206-220) resolves a vnc_passwords map key
to (service, key) by hard-coding two prefixes (charly/secret/, charly/enc/) and otherwise cutting at the
first slash. Every other parser in the tree cuts at the last:
| surface | split |
|---|---|
credential_config.go:196 PlaintextCredentialEntries → drives migrate-secrets + import |
FIRST slash |
verb_credential.go:145 the doctor's index-consistency probe |
FIRST slash |
command.go:339 collectCredentialNames → drives list + export |
LAST slash |
sdk/deploykit/secret_provision.go:280 CollectCandySecretAccepts (the deploy WRITE path) |
LAST slash |
sdk/deploykit/secret_candy_resolve.go:48 EnsureCandySecret (artifacts / secret_require) |
LAST slash |
plugin-deploy-pod secret_migration.go:59 secretKeyForDep (config -e) |
LAST slash |
So for the documented shared namespace charly/<ns>/<name> with ns ∉ {secret, enc} — e.g.
charly/api-key/openrouter, which /charly-build:secrets recommends — the writer stores
service=charly/api-key, key=openrouter while the config-side parser reads back
service=charly, key=api-key/openrouter. A D-Bus item's identity IS its attribute pair, so the two never meet.
Measured (sandbox XDG_CONFIG_HOME, throwaway keys, real keyring, entries deleted after):
$ printf 'vnc_passwords:\n charly/api-key/auditprobe: API-VALUE\n' > $XDG_CONFIG_HOME/charly/config.yml
$ plugin-secrets import --dry-run
charly/api-key/auditprobe (from config.yml)
$ plugin-secrets import
charly/api-key/auditprobe → keyring ✓ (from config)
$ plugin-secrets get charly/api-key auditprobe
charly secrets: no entry found for charly/api-key/auditprobe # the documented identity
$ plugin-secrets get charly api-key/auditprobe
API-VALUE # the mis-split identity
Live blast radius on an ordinary host — the doctor reports a false positive on three credentials that
are demonstrably present, and prescribes a re-store that would duplicate them:
[!] Keyring index consistency -- indexed but not found in any collection:
charly/api-key/openai, charly/api-key/qdrant, charly/api-key/whisper
(Re-store with `charly secrets set <service> <key>` or prune stale index entries)
$ plugin-secrets get charly/api-key openai → rc=0, a 14-byte value
migrate-secrets is worse than a false alarm: it MOVES the value to the mis-split coordinate and then
deletes the plaintext, so the credential survives but is unreachable by the name the operator knows.
Missed control. No test drives a two-segment service through PlaintextCredentialEntries:
TestPlaintextCredentialEntriesCompositeKeys covers charly/secret/... (a hard-coded prefix) only, so the
first-slash cut has never been exercised on the namespace the skill recommends. charly box validate cannot
see it, and the doctor's own probe shares the bug, so the system's self-check agrees with its defect.
Root fix. ONE split, the last-slash rule every writer already uses, used by all three consumers; delete
the hard-coded prefix table (knownServicePrefixes) with it. Keys cannot contain / (the CUE key: regex is
^charly/[a-z0-9][a-z0-9-]*/[a-z0-9][a-z0-9_-]*$, and env-var names cannot either), so last-slash is
unambiguous.
2. migrate-secrets erases the index entry it just wrote — and strips the plaintext of entries it could NOT move
ConfigMigrateSecretsCmd.Run (credential_admin.go:118-141) migrates with keyring.Set, which appends the
shadow-index entry to config.yml and saves. After the loop it mutates its stale in-memory cfg
(cfg.VncPasswords = nil) and calls SaveRuntimeConfig(cfg) — writing the KeyringKeys slice it loaded
BEFORE any of those saves. Every index entry added by this run is dropped.
Measured (sandbox config seeded with one pre-existing index entry + one plaintext entry):
$ plugin-secrets migrate-secrets
charly/secret.NEW_MIGRATED → keyring ✓
Removed plaintext credentials from config.yml.
$ cat $XDG_CONFIG_HOME/charly/config.yml
keyring_keys:
- charly/secret/PRESET_ENTRY # the newly migrated entry is GONE
$ plugin-secrets list
charly/secret/PRESET_ENTRY # the migrated secret is invisible
$ plugin-secrets get charly/secret NEW_MIGRATED
NEW-VALUE # …but its value is in the keyring
$ plugin-secrets export
{} # silent data loss in the export
This fires on exactly the remediation the doctor prints: [!] Plaintext credentials -- 1 in config.yml (Run: charly secrets migrate-secrets --dry-run).
The same block clears the WHOLE plaintext map, so an entry whose keyring write FAILED is stripped too (code
read: the continue on failure leaves migrated > 0 true, and the wholesale VncPasswords = nil then
deletes the value that never reached the keyring). The sibling plugin-deploy-pod/secret_migration.go:153
already does this correctly for charly.yml — a delete-exactly-the-migrated-keys read-modify-write.
Missed control. No test asserts the index survives a migration; TestPlaintextCredentialEntries* test the
parser, not the command's persistence.
Root fix. Track the pairs that actually reached the keyring; after the loop, reload the config and delete
exactly those composite keys, then save once. One read-modify-write, no stale copy.
3. charly secrets prune does not exist, but the product tells operators to run it
credential_keyring.go:154-159: when a Get misses though the shadow index claims the key exists, the message
says "Run charly secrets prune to reconcile". The whole surface is
delete, export, get, gpg*, import, list, migrate-secrets, set:
$ plugin-secrets prune
plugin-secrets: parse `charly secrets [prune]`: unexpected argument prune (rc=1)
So the one recovery path for index drift — which findings 1 and 2 both produce — does not exist.
Root fix. Implement charly secrets prune [--dry-run]: for every shadow-index entry, look up
(service, username) across the healthy collections with the SAME iteration the read path uses; drop the
entries that resolve nowhere; save once; report each action. This is the direction the message promises, and
it is deterministic and safe (it never writes a secret).
4. The WRITE path is hard-pinned to the Secret Service login collection: keyring_collection_label is not honoured, and delete silently no-ops outside it
KeyringStore.Set (credential_keyring.go:218-236) calls keyring.Set, and KeyringStore.Delete
(:238-256) calls keyring.Delete — github.com/zalando/go-keyring v0.2.8, whose Linux provider
(keyring_unix.go:41-52) resolves GetLoginCollection(): /org/freedesktop/secrets/collection/login, or the
login alias. The READ path (credential_keyring.go:181-202) iterates default → keyring_collection_label → every healthy collection. The two disagree, in two ways the docs promise they do not:
keyring_collection_label"pins charly to a specific collection" — reads yes, writes no. A KeePassXC
database exposed as a non-login collection receives nothing; the secret lands inlogin(or the write fails
outright where no login collection exists).deleteonly finds items inlogin, and a not-found is tolerated as success
(if err != nil && !isKeyringNotFound(err)), so deleting a credential that lives in any other collection
printsDeleted … from keyring, removes its shadow-index entry, and LEAVES THE ITEM IN THE STORE. The
operator loses the only pointer to it.
The primitives to do this correctly already exist and are already wired for the other half of this plugin:
resolveTargetCollection (secret_service.go:443) carries the comment "a key written under
keyring_collection_label: opencharly will be readable by a subsequent findItemByAttrsAcrossCollections call
with the same setting", and createItem/deleteItem are used by the GPG keystore path
(secrets_gpg.go:637-641) — with zero callers on the credential-store path. This is a built, tested, documented
capability that was never connected.
Root fix. Route KeyringStore.Set/Delete through the same ssClient the reads use
(resolveTargetCollection + createItem(..., replace=true); findItemByAttrsAnyCollection + deleteItem),
map the locked/all-broken errors onto the existing KeyringLockedError, and drop go-keyring — after this it
has no caller in the plugin, and an unused dependency is the same class of residue as a dead shim.
5. The secrets skill states three things the store does not do
Measured against the code, on the same reading:
| skill claim | reality |
|---|---|
the env override is CHARLY_VNC_PASSWORD |
it is the bare VNC_PASSWORD (charly/check_endpoint_resolve.go:158,163); no CHARLY_-prefixed credential override exists (CHARLY_SECRET_BACKEND switches the backend, it is not a credential) |
auto-generated tokens are "32-byte hex via generateRandomHex(32)" |
base64url of 32 bytes = 44 chars, sdk/deploykit/secret_probe.go:54-60; no function named generateRandomHex exists anywhere in the tree |
charly secrets list reflects "the active store" |
it reflects the CONFIG FILE (shadow index + plaintext) whatever the backend — which is why finding 2 hides credentials from it |
Plus the missing prune verb and the collection-label half of finding 4 once they exist. R4 applies: the
product is fixed first (findings 1-4), then the prose. Editing the skill to describe today's pinning
behaviour would be documenting the defect.
Blast radius of the doc rows. Every operator who stores a credential under a charly/-prefixed env
override (a documented first-time-setup step) gets a value that ResolveCredential finds and charly secrets get does not, and the skill is where they learn the name to use.
Related, and NOT fixed here
- bed config: a secret_require with an explicit key: is not resolved from that coordinate (the default coordinate is required) sdk#526 — a bed's
secret_requirewith an explicitkey:is not resolved from that
coordinate. Different mechanism (the bed's overlay metadata loseskey:); this issue's findings make the
coordinate itself coherent but do not touch that path. - RCA: the admin password is ONE global secret key while its sibling secret is per-deploy — the documented lookup returns another deployment's value pod-openwebui#19 — one global admin-password key vs per-deploy siblings. Different mechanism
(key naming), untouched.
Fix plan — one cutover in this repo
fix(secrets): one composite-key split (parseCompositeKeylearns last-slash,knownServicePrefixes
deleted,collectCredentialNamescalls it) + a test on the two-segment namespace that fails today.fix(secrets):migrate-secretsmigrates, then one fresh read-modify-write deleting exactly the migrated
composite keys; a failed entry keeps its plaintext. Test asserts the index survives.feat(secrets):charly secrets prune [--dry-run], built on the read path's own iteration.feat(secrets):Set/DeletethroughresolveTargetCollection/createItem/deleteItem;go-keyring
removed with its last caller; description prose swept.docs(skill): the four rows above, plusprunein the quick reference.- Corpus leg in
opencharly/marketplace, producer-first after this lands and tags: bump the
plugin-secretspin and regenerate thebuild/secretsprojection.
Evidence provenance
Live: findings 1 (import + doctor), 2 (sandbox migration), 3 (prune rc=1), 4 (go-keyring source read +
the live keyring_collection_label read path), 5 (source read + live value lengths). Code-read, marked as
such: finding 2's failed-entry plaintext strip.
All throwaway credentials used for the measurements were deleted afterwards; the host's
~/.config/charly/config.yml differs from its pre-session state only by the removal of the probes.
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
Activity
aitrawog commentedon Nov 15, 2026
CLAIM — I am taking issue #9: the credential store's identity, index, and collection pinning.
Scope, one cutover in this repo:
PlaintextCredentialEntries, the doctor probe andcollectCredentialNames;migrate-secretssaving once from a fresh read-modify-write, deleting only the pairs that reached the keyring;charly secrets prune [--dry-run], the verb the drift message already names;Set/DeletethroughresolveTargetCollection+createItem/deleteItem(the primitives the GPG path already uses),go-keyringdropped with its last caller;secretsskill's four false rows, after the product is fixed (R4).Branch
feat/store-identity-and-indexin a session worktree off freshorigin/main. The corpus leg (opencharly/marketplace: pin bump + regeneratedbuild/secretsprojection) follows producer-first after this lands.Agent: charly
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
aitrawog commentedon Nov 15, 2026
STATUS — the cutover is open as #10 (head
554c11ba0ce55c5491a70f687ee915425027228f).Landed in the branch: one composite-key split (prefix table deleted,
collectCredentialNamescalls it);migrate-secretssaving once from a fresh read-modify-write and stripping only the pairs that reached thekeyring;
charly secrets prune [--dry-run];Set/DeletethroughresolveTargetCollection+createItem/deleteItemwithgo-keyringremoved and its three prose claims swept; and thesecretsskill's false rows.
Next: the
opencharly/marketplacecorpus leg (pin bump + regeneratedbuild/secretsprojection),producer-first after #10 merges and tags. Due immediately after the merge.
One correction to this issue's finding 4, measured after filing — the mechanism is narrower than I
wrote. go-keyring v0.2.8's Linux provider resolves ONE collection:
/org/freedesktop/secrets/collection/loginwhen it exists, else the
defaultalias path (keyring_unix.go:41-52,secret_service.go:97-103). It isnot "the login collection only", so on a host whose
logincollection is absent (like this one) writes anddeletes did land in
default— where reads also start — and no defect was observable there. The two realconsequences stand:
keyring_collection_labelwas ignored by every write and delete (the documented pinheld on reads only, which is exactly the multi-database case the key exists for), and a credential living in
any collection other than the one go-keyring resolves could not be deleted —
Deleteprinted success,dropped its index entry, and left the item in the store. The PR body and the fixed code carry the corrected
mechanism.
Agent: charly
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
fix(secrets): one credential identity, a truthful index, the promised…
aitrawog commentedon Nov 15, 2026
RESOLVED — landed as #10 (squash
7126737), taggedv2026.319.2321,CHANGELOG
2026.319.2321.All five findings are fixed in the tree, not deferred: the one composite-key split,
migrate-secretssaving once from a fresh read-modify-write (and keeping the plaintext of a failed write),
charly secrets prune [--dry-run],Set/Deletethrough the same ssClient asGetwithgo-keyringremoved, and the
secretsskill's false rows corrected after the product was.The corpus leg (bump the
plugin-secretspin inopencharly/marketplaceand regenerate thebuild/secretsprojection) follows producer-first now that the tag exists.Agent: charly
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)