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
@@ -100,6 +100,8 @@ NOT ported (V1-2 only, with the reason): `SB_SEED_PW` / `seed_passwords` / `SAND
|
||||
- NOT touched (still true after the fix): `docs/development/RUST.md:178`, `BROWSER_TESTS.md:103`,
|
||||
`SUPABASE.md:38`, `CHANGELOG.md` (neither 6287e5b nor the V1-2 commits added a line).
|
||||
|
||||
7. (owner, checkpoint 2026-11-02) `packages/supabase/tests/e2e/noRedirectFetch.ts`: `export const noRedirectFetch: typeof fetch = (input, init) => fetch(input, { ...init, redirect: 'error' })`; the suite's `anonClient()` and `serviceClient()` add `global: { fetch: noRedirectFetch }` (supabase-js hands `global.fetch` raw to auth-js and through `fetchWithAuth` to REST and Storage; no layer sets `redirect`, our wrapper sets it last); regression test `tests/no-redirect-fetch.test.ts` (two `node:http` servers, 302 from A to B, auth + REST + Storage calls fail, B sees nothing, `apikey` only at A, control plain fetch reaches B); live proof j under strace. The suite now differs from V1-2 by those lines: V1-2 takes the same change at integration (merge rule amended).
|
||||
|
||||
## Merge expectations (V1-2 → develop, later)
|
||||
|
||||
Develop's `db-sandbox.sh` is the merge-base text (9135d73); the port changes base regions V1-2 changes
|
||||
@@ -107,7 +109,7 @@ differently. Expected conflicts: the usage header, the function block (V1-2 has
|
||||
`cmd_sheet_assets_e2e` around `cmd_avatar_e2e`), the dispatcher, the usage `sed` range. Rule: take V1-2's
|
||||
file whole; check with an empty `git diff <V1-2 tip> -- scripts/db-sandbox.sh` after the merge. The suite,
|
||||
`package.json`, `dev-env.sh`, the vitest comment and the ported variable / `down` / `REPO` lines merge
|
||||
cleanly. Doc lines reworded for develop conflict with V1-2's: keep V1-2's text (same rule as the
|
||||
cleanly, except the suite: V1-2 adopts the `noRedirectFetch` lines (owner decision 2026-11-02). Doc lines reworded for develop conflict with V1-2's: keep V1-2's text (same rule as the
|
||||
sheet-assets lines in TODO).
|
||||
|
||||
## Proof (log committed as `.claude/audits/2026-11-02-avatar-e2e-sandbox-only.md` on this branch)
|
||||
|
||||
Reference in new issue
Block a user