Skip to content

fix(backend): Stop verifying ES256 tokens (Core 2) - #11106

Merged
nikosdouvlis merged 16 commits into
release/core-2from
nikos/backend-drop-es256-core-2
Dec 3, 2026
Merged

nikosdouvlis merged 16 commits into
release/core-2from
nikos/backend-drop-es256-core-2

Conversation

@nikosdouvlis

@nikosdouvlis nikosdouvlis commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Stacked on #11108. @clerk/backend removes the ES256 support added in 2.34.0 and stops accepting ES256 tokens, and a configured jwtKey is always used to verify. Multi-key JWKS, composite kids and kid-based key selection from #11037 stay.

 loadVerificationKey
-  jwtKey set → RSA PEM or P-256 JWK; if it can't verify the token alg and secretKey is set → JWKS by kid
+  jwtKey set → RSA PEM, always used
   no jwtKey  → JWKS by kid

 verifyJwt algorithms
-  RS256 | RS384 | RS512 | ES256
+  RS256 | RS384 | RS512

Evidence

  • Before: an ES256 token verified against an EC key from the JWKS.
    After: verify.test.ts "rejects an ES256 token as an invalid algorithm" passes, and an RS256 token still verifies while the JWKS lists an EC key.
  • A pinned jwtKey makes 0 JWKS requests when the signature check fails.

Merge Danger

Door: two-way

A revert restores ES256. An ES256 session cookie is signed out on this version, not refreshed through a handshake.

Blast Radius: verification

  • Apps on an instance that signs with ES256 lose their sessions.
  • A jwtKey set to a P-256 key stops working.
  • signJwt / verifyJwt throw for ES256.
  • A configured jwtKey never calls the network, which matches the behavior before 2.34.

@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Dec 3, 2026 3:38pm UTC
mosaic-docs Error Error Dec 3, 2026 3:38pm UTC
swingset Error Error Dec 3, 2026 3:38pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@nikosdouvlis
nikosdouvlis marked this pull request as ready for review December 3, 2026 13:50
@blacksmith-sh

blacksmith-sh Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Matches ES256 session token is rejected

Tested on 7b71d23f — Base verified the ES256 token from the JWKS; head rejects it with token-invalid-algorithm.

Merge-base

ES256 via JWKS

This PR 7b71d23f

ES256 via JWKS

Also checked · 3 match

Matches RS256 still verifies beside an EC JWKS key
Matches Pinned jwtKey is always used, never fetches JWKS
Matches P-256 jwtKey and ES256 signJwt stop working

Proof on 3351973f (from 7b71d23f) · mocked: Backend API /v1/jwks (Loopback HTTP fixture serves test JWKS and counts requests) · Did Proof get it right? Yes · No

View full Proof report · React 👎 or comment @codesmith dismiss this proof to dismiss

@nikosdouvlis nikosdouvlis changed the title fix(backend): Stop verifying ES256 tokens (Core 2) fix(backend): Accept RSA jwtKey of any size and stop verifying ES256 tokens (Core 2) Dec 3, 2026
@changeset-bot

changeset-bot Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e0b9efe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Minor
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@11106

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@11106

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@11106

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@11106

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@11106

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@11106

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@11106

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@11106

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@11106

@clerk/express

npm i https://pkg.pr.new/@clerk/express@11106

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@11106

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@11106

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@11106

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@11106

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@11106

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@11106

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@11106

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@11106

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@11106

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@11106

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@11106

@clerk/types

npm i https://pkg.pr.new/@clerk/types@11106

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@11106

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@11106

commit: 3351973

@nikosdouvlis nikosdouvlis changed the title fix(backend): Accept RSA jwtKey of any size and stop verifying ES256 tokens (Core 2) fix(backend): Stop verifying ES256 tokens (Core 2) Dec 3, 2026
@vercel
vercel Bot temporarily deployed to Preview – clerk-js-sandbox December 3, 2026 14:17 Inactive
@nikosdouvlis
nikosdouvlis changed the base branch from release/core-2 to nikos/backend-jwt-key-any-size-core-2 December 3, 2026 14:17
…nd-drop-es256-core-2

# Conflicts:
#	packages/backend/src/tokens/__tests__/keys.test.ts
#	packages/backend/src/tokens/keys.ts
@nikosdouvlis
nikosdouvlis merged commit d82484e into release/core-2 Dec 3, 2026
74 of 78 checks passed
@nikosdouvlis
nikosdouvlis deleted the nikos/backend-drop-es256-core-2 branch December 3, 2026 15:54

This branch had an error being deployed

1 failed and 1 active deployments
Preview – clerk-js-sandbox — 3351973f Deployed Dec 3, 2026 by vercel[bot]
Preview – swingset — 3351973f Deployed Dec 3, 2026 by vercel[bot]
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