fix(supabase): e2e:avatar runs on the sandbox only, DEV runner removed
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.
This commit is contained in:
1 parent
6287e5bb9f
commit
3a4614bc86
17 files changed
+589
-117
No files matched your search
@@ -34,8 +34,7 @@ never hard-coded in the sources.
|
||||
| derived | `FAUNOSTEO_DEV_API_URL` `http://<host>:54321`, `FAUNOSTEO_DEV_SITE_URL` `http://<host>:5173`, `FAUNOSTEO_DEV_API_ORIGIN`, `FAUNOSTEO_DEV_STUDIO_URL` `:54323`, `FAUNOSTEO_DEV_MAILPIT_URL` `:54325` (gateway) | read by `supabase/config.toml` (`env()`) and by the Vite dev server |
|
||||
|
||||
Consumers: `scripts/supabase.sh` (every CLI call: `pnpm supabase …`,
|
||||
`pnpm db:start|stop|reset|test|types`), `scripts/dev.sh` (`pnpm dev`),
|
||||
`scripts/avatar-e2e.sh`. The address changes with `FAUNOSTEO_DEV_HOST=…`
|
||||
`pnpm db:start|stop|reset|test|types`), `scripts/dev.sh` (`pnpm dev`). The address changes with `FAUNOSTEO_DEV_HOST=…`
|
||||
in front of the command, without touching a source file. Calling the CLI
|
||||
binary directly (`node_modules/.bin/supabase start`) leaves the literal
|
||||
`env(...)` text in the services: always go through `pnpm`.
|
||||
|
||||
@@ -126,8 +126,8 @@ VITE_AUTH_PROVIDERS=google pnpm dev # http://<host>:5173 from any device of th
|
||||
9. REST: anon cannot read profiles (`42501`), alice reads one row only
|
||||
(SUPABASE.md §8).
|
||||
10. Profile photo (Step 8, worker container running: `pnpm worker:image`
|
||||
then `docker compose --profile worker up worker` or the container of
|
||||
`scripts/avatar-e2e.sh`): Mon compte → Modifier la photo with a phone
|
||||
then `docker compose --profile worker up worker` or the `docker run` of
|
||||
STORAGE.md §6; `pnpm e2e:avatar` runs on the sandbox): Mon compte → Modifier la photo with a phone
|
||||
JPEG → preview → Enregistrer → "Traitement en cours…" → the photo in the
|
||||
circle, the sidebar, the drawer (mobile) and the top bar (name beside it
|
||||
on desktop, alone on mobile) linking to Mon compte; a renamed PNG is
|
||||
|
||||
@@ -327,9 +327,8 @@ docker run --rm --read-only --cap-drop ALL --security-opt no-new-privileges:true
|
||||
--network supabase_network_faunosteo \
|
||||
-e SUPABASE_URL=http://supabase_kong_faunosteo:8000 \
|
||||
-e SUPABASE_SERVICE_ROLE_KEY="$(pnpm -s supabase status -o env | sed -n 's/^SERVICE_ROLE_KEY="\(.*\)"/\1/p')" \
|
||||
faunosteo_worker:dev run
|
||||
pnpm --filter @faunosteo/supabase test:e2e # real-stack end-to-end (needs the worker above)
|
||||
pnpm e2e:avatar # scripts/avatar-e2e.sh: the three lines above in one, worker started with a 5 s sweep and no quarantine grace
|
||||
faunosteo_worker:dev run # the worker beside the local stack, for the manual photo flow (IDENTITY.md); the e2e suite refuses this stack
|
||||
pnpm e2e:avatar # = pnpm db:sandbox avatar-e2e: the suite and the worker (5 s sweep, no quarantine grace) on the throwaway stack only (SUPABASE.md §5.1); the DEV script was removed on 2026-11-02
|
||||
```
|
||||
|
||||
`docker compose --profile worker up worker` runs the same container from
|
||||
|
||||
@@ -171,7 +171,7 @@ User files land in private buckets and are processed by the Rust worker
|
||||
|
||||
```bash
|
||||
pnpm worker:image # faunosteo_worker:dev
|
||||
pnpm e2e:avatar # starts the container on supabase_network_faunosteo, runs tests/e2e, stops it
|
||||
pnpm e2e:avatar # = pnpm db:sandbox avatar-e2e: the suite and the worker on the throwaway stack (§5.1) only
|
||||
docker compose --profile worker up worker # the same container from docker-compose.yml, reading .env.worker
|
||||
```
|
||||
|
||||
@@ -518,8 +518,9 @@ the scripts:
|
||||
on the sandbox, clean and with those conditions reproduced (scenarios and
|
||||
mutations in the journal of 2026-10-27). DEV is not validated by `db:test`
|
||||
until a run there passes.
|
||||
- `pnpm e2e:avatar`: not part of this procedure; optional, the owner's call.
|
||||
It writes on DEV beyond its own fixture: it creates a temporary confirmed
|
||||
- `pnpm e2e:avatar`: not part of this procedure. Since 2026-11-02 it runs on
|
||||
the sandbox only (owner decision; the DEV script `scripts/avatar-e2e.sh` is
|
||||
removed). Its DEV run, as recorded on 2026-10-26, wrote on DEV beyond its own fixture: it creates a temporary confirmed
|
||||
account `e2e-avatar-<time>@faunosteo.local` (and, after M1, its workspace),
|
||||
deletes it at the end (a failed run leaves it), signs in as
|
||||
`bob@faunosteo.local` (sessions and `last_sign_in_at` of an existing
|
||||
@@ -804,6 +805,7 @@ Docker.
|
||||
| `pnpm db:sandbox types [--check]` | `supabase gen types --db-url ... --schema public` through Prettier, written or diffed with the committed file |
|
||||
| `pnpm db:sandbox test` | `packages/supabase/tests/sandbox/*.sandbox.ts`: real GoTrue and PostgREST sessions, concurrent SQL sessions |
|
||||
| `pnpm db:sandbox e2e-shell` (= `pnpm e2e:shell`) | the authenticated `/app` shell in Chromium (`apps/app/e2e/shell`, `docs/development/BROWSER_TESTS.md`): a loopback dev server whose Supabase calls are replayed on the sandbox, fictitious accounts per test |
|
||||
| `pnpm db:sandbox avatar-e2e` (= `pnpm e2e:avatar`) | the avatar flow on the sandbox alone: an nginx gateway (`nginx:1.31-alpine`; `/auth/v1/`, `/rest/v1/`, `/storage/v1/` to the sandbox containers, `return 404` elsewhere) published on `127.0.0.1:57800` only; the real worker `faunosteo_worker:dev run` (avatars and sweep, 5 s sweep, no quarantine grace, 512 MiB, read-only, no capability, `nonroot`) on the sandbox network, its service key in a 600 env file removed once started; then `packages/supabase/tests/e2e/avatar-flow.e2e.ts` through that port. The suite accepts only `http://127.0.0.1:57800`, the container `faunosteo_dbsandbox_db` and keys whose JWT payload carries `iss: db-sandbox`, else it throws before any request. The issuer check only routes the run to the sandbox: it is not a signature check and not an authentication. The isolation rests on the fixed gateway URL in the worker's env file, the worker's `max_redirects(0)` and `proxy(None)` (`crates/worker/src/http.rs`), sandbox-signed keys and upstreams reached by container name on the sandbox network. Residual: the suite's supabase-js clients keep fetch's default `redirect: follow` (no endpoint of the gateway or its upstreams redirects today) |
|
||||
| `pnpm db:sandbox sql` / `down` | psql as postgres on stdin / remove the stack |
|
||||
|
||||
Every CLI call passes `--db-url` with `sslmode=disable` (the sandbox has no
|
||||
|
||||
@@ -67,7 +67,7 @@ unit suites, 2 by the browser journeys.
|
||||
| CSP on the image (R2) | the real app image behind the DEPLOY.md CSP in headless Chromium: with `'wasm-unsafe-eval'` the core runs the editor path, without it the degraded state and an untouched draft; no module request on `/login`, `/app/account`, `/` | `docker/csp-proof/app-image.sh` | before a merge touching the core loading or the image; manual (needs Chromium) |
|
||||
| Worker sandbox | integration tests against the musl binary that ships: fixture corpus through the full sandbox, refusals, SIGSYS on a denied syscall, output cap, `RLIMIT_AS` abort, `RLIMIT_CPU`, deadline; seccomp allowlist derived by `strace` and compared | `crates/worker/tests/sandbox.rs`, Dockerfile stage `test` (`pnpm worker:test`, Docker only, never native) | every `crates/worker` commit, `pnpm check:all`; CI `docker` job prepared |
|
||||
| Worker job loop | native unit tests on a fake backend and a fake decoder: call order claim → download → decode → upload → commit → purge, every child outcome mapped to a closed code, no deletion on a refused commit, lease left on transport failures, sweeper targets and acks, key validation, config and secret redaction | `crates/worker/tests/job_loop.rs`, `crates/worker/src/*` unit tests (`pnpm rust:check`) | every Rust commit |
|
||||
| Files e2e (real stack) | the worker container against the local Supabase stack: clean upload and owner-only download (Bob, anon, quarantine, direct final-key write refused), replacement and purge after the grace (queue clock shifted through psql), late signed-upload bytes swept, hostile uploads rejected with closed codes, removal and drained queue | `packages/supabase/tests/e2e/avatar-flow.e2e.ts` (`pnpm e2e:avatar`, `scripts/avatar-e2e.sh`) | every Storage, worker or avatar change; not in `check:all` (needs the stack) |
|
||||
| Files e2e (real stack) | the worker container against the throwaway sandbox stack (since 2026-11-02; DEV before): clean upload and owner-only download (Bob, anon, quarantine, direct final-key write refused), replacement and purge after the grace (queue clock shifted through psql), late signed-upload bytes swept, hostile uploads rejected with closed codes, removal and drained queue | `packages/supabase/tests/e2e/avatar-flow.e2e.ts` (`pnpm e2e:avatar` = `pnpm db:sandbox avatar-e2e`, `scripts/db-sandbox.sh`) | every Storage, worker or avatar change; not in `check:all` (needs the sandbox) |
|
||||
|
||||
Browser-only code (`svgToPng`, `DOMParser` in the importer) runs under
|
||||
happy-dom where sufficient and under Playwright when real rendering matters
|
||||
|
||||
@@ -101,7 +101,7 @@ works as `corepack pnpm <cmd>`.
|
||||
| `pnpm build` | typecheck + Vite build in every package |
|
||||
| `pnpm check` | typecheck, test:run, lint, build in sequence (the Node gate) |
|
||||
| `pnpm check:all` | the whole pre-merge gate: native Rust check, types drift, wasm build, `pnpm check`, application and worker images (`docs/development/RUST.md` §4; no CI runs it yet) |
|
||||
| `pnpm e2e:avatar` | real-stack end-to-end of the avatar flow: worker container against the local Supabase stack + `packages/supabase/tests/e2e` (`docs/development/STORAGE.md` §6; needs `pnpm db:start`) |
|
||||
| `pnpm e2e:avatar` | = `pnpm db:sandbox avatar-e2e`: real-stack end-to-end of the avatar flow, worker container + `packages/supabase/tests/e2e` on the throwaway stack only (`docs/development/STORAGE.md` §6; needs `pnpm db:sandbox up fresh` and `pnpm worker:image`) |
|
||||
| `pnpm format` | Prettier on the whole repository |
|
||||
|
||||
Package-scoped: `pnpm --filter @faunosteo/app <script>`.
|
||||
|
||||
Reference in new issue
Block a user