LeakPatrol › Guides

Is this API key safe in my frontend?

By LeakPatrol · Updated 23 October 2026

Paste a key or token below to see what it is and whether it's allowed in your app's frontend code (anything in a VITE_, NEXT_PUBLIC_ or REACT_APP_ variable ends up there). The check runs entirely in your browser: the key is never sent to us or anywhere else.

Nothing you type here leaves this page.

Public keys vs secret keys

Some keys are designed to be in the browser: they only identify your project, and the real protection lives somewhere else (Row Level Security in Supabase, domain restrictions in Google Cloud). Secret keys are different: whoever holds one can act as you, spend your money or read your data, and every visitor to your site can read your frontend code.

KeyStarts withIn the frontend?
Supabase anon / publishable keyeyJ… (role anon), sb_publishable_Yes, with RLS on every table
Supabase service_role / secret keyeyJ… (role service_role), sb_secret_Never
Stripe publishable keypk_live_, pk_test_Yes
Stripe secret keysk_live_, sk_test_, rk_live_Never
OpenAIsk-proj-, sk-Never
Anthropicsk-ant-Never
Firebase / Google MapsAIzaYes, if restricted to your site and APIs
AWSAKIA, ASIANever
Resend, SendGridre_, SG.Never

If a secret key was in your frontend

  1. Rotate it in the provider's dashboard. Removing it from your code isn't enough: it's already been downloaded.
  2. Move the call to a server, such as a Supabase Edge Function or an API route, that reads the key from a secret.
  3. Rename the variable so it doesn't start with VITE_, NEXT_PUBLIC_ or REACT_APP_.
  4. Set a spend limit for AI providers, and check their usage logs for anything you don't recognise.

Not sure which keys your live app is shipping? The free LeakPatrol scan reads every JavaScript file your site loads and lists any secret keys it finds (masked), plus public .env files and missing protections.

Check your app in a minute

Free, read-only, no sign-up. Every problem comes with a plain-English fix and a prompt for your AI tool.

Get the 10-point checklist

Every check we run on AI-built apps, with how to do each one yourself. Straight to your inbox.

Questions

Is the Supabase anon key safe in the frontend?

Yes. The anon (or publishable) key is meant to be public. Your data is protected by Row Level Security, so make sure RLS is enabled on every table with policies that only allow what each user should see.

Is the Supabase service_role key safe in the frontend?

No. The service_role key (and the newer sb_secret_ key) bypasses Row Level Security and can read and change your whole database. Keep it in Edge Functions or on a server only, and rotate it if it was ever exposed.

Is a Firebase API key a secret?

No. Firebase API keys starting with AIza are designed to be in the browser, but restrict them to your website and the APIs you use in Google Cloud, and protect data with Firebase security rules.

Does this tool send my key anywhere?

No. The check runs in your browser using only the key format. Nothing you paste is sent to LeakPatrol or anyone else.

More guides