Skip to content

feat(transcript): single-user read policy for the owner's narrowed credentials - #315

Merged
ZacxDev merged 2 commits into
mainfrom
feat/single-user-transcript-visibility
Nov 12, 2026
Merged

ZacxDev merged 2 commits into
mainfrom
feat/single-user-transcript-visibility

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Nov 12, 2026

Copy link
Copy Markdown
Owner

What

On a personal, single-user instance the owner's own agent credentials were refused every transcript whose visibility set V contains * (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 by transcript.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-capture is. When it is set, the startup line says transcript reads SINGLE-USER.

When it is on, the content owner arm (Policy.readsOwn) admits any credential whose principal (Kind, ID) equals meta.Owner, narrowed or not. The (Kind, ID)-never-Display rule still holds.

Surfaces

Surface Asks Changed?
Store.View (session page transcript section, raw-record view, agent read API on both listeners via Store.Answer) Policy.Visible / Policy.readsOwn yes, under the setting only
Store.ViewsWithOutputs (per-row plugin one-liner) Policy.Visible / Policy.readsOwn yes, under the setting only
Store.Mine ("My sessions" listing) Viewer.owns no
Store.OwnedBy (session-level plugin opt-out, delete form visibility) Viewer.owns no
Store.Delete Viewer.owns no
Store.ForPlugin(s) (plugin reads) the toggle fold, no viewer arm no
package-level transcript.Visible Policy{} (multi-user) no
capture / derivation (scopeuse, capture/route.go) n/a not touched

The predicate is split: Viewer.owns stays the strict ownership arm. A new Viewer.isUploader holds the (Kind, ID) equality that both arms share. Because V is 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 in internal/ui, and internal/transcript/README.md now describe both policies.

How to enable

Add -transcript-single-user to the cairn-ui arguments, next to the six worker flags. Only do this on an instance that has exactly one user.

Tests

New: internal/transcript/singleuser_test.go and cmd/cairn-ui/singleuser_test.go, plus a refusal row in each of TestTheWorkerFlagsAreAllOrNoneAndNeverBlank and TestTheBinaryRefusesEachWorkerMisconfiguration.

Red/green matrix

  • At origin/main, the new test file does not compile (Policy / WithPolicy undefined).
  • Behaviour reverted (readsOwn returns v.owns(meta) regardless of the setting, which is main's semantics): TestSingleUserLetsTheOwnersNarrowedCredentialsReadEveryOwnedSession is red, for example single-user: owner-narrowed-alpha reading s-star-09 = false, want true (V = {*}) and single-user: owner-narrowed-nothing reading s-star-03 = false, want true (V = {alpha-notes (lacked), *}). TestSingleUserPolicyOnLiteralSets and TestSingleUserWidensTheOutputRowsToo are red too.
  • At HEAD: green.

Pinned (literal expectations)

  • Setting OFF: the same narrowed owner credentials are refused {*}, {lacked, *}, {held, *} and {}.
  • Setting ON: refused for a narrowed credential of a different principal, for a principal whose Display equals the owner's Display (different ID), for a principal whose Display is the owner's ID, and for the owner's ID under another Kind.
  • Setting ON: OwnedBy, Mine and Delete still refuse the owner's narrowed credential, and the session survives the refused delete. The positive controls with the un-narrowed owner pass.
  • cmd/cairn-ui: transcriptReadSide carries 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)

Mutant Killed by
setting check deleted (relaxed arm always on) TestSingleUserLetsTheOwnersNarrowedCredentialsReadEveryOwnedSession (multi-user (default): owner-narrowed-alpha reading s-star-09 = true, want false), TestSingleUserPolicyOnLiteralSets
setting ignored (strict always) same tests, the single-user: ... want true rows
single-user arm also accepts Display id-as-display-narrowed ... = true, want false
single-user arm ignores Kind owner-id-project-kind-narrowed ... = true, want false
Delete asks the read policy TestSingleUserLeavesOwnershipStrict (Delete(owner's narrowed credential) = true)
OwnedBy asks the read policy TestSingleUserLeavesOwnershipStrict (OwnedBy(...) = true)
ViewsWithOutputs keeps the strict predicate TestSingleUserWidensTheOutputRowsToo
transcriptReadSide drops the flag TestTheReadSideCarriesTheSingleUserFlag
no-listener refusal removed both refusal rows

tests/control_mutants.py and tests/plugins/e2e.sh anchor 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 e2e d / k. Two rows were added: transcript-single-user-setting-ignored and transcript-single-user-widens-delete. Every affected row was run with --only and each one reported killed. 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 in singleuser_test.go produced 2 findings (reachable-hostname, private-ip); after it was removed the result was 0 again.

🤖 Generated with Claude Code

…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>
@ZacxDev

ZacxDev commented Nov 12, 2026

Copy link
Copy Markdown
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 0 · requirements: 7 (unattributed: 5) · deletion candidates: 2

D1 — the -transcript-single-user no-listener startup refusal (cmd/cairn-ui/worker.go) and its two refusal test rows: without the listener the Store is nil, so the flag is already inert
D2 — package-level transcript.Visible (internal/transcript/visible.go): no production caller remains, only visible_test.go
Q1 — With the flag on, every narrowed credential on the owner principal (including integration credentials and a write-only one) reads EVERY owner transcript regardless of its scope and verb narrowing; is that intended, or should only some of the owner's credentials pass? · forcing: user
Q1=answered: intended — on a single-user instance every credential the owner issued may read every transcript the owner uploaded, regardless of scope or verb narrowing; ownership and delete surfaces stay strict

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>
@ZacxDev

ZacxDev commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Round 1 (full nine-axis audit of 5c5ff87): no 🔴, so the ladder ends here.

  • 🟡1: a narrowed credential with no read verb (write-only) reads every owned transcript in single-user mode. This is accepted by the operator decision on Q1 (every credential the owner issued is trusted with every owner transcript). It is now stated in the flag help and the Policy comments.
  • 🟡2: the help text pointed at the user count rather than at the real trust boundary, which is every narrowed credential the owner has issued. Reworded in e739f49.
  • 🟢3: the help text said -worker-owner, but the code matches the session's recorded uploader. Reworded in e739f49.

The 🟡/🟢 fixes are wording only and are not re-audited, per the stop rule.

1. flag help for -transcript-single-user now states that verb narrowing is ignored (write-only tokens read) and that the uploader, not the current -worker-owner, is matched
2. Policy.SingleUser and readsOwn comments now state the same trust boundary and cite the Q1 decision

@ZacxDev
ZacxDev marked this pull request as ready for review November 12, 2026 14:48
@ZacxDev
ZacxDev merged commit 6ba00c5 into main Nov 12, 2026
29 checks passed
@ZacxDev
ZacxDev deleted the feat/single-user-transcript-visibility branch November 12, 2026 14:48
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