scripts/avatar-e2e.sh read the DEV keys through `supabase status`, started the worker on the DEV network and let the suite write and purge on DEV. Port the V1-2 sandbox runner (`db-sandbox.sh avatar-e2e`: loopback gateway, worker in a 600 env file) and the guarded suite (fixed URL, container and key issuer, per-run accounts); refusals and the positive run proven under strace in .claude/audits/2026-11-02-avatar-e2e-sandbox-only.md.
9.6 KiB
Audit log — pnpm e2e:avatar on develop reaches the sandbox only (2026-11-02)
Branch bugfix/avatar-e2e-sandbox-only (off develop 6287e5b). Contract
.claude/tasks/contracts/2026-11-02-avatar-e2e-sandbox-only-0240.md, plan
.claude/tasks/plans/2026-11-02-avatar-e2e-sandbox-only-0215.md (revision 3).
Every live command below was run by the orchestrator, from the bugfix worktree by
absolute path (W=…/scratchpad/bugfix-avatar), never through a bare pnpm, never
from the main checkout (which still holds the old DEV runner). Raw traces and outputs
stay in the session scratchpad (…/scratchpad/proofs/), not in the repository.
Pre-flight (read-only)
- Docker: context
default, endpointunix:///run/user/1000/docker.sock,DOCKER_HOSTset to that same socket. Nodocker contextpointing elsewhere. - Proxy variables (
HTTP_PROXY,HTTPS_PROXY,ALL_PROXY,NO_PROXY, their lower-case forms,NODE_USE_ENV_PROXY,npm_config_proxy,npm_config_https_proxy,GLOBAL_AGENT_HTTP_PROXY): none set in the shell; every proof below also unsets them explicitly (env -u …). scripts/avatar-e2e.shabsent in$W;package.jsonalias =bash scripts/db-sandbox.sh avatar-e2e.- Old DEV runner container
faunosteo_worker_e2e: absent. - DEV containers
supabase_*_faunosteo(8), allrunning,StartedAt2026-10-28T14:45:28/29Z (recorded before; identical after every proof, see "After"). - Sandbox before: the V1-2 session's stack (db 57432, auth 57999, rest 57300, storage 57500,
mail 57025, all on 127.0.0.1, no gateway, no worker), network
faunosteo_dbsandbox_net(bridge, 5 containers), no Docker volume namedfaunosteo_dbsandbox*. - Shared image
faunosteo_worker:devbefore:sha256:b32319b9…(V1-2 build of 2026-11-01 22:59). - No concurrent
db-sandbox,vitestorplaywrightprocess.
Static criteria (contract 1-4, 8)
| # | Oracle | Result |
|---|---|---|
| 1 | runner deleted, no line invokes it (the two "removed" mentions excluded) | DEV_RUNNER_GONE |
| 2 | alias, bash -n, dispatcher line |
ALIAS_OK |
| 3 | suite cmp-identical to V1-2; db-sandbox.sh blocks 47-52, 58-61, 255, 270-332, 342-359 verbatim; no cmd_verify_e2e / cmd_sheet_assets_e2e |
BLOCKS_IDENTICAL |
| 4 | no supabase status, 54321, supabase_kong, supabase_db_faunosteo, supabase_network_faunosteo in the runner or the suite |
NO_DEV_IDS |
| 8 | corepack pnpm -s typecheck && lint in $W (after pnpm wasm:build, the git-ignored packages/core-wasm/pkg being absent in a fresh worktree) |
STATIC_GREEN |
Refusal proofs (strace -f -e trace=connect,sendto,sendmsg, child processes followed)
Positive control: the same filter on curl http://127.0.0.1:9/ shows 1 AF_INET connect.
Keys in c, d, e, h, i are forged unsigned JWTs (base64url(header).base64url(payload).x),
never the sandbox secrets, never DEV keys. Criterion: no AF_INET / AF_INET6 line unless stated.
| Case | Setup | Result | AF_INET lines |
|---|---|---|---|
| a | bash $W/scripts/db-sandbox.sh avatar-e2e, FAUNOSTEO_SANDBOX_DIR = empty dir |
db-sandbox: not running (pnpm db:sandbox up fresh), rc 1, no container, dir still empty |
0 |
| b | the suite (vitest binary, vitest.e2e.config.ts), no environment |
throws avatar e2e: run it through pnpm e2e:avatar, on the sandbox stack only, rc 1 |
0 |
| c | SUPABASE_URL=http://127.0.0.1:54321, AVATAR_E2E_DB_CONTAINER=supabase_db_faunosteo, two keys iss: supabase-demo |
throws (same message) | 0 |
| d | sandbox URL, keys iss: db-sandbox, container supabase_db_faunosteo |
throws | 0 |
| e | sandbox URL and container, anon key whose payload is not JSON | throws | 0 |
| i | sandbox URL and container, anon iss: db-sandbox + service iss: supabase-demo, then the swap (i1, i2) |
throws, both orders | 0, 0 |
| h | nothing listening on 57800 (ss -ltn: 0), sandbox URL and container, two forged iss: db-sandbox keys |
the guard passes; beforeAll fails on createUser: fetch failed (the refused connect), 5 tests skipped, rc 1 |
1: connect(127.0.0.1:57800) |
| f | sandbox up, image present, 127.0.0.1:57800 held by python3 -I -m http.server |
db-sandbox: port 127.0.0.1:57800 is already in use: free it, nothing was started, rc 1, no gateway, no worker, no worker.* env file |
1: the /dev/tcp probe connect(127.0.0.1:57800) = 0 (the exception accepted by the owner) |
Reading of h (brief §3): the issuer check routes the run to the sandbox, it is not a signature check and not an authentication: whoever holds 127.0.0.1:57800 receives the keys the environment supplies. Nothing else is contacted.
Setup and positive run
corepack pnpm --dir $W worker:image:faunosteo_worker:devnowsha256:d841660a…(develop's crates; cached build dated 2026-11-01 01:38). The V1-2 buildb32319b9…is no longer listed: the V1-2 session rebuilds it before its next worker run.bash $W/scripts/db-sandbox.sh down(identity checked first: 5faunosteo_dbsandbox_*containers onfaunosteo_dbsandbox_net, no volume, no concurrent process), thenup freshfrom the branch: develop migrations and seeds, no key in the output.- Positive run, once, under strace, with hostile exports in the environment:
SUPABASE_URL=http://127.0.0.1:54321, forgediss: supabase-demokeys,AVATAR_E2E_DB_CONTAINER=supabase_db_faunosteo,SUPABASE_NETWORK=supabase_network_faunosteo,SUPABASE_INTERNAL_URL=http://supabase_kong_faunosteo:8000,WORKER_IMAGE=faunosteo_worker:local(the old runner's knobs), proxies unset →bash $W/scripts/db-sandbox.sh avatar-e2e: 5/5 passed (15 s), rc 0,== worker up (faunosteo_worker:dev, run, via faunosteo_dbsandbox_gateway). - strace of the run: 4
AF_INETconnects, all127.0.0.1:57800(1 probeECONNREFUSEDbefore the gateway existed, 3 from the suite); 0 to:54321/:54322/ a LAN address; 0AF_INET6. - Watcher during the run (filtered templates only, never a raw
docker inspect):docker port faunosteo_dbsandbox_gateway 8000/tcp=127.0.0.1:57800; gateway and worker networks =faunosteo_dbsandbox_netonly; workerSUPABASE_URL=http://faunosteo_dbsandbox_gateway:8000; worker env names =PATH SSL_CERT_FILE SUPABASE_SERVICE_ROLE_KEY SUPABASE_URL WORKER_ID WORKER_POLL_SECONDS WORKER_QUARANTINE_GRACE_SECONDS WORKER_SWEEP_SECONDS; imagefaunosteo_worker:dev=d841660a…; usernonroot, read-only rootfs,CapDrop=[ALL], no published port. - Worker log events:
worker_start1,job_completed3,job_rejected3,child_rejected3,sweep_done4,token_expires_soon1 (the sandbox key's lifetime); no DEV name, no key (eyJcount 0 in every output).
After
- Gateway and avatar worker removed by the EXIT trap; no
worker.*env file left in the state dir. - Final
bash $W/scripts/db-sandbox.sh down: 0faunosteo_dbsandbox_*container; the state dir keeps onlyrehearsal/andupgrade-base/(pre-existing). - DEV containers: same 8
StartedAtvalues as before. No HTTP request to DEV at any point (no connect to 54321/54322 in any trace).
What the isolation rests on (not the issuer check)
- The worker's target is fixed to
http://faunosteo_dbsandbox_gateway:8000in a 600 env file removed once the container started (scripts/db-sandbox.shstart_worker); the worker's HTTP client setsmax_redirects(0)andproxy(None)(crates/worker/src/http.rs:31,33). - The gateway's upstreams are the sandbox containers by name;
location / { return 404; }; published on127.0.0.1:57800only, checked after start (docker port). - The sandbox keys are signed with a secret DEV does not hold; the suite builds its clients on the
constant
http://127.0.0.1:57800, never on the env URL;psqlon the constant container. scripts/dev-env.sh:23exportsFAUNOSTEO_DEV_API_URLinto every child of db-sandbox.sh; nothing in the runner or the suite reads it.NETis a plain bridge (it can route to the host): the proofs above show nothing uses that route.
Residual LOW (owner brief §3; no code change here, to fix on V1-2 first then port)
- The suite's supabase-js clients use Node's global fetch: default
redirect: follow; a proxy would be honoured only withNODE_USE_ENV_PROXY=1(unset here, unset by every proof). No endpoint of the gateway or its upstreams redirects today; a redirect to a foreign host would appear in strace as a connect outside 127.0.0.1:57800 (none). Security gate nuance: on a cross-origin redirect undici dropsAuthorizationbut keeps supabase-js'sapikeyheader, so a redirecting sandbox upstream would carry the sandbox anon or service key to the target; that key opens nothing on DEV (different JWT secret). Hardening when ported from V1-2: a custom fetch withredirect: 'error'in the suite's two client factories. worker_envis read by the EXIT trap beforestart_workerassigns it (an inherited value would berm -f'd on an earlydie).- Every docker call follows
DOCKER_HOST/ the current context (both local here). SB_SEED_PW/ rotated seed password not ported (develop's sandbox suite signs in with the seed password); the avatar suite itself creates its two accounts with a random password.
Hand-off
- V1-2 session: rebuild
faunosteo_worker:dev(pnpm worker:imagein its worktree) and runpnpm db:sandbox up freshbefore its next sandbox run (the develop secrets file carries noSB_SEED_PW; V1-2'sload_secretsrefuses it: fails closed). - Copies that still reach DEV through
pnpm e2e:avatar: the main checkout/home/bchanot/Documents/faunosteo(feature/v1-1-clients-animals, merged) and the worktreeold-958228a. Agents never run them; their fate is the owner's call.