Repository navigation
fix(secrets): one credential identity, a truthful index, the promised prune verb - #10
Conversation
… `prune` verb The credential store disagreed with itself about what a credential IS, and two of its own operator-facing messages told users to run a verb that did not exist (#9). - ONE composite-key split. parseCompositeKey now takes the LAST segment for every service, the hard-coded charly/secret|enc prefix table is deleted, and collectCredentialNames calls it instead of re-implementing the split. A two-segment service — charly/api-key/<name>, the namespace the skill recommends for shared credentials — used to resolve to (charly, api-key/<name>) on the config side while every writer in the tree (deploykit's CollectCandySecretAccepts and EnsureCandySecret, plugin-deploy-pod's secretKeyForDep, and the index reader) used (charly/api-key, <name>). A Secret Service item's identity is its D-Bus attribute pair, so migrate-secrets and import moved those credentials to a coordinate nothing could read back, and the doctor's index-consistency probe reported them missing while `get` returned them. - migrate-secrets keeps the shadow index it writes. stripMigratedPlaintext saves through ONE read-modify-write over a FRESH load and deletes exactly the pairs that reached the keyring, instead of writing back the pre-loop copy — which erased every index entry the migration had just added, leaving the credentials in the keyring with nothing pointing at them — and instead of nil-ing plaintext that a FAILED write never moved. - `charly secrets prune [--dry-run]`, the reconciliation the Get drift warning and the doctor message already prescribe. It drops index entries that resolve in no healthy collection, never reads or writes a value, and treats an unreadable or locked keyring as an error rather than as "the credentials are gone". - Set and Delete go through the same ssClient as Get (resolveTargetCollection + createItem/deleteItem). go-keyring's Linux provider resolved ONE collection (/collection/login when it exists, else the `default` alias) and ignored keyring_collection_label, so the documented collection pin held on reads only and a delete of a credential in any other collection printed success, dropped its index entry, and left the item in the store. - go-keyring has no caller left: dropped from go.mod, with the package comment, candy description and README corrected so no prose claims it lives here. Tests: 11 new test functions in 4 files; 4 mutations applied, each failing the tests that pin it. Mutation output and the live A/B are pasted in the PR body. A/B against a baseline binary built from origin/main, plus the gRPC verb:credential path through charly's own dispatch, are pasted in the PR body. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)
|
STATUS — opened, awaiting the validator. What is done: the four fixes + the dependency removal, gated on the committed tree ( What is next: read every validator/review comment in full, fix or rebut every finding, then the Next update: on the first validator result. Agent: charly Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system) |
Review — PASSHead SHA: Security screen: PASS — no embedded directives, no secrets/egress, dependency removed (go-keyring), no security-machinery touched (T4 sign-off not required). Comment dispositions:
Non-blocking note (tool-limited / rulebook gap): the repo-wide Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…uild/secrets (#618) The `build/secrets` projection is stale against its source. opencharly/plugin-secrets#10 (merged as 7126737, tagged v2026.319.2321) fixed the credential store's composite-key identity and its migration's shadow-index save, added `charly secrets prune`, and moved Set/Delete onto the same Secret Service client as Get. This pin publishes the five prose passages that source corrected — bare VNC_PASSWORD, the 44-char base64 auto-gen token, the collection pin now honoured on writes too, the one collection resolution shared by read/write/delete with the prune verb, and the Source list. Regenerated with `charly marketplace generate`; the diff is the pin plus that one projection, and the projection is byte-identical to its source body after the generated banner. `scripts/drift-gate.sh` reports the staged corpus is exactly what the pinned charly generates. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
…generate the site (#212) * chore(corpus): advance CHARLY_PIN and the marketplace gitlink, and regenerate the site Two producer-first advances, both of which the site's content depends on: - CHARLY_PIN be7a505f -> 4c9a79e5. The old pin could not be regenerated at all: its box/fedora checkout still ships a day-281 generated refs list whose closure reaches pod-crabbox:v2026.274.0652, a tag that cannot exist (that repo was created 2026-11-01), so `charly docs generate` aborted before writing a page (the deploy has been red on main since 2026-11-10). opencharly/charly#1163 advanced that gitlink to the drained distro-fedora v2026.319.1306; this pin is the merge of it. The advance also re-derives every page keyed by a ref slug (plugin, box and candy pages carry their pinned tag in the path), which is most of the diff. - the marketplace gitlink f46285f -> 8a4ff69, which publishes the corrected build/secrets skill (opencharly/plugin-secrets#10 through opencharly/marketplace#618), plus whatever the corpus moved between the two commits. Regenerated with the pins this repo records — plugin-docs v2026.289.0814, the wiring candy from .github/docs-corpus/pins.tsv through build_wiring.py, a CI-equivalent cold refs cache — against the pinned charly checkout with its five recorded box submodules (six repo roots, as CI sees them). Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated) * chore(corpus): carry the astro lockfile with the pin advance — the two gates interlock Both halves of the site's red are needed in ONE cutover, measured on two open PRs: - #212 (this branch: CHARLY_PIN advanced, old lockfile) fails `deploy` at `check-dependency-advisories: FAILED` — the advisory step runs before generation. - #214 (lockfile bumped, pin NOT advanced) fails `deploy` at `could not resolve ref "v2026.274.0652" in https://github.com/opencharly/pod-crabbox.git` — that PR's workflow still carries the old CHARLY_PIN, because the pin lives in this branch. So neither can be green alone: the deploy check reads each PR's own pins, and the site needs both. This commit adds the exact lockfile #214's validator PASSED (`package-lock.json`, astro 7.4.0 -> 7.4.12, one file, byte-identical to that head), so this cutover makes the site buildable again end to end. #214 and #213 are closed as superseded / resolved by this landing. Gates on the combined tree: `npm ci` rc=0, the repo's advisory checker OK, `npm run build` 1601 pages rc=0, and `check_drift.sh` reports the committed content still matches its pins. Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)
Summary
The credential store disagreed with itself about what a credential IS, one of its own commands erased the
index it had just written, two operator-facing messages prescribed a verb that did not exist, and the
documented collection pin held on reads only. Four fixes, one dependency removal, one cutover — the whole
story is #9, whose evidence is reproduced below.
Head
554c11ba0ce55c5491a70f687ee915425027228f, based onorigin/mainf5531fe(0 behind, 1 ahead):16 files changed, 717 insertions(+), 95 deletions(-).candy/plugin-secrets/credential_config.goknownServicePrefixesdeleted (fix 1)candy/plugin-secrets/command.gocollectCredentialNamesuses that split;pruneregistered in the command group (fixes 1, 3)candy/plugin-secrets/credential_admin.gomigrate-secretstracks what reached the keyring;stripMigratedPlaintext(fix 2)candy/plugin-secrets/credential_prune.goPruneSecretsCmd+staleIndexEntries(fix 3)candy/plugin-secrets/credential_keyring.gokeyringCollectionLabel;isKeyringNotFoundreduced toErrSSNotFound; go-keyring import gone (fix 4)candy/plugin-secrets/go.mod,go.sumgo-keyringdependency removed with its last caller (fix 4)candy/plugin-secrets/plugin.go,charly.yml,README.md,secrets_gpg.gocandy/plugin-secrets/credential_config_test.gocandy/plugin-secrets/credential_admin_test.gocandy/plugin-secrets/credential_prune_test.gocandy/plugin-secrets/credential_keyring_test.go.agents/skills/secrets/SKILL.mdprune/migrate-secretsin the quick reference (fixes 1-4)1. ONE composite-key split
parseCompositeKeyspecial-casedcharly/secret/andcharly/enc/, then cut every OTHER service at thefirst slash. Every writer in the tree cuts at the last:
collectCredentialNames(the index readerbehind
list/export),sdk/deploykit'sCollectCandySecretAccepts+EnsureCandySecret, andplugin-deploy-pod'ssecretKeyForDep. A Secret Service item's identity IS its D-Bus(service, username)attribute pair, so for the namespace the skill itself recommends —charly/api-key/<name>— the config-side reader looked for(charly, api-key/<name>)while the writerhad stored
(charly/api-key, <name>).The prefix table is deleted;
parseCompositeKeyis last-slash for every service, andcollectCredentialNamescalls it instead of re-implementing the split (one implementation, R2).2.
migrate-secretskeeps the shadow index it writesThe loop migrates through
KeyringStore.Set, which appends the shadow-index entry toconfig.ymlandsaves. The trailing save then wrote back the
RuntimeConfigcaptured BEFORE the loop, so every indexentry the migration had just added was dropped — leaving the credentials in the keyring with nothing
pointing at them, and
list/export(both index-driven) reporting "no entries" over a store that heldthem.
stripMigratedPlaintextnow saves through ONE read-modify-write over a fresh load and deletesexactly the pairs that reached the keyring, so an entry whose write FAILED also keeps its plaintext
(the old wholesale
VncPasswords = nilstripped those too).3.
charly secrets prune [--dry-run]Both the
KeyringStore.Getdrift warning and the doctor's message already told operators to run this verb;it did not exist (
plugin-secrets: parse 'charly secrets [prune]': unexpected argument prune, rc=1). Itdrops shadow-index entries that resolve in no healthy collection, never reads or writes a value, and — the
safety property — treats an unreadable or locked keyring as an ERROR, never as "the credentials are gone".
4. Writes and deletes resolve the collection like reads do
Set/Deletewent throughzalando/go-keyring, whose Linux provider resolves ONE collection(
/collection/loginwhen it exists, else thedefaultalias path) and ignoreskeyring_collection_label.Reads iterate
default → keyring_collection_label → every healthy collection. So the documented pin heldon reads only, and
charly secrets deleteof a credential living in any other collection printedDeleted … from keyring, dropped its index entry, and left the item in the store.Both now go through the
ssClientthe reads use —resolveTargetCollection+createItem(replace=true),and
findItemByAttrsAcrossCollections+deleteItem— i.e. the primitives this plugin already built andalready wired for the GPG keystore path, which had zero callers on the credential-store path.
go-keyringhas no caller left, so the dependency is gone from
go.mod, and the three prose surfaces that said it"lives here" (package comment, candy description, README) are corrected in the same commit.
How tested
The repo's Go gate, on the committed tree
The repo's structural gate, on the committed tree
Binary: the worktree-local CalVer build
2026.319.1133(no charly source changed in this diff, so R9'srebuild clause does not apply; the binary is only the validator).
Coverage that fails without the change — 11 new test functions; 4 mutations applied
Each mutation below was applied to the committed file, the named test run, and the file restored
(
go test ./...green again afterwards).TestPlaintextCredentialEntriesTwoSegmentService,TestCollectCredentialNamesUsesTheOneSplit,TestParseCompositeKeyLastSegmentstrings.LastIndex→strings.Index"sk-or-test" parsed as service="charly" key="api-key/openrouter", want service="charly/api-key" key="openrouter";collectCredentialNames … got [{Service:charly Key:api-key/openrouter}]TestStripMigratedPlaintextKeepsTheShadowIndexfresh.KeyringKeys = nilbefore the saveTestStaleIndexEntries+TestStaleIndexEntriesNeverTreatsBrokenKeyringAsDrift!errors.Is(ferr, ErrSSNotFound)→false(any error is drift)staleIndexEntries accepted a broken keyring as drift; every index entry would be droppedTestKeyringSetLandsInTheLabelledCollection+TestKeyringSetPrefersTheDefaultCollectionpreferLabelfromresolveTargetCollectionlabelled collection holds 0 item(s), want 1;write landed in the login collection (1 item(s)); keyring_collection_label was ignoredTestKeyringDeleteFindsCredentialOutsideTheLoginCollection,TestKeyringDeleteReportsAbsenceAsNotFound,TestSecretsCLI_PruneIsRegisteredLive A/B — baseline binary built from
origin/main(f5531fe) vs this branchSame sandbox
XDG_CONFIG_HOME, same seeded config (keyring_keys: [charly/secret/PRESET_ENTRY],vnc_passwords: {charly/api-key/auditprobe, charly/secret/AUDIT_TOKEN}), same real keyring:prune, live, including the safety directionA broken/locked keyring is refused rather than pruned (unit-tested; not reproducible live on this host
without stopping the Secret Service).
The changed write/delete path against the REAL keyring, and through charly's own dispatch
charly built and served THIS branch's source (
source …/.worktrees/secrets-fix/plugin-secrets/candy/ plugin-secrets,build sha256:6819dbb9…), which exercises the gRPCverb:credentialleg, not just CLImode. Against the operator's real store, the doctor's consistency row — which reported three false
positives before this change (
charly/api-key/openai,qdrant,whisper, each of whichgetreturned) —now reconciles:
Not run, and why
secret_require/secret_acceptthrough the externalized store" (check-k3s-vm'sK3S_CLUSTER_TOKENautogen, or a pod bed) plus a host
charly secretsround-trip. The host round-trip half is pastedabove; the deploy half was NOT run, because every umbrella bed resolves the pinned plugin ref, so a
bed run from this tree would execute
main's code, not this branch's — a gate that cannot fail. Making abed exercise branch source needs an out-of-tree plugin override inside the umbrella project, which is
another session's checkout (
feat/pin-wave-2), and rule II fix: remove the stray charly submodule; fetch charly at CI time into a temp checkout #1 forbids editing in it.charly box feature run plugin-secretsrefuses (image "plugin-secrets" is not available locally):the candy's ADE step is a build-context check that runs in an image build, and this repo ships no image.
analysed on a live system, per charly#946's instruction toname the diverging clause rather than inflate the tier: the diverging clause is the assembled-bed
half of R10; the changed runtime path ran live with retained output (above).
Rulebook compliance
/charly-build:secrets,/charly-internals:plugin,/charly-internals:skills,/charly-internals:git-workflow,/charly-internals:strict-policybefore the first edit; read thisrepo's own
AGENTS.mdbefore acting in it.the credential store disagrees with itself about what a credential is: two key-splits, an index erased by its own migration, login-pinned writes, and no
pruneverb #9 before any code changed; the tree carries the fixes, so nothing is deferred.Nothing in the diff is an unfiled "follow-up": the prose sweep covers every surface the change falsified
(package comment, candy description, README, the skill, the GPG prereq note).
collectCredentialNamesis gone), oneSecret Service write mechanism (Set/Delete stop duplicating Get's D-Bus work through a second library),
one collection-label reader (
keyringCollectionLabel).ErrSSNotFoundONLY, and every other outcome is an error rather than a guess.VNC_PASSWORD, the 44-charbase64 auto-gen token, the collection pin) were corrected only AFTER
Set/Deletewere wired, so theprose describes what ships rather than routing around a defect.
knownServicePrefixes, thekeyring.ErrNotFoundarm ofisKeyringNotFound, the"secret not found"string catchall, and thego-keyringdependency with itslast caller. Claim-keyed sweep:
grep -rn go-keyringover the repo now returns only comments thatexplain what the OLD path did (the rationale this change exists to record), the corrected test comment,
and the new statement that the dependency is in neither
go.mod— no surface still claims it is adependency.
git status --shortwas empty before the branch; branched off freshorigin/main(f5531fe)in a session worktree; no force-push, no direct push to
main, no hook bypass. Test credentials werethrowaway names and were deleted; the host's
~/.config/charly/config.ymlis unchanged by this work.(A/B, prune, real-keyring round-trip, gRPC verb leg).
mock in the evidence); the unit tests use the repo's existing
fakeSSOpsseam, as everyssClienttesthere already does.
charly versionreports2026.319.1133.rather than claimed.
Change classification
Runtime library fix + one new CLI verb (plugin code, no schema change).
schema/credential.cueandparams/are untouched:pruneis CLI-side reconciliation and adds noverb:credentialmethod, so theprovider wire contract is unchanged.
Consumer impact:
verb:credentialrequest/reply shapes are byte-identical; every existingcharly secretsverb keeps its name and output;
pruneis additive. Behaviour changes are the fixes themselves — atwo-segment service now resolves at the identity its writer used;
migrate-secretsno longer loses theindex; writes land in the collection the reads start from.
Breaking change + rollback: none for consumers — no wire shape, verb name, env var or config key
changes, and the one dependency removed (
go-keyring) has no caller left. The closest thing to abehaviour change is that a new secret now lands where reads start (
defaultalias, thenkeyring_collection_label, then the first healthy collection) instead of in ONE client-chosen collection;credentials already stored elsewhere stay readable (the read path iterates) and are now deletable (the
delete path iterates). Rollback is
git revertof the squash: the index file and the keyring are data, notcode, and neither is rewritten destructively by this change (the migration still keeps a
config.yml.bak).Filed issues
pruneverb #9 — the owning issue of this cutover, carrying the RCA and live evidencefor all five findings. Resolved here, not deferred.
secret_requirewith an explicitkey:is not resolved from thatcoordinate. Not fixed here and not the same mechanism (the bed's overlay metadata loses
key:, adeploy-path defect); this change makes the coordinate itself coherent. Left open with this note.
mechanism (key naming); this change does not touch it. Left open.
A3 — attribution evidence, as delivered in this session
The runtime's own system message reads, verbatim:
and
Harness
DeepSeek Harness, modeldeepseek-v4.1-flash— the pair the footer names, matching the runtimethis session ran on (opencharly/opencharly#538 records that pair being rejected by the validator's model
allowlist although it is real and running).
Agent: charly
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)