Repository navigation
feat(transcript): single-user read policy for the owner's narrowed credentials - #315
Merged
Merged
Conversation
…edentials
On a single-user instance the owner's agent credentials were refused every
transcript whose visibility set holds `*` (owner-only), because the owner arm
of the content predicate requires an un-narrowed credential.
Add `transcript.Policy{SingleUser}` and `cairn-ui -transcript-single-user`
(off by default; flag only, no env spelling, like the other transcript flags;
refused without the worker listener). With it on, the CONTENT owner arm
(`Policy.readsOwn`, asked by `Store.View` and `Store.ViewsWithOutputs`)
admits any credential whose principal (Kind, ID) equals meta.Owner, narrowed
or not. Display names still never match.
The predicate is split: `Viewer.owns` stays the strict ownership arm and is
still what `Store.Mine`, `Store.OwnedBy` (plugin opt-out) and `Store.Delete`
ask, on every instance. `Visible` keeps its signature as the multi-user
predicate. Capture and derivation are untouched, so V is recorded as before
and turning the flag off restores the old answers with no migration.
Retargets five source-anchored mutants (control_mutants.py, plugins/e2e.sh)
to the new lines and adds two for the new branch.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
Author
|
Round 0 (requirements & deletion) for this PR. Verdict: requirement questioned (Q1), now answered by the operator below. Proceed to the checklist. Ledger: |
Round 1 of the audit: the help text said "set it only on an instance with exactly one user", but users stay isolated either way. What the flag actually widens is every narrowed credential the owner has issued, including write-only ones, and it applies to the session's recorded uploader rather than the current -worker-owner. Reword the flag help and the Policy comments to say that. No behaviour change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
Author
|
Round 1 (full nine-axis audit of 5c5ff87): no 🔴, so the ladder ends here.
The 🟡/🟢 fixes are wording only and are not re-audited, per the stop rule. |
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.
What
On a personal, single-user instance the owner's own agent credentials were refused every transcript whose visibility set
Vcontains*(owner-only). That happens through the cross-instance rule, store-wide read headers, F2 and legacy ledger stars, because the owner arm of the content predicate required an un-narrowed credential, and an agent credential is a narrowed credential of the owner.This adds an instance-level read policy, off by default:
transcript.Policy{SingleUser bool}, carried bytranscript.Store(NewStore(...).WithPolicy(p); the zero value is the existing multi-user behaviour).cairn-ui -transcript-single-user(bool flag, default false). Like the other transcript/worker flags it is flag only, no environment spelling. It is refused at startup without the worker listener, as-arm-transcript-captureis. When it is set, the startup line saystranscript reads SINGLE-USER.When it is on, the content owner arm (
Policy.readsOwn) admits any credential whose principal(Kind, ID)equalsmeta.Owner, narrowed or not. The(Kind, ID)-never-Displayrule still holds.Surfaces
Store.View(session page transcript section, raw-record view, agent read API on both listeners viaStore.Answer)Policy.Visible/Policy.readsOwnStore.ViewsWithOutputs(per-row plugin one-liner)Policy.Visible/Policy.readsOwnStore.Mine("My sessions" listing)Viewer.ownsStore.OwnedBy(session-level plugin opt-out, delete form visibility)Viewer.ownsStore.DeleteViewer.ownsStore.ForPlugin(s)(plugin reads)transcript.VisiblePolicy{}(multi-user)scopeuse,capture/route.go)The predicate is split:
Viewer.ownsstays the strict ownership arm. A newViewer.isUploaderholds the(Kind, ID)equality that both arms share. BecauseVis recorded exactly as before, turning the flag off restores the multi-user answers for every stored session, with no data migration.The 🔴 comments on
owns/readsOwn/reads/Visible/Store.View/Delete/OwnedBy/Mine, the agent-read and outputs comments ininternal/ui, andinternal/transcript/README.mdnow describe both policies.How to enable
Add
-transcript-single-userto thecairn-uiarguments, next to the six worker flags. Only do this on an instance that has exactly one user.Tests
New:
internal/transcript/singleuser_test.goandcmd/cairn-ui/singleuser_test.go, plus a refusal row in each ofTestTheWorkerFlagsAreAllOrNoneAndNeverBlankandTestTheBinaryRefusesEachWorkerMisconfiguration.Red/green matrix
origin/main, the new test file does not compile (Policy/WithPolicyundefined).readsOwnreturnsv.owns(meta)regardless of the setting, which ismain's semantics):TestSingleUserLetsTheOwnersNarrowedCredentialsReadEveryOwnedSessionis red, for examplesingle-user: owner-narrowed-alpha reading s-star-09 = false, want true(V ={*}) andsingle-user: owner-narrowed-nothing reading s-star-03 = false, want true(V ={alpha-notes (lacked), *}).TestSingleUserPolicyOnLiteralSetsandTestSingleUserWidensTheOutputRowsTooare red too.Pinned (literal expectations)
{*},{lacked, *},{held, *}and{}.OwnedBy,MineandDeletestill refuse the owner's narrowed credential, and the session survives the refused delete. The positive controls with the un-narrowed owner pass.transcriptReadSidecarries the flag into the Store, checked behaviourally against a{*}session. The binary announces it only when set and refuses it without the listener.Mutations (each red with the named assertion, restored and checksum-verified afterwards)
TestSingleUserLetsTheOwnersNarrowedCredentialsReadEveryOwnedSession(multi-user (default): owner-narrowed-alpha reading s-star-09 = true, want false),TestSingleUserPolicyOnLiteralSetssingle-user: ... want truerowsid-as-display-narrowed ... = true, want falseowner-id-project-kind-narrowed ... = true, want falseDeleteasks the read policyTestSingleUserLeavesOwnershipStrict(Delete(owner's narrowed credential) = true)OwnedByasks the read policyTestSingleUserLeavesOwnershipStrict(OwnedBy(...) = true)ViewsWithOutputskeeps the strict predicateTestSingleUserWidensTheOutputRowsTootranscriptReadSidedrops the flagTestTheReadSideCarriesTheSingleUserFlagtests/control_mutants.pyandtests/plugins/e2e.shanchor mutants on exact source lines. Five of those lines moved, so the mutants were retargeted with their meaning kept:transcript-section-without-predicate,transcript-narrowed-owner-arm,plugins-output-rendered-without-predicate,transcript-read-api-without-predicate, and e2ed/k. Two rows were added:transcript-single-user-setting-ignoredandtranscript-single-user-widens-delete. Every affected row was run with--onlyand each one reportedkilled. All 16 e2e sabotage anchors were checked to occur exactly once.Local runs were scoped:
go test ./internal/transcript/... ./cmd/cairn-ui/ ./internal/capture/passed. The full suite is left to CI.tests/leakscan.py: 0 findings at HEAD. As a positive control, a temporary line with a private IP and a hostname insingleuser_test.goproduced 2 findings (reachable-hostname,private-ip); after it was removed the result was 0 again.🤖 Generated with Claude Code