Cross-backend suite for the _testing_* backdoor actions: the backend's
declaration of which it mounts, and the credential gate on each.
TESTING_BACKDOOR_METHODS (_testing_reset, _testing_drain_effects,
_testing_mint_session, _testing_put_fact,
_testing_flood_notifications, _testing_schema_snapshot,
_testing_migration_tracker, _testing_action_manifest,
_testing_origin_check, _testing_shorten_credential_expiry) are
privileged test-binary actions the production
wire never exposes — direct DB writes (full auth wipe, forged session row,
raw fact insert), the audit barrier, a flood of the caller's own connection,
introspection reads (the live schema, the schema_version migration
tracker, and the live RPC registry — the highest info-leak of the set were
the gate to break), a probe of the origin allowlist parser, and a rewrite of
an account's credential expiries. Their only structural fence
is the daemon-token credential gate on
each spec's auth axis. A test binary live-mounts them on its RPC
endpoint (and, on fuz_app's spine binary and the Rust stub, its WS
endpoint) but keeps them off the declared surface — so the spec-derived
describe_rpc_attack_surface_tests never enumerates them. This suite fires
them with non-daemon credentials to prove the gate holds end-to-end, against
each impl's real auth resolution; a conformance table given the live mount
(live_rpc_endpoints) fires the same refusals through the auth rows
generate_rpc_auth_conformance_cases generates for them.
The declaration. A backend states which it mounts in
capabilities.testing_backdoors, and the suite holds it to that: each known
backdoor the declaration leaves out is sent anonymously and must answer
method_not_found (404) — both spines look a method up before they
authenticate the caller, so an unmounted method answers that whatever the
credential — and each declared one runs the rows below, whose anonymous row
(a 401, not method_not_found) proves it mounted. A wrong declaration fails
either way, so the suites that skip on an undeclared backdoor
(describe_spine_cross_suites) skip only what the backend truly lacks. The
check runs on every backend, one mounting none of them included.
For every declared backdoor, and each extra_methods seam (a consumer's own
daemon-token action), three principals:
- anonymous (no credential) →
401 (pre-authorization auth refuses an
account-less caller before anything else). - session (the keeper's browser-context cookie) →
403
credential_type_required — a session cookie, even one carrying the
keeper role, tops out below the daemon-token channel. - bearer (the keeper's api-token, non-browser context) →
403
credential_type_required — same ceiling; an api token cannot reach
keeper operations.
Over WebSocket (when ws is supplied), the same methods sent on a socket
opened with the keeper's session cookie answer the same forbidden
error with credential_type_required: the upgrade admits a session, but
each message runs the same per-action gates as HTTP RPC, so a socket is no
way around the daemon-token channel. Anonymous and bearer have no WS case —
an anonymous upgrade is refused before any message, and the upgrade client
threads cookies.
Each method is sent with valid params so each case varies only the
credential. (Validation runs after the gates — the order is 401 → authz →
403 → 429 → 400 — so the shapes are belt-and-suspenders here rather than load-
bearing.) The handler never runs (the gate refuses first), so the writes
never execute.
Complements the spec-level gate check (which pins that each spec *declares*
credential_types: ['daemon_token']) and the surface-absence invariant
(assert_no_testing_methods) — this one pins the runtime 401/403 behavior
on both impls. Cited property: security.md §Test Backdoor Actions
(daemon-token-gated, off-surface, DEV-excluded).
The credential rows run cross-process only — the _testing_* actions are
mounted on the spawned binary, not the in-process app — like the ws/sse
suites; there, wire from a *.cross.test.ts, whose setup fires
_testing_reset, so the backend must mount that one. In-process, an app
mounting none declares none, and the suite runs the declaration rows alone,
one per known backdoor. The WS cases run when ws is passed — for a
backend that also serves its backdoors on its WS endpoint.