Skip to content

fix(relay): bump @clerk/backend to 3.31.2 - #4

Merged
oskarfreye merged 2 commits into
mainfrom
cursor/clerk-backend-oidc-advisory-6eb2
Nov 21, 2026
Merged

oskarfreye merged 2 commits into
mainfrom
cursor/clerk-backend-oidc-advisory-6eb2

Conversation

@oskarfreye

@oskarfreye oskarfreye commented Nov 20, 2026 •

Copy link
Copy Markdown

Problem

@clerk/backend 3.27.0 accepts an OIDC ID token as a session token (GHSA-wpqf-h9rq-rg73). The relay calls verifyToken() directly in infra/relay/src/http/Api.ts, and that path was not covered by Clerk's server-side category tagging on any release before 3.28.0.

Tracked in https://github.com/draht-dev/ops/issues/142 (parent https://github.com/draht-dev/ops/issues/133).

Change

The catalog pin is now @clerk/backend 3.31.2, the newest 3.x on npm (published 2026-11-19, above the 3.28.0 fix). pnpm-lock.yaml is updated to match.

@clerk/shared moves from 4.44.1 to 4.48.1 with it. Backend 3.31.2 depends on ^4.48.1, and the existing "@clerk/shared": "catalog:" override forces every Clerk package onto that one version. @clerk/clerk-js, @clerk/react, @clerk/expo, and @clerk/electron already accept ^4.44.1, so 4.48.1 stays inside their ranges. Both releases are still inside pnpm's one-day release age, so they are listed in minimumReleaseAgeExclude.

No local header check was added. In 3.31.2, verifyToken() rejects a JWT before signature verification when cat is anything other than the session category cl_B7d4PD111AAA (JWT templates remain verifiable for direct callers). That includes a missing cat, which is how older OIDC ID tokens are shaped, and cat === 'cl_B7d4PD444AAA', the category Clerk stamps on ID tokens. The advisory's pre-check is the workaround for callers who cannot upgrade, and it only covers that one category. The installed 3.31.2 build rejects both shapes with token-invalid / "Invalid session token category." A real session token (cl_B7d4PD111AAA) continues on to signature verification.

The relay's OAuth fallback does not reopen the hole. A failed verifyToken() falls through to authenticateRequest({ acceptsToken: "oauth_token" }), which only accepts oat_ tokens or JWTs whose typ is at+jwt. An ID token is neither.

Scope

Security dependency bump for https://github.com/draht-dev/ops/issues/142. No relay behavior change beyond the patched verifier. Not merged and not deployed.

Verification

  • npm latest for @clerk/backend is 3.31.2. The published dist rejects cat: cl_B7d4PD444AAA and a missing cat with token-invalid before checking the signature, and sends a session-category token through to token-invalid-signature.
  • vp test run --dir . in infra/relay: 37 files, 318 tests passed.
  • vp run typecheck passed for t3code-relay, @t3tools/web, @t3tools/desktop, and @t3tools/mobile (pre-existing schema-brand suggestions only).

Grok 4.7 via Cursor cloud agent.

Open in Web Open in Cursor 

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@clerk/backend 3.27.0 accepts OIDC ID tokens as session tokens
(GHSA-wpqf-h9rq-rg73). 3.31.2 rejects them inside verifyToken(), which
the relay calls directly. The catalog override also moves @clerk/shared
to 4.48.1, the version that release requires.

Grok 4.7 via Cursor cloud agent.

Co-authored-by: Oskar Freye <oskar@freye.tech>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0c69537 and c206ab2.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The workspace updates the Clerk backend and shared package versions, and adds both versions to the release-age exclusion list.

Changes: Clerk dependency versions

Layer / File(s) Summary
Update Clerk versions and exclusions
pnpm-workspace.yaml
The catalog updates @clerk/backend to 3.31.2 and @clerk/shared to 4.48.1. The release-age exclusion list adds both versions. A comment describes the backend dependency on the shared version and the override.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · previous review 0c695

This updates the Clerk backend and shared packages to pick up a fix that rejects OIDC ID tokens as session tokens in the relay. No actionable merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(relay): bump @clerk/backend to 3.31.2" names the main change: the catalog pin for @clerk/backend moves from 3.27.0 to 3.31.2. The raw summary confirms this, and the objectives describe …
Description check Passed The description covers the problem, the change, scope, and verification. It follows the template's Problem, Change, Scope, and Verification sections, with the advisory, the affected call site, the dep…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(relay): bump @clerk/backend to 3.31.2" names the main change: the catalog pin for @clerk/backend moves from 3.27.0 to 3.31.2. The raw summary confirms this, and the objectives describe the same bump as the security fix. It uses a conventional commit format and is specific. It does not mention the @clerk/shared move, which is a secondary change and not required in the title.

Full details: Description check

Explanation

The description covers the problem, the change, scope, and verification. It follows the template's Problem, Change, Scope, and Verification sections, with the advisory, the affected call site, the dependency change, and the test results. Two template gaps remain. The Problem section does not describe reproduction steps, and the Verification section cites test counts and npm checks but does not give observed results for a manual check of the relay path. The description also includes the agent footer, which the template asks for. Overall the description is mostly complete, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9a9f9dd and 0c69537.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 1

  • pnpm-workspace.yaml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@oskarfreye
oskarfreye merged commit 2a11278 into main Nov 21, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants