Deprecate middleware auth gating across Next.js reference and guides - #3405
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
f02d2a7 to
5fad417
Compare
Wraps the auth-gating sections of the Next.js clerkMiddleware reference with the deprecation notice (keeping anchors and clerkMiddleware config intact), redirects token-type gating to auth({ acceptsToken }) at the route, and points readers to resource-level protection. Updates the guides that taught the pattern: basic-rbac now leads with page-level checks, session-tasks elevates <RedirectToTasks />, geo-blocking and satellite-domains keep their middleware but drop the auth tail, the custom sign-in/up steps are framed as legacy, CSP examples drop the irrelevant auth gating, and the MCP guide no longer special-cases .well-known. All surviving createRouteMatcher examples use the newline-safe :path* form instead of (.*).
The newline-bypass mechanism for (.*) maps to an unpublished advisory (still embargoed), so the reference page should not describe it yet. Keep the neutral :path* recommendation; the security framing returns with the deprecation track once the CVE is public.
…n (nextjs) Onboarding WARNING: drop the embargoed 'can be bypassed' assertion, keep the not-a-security-boundary point via re-render + separate-route-model framing. clerk-middleware NOTE: add a non-security reason for the :path* swap so it can't be paired with bypass prose to reconstruct the unpublished fix.
5fad417 to
5701fe8
Compare
basic-rbac: await the async checkRole() in setRole and AdminDashboard (a negated Promise is always falsy, so the guard never fired), and add the missing admin check to removeRole. The page argues resource-level protection hardest; its sample guards must actually run. geo-blocking, satellite-domains: give the 'protect at the resource' pointers a one-line, embargo-safe why (keeps the check in sync with your routes) so the de-gated examples don't read as arbitrary churn.
|
Heads up: this PR is part of the #3426 carries a reframed, positive-recommendation version of the shared Keeping |
|
Superseded by #3426, now the canonical Next.js |
Stacked on #3404. Applies the deprecation across the Next.js reference and the guides that taught middleware gating.
The reference page is kept-but-wrapped: each auth-gating section keeps its existing anchor but gains the deprecation notice, token-type gating now points to
auth({ acceptsToken })at the route, and the Combine-Middleware example loses itsauth.protect()line. In the guides,basic-rbacnow leads with the page-level check,session-taskselevates<RedirectToTasks />,geo-blockingandsatellite-domainskeep their middleware but drop the auth tail, the custom sign-in/up steps are framed as legacy, the CSP examples drop the auth gating that was never relevant to CSP, and the MCP guide stops special-casing.well-known.Load-bearing bit to scrutinize: every surviving
createRouteMatcherexample moves from/foo(.*)to/foo/:path*. The(.*)form misses encoded newlines (a bypass) and over-matches/foobar;/:path*fixes both. Verified against the SDK's path-to-regexp.