Abbi Labs

Tools · Guides

Is this API key safe in the frontend? (free checker)

By Abbi Labs · Last updated 19 November 2026

Some keys are made to ship in your JavaScript. Others give whoever copies them your database, your Stripe account or your AI bill. Paste one below to see which kind it is, where to rotate it, and what to do next. Supabase keys are decoded on the spot to show their role and expiry.

Checked in your browser. The key never leaves this page: no request, no logging, no analytics. You can turn off Wi-Fi and it still works.

Public by design vs rotate now

Fine in the frontendServer only (rotate if it leaked)
Supabase anon JWT, sb_publishable_Supabase service_role JWT, sb_secret_, sbp_ access tokens
Stripe / Clerk pk_live_, pk_test_Stripe sk_live_, rk_live_, whsec_ (test-mode sk_test_ too)
Firebase web apiKey, Maps JS keys (restrict by referrer)The same AIza format used for Gemini or server APIs
Mapbox pk., PostHog phc_, Sentry DSNOpenAI sk-, Anthropic sk-ant-, Groq, xAI, OpenRouter, Replicate
AWS AKIA, GitHub ghp_, Resend re_, SendGrid SG., Slack xox, private keys, database URLs with a password

If it says "Rotate now"

  1. Rotate the key first — deleting it from code does not un-leak it. The old key works until you revoke it, and bots copy keys from public sites and repos within minutes.
  2. Put the new key in a server-only environment variable (no NEXT_PUBLIC_, VITE_, PUBLIC_ or EXPO_PUBLIC_ prefix) and call the provider from a server route or edge function.
  3. Check the provider's usage or audit log for activity you don't recognise, and set spend limits on AI keys.
  4. Scan your live site to make sure no other secret is still in your bundles.

Step-by-step guides: Supabase service_role key exposed, AI API key exposed in the frontend, NEXT_PUBLIC_ and VITE_ variables.

Find every key your live site ships

One key at a time is useful; your bundle may hold more. The free Abbi Labs quick check reads the JavaScript your site serves, flags secret keys (masked, never stored in full), and tests whether your Supabase tables are readable with the public key. Read-only, no sign-up.

No sign-up. Read-only public-resource and protocol metadata checks. No model prompts or tool execution. Scan only sites you own or are allowed to test.

Run on every deploy or use from Cursor / Claude Code via MCP →

FAQ

Do you send or store the key I paste?

No. The check runs in JavaScript on this page. The key isn't sent to Abbi Labs or anyone else, isn't logged, isn't saved, and isn't included in analytics. You can disconnect from the internet after the page loads and it still works.

Is the Supabase anon key safe to put in my frontend?

Yes, it's designed for that, and so is the newer sb_publishable_ key. They only get what your Row Level Security policies and grants allow signed-out users. The danger is a table with RLS off or a using (true) policy, not the key itself.

Is the Firebase apiKey a secret?

No. The apiKey in the Firebase web config identifies your project; it doesn't protect data. Your Firestore, Realtime Database and Storage security rules do. Restrict the key by HTTP referrer anyway, and make sure your rules don't allow public reads.

I leaked a secret key. Is deleting it from my code enough?

No. Rotate the key first — deleting it from code does not un-leak it. Bots scrape public sites and GitHub for keys within minutes, and the old value keeps working until you revoke it at the provider. Then move it to a server-only environment variable.

Why are NEXT_PUBLIC_ and VITE_ variables a problem?

Anything with those prefixes is copied into the JavaScript every visitor downloads. They're fine for publishable keys and wrong for secrets. If a secret key ever had one of those prefixes, treat it as leaked.

How do you decode a Supabase key?

Legacy Supabase keys are JWTs. The middle part is base64-encoded JSON, so the page decodes it locally to show the role (anon or service_role), project ref, and issue and expiry dates. It doesn't verify the signature, and it never calls Supabase.

Related

Weekly AI-app security checklist

One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.