chore(issues): re-verify #ZBAC9D with code evidence and a measured exposure count - #2494
Conversation
Re-verified the orphaned-document republication hazard against main a633eb6. The row understated it. The retrieval path is closed at no layer: retrieval_owner_matches still resolves the public sentinel to `row_owner_id is null`, and public_corpus appears zero times across rag-candidate-sources, corpus-grounding, deep-memory, document-enrichment, owner-scope, clinical-search and query-privacy. The helper written to close the hazard, src/lib/documents/is-public-document.ts, has no production caller — it is exercised only by its own test, which pins the exact orphaned-row case. Only the REST document read is genuinely closed, via withOwnerReadScope. Append-only inbox request; the canonical ledger is untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_a294f250-96f2-45ac-a339-69ab28a6b3f3) |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 651e999152
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
#ZBAC9Dwith re-verified code evidence and a measured production exposure count, keeping it at P2.No product code, no migration, no schema change. The canonical ledger
docs/outstanding-issues.mdis untouched; these are immutable request files underdocs/outstanding-issues-inbox/, applied later by a serializednpm run issues:reconcile.Three request files, which is the inbox's designed retraction path rather than an edit: an initial update raising the row to P1, a
cancelretracting it, and the final update at P2. The cancelled request is retained for the audit trail and is dropped from the active set at reconcile time.The hazard
documents.owner_idisON DELETE SET NULLwhile a null owner independently means "public corpus", so deleting an auth user would silently republish that user's private documents.The code defect — real, and worse than the row previously recorded
The retrieval path is closed at no layer.
public.retrieval_owner_matchesresolves the public sentinel torow_owner_id is nullwith nopublic_corpuscondition, andpublic_corpusappears zero times acrosssrc/lib/rag/rag-candidate-sources.ts,corpus-grounding.ts,deep-memory.ts,document-enrichment.ts,owner-scope.ts,clinical-search.tsandquery-privacy.ts.The helper written for exactly this hazard is dead code.
src/lib/documents/is-public-document.tsrequiresowner_id === null && metadata.public_corpus === true, andtests/documents-is-public.test.ts:22pins the precise case ("Orphaned after user delete"→false). No production caller exists outside its own module and the barrel re-export. Same dead-contract shape as#A3AHCX.One path is genuinely closed: the REST document read, via
withOwnerReadScopeinsrc/lib/public-api-access.ts:116. The previous wording "the application read paths were closed" is true only of that path.The measured exposure — and why this stays P2
The owner approved a read-only count against production (
sjrfecxgysukkwxsowpy,GETonly):owner_idNOT NULL (privately owned)owner_idIS NULL (treated as public by retrieval)metadata.public_corpus = trueThe entire production corpus is deliberately published and no document is privately owned, so there is nothing for the mechanism to leak and its trigger — deleting an auth user who owns documents — cannot fire.
That is why the P1 escalation queued earlier in this PR is cancelled rather than kept. It was raised on the code evidence before the count was run, and the count does not support it.
The trigger condition matters more than the priority: this must be closed before the first privately-owned document exists in production, because from that moment the hazard is live, silent, and the helper that would catch it is dead.
A useful side effect of the measurement: because all 2851 documents carry the marker, adding the
public_corpuspredicate to the retrieval path should move zero rows, which makes the required eval-canary an unusually safe one.Verification
Documentation and ledger paperwork only. Code claims were checked by reading
origin/mainata633eb6e3. The counts came from four read-onlyGETrequests against the PostgREST endpoint, guarded by a script that refuses to run unless the project ref is exactlysjrfecxgysukkwxsowpy; no value of any secret was printed, and no write, migration, OpenAI or Railway access occurred.npx prettierreports the added files already formatted. No unit, build or browser check was run: this diff contains no executable code.npm run check:ledger-write-disciplinein CI is the gate that governs this path.🤖 Generated with Claude Code