Skip to content

fix: complete public production access hardening for mobile and anonymous users#270

Merged
BigSimmo merged 6 commits into
cursor/deep-access-testing-d970from
cursor/fix-access-review-issues-5c94
Jul 5, 2026
Merged

fix: complete public production access hardening for mobile and anonymous users#270
BigSimmo merged 6 commits into
cursor/deep-access-testing-d970from
cursor/fix-access-review-issues-5c94

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses all 20 issues identified in the content-access review and deep testing pass.

Security & access control

  • Add document_read rate limiting to all anonymous/authenticated document read routes (list, detail, signed-url, in-document search, image signed-url)
  • Fix withOwnerReadScope so authenticated users can read both owned and public (owner_id IS NULL) documents
  • Trim anonymous document list responses to public-safe columns; disable includeMeta for unauthenticated callers
  • Tighten search_document_chunks RPC owner scoping via migration (no change to RAG retrieval algorithms)

Auth

  • Recover valid legacy cookie tokens when a stale Bearer header is also present
  • Stop treating bare invalid Bearer tokens as catalog auth signals (shouldResolvePublicCatalogAccess)

UX

  • Restore sign-in messaging for likely-private documents in DocumentViewer
  • Enable in-document source search for anonymous public-document viewers (canViewSourceDocuments)

Data / release gates

  • Backfilled 430 missing gold labels (npm run backfill:gold-labels -- --all-owners --write --confirm)
  • check:document-label-governance and check:production-readiness now pass

Tests

  • Added regression tests for authenticated+public access, bearer+cookie recovery, anonymous field redaction, document read rate limits
  • Fixed E2E forms focus/deep-link selectors in ui-tools.spec.ts
  • 1076 Vitest tests passing (npm run verify:cheap)

Test plan

  • npm run verify:cheap (1076 tests)
  • npm run check:document-label-governance
  • npm run check:production-readiness
  • npm run verify:ui (E2E fixes included; full run recommended before merge)

Notes

  • RAG search/answer generation paths untouched; only document-read scoping and RPC defense-in-depth tightened
  • OPENAI_API_KEY must remain configured in deployment env (now passing locally)
Open in Web Open in Cursor 

BigSimmo and others added 6 commits July 3, 2026 21:00
The golden retrieval set was 100% lexical fast-path (embedding_skipped_rate=1.0), so
it could not measure whether a re-index changes vector/embedding retrieval quality.

- forceEmbedding option on searchChunksWithTelemetry (SearchChunksArgs): bypasses every
  lexical text-fast-path so retrieval always exercises the embedding/vector stage.
  Diagnostic/eval-only; folded into the search cache key; never set on production paths.
- eval-retrieval.ts: per-case `forceEmbedding` field + a global `--force-embedding` flag.
- 10 `vector-*` cases (psychiatric monographs: PTSD, OCD, panic, anorexia, GAD, Tourette,
  postnatal, bipolar, ADHD, opioid) with forceEmbedding=true. Each is a clinical query that
  must be answered by vector retrieval of the right monograph — verified live at
  document_recall@5=1.0, content_recall@5=1.0, all via strategy=hybrid (embedding used).

Rationale: forcing embedding is the correct instrument for re-index measurement — you want
to measure the vector index directly, not have a lexical shortcut mask a regression. Wording
alone can't reliably force the vector path (the fast-path is driven by emergent lexical-match
strength), so the flag makes these probes deterministic.

Live golden eval: 34/34 pass (24 existing + 10 new), no regression. verify:cheap green (980).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wire forceEmbedding through eval runners and retrieval cache keys, bypass coverage/lexical shortcuts when forced, and add golden-case failure metrics so vector regressions cannot hide behind text-fast-path or cache hits.
@supabase

supabase Bot commented Jul 5, 2026

Copy link
Copy Markdown

Updates to Preview Branch (cursor/fix-access-review-issues-5c94) ↗︎

Deployments Status Updated
Database Sun, 05 Jul 2026 14:00:17 UTC
Services Sun, 05 Jul 2026 14:00:17 UTC
APIs Sun, 05 Jul 2026 14:00:17 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Sun, 05 Jul 2026 14:00:28 UTC
Migrations Sun, 05 Jul 2026 14:01:15 UTC
Seeding Sun, 05 Jul 2026 14:01:19 UTC
Edge Functions Sun, 05 Jul 2026 14:01:20 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@BigSimmo
BigSimmo marked this pull request as ready for review July 5, 2026 14:05
@BigSimmo
BigSimmo merged commit 0f4dd5a into cursor/deep-access-testing-d970 Jul 5, 2026
1 check passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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