My Clerk key leaked. What do I do?
The Clerk Secret Key (sk_live_…) gives full Backend API access: list, edit and delete users and impersonate sessions. Rotate it in the Clerk Dashboard's API keys page, update CLERK_SECRET_KEY on every server, then review users and sessions for changes. The Publishable Key (pk_live_…) is public by design.
Last updated 2026-11-25 · Reviewed by ProofForge
Is it this key?
Format: Secret sk_live_ / sk_test_ (server only). Publishable pk_live_ / pk_test_ (public by design).
Blast radius: Backend API access to your entire user base: user data, metadata, sessions, organizations.
The first 10 minutes
| When | Do | How |
|---|---|---|
| 0–3 min | Add key | Clerk Dashboard → select the app and environment → API keys → Secret keys → Add new key. It's shown once, so copy it now. |
| 3–5 min | Swap & delete | Set CLERK_SECRET_KEY on every server, redeploy and verify, then delete the leaked key. |
| 5–8 min | Audit | Review recently created or changed users, admin metadata changes and active sessions. Revoke suspicious sessions. |
| 8–10 min | Close the hole | Remove the key from client code and history. Only NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY belongs in the browser. |
Stop the next leak
- Keep the key in a server-side env var. Never use a
VITE_,NEXT_PUBLIC_orEXPO_PUBLIC_variable or hard-code it in frontend code. - Call the provider from your backend or an edge function, and add
.env*to.gitignore. - Re-scan the live site after every deploy. Keys also leak through JS bundles, source maps and exposed
.envor.gitpaths.
Check your live app
A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.
FAQ
Is my publishable key a leak?
No. pk_ keys are designed for the frontend.
Can I have more than one secret key?
Yes. Clerk supports multiple active secret keys. Use one per consumer (production host, CI) so one leak means rotating one key.
How did it end up public?
Usually a NEXT_PUBLIC_ / VITE_ prefix on the secret key, or a committed .env.