Guide · Keys

Is my API key exposed, and does it matter?

Short answer: Some keys are meant to be in your website and some must never be. A Firebase apiKey, a Supabase anon or publishable key, and a Stripe pk_ key are public by design: your database rules do the protecting. A Supabase service key, a Stripe sk_live_ key, an OpenAI or Anthropic key, a cloud key or a database password in browser code is a breach: anyone can copy it and use it as you. If you find one, rotate it today and move the code that uses it to your server.

Updated 25 October 2026

Which keys may be public

Which keys may be public
KeyLooks likeIn the browser?
Firebase web config keyAIza…Fine, if your Security Rules are strict and the key is restricted in Google Cloud
Supabase anon / publishableJWT with role anon, or sb_publishable_…Fine, if Row Level Security is on
Stripe publishablepk_live_…, pk_test_…Fine
Supabase service keyJWT with role service_role, or sb_secret_…Never: skips every database rule
Stripe secret / restrictedsk_live_…, rk_live_…Never: can refund, pay out, read customers
AI provider keyssk-…, sk-proj-…, sk-ant-…Never: strangers run up your bill
Cloud and code keysAKIA…, ghp_…, github_pat_…Never
Database address with passwordpostgres://user:pass@…Never: direct access to all data

What to do, step by step

Here is how to tell the two apart and what to do about each.

  1. Search what your site ships

    Open the site, press F12, go to Sources (or Debugger) and search all files for the prefixes in the table. Also search your repository for NEXT_PUBLIC_, VITE_, REACT_APP_ and EXPO_PUBLIC_: every variable with one of those names is copied into the browser at build time.

  2. Rotate, don't just delete

    Removing the key from the code is not enough. It is already in old builds, caches and your git history. Create a new key at the provider, switch your server to it, and revoke the old one. Then check the provider's logs or bill for use you don't recognise.

  3. Move the call to the server

    Anything that needs a secret key (charging a card, calling an AI model, writing as admin) belongs in an API route, a server action or an edge function. The browser asks your server; your server holds the key.

  4. Lock down the public keys

    Restrict a Firebase or Google key in Google Cloud Console to your domains and the APIs you use. Write Firebase Security Rules that check request.auth, and consider App Check. For Supabase, check Row Level Security.

  5. Stop it happening again

    Turn on GitHub secret scanning and push protection, and run gitleaks over the repository's history once. Keep secrets in your host's environment settings, never in the code.

What vibeship checks for you

You can do all of the above by hand. If you'd rather start with a list of what's wrong, the vibeship quick check runs from outside, the way a stranger sees your site. The quick check is free and needs no account. It shows your grade and how many problems sit in each area; what each problem is and how to fix it is in the full report.

Checked automatically

  • Reads the page and up to twelve scripts every visitor downloads, looking for the secret keys in the table above
  • Tells public keys apart from secret ones, so a Firebase or Stripe publishable key is not reported as a leak
  • When it finds a Supabase or Firebase backend, checks whether a stranger can count rows in sensitive tables (it never reads a row)
  • Never stores or shows the key it finds: the report names the kind of key and the script it sat in

Deeper, and what we don't check

  • With a subscription and our GitHub app: your whole repository history, scanned for committed keys
  • On request only: whether a found key still works, so you know which to rotate first
  • Not checked: keys only used by a mobile app, or keys loaded after sign-in

Questions people ask

Is it safe that my Firebase API key is visible?

Yes, Firebase's own documentation says the web API key is not a secret. It identifies the project. What protects your data is your Security Rules, so check those, and restrict the key to your domains.

I deleted the key from my code. Am I safe now?

No. Anyone who loaded the site before still has it, and it stays in your git history. Rotate it at the provider so the old one stops working.

Are environment variables secret?

Only the ones that stay on the server. Variables starting with NEXT_PUBLIC_, VITE_ or REACT_APP_ are written into the browser code on purpose.

How fast are leaked keys abused?

Fast. Automated scanners watch public code and websites for cloud and AI keys, and reports of abuse within minutes of a public push are common. Treat a leaked key as already used.

Best effort, not a guarantee: Our scans are best effort: they can miss a weakness or flag one that isn't there. This is advice, not a guarantee, and it doesn't replace a security firm. Your site's safety stays your responsibility. Read the terms.

Related guides