Is My Firebase API Key Safe to Expose?
Short answer: usually no, it is not a leak. The Firebase apiKey is meant to be public. But that only holds if your Security Rules are set up right, and that is the part AI-built apps often get wrong.
Check your live app for free
Paste your link. The free summary usually takes under a minute.
See an example report (for example.org) · a real free scan of a test site, so you can see what you get
Why the Firebase key isn't a secret
Firebase's own docs say its API keys are "Public by design" They only tell Firebase which project and app a request is for. They do not decide who can read or change your data (Firebase: Learn about API keys).
The same page says that if your setup follows their advice, keys restricted to Firebase services "do not need to be treated as secrets, and it's safe to include them in your code or configuration files."
So who decides what people can do with your data? Firebase says: "Security of your Realtime Database, Cloud Firestore, and Cloud Storage data is enforced using Firebase Security Rules, and protection of covered APIs is by Firebase App Check — not by keeping your Firebase API key secret" (same page).
When it is a problem
The key being public is fine. These things are not:
- Open rules. If your rules say
allow read, write: if true;, Firebase warns that anyone who guesses your project ID "can steal, modify, or delete the data" (Firebase: Avoid insecure rules). Your project ID is in the same public config as the key, so it doesn't take much guessing. - "Any signed-in user" rules. A rule like
allow read, write: if request.auth.uid != null;lets every logged-in user read and change everything. Firebase lists this as a common mistake. It says: "If one of your rules includesauth != null, confirm that you want any logged-in user to have access to the data" (same page). - Test mode left on. When you create a database, Firebase lets you "deny access to all users (Locked mode) or grant access to all users (Test mode)." Firebase says to "properly configure your rules and secure your data before deploying your app" (same page).
- Other Google keys mixed in. Firebase says: "Use your Firebase-provisioned API keys only for Firebase-related APIs." If your app uses other APIs, such as Maps or the Gemini Developer API, "use a separate API key and restrict it to the applicable API." And: "The API key that you use for calls to the Gemini Developer API in your app should never be included in your code or configuration files" (Firebase: Learn about API keys).
Why AI-built apps get caught out
AI app builders are great at getting Firebase working fast. The quickest way to make "it works" is often open rules or test mode. The app looks fine to you, because you are the only user. But once it's live on the internet, anyone can use the same public config to talk to your database.
How to check your own app
- Look at your rules. In the Firebase console, open Firestore, Realtime Database or Storage and click Rules. Firebase says "the Firebase console always shows the most recently deployed version of your Firebase Security Rules" (Firebase: Avoid insecure rules). Look for
if true,".read": true,".write": true, or rules that only checkauth != null. - Check your keys in Google Cloud. Firebase says you can see all your keys and their limits on the APIs & Services > Credentials page of the Google Cloud console. Make sure the key in your app is only allowed to use Firebase APIs, and does not have the Generative Language API on its list (Firebase: Learn about API keys).
- Run a free scan. Paste your URL into the box at the top of this page. The rest of what the scan can and can't see is below.
How to fix it
Ask your AI builder to tighten things up. You can paste something like this:
Review my Firebase Security Rules for Firestore, Realtime Database and Storage. Remove any rule that allows read or write for everyone (such as `allow read, write: if true`). Require sign-in, and only let each user read and change their own data (for example `request.auth.uid == userId`). Don't use rules that only check that someone is signed in. Then tell me how to turn on Firebase App Check.Then:
- Test your rules with the Firebase Rules Simulator or the local emulator before you publish them (Firebase suggests both on the insecure rules page).
- Move any non-Firebase Google API to its own restricted key.
- Keep AI keys, like an OpenAI or Gemini key, on a server, never in front-end code. See Is my Gemini API key safe in my app?.
What the rooGBotVC scan checks
Paste your URL in the box at the top. The scan looks at your app's public JavaScript the way a visitor would.
- If it finds a Firebase config, it shows an info finding called Firebase config found: check your Security Rules. That is a reminder to check your rules. It is not a test of them.
- It also flags real secret keys (like OpenAI or Stripe secret keys) if they've ended up in your public code. Found keys are shown with most of the key hidden.
What the scan can't do:
- It does not log in to or test your database.
- It does not open your Firebase console or read your Security Rules.
- It can't see your Google Cloud settings, so it can't tell whether a key is restricted.
Quick recap
- Your Firebase
apiKeyin public code is normal and not a leak by itself. - Your Security Rules are what protect your data. Open rules mean anyone can read or wipe it.
- Use the Firebase key only for Firebase, and keep AI keys off the front end.
- Check your rules, check your key limits, and run a free scan.
Related reading
- Are my Firebase Security Rules leaving my data open?: how to spot open or "any signed-in user" rules, and how to tighten them.
- Is my Google Maps API key safe to expose?: the Google key that is meant to be public, if you lock it down.
- Is my Gemini API key safe in my app?: a Google key that must stay on the server.
- Exposed API keys: what to do when a real secret key leaks.
Related guides
rooGBotVC is an automated, read-only check of what any visitor can see. It is not a full security audit and it does not test your database. Not affiliated with Firebase, Google, Lovable, Bolt, Cursor, Replit or v0.