Skip to content
BuildThenTestedSee packages

Clerk security: defaults, what breaks, what to check

Clerk is a hosted authentication and user management service with prebuilt UI components and SDKs. Below: what it configures by default according to its own documentation (verified 2026-09-21), the 10 patterns most associated with it, the security features the vendor offers and where they stop, and a checklist you can run without buying anything.

The fetched session-token page did not state the default token lifetime, so no figure is recorded.

Clerk provides hosted authentication with prebuilt components and SDKs. Its docs separate the publishable key for the frontend from the secret key that must stay on the server, and describe a short-lived session JWT that SDK middleware or your code verifies on every request.

Clerk answers who the user is. Whether that user may do what they are asking is your application's job, and that is where testing focuses. Routes that read the session but skip the role check. Data layers that trust a user id sent from the browser.

Clerk defaults that matter for testing

Each row is taken from the vendor's documentation on the date shown. Defaults change; the date is the claim.

Defaults of Clerk as documented by the vendor
AreaDefaultSource
Publishable vs secret keyThe publishable key (pk_test_ / pk_live_) is for the frontend; the secret key (sk_test_ / sk_live_) must not be exposed through a public environment variable. Next.js uses NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY.docs · verified 2026-09-21
Session verification server-sideThe session token is a short-lived JWT stored in a cookie; SDK middleware validates it automatically, or you verify it manually with authenticateRequest() or the JWKS public key.docs · verified 2026-09-21
Manual JWT checksManual verification must check the algorithm, signature, exp and nbf claims and the azp (authorized parties) claim; the docs recommend setting authorizedParties against CSRF.docs · verified 2026-09-21
Route protectionclerkMiddleware does not protect routes on its own; the docs advise against protecting routes in middleware and recommend checking access as close to the data as possible. createRouteMatcher() is deprecated in favour of resource-based checks.docs · verified 2026-09-21
Account lockoutNew instances lock an account after 10 failed sign-in attempts (changed from 100 on July 6, 2026) for a one-hour cooldown; passwords, resets, backup codes, email and phone codes and TOTP count.docs · verified 2026-09-21

Documentation home: clerk.com/docs

What breaks in Clerk projects

10 patterns in the catalogue name Clerk; the most severe are listed here across secrets and keys, data access, login and permissions, payments. Attribution is descriptive: the default stack makes the pattern reachable, or a public incident names it.

Public incidents

Lovable reported that from 3 February to 20 April 2026 a backend regression let any logged-in Lovable user read the chat history and source code of public projects; a fix shipped within two hours.

  • 2026-02-03 to 2026-04-20 Exposure window
  • 2026-02-22 First HackerOne report
  • about 2 hours Time from public report to fix

Apr 2026 · Lovable · all sources

One education app built on Lovable had 16 vulnerabilities, 6 critical; a database function denied callers whose role was 'authenticated', so anonymous callers passed and 18,697 user records were readable without login.

  • 16 Vulnerabilities found
  • 6 Critical
  • 18,697 User records exposed
  • 14,928 Unique email addresses
  • 870 Enterprise users with full PII

Feb 2026 · Taimur Khan · all sources

On the Base44 app builder, undocumented registration and one-time-password endpoints accepted a non-secret app_id, so anyone could create a verified account on a private app; Wix fixed it within 24 hours.

  • 2025-07-09 Reported to Wix
  • 2025-07-10 Fix verified
  • under 24 hours Time to fix
  • 2025-07-29 Public disclosure

Jul 2025 · Wiz Research · all sources

Two days after announcing a SaaS built with Cursor and no hand-written code, its founder reported subscription bypasses, maxed-out API keys and unwanted database writes; he shut the app down three days later.

  • 2025-03-15 Launch announcement
  • 2025-03-17 Report of subscription bypass and API key abuse
  • 2025-03-20 Shutdown announcement

Mar 2025 · Leo (Enrichlead founder) · all sources

Each entry links to its primary source in the evidence list. What to do about it is the self-check below.

Clerk's own security features, and where they stop

Stated from the vendor's documentation. The limits are the vendor's scope statements, not judgements.

  • Bot sign-up protection

    Uses CDN signals to detect likely bots at sign-up and shows an interactive CAPTCHA challenge when suspected.

    Where it stops: The Native API setting opens a request path where CAPTCHA is bypassed even with bot protection enabled; custom flows must render the CAPTCHA widget themselves.

    vendor docs · verified 2026-09-21

  • Account lockout

    Tracks failed verification attempts across sign-in methods and locks the account; limits and duration are adjustable, with an indefinite option.

    Where it stops: The page states the behaviour applies if enabled on your instance; minimum configurable threshold is 5 attempts.

    vendor docs · verified 2026-09-21

  • Signed webhooks

    Webhooks are delivered by Svix and signed; verify with Clerk's verifyWebhook helper using the signing secret from the dashboard.

    Where it stops: The docs say to treat the payload as unsafe until you validate it; verification is the receiver's responsibility.

    vendor docs · verified 2026-09-21

  • Server-side token verification

    authenticateRequest() handles signature, expiry and authorized-party validation.

    Where it stops: Only protects endpoints where it is called; the middleware reference says to check authorization in the code that reads or mutates data.

    vendor docs · verified 2026-09-21

Check it yourself, in this order

The critical patterns first. Each uses the dashboard and your browser.

NEXT_PUBLIC_ prefix on a secret

  1. In your hosting dashboard (Vercel: Project, Settings, Environment Variables) or your .env files, list every variable whose name starts with NEXT_PUBLIC_.
  2. For each one, ask whether the provider calls that value secret, private, server or admin. Stripe secret keys, model provider keys, database passwords and Supabase service_role keys all fall in that group.
  3. Open the live site in Chrome, right-click, choose Inspect, open the Sources tab and press Ctrl+Shift+F. Search for the first few characters of each suspect value.
  4. A bad result is a NEXT_PUBLIC_ variable holding a server-only key, or a search hit for that key's value in a loaded script.

Secrets committed to the code repository

  1. Open your project on GitHub (or the code view in your builder) and look at the file list for .env, .env.local, .env.production, serviceAccountKey.json or firebase-adminsdk files.
  2. Use the repository search box and search for sk_live, sk-, service_role, BEGIN PRIVATE KEY and password=.
  3. If you have the code on your computer, run one command in the project folder: git log --all -p -S sk_live -- . | head. Any output means a live key has been committed at some point.
  4. On GitHub, open Settings, then Code security, and check whether Secret scanning shows alerts.
  5. A bad result is any env or key file in the file list, any search hit that shows a real key, or an open secret scanning alert.

Record ids accepted without an ownership check

  1. Create two accounts in your app and add one record, such as an order or a note, in each.
  2. In account A, open a record and copy its address from the browser bar, or open developer tools (right-click, Inspect, then Network) and copy the request that loads it.
  3. Sign in as account B in a private window and paste that address, or use Copy as cURL on the request and run it with account B's cookies.
  4. Try the same with an id one higher or lower than your own, and with the edit and delete actions.

A bad result is account A's record appearing for account B, or an edit or delete going through.

Clerk pre-launch checklist

10 checks, in the order we run them. Usable without buying anything.

Self-check tool

Answer questions about your setup and get the patterns that apply, ordered by severity. Runs in your browser; nothing is sent.

Run the self-check

Packages for Clerk projects

Pre-launch check

Start here

For founders about to let real users in.

$490

Report in 48 hours
  • Keys and secrets in the browser or repo
  • Who can read and change whose data
  • Login, roles and admin routes
  • Errors, retries and rate limits
  • Debug mode, headers, deploy path

What you receive

Security sweep

For anyone who wants the three riskiest areas checked fast.

$290

Report in 24 hours
  • API keys and secrets in the bundle
  • Row-level rules on every table
  • Cross-user data reads
  • Admin and hidden routes
  • Client-only permission checks

What you receive

All packages and prices. Every report includes a re-check after your fixes.

Questions about Clerk

clerk auth security review

We confirm the secret key is server-only, that every protected route and Server Action verifies the session with the SDK, and that authorization (roles, ownership) is checked after authentication. Clerk's docs state middleware is not where routes should be protected; we test the routes directly.

clerk protected routes not working

A common shape: the page checks auth but the Server Action or API route it calls does not, so a direct request bypasses the page. Call the endpoint with a second user's session and see what it returns.

clerk security

Clerk documents bot protection, account lockout after failed attempts, session token verification and organisation roles. Enable lockout and bot protection, then test your own authorization checks.