Cross-backend fact-serving parity suite — the per-reference (cell-scoped)
read model over real HTTP.
Re-proves the D1 fact-access cases (docs/security.md § Fact Access Control)
against each backend's real auth resolution, twinning fuz_app's
server/serve_fact_route.ts and the Rust fuz_fact_serving routers:
- cell-scoped admit — anon reads a fact through a viewable (public)
referencing cell → 200 + bytes;
- cross-owner dedup does not leak — A's *private* reference to bytes that
B *also* publishes from a *public* cell stays 404 for everyone but A, even
though the identical bytes are world-readable via B's cell (one deduped
fact row; authz lives on the (cell, hash) edge, never unioned); - 404-mask — a missing cell and a viewable cell that doesn't reference
the hash both 404 (never 403, never "exists elsewhere"), and every masked
404 is bodyless, so its shape names no branch;
- unviewable cell hides its refs — for a private cell the caller can't
view, a hash it references and one it doesn't answer the same masked 404
(the view check runs first, so the work done is the same too — each
spine's own suite pins that order);
- hardening headers — a served fact carries `X-Content-Type-Options:
nosniff
, the default-src 'none'; sandbox CSP, and Cache-Control:
private, max-age=300`, whatever its content type; - bare-hash admin-only —
GET /api/facts/:hash is admin (keeper) only:
non-admin → 403, anonymous → 401 (gated on fact_serving_admin_hash too); - URL bound to hash — a row whose
external_url is a well-formed
file: URL naming another hash's file is a masked 404 on both routes,
refused before any disk read (each spine's unit suite proves the bytes
behind such a URL never serve); - missing disk file — a row whose
file: URL addresses its own hash but
whose file isn't on disk is a masked 404 (opened before any 200 commits;
needs a backend serving external facts from disk, not by X-Accel); - multi-actor fallthrough — a multi-actor caller resolves to a null
(anonymous) context on the (
acting-less) cell-scoped route, so it can't
read its own *private* fact there (admitted only by public cells). Opt-in
(needs the multi-actor setup); every spine resolves the acting actor at the
dispatcher's authorization phase from account-grain credentials, so the
multi-actor account is drivable on TS and Rust alike; - narrowed-token downgrade — a scope-narrowed API token on the
cell-scoped route is anonymous, not refused: its owner's private fact 404s
exactly as for an anonymous caller, while a public cell still serves.
Facts are seeded embedded via _testing_put_fact (the cross-process
driver has no DB handle), or as a bare external row through its
external_url; the referencing cell via the cell_create RPC
(the hash, a whole string value in data, is derived into cell.refs). A
non-admin owner's cell may reference only a fact it holds, so a fact a
non-admin references is put with that owner as its holder (the keeper is
a global admin, whom ref admission doesn't gate). Gated
on capabilities.fact_serving (the cell-gated route + the seeder), the
bare-hash cases on capabilities.fact_serving_admin_hash as well, so a
backend serving only the cell-gated route runs the rest; runs under every
cross_backend_* project — the TS spine binary and the Rust
testing_spine_stub both mount both routes + the seeder.