test(supabase): avatar e2e clients refuse HTTP redirects
The suite's supabase-js clients followed redirects by default, so a 3xx from the sandbox gateway would have carried the apikey header to another origin. `noRedirectFetch` (`redirect: 'error'`) is passed as `global.fetch` of both client factories; a regression test with two loopback servers proves REST, auth and Storage calls stop at the 302. Live proof j and a second 5/5 run are in the audit log; no production client changes.
This commit is contained in:
1 parent
e8da0d96d9
commit
d3dfd03213
7 files changed
+147
-16
No files matched your search
@@ -805,7 +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 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. The suite's supabase-js clients refuse every HTTP redirect (`global.fetch` = `tests/e2e/noRedirectFetch.ts`, `redirect: 'error'`; regression test `tests/no-redirect-fetch.test.ts`) |
|
||||
| `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
|
||||
|
||||
Reference in new issue
Block a user