@clerk/nextjs
7.10.2 · 17 Nov 2026MIT4.2M / weekRepositoryHomepagenpmAtom feed
6.39.9 is the newest release of 6.x.
In short
4 security2 new4 internal
- Security
Automatic generation of CSP headers with default security policies compatible with Clerk requirements
- Security
Support for both standard and strict-dynamic CSP modes
- Security
Automatic nonce generation for strict-dynamic mode
- Security
Ability to add custom directives to match project requirements
Security
3 advisories affect 6.14.0; 6.39.3 fixes them
- CriticalOfficial Clerk JavaScript SDKs: Middleware-based route protection bypassGHSA-vqx2-fgx2-5wq9 · 16 Apr 2026Fixed in 6.39.2
- HighClerk has an authorization bypass when combining organization, billing, or reverification checksGHSA-w24r-5266-9c3c · 30 Apr 2026Fixed in 6.39.3
- High@clerk/backend Performs Insufficient Verification of Data AuthenticityGHSA-9mp4-77wg-rwx9 · 9 Jul 2025Fixed in 6.23.3
Release note
Minor Changes
Update
useAuthto handle pending sessions as signed-out by default, with opt-out viauseAuth({ treatPendingAsSignedOut: false })or<ClerkProvider treatPendingAsSignedOut={false} />Introduce
auth().redirectToSignUp()that can be used in API routes and pages. Originally effortimport { clerkMiddleware } from '@clerk/nextjs/server'; export default clerkMiddleware(async auth => { const { userId, redirectToSignUp } = await auth(); if (!userId) { return redirectToSignUp(); } });Added Content Security Policy (CSP) header generation functionality to
clerkMiddlewarewith support for both standard and strict-dynamic modes. Key features:Automatic generation of CSP headers with default security policies compatible with Clerk requirements
Support for both standard and strict-dynamic CSP modes
Automatic nonce generation for strict-dynamic mode
Ability to add custom directives to match project requirements
Example
export default clerkMiddleware( async (auth, request) => { if (!isPublicRoute(request)) { await auth.protect(); } }, { contentSecurityPolicy: { mode: "strict-dynamic", directives: { "connect-src": ["external.api.com"], "script-src": ["external.scripts.com"] } } } );
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.