Skip to content

docs(privacy): session-custody requirements checklist + gap analysis - #104

Open
myselfsiddharth wants to merge 1 commit into
mainfrom
track1/b5-session-custody
Open

docs(privacy): session-custody requirements checklist + gap analysis#104
myselfsiddharth wants to merge 1 commit into
mainfrom
track1/b5-session-custody

Conversation

@myselfsiddharth

Copy link
Copy Markdown
Contributor

Closes #37.

Summary

docs/privacy/session-custody.md restates PRD §7's Fork-A session-custody requirements as six checkable rows (SC-01..SC-06) and audits the code at HEAD against each — citing file:function for every "enforced" claim and verifying it, not assuming it, per the issue's core ask.

Id Requirement Status
SC-01 Encrypted at rest, per-tenant keys not addressed — no persistence mechanism exists at all yet
SC-02 Never written to trajectories enforced by construction (one residual bypass gap)
SC-03 Never written to logs conventional only — and empirically weaker than documented
SC-04 Excluded from compiler's input by construction enforced by construction
SC-05 Explicit consent language not addressed
SC-06 Documented ToS per anchor site not addressed, currently inapplicable (no vertical locked, Track 1 is self-hosted)

Notable findings

  • SC-02/SC-04 are genuinely solid. TrajectoryRecorder.toTrajectory() never serializes runtime bindings (only the type map), and additionalProperties: false closes every schema in the pipeline (trajectory → cache-row → assertion → metrics) — a cookie field isn't just unpopulated, it's invalid. Verified by walking the schemas directly, not by reading the doc comment.
  • SC-03 has a real, verified hole. CONTRIBUTING.md claims "Secret-scanning CI fails the build on matches" for session/storage dumps. I built a synthetic (fake-valued) fixture shaped exactly like a real Playwright storageState() dump and ran it against all eight of secret-scan.mjs's patterns: zero matched. The existing patterns look for Set-Cookie: text or a "sessionid"-named key — not the cookies: [{name, value, domain, httpOnly, sameSite}] array shape Playwright actually produces. No real session material was used or committed anywhere in this process.
  • The custody-vs-pooling distinction is stated explicitly, per the issue's ask: docs/privacy/boundary-spec.md's canary tests (verified by reading tests/canary/*.test.ts) seed fake account ids/names/thresholds and prove they don't reach the pool — that's a different boundary (cross-tenant leakage) with a different failure mode than custody (session material at rest anywhere, including tenant-scoped rows and logs).
  • Track-1 relevance stated plainly: the gate authenticates to a local, self-hosted Grafana container with fixture credentials the project provisions itself — no real customer session, no third party. SC-05/SC-06 become required the moment anything targets a real account or a portal this project doesn't own.

Follow-up issues filed (linked from the doc's table)

One-line fix taken inline

docs/architecture.md invariant 3 cited src/recorder/redact.ts:66-81 for assertNoLiteralSecrets; verified the function is actually at lines 102-117 at HEAD. Corrected, and bumped the doc's updated date.

Test plan

  • npm run secret-scan — clean (had to reword three spots in the new doc that literally contained the trigger substring Set-Cookie: while describing the existing pattern — confirmed the fix empirically before and after)
  • npm run test:canary — clean, confirms the canary still only tests the pooling boundary, not custody
  • npm run lint:docs — clean (46 docs)
  • npm run ci — clean (secret-scan, contracts, lint, typecheck, unit + integration)
  • No real session material anywhere in the diff or in the follow-up issues — only synthetic, disposed-of fixtures used to verify claims empirically

Checklist (from the issue)

  • Every PRD §7 requirement has a row and a status
  • Every "enforced" claim cites a file and function and was verified, not assumed
  • Custody vs pooling-allowlist distinction stated explicitly
  • Follow-up issues filed for each gap and linked from the table
  • No real session material anywhere in the diff
  • docs/README.md privacy table row added
  • Branch track1/b5-session-custody

🤖 Generated with Claude Code

…37)

Restates PRD §7's five Fork-A session-custody requirements as six checkable
SC-01..SC-06 rows (splitting "never written to logs or trajectories" since
the two have different enforcement today) and reads the code at HEAD
against each, citing file:function and verifying rather than assuming:

- SC-02 (trajectories) and SC-04 (compiler input) are enforced by
  construction: no code path reads cookies/storage in the first place, the
  recorder's own output-object construction never serializes runtime
  bindings, and additionalProperties:false closes every schema in the
  pipeline. One residual gap each, filed as follow-ups.
- SC-03 (logs) is conventional only, and empirically weaker than
  CONTRIBUTING.md's "secret-scanning CI fails the build on matches" claims:
  a synthetic Playwright storageState()-shaped fixture matched zero of
  secret-scan.mjs's eight patterns. Filed as #100.
- SC-01 (encryption at rest) and SC-05 (consent language) are not
  addressed — no persistence mechanism and no consent copy exist yet.
- SC-06 (ToS per anchor site) is not addressed and currently inapplicable:
  no vertical is locked (ADR-0004) and Track 1 is self-hosted by design
  (ADR-0003), so there is no third party's ToS in play yet.

Explicitly separates this from docs/privacy/boundary-spec.md's pooling
allowlist (different boundary, different failure mode, canary tests cover
only the first) and states Track-1's fixture-credential posture plainly.

Six follow-up issues filed and linked from the table (#98-#103). One
one-line fix taken inline: a stale redact.ts line citation in
architecture.md's invariant list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@myselfsiddharth
myselfsiddharth requested a review from a team as a code owner July 31, 2026 00:54
@github-actions github-actions Bot added the size/L <= 600 changed lines label Jul 31, 2026
@github-actions
github-actions Bot requested a review from OM152002 July 31, 2026 00:54
@github-actions github-actions Bot added documentation Improvements or additions to documentation privacy-boundary Touches the privacy boundary — canary is merge-blocking labels Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation privacy-boundary Touches the privacy boundary — canary is merge-blocking size/L <= 600 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session-custody requirements checklist + gap analysis (PRD §7)

1 participant