Security: fetch-retry final log still includes `init.body` — leaks refresh tokens after #598 removed headers
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- typescript
- Ambito
- security
Direzione di ricerca
Inizia in src/runtime/utils/fetch-retry.ts e ispeziona il logging del tentativo finale descritto nell’issue. Riproduci una richiesta con un body sensibile che fallisca dopo tutti i tentativi e verifica quindi che l’errore finale della console ometta il body, mantenendo però l’errore di fetch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version
@nuxtjs/supabase 2.0.9 (current main)
Summary
#598 / PR #599 removed headers from the final-failure log in src/runtime/utils/fetch-retry.ts, but the rest of init is still logged — and that includes init.body:
if (attempt === retries) {
const { headers: _headers, ...safeInit } = init ?? {}
console.error(`Error fetching request ${req}`, error, safeInit)
throw error
}
For requests supabase-js sends to /auth/v1/token, init.body contains credentials:
?grant_type=refresh_token→{"refresh_token":"..."}?grant_type=password→ the user's email and password
So the body has the same failure mode #598 fixed for headers: any auth request that fails all 3 retries (network blip, device offline, rate limit) logs the credential via console.error, and any runtime that captures console output persists it — Sentry's default console breadcrumbs attach it to captured events, and the same applies to Cloudflare Workers Observability, Vercel log drains, and stdout shipping.
A leaked refresh token is a live session: it can be exchanged for a fresh access + refresh token pair by anyone with read access to the logging destination.
Reproduction
Any request with a sensitive body that fails 3 times, e.g. go offline (or block *.supabase.co) with a session due for refresh; the final attempt logs {"method":"POST","body":"{\"refresh_token\":\"...\"}"}.
Proposed fix
Extend the #599 destructure by one key:
const { headers: _headers, body: _body, ...safeInit } = init ?? {}
The body is never useful for diagnosing a fetch failure (the error carries the cause), so there's nothing to redact selectively.
Happy to open a PR.
- Lingua principale
- TypeScript
- Stelle
- 940
- Fork
- 157
- Merge medio
- 6g 9h
- PR unite (30g)
- 3
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nuxt-modules/supabase
-
enhancement Stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nuxt-modules/supabase#621 · 5 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
nuxt-modules/supabase#642 ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nuxt-modules/supabase#371 · 8 commenti ·
-
Dependency DashboardAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
nuxt-modules/supabase#4 ·
Tutte le issue di nuxt-modules/supabase
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
TomerAberbach/profiler-md#733 ·
I maintainer di solito rispondono entro 1 giorno
-
bug priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
brentspine/brents-toasts#143 ·
-
🐛 bug 🗺️ DB Models & Ops
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
LibreChat-AI/LibreChat#17214 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
Wavvon/Wavvon-clients#136 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
umami-software/umami#4637 ·
I maintainer di solito rispondono entro 3 giorni