bug(nuxt): repeated Set-Cookie headers are overwritten by clerkMiddleware
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 86/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- nuxtjs, typescript
- Ambito
- authentication, backend
Direzione di ricerca
Inizia da packages/nuxt/src/runtime/server/tests/clerkMiddleware.test.ts, soprattutto dalla riproduzione intorno alle righe 116-143, e ispeziona il percorso clerkMiddleware eseguito dall'handler H3. Esegui il test mirato con intestazioni di autenticazione simulate; il lavoro è completato quando entrambe le direttive Set-Cookie aggiunte rimangono disponibili nella risposta Nuxt.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Preliminary Checks
- I have reviewed the documentation: https://clerk.com/docs
- I have searched for existing issues: https://github.com/clerk/javascript/issues
- I have not already reached out to Clerk support via email or Discord
- This is a bug report directly related to Clerk
Reproduction
The package's existing clerkMiddleware.test.ts can reproduce this without a Clerk instance: mock authenticateRequest() with a Headers object containing two appended Set-Cookie values, run the H3 handler, then inspect response.headers.getSetCookie(). Only the last value remains.
Publishable key
Not applicable. This is a unit-level server middleware reproduction and does not make a request to Clerk.
Description
Steps to reproduce:
- Create a
Headersinstance and append twoSet-Cookievalues, such as an expired__clerk_handshakecookie and a refreshed__sessioncookie. - Return those headers from the mocked
authenticateRequest()result used byclerkMiddleware. - Send a request through the H3 handler and inspect
response.headers.getSetCookie().
Expected behavior:
Both cookie directives are present in the Nuxt response. Set-Cookie is a repeatable response header, and Clerk can return several cookie mutations from one authentication or handshake result.
Actual behavior:
Only the last cookie directive is present. clerkMiddleware iterates over the authentication headers and calls H3's setResponseHeader() for every value. That API replaces a previous value with the same name, so each Set-Cookie overwrites the preceding one.
This can leave an expired or stale Clerk handshake cookie in the browser when its deletion directive is followed by another cookie directive. Subsequent server requests can then continue entering the handshake path until that short-lived cookie expires.
Environment
System:
OS: Linux 6.16 Pop!_OS 24.04 LTS
CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz
Binaries:
Node: 25.0.0
npm: 11.6.2
pnpm: 10.33.0
Browsers:
Chrome: 150.0.7871.46
npmPackages:
@clerk/nuxt: 3.0.15
h3: 1.15.11
- Lingua principale
- TypeScript
- Stelle
- 1.8k
- Fork
- 472
- Merge medio
- 2g 8h
- PR unite (30g)
- 184
Guida per i contributori
Apri la 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 clerk/javascript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
clerk/javascript#9611 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 64/100
clerk/javascript#9775 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
clerk/javascript#9770 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
clerk/javascript#9667 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
clerk/javascript#9659 · 1 commento ·
Tutte le issue di clerk/javascript
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
area:tools bug good first issue help wanted priority:P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
newrelic-experimental/preflight#793 · 1 commento ·
-
bug 🐞
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
BasedHardware/omi#15320 ·