Guides
Sign in

Guide · Leaked keys and files

Is your Firebase database still in test mode? Check your security rules

Every Firebase web app ships its config, the API key and project ID, in its public JavaScript. That’s by design, as the config isn’t a password. Your security rules are what protect your data. A rule that says yes to everyone leaves your database or your files open to anyone who finds your project. Our checker can see that you use Firebase. But it can’t see your rules, so this one is yours to check.

Why a public config is fine

Firebase’s own docs say its API keys “are OK to include in code or checked-in config files”, because they aren’t used to control access to your data (Firebase docs). They tell Firebase which project you mean. Security Rules decide who can read and change what, with one set each for Cloud Firestore, Realtime Database and Cloud Storage (Firebase docs).

So hiding the config doesn’t help, and showing it isn’t the problem. Rules that let everyone in are.

The rules that leave your data open

  • allow read, write: if true; lets anyone read and change the data. Firebase warns about it: “NEVER use this rule set in production; it allows anyone to overwrite your entire database” (Firebase docs).
  • Test mode. When you create a database you choose Locked mode, which denies everything, or Test mode, which allows anyone access (Firebase docs). It’s for trying things out, not for launch.
  • Only checking that someone is signed in (if request.auth != null). Firebase marks this “Not recommended”: any signed-in user can then read and write everything it covers (Firebase docs). If your app allows anonymous sign-in, that’s anyone, with no account at all.
  • Realtime Database rules set to true (".read": true). Its rules cascade: a rule grants access to its path and every path under it (Firebase docs), so one near the top can open the whole database.
  • Storage rules. Cloud Storage has its own rules, separate from your database’s. So locking Firestore leaves your uploaded files exactly as open as they were.

How do I check my rules?

  1. Open the Firebase console and your project. Firestore’s rules are under Databases & Storage › Firestore › Rules. Storage’s are under Storage › Security Rules, and Realtime Database’s under Realtime Database › Rules.
  2. Read every allow line, and every ".read" and ".write". Look for if true, a rule that only checks request.auth != null, and anything set to true.
  3. Try a change in the Rules Playground before you publish it (Firebase docs). It tests the rules in your editor, not the ones already live.

If your project keeps its rules in a file such as firestore.rules, deploying from the command line overwrites the rules in the console (Firebase docs). So fix the file too. And if Firebase ever alerts you that your Cloud Firestore database isn’t properly secured, treat it as Fix now.

Fix it

Prompt for Lovable, Bolt, Cursor or Claude Code

My app uses Firebase. Check my Firestore and Storage security rules. Make sure nothing allows read or write for everyone (if true) and that users can only reach their own documents. Show me the corrected rules. Then write a test with two accounts: signed in as the first, try to read, change and delete the second one’s documents and files, and expect each to be refused.

“Only their own documents” usually means a rule like this one, from Firebase’s docs: a signed-in user can read and write documents under their own user ID, and nobody else’s (Firebase docs).

Firestore rule, from Firebase’s docs

match /some_collection/{userId}/{document} {
  allow read, write: if request.auth != null && request.auth.uid == userId
}

Your collections will have their own names. And data meant for everyone, like a public product list, needs a read rule of its own. Ask your AI tool to explain each rule it writes, then test it in the Rules Playground.

Why it matters

In July 2025 the Tea app said “a legacy data storage system was compromised”, exposing “approximately 72,000 images, including approximately 13,000 selfies and photo identification submitted by users” (Tea’s statement, via Simon Willison). Willison describes it as a legacy unprotected Firebase cloud storage bucket, and is confident vibe coding wasn’t to blame. The lesson is older than AI tools: storage left open by default stays open until someone checks.

What this can’t tell you

We look for signs of Firebase in your page and scripts: a firebaseapp.com or firebaseio.com address. We never read your rules or try your database, as that would mean reaching into your data. So this line is always Check yourself, never Clear. Server code that uses Firebase’s Admin SDK skips your rules altogether, so it needs its own checks.

Related