Packages

@clerk/nextjs

7.10.2 · 17 Nov 2026MIT4.2M / weekRepositoryHomepagenpmAtom feed

Your version

6.14.0

7 Apr 2025Where it was published

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

Release note

Minor Changes

  • Update useAuth to handle pending sessions as signed-out by default, with opt-out via useAuth({ treatPendingAsSignedOut: false }) or <ClerkProvider treatPendingAsSignedOut={false} />

  • Introduce auth().redirectToSignUp() that can be used in API routes and pages. Originally effort

    import { 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 clerkMiddleware with 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.