test(visibility): full suite green under RLS — sync paths, device-auth bridge, seed pool
Phase 5 (plan §7): the entire integration suite passes with the RLS policies live. The suite was the triage enumerator the plan predicted: - device_auth middleware: the THIRD identity bridge — KOReader/Kobo device-authenticated requests read media as the DEVICE OWNER (plan A9 called this path out; the flip was 404s on sync metadata). - conflicts/analytics/progress handlers: detached context.Background() reads threaded to the request context (the requesting user's identity) — 12+ sites; resolve helpers take ctx. - scanner: ScanFolders self-declares its configured admin identity (server maintenance, product-correct for any caller); generic job creation stamps the requesting admin. - harness: setup.DBPool and the sync-test pool declare rls.SeedIdentity at SESSION scope via BeforeAcquire — the pool never serves a second identity, so no A3 bleed; setup.DB falls back to the seed identity (NewSeedDB) for ungoverned-context calls; filter tests use seedExec for raw governed-table statements. - contract pin WIDENED (docs/contract_pins.md 2026-10-29): under RLS, item-scoped gates may answer 404 (row invisible — no existence leak) as well as 403 (Go-level checks on listings keep strict 403). - TestWorker_JobStatusTracking — the pre-existing red from the Phase 0 baseline — passes with the harness seed work; no product change.
This commit is contained in:
1 parent
bb2cc26e9d
commit
4d697f5fcf
7 files changed
+84
-38
No files matched your search
@@ -432,3 +432,14 @@ library_name`.
|
||||
partial (layout=dropdown on the same endpoint, HX-Request) instead
|
||||
of the retired innerHTML renderer in web/src/search.ts — same
|
||||
endpoint, same auth, content server-rendered.
|
||||
|
||||
## 2026-10-29 — RLS visibility: item-scoped gates may answer 404 as well as 403
|
||||
|
||||
With library visibility enforced by Postgres RLS (see
|
||||
database/schema/schema.sql), a hidden library's rows are INVISIBLE to
|
||||
the engine — item-scoped endpoints (chapters, tracks, download, detail)
|
||||
can no longer run their Go-level 403 gate because the row never arrives.
|
||||
Both answers are gated: 403 (Go-level explicit-library checks remain on
|
||||
listing endpoints) and 404 (row-level invisibility — no existence leak).
|
||||
Pins asserting 403 on item-scoped content endpoints widen to accept
|
||||
{403, 404}. Listing/scoped endpoints keep the strict 403 contract.
|
||||
Reference in new issue
Block a user