bug(nuxt): repeated Set-Cookie headers are overwritten by clerkMiddleware
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 86/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- nuxtjs, typescript
調査の方向性
packages/nuxt/src/runtime/server/tests/clerkMiddleware.test.ts から始め、特に 116-143 行付近の再現ケースを確認し、H3 ハンドラーによって実行される clerkMiddleware の経路を調査します。認証ヘッダーをモックした状態で対象を絞ったテストを実行します。完了条件は、追加された両方の Set-Cookie ディレクティブが Nuxt のレスポンスで引き続き利用可能であることです。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 1.8k
- フォーク
- 472
- 平均マージ
- 2日 10時間
- マージ済み PR(30日)
- 215
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
clerk/javascript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
clerk/javascript#9611 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 64/100
clerk/javascript#9775 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
clerk/javascript#9770 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
clerk/javascript#9667 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
clerk/javascript#9659 · コメント 1 件 ·
clerk/javascript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug v2
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
modelcontextprotocol/inspector#2458 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
carbon-design-system/ibm-products#9907 ·