@clerk/nextjs
7.10.2 · 17 Nov 2026MIT4.1M / weekRepositoryHomepagenpmAtom feed
4.31.8 is the newest release of 4.x.
In short
1 new1 fixed4 internal
Security
1 advisory affects 4.28.0; 4.29.3 fixes them
- Critical@clerk/nextjs auth() and getAuth() methods vulnerable to insecure direct object reference (IDOR) GHSA-q6w5-jg5q-47vg · 12 Jan 2024Fixed in 4.29.3
Release note
Minor Changes
Introduce Protect for authorization.
Changes in public APIs:
Rename Gate to Protect
Support for permission checks. (Previously only roles could be used)
Remove the
experimentaltags and prefixesDrop
somefrom thehasutility and Protect. Protect now accepts aconditionprop where a function is expected with thehasbeing exposed as the param.Protect can now be used without required props. In this case behaves as
<SignedIn>, if no authorization props are passed.haswill throw an error if neitherpermissionorroleis passed.auth().protect()for Nextjs App Router. Allow per page protection in app router. This utility will automatically throw a 404 error if user is not authorized or authenticated.inside a page or layout file it will render the nearest
not-foundcomponent set by the developerinside a route handler it will return empty response body with a 404 status code
Patch Changes
Accept
redirectUrlas an option forauth().protect().For example:
// Authorization auth().protect({ role: 'org:admin' }, { redirectUrl: '/any-page' }); auth().protect({ permission: 'org:settings:manage' }, { redirectUrl: '/any-page' }); // Authentication auth().protect({ redirectUrl: '/any-page' });
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.