# CONTRACT — avatar-e2e-sandbox-only - date: 2026-11-02 | flow: bugfix | branch: bugfix/avatar-e2e-sandbox-only (off develop 6287e5b) - status: active - worktree: /tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar - reference worktree (V1-2 a15c35c): /tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2 - plan: .claude/tasks/plans/2026-11-02-avatar-e2e-sandbox-only-0215.md (revision 3) ## REQUEST (verbatim — IMMUTABLE) Owner brief « Suite incident DEV et préparation de la validation graphique V1-2.4 » (2026-11-02), §1 and §3: > ## 1. Nouveau bugfix urgent sur develop : e2e:avatar > > Je t'autorise à créer une branche `bugfix/*` dédiée depuis `develop`, dans un worktree sûr, afin de neutraliser l'ancien `pnpm e2e:avatar` qui peut encore écrire dans DEV. > > Appliquer la même approche prudente que pour `sheet-assets` : > > - Préférer un portage minimal du runner sûr déjà développé dans V1-2 si toutes ses dépendances sont disponibles. > - Sinon, remplacer le point d'entrée par un refus explicite sans effet de bord. > - Aucun accès automatique à DEV, ni lecture ni écriture. > - Aucune récupération implicite des clés par `supabase status`. > - Aucun repli sur les URL, bases, comptes ou buckets DEV. > - Refus avant toute connexion en cas de configuration absente ou invalide. > - Tests des refus avec preuve d'absence de connexion IP. > - Revue de sécurité indépendante ciblée. > > Après réussite de ces vérifications, je t'autorise à fusionner uniquement ce bugfix dans `develop`, selon Gitflow. > > Ne fusionne pas la branche V1-2. > > ## 3. Limites de sécurité du runner > > Conserver le suivi des LOW signalés. > > Le contrôle de l'émetteur d'un JWT n'équivaut pas à une vérification de signature. Ne le présenter ni comme une authentification cryptographique complète ni comme l'unique protection. > > La restriction stricte de destination et l'isolation du bac à sable restent obligatoires. > > Vérifier que les redirections, les variables héritées et les configurations ambiguës ne permettent pas de sortir du bac à sable. Skill invocation: « develop: neutraliser `pnpm e2e:avatar` (scripts/avatar-e2e.sh lit les clés DEV via supabase status, démarre le worker sur le réseau DEV, écrit et accélère les purges). Porter le runner sûr de V1-2 (db-sandbox avatar-e2e + garde dans la suite) ou refus explicite. Branche bugfix/* depuis develop dans un worktree sûr, aucun accès DEV, refus prouvés sans connexion IP, revue sécurité indépendante, puis merge dans develop (autorisé par le propriétaire). » ## CLARIFICATIONS Q: port `cmd_sheet_assets_e2e` too (same gateway), so `pnpm e2e:sheet-assets` works on develop? / A: no, avatar only [gated 2026-11-02] Q (challengers): the port cannot make the later V1-2 → develop merge conflict-free in db-sandbox.sh / A: accepted, expectations and rule written in the plan ("take V1-2's file whole") [gated 2026-11-02] Q (owner, checkpoint 2026-11-02): close the redirect LOW before the merge / A: the suite's two client factories pass `global: { fetch: noRedirectFetch }` (`redirect: 'error'`, tests/e2e/noRedirectFetch.ts), a regression test with a real 302 in `pnpm --filter @faunosteo/supabase test:run`, live proof j; the suite file therefore differs from V1-2 by those lines only (V1-2 gets the same change at integration) [gated 2026-11-02] Q (executor): the plan's CLAUDE.md:490 and SUPABASE.md §6 wording names `scripts/avatar-e2e.sh` as removed, criterion 1 said "nothing names it" / A: criterion 1 narrowed to "nothing invokes it", lines containing `removed` or `the DEV script` (the SUPABASE.md note wraps before `removed`) excluded from the oracle (same wording as V1-2) [gated 2026-11-02, internal] Q (challengers): proof f (port taken) contains one loopback connect by construction / A: criterion for f = the only AF_INET connect is 127.0.0.1:57800; flagged to the owner [gated 2026-11-02] ## ACCEPTANCE CRITERIA 1. The DEV runner is gone: `scripts/avatar-e2e.sh` no longer exists and nothing in the tree invokes or documents it as runnable; the only remaining mentions say it was removed (CLAUDE.md workflow line, SUPABASE.md §6 note, the V1-2 wording). CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; test ! -e "$W/scripts/avatar-e2e.sh" && ! git -C "$W" grep -n "avatar-e2e\.sh" -- . ':!.claude' | grep -v -i -E 'removed|the DEV script' | grep -q . && echo DEV_RUNNER_GONE EXPECT: DEV_RUNNER_GONE EVIDENCE: MET exit=0 marker-found :: DEV_RUNNER_GONE 2. `pnpm e2e:avatar` is the sandbox alias and the runner dispatches it; the script parses. CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; grep -qF '"e2e:avatar": "bash scripts/db-sandbox.sh avatar-e2e"' "$W/package.json" && bash -n "$W/scripts/db-sandbox.sh" && grep -qF 'avatar-e2e) shift; cmd_avatar_e2e "$@" ;;' "$W/scripts/db-sandbox.sh" && echo ALIAS_OK EXPECT: ALIAS_OK EVIDENCE: MET exit=0 marker-found :: ALIAS_OK 3. The ported blocks are the V1-2 bytes: the suite file is identical to V1-2's once the lines naming `noRedirectFetch` are dropped (the import and the two `global: { fetch: noRedirectFetch }` options, owner-gated); db-sandbox.sh contains V1-2 a15c35c lines 47-52 (variables), 58-61 (REPO check), 255 (down), 270-332 (gateway and worker helpers) and 342-359 (`cmd_avatar_e2e`) verbatim, and does NOT contain `cmd_verify_e2e` nor `cmd_sheet_assets_e2e`. CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; V=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/e641af9a-743e-46d0-9804-99667836040e/scratchpad/v1-2; python3 -I -c 'import sys; a=[l for l in open(sys.argv[1],encoding="utf-8") if "noRedirectFetch" not in l]; b=open(sys.argv[2],encoding="utf-8").readlines(); sys.exit("suite differs beyond noRedirectFetch lines") if a!=b else None' "$W/packages/supabase/tests/e2e/avatar-flow.e2e.ts" "$V/packages/supabase/tests/e2e/avatar-flow.e2e.ts" && python3 -I -c 'import sys; dev=open(sys.argv[1],encoding="utf-8").read(); ref=open(sys.argv[2],encoding="utf-8").read().split("\n"); bad=[f"{a}-{b}" for a,b in [(47,52),(58,61),(255,255),(270,332),(342,359)] if "\n".join(ref[a-1:b]) not in dev]; bad+=[n for n in ("cmd_verify_e2e","cmd_sheet_assets_e2e") if n in dev]; sys.exit("not verbatim / forbidden: "+" ".join(bad)) if bad else print("BLOCKS_IDENTICAL")' "$W/scripts/db-sandbox.sh" "$V/scripts/db-sandbox.sh" EXPECT: BLOCKS_IDENTICAL EVIDENCE: MET exit=0 marker-found :: BLOCKS_IDENTICAL 4. No DEV identifier remains in the runner or the suite (no `supabase status`, no 54321, no DEV container or network name). CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; ! grep -rn "supabase status\|54321\|supabase_kong\|supabase_db_faunosteo\|supabase_network_faunosteo" "$W/scripts/db-sandbox.sh" "$W/packages/supabase/tests/e2e" && echo NO_DEV_IDS EXPECT: NO_DEV_IDS EVIDENCE: MET exit=0 marker-found :: NO_DEV_IDS 5. Refusal before any connection, no environment (plan proof b): the suite throws at load and opens no AF_INET / AF_INET6 socket. Positive control: the same trace filter, run on `curl -s http://127.0.0.1:9/`, shows an AF_INET connect. CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; T="$(mktemp -d)"; strace -f -e trace=connect,sendto,sendmsg -o "$T/ctl" curl -s --max-time 2 http://127.0.0.1:9/ >/dev/null 2>&1; grep -q 'AF_INET' "$T/ctl" || { echo "positive control failed"; exit 1; }; (cd "$W/packages/supabase" && env -u SUPABASE_URL -u SUPABASE_ANON_KEY -u SUPABASE_SERVICE_ROLE_KEY -u AVATAR_E2E_DB_CONTAINER strace -f -e trace=connect,sendto,sendmsg -o "$T/run" node_modules/.bin/vitest run --config vitest.e2e.config.ts >"$T/out" 2>&1); rc=$?; [ "$rc" -ne 0 ] && grep -q "run it through pnpm e2e:avatar, on the sandbox stack only" "$T/out" && ! grep -q 'AF_INET' "$T/run" && echo REFUSED_NO_IP EXPECT: REFUSED_NO_IP EVIDENCE: MET exit=0 marker-found :: REFUSED_NO_IP 6. The other refusals of the plan (a, c, d, e, f, h, i) and the straced positive sandbox run with hostile DEV exports are executed by the orchestrator (never a sub-agent), by absolute path, and recorded in `.claude/audits/2026-11-02-avatar-e2e-sandbox-only.md` with the strace criterion per case (f: the single loopback connect to 127.0.0.1:57800 named), the `docker ps` / `docker port` / `docker inspect` readings, the DEV containers' start times unchanged, and the hand-off to V1-2 (`down` at the end). Judged by the verifier against the log. 7. Documentation names the sandbox path only and is true on develop: no instruction to run the worker or the suite against `supabase_network_faunosteo` / `supabase status` for the e2e, the removal date is 2026-11-02, no `verify-e2e`, no "V1-2.3" introduced; STORAGE.md §6 no longer tells the reader to run `pnpm --filter @faunosteo/supabase test:e2e` against the local stack. RUST.md:178, BROWSER_TESTS.md:103, SUPABASE.md:38 and CHANGELOG.md untouched. Judged by the verifier. 8. The static gates pass in the worktree. CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; cd "$W" && corepack pnpm -s typecheck >/dev/null 2>&1 && corepack pnpm -s lint >/dev/null 2>&1 && echo STATIC_GREEN EXPECT: STATIC_GREEN EVIDENCE: MET exit=0 marker-found :: STATIC_GREEN 9. The guard's limits are written where a reader meets them (brief §3), without touching the byte-copied code: the SUPABASE.md §5.1 row for `pnpm db:sandbox avatar-e2e` and the audit log state that the issuer check routes to the sandbox and is not a signature check, and name what the isolation rests on (fixed gateway URL in the worker's 600 env file, `max_redirects(0)` and `proxy(None)` in `crates/worker/src/http.rs`, sandbox-signed keys, upstreams by container name) and the redirect refusal of criterion 10 (the former residual LOW). Judged by the verifier. 10. The suite's supabase-js clients refuse HTTP redirects: `tests/e2e/noRedirectFetch.ts` exports `noRedirectFetch` (`fetch(input, { ...init, redirect: 'error' })`, `redirect` set last), both client factories of the suite pass `global: { fetch: noRedirectFetch }`, no production client (`packages/supabase/src`, `apps/app/src`) changes, and the regression test `tests/no-redirect-fetch.test.ts` proves with two local `node:http` servers that a 302 from the first towards the second is not followed by auth, REST and Storage calls (the second server receives no request, the `apikey` header reaches only the first) while a control fetch with the default `follow` does reach the second. Live proof j (orchestrator): the suite with forged `iss: db-sandbox` keys against a 302 listener on 127.0.0.1:57800 pointing at 127.0.0.1:57801 opens no connect to 57801 (strace), logged in the audit file. CHECK: W=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/573c6c77-7294-4d96-a518-83afaafef8d1/scratchpad/bugfix-avatar; grep -qF "redirect: 'error'" "$W/packages/supabase/tests/e2e/noRedirectFetch.ts" && [ "$(grep -c 'global: { fetch: noRedirectFetch }' "$W/packages/supabase/tests/e2e/avatar-flow.e2e.ts")" = 2 ] && git -C "$W" diff --quiet 6287e5b -- packages/supabase/src apps/app/src && cd "$W/packages/supabase" && node_modules/.bin/vitest run tests/no-redirect-fetch.test.ts >/dev/null 2>&1 && echo NO_REDIRECT_OK EXPECT: NO_REDIRECT_OK EVIDENCE: MET exit=0 marker-found :: NO_REDIRECT_OK ## FILE SCOPE packages/supabase/tests/e2e/noRedirectFetch.ts (new), packages/supabase/tests/no-redirect-fetch.test.ts (new), scripts/db-sandbox.sh, scripts/avatar-e2e.sh (deleted), package.json, packages/supabase/tests/e2e/avatar-flow.e2e.ts, packages/supabase/vitest.e2e.config.ts, scripts/dev-env.sh, CLAUDE.md, README.md, docs/development/{STORAGE,SUPABASE,WORKSPACE,TEST_STRATEGY,ENVIRONMENTS,IDENTITY}.md, .claude/audits/2026-11-02-avatar-e2e-sandbox-only.md (new), .claude/tasks/{plans,contracts}/2026-11-02-avatar-e2e-sandbox-only-*.md