Firebase Security Rules: How to Check If Your Data Is Exposed
By Pouyan · Updated August 2026
If your AI-built app stores data in Firebase (Firestore or the Realtime Database), there's a specific, extremely common way it can be leaking everything: open Security Rules. It's the Firebase equivalent of the Supabase open-database problem, and it's just as easy to ship by accident and just as easy to fix once you know to look.
The Firebase config in your code is fine. The rules are what matter
Firebase apps ship a config object in the frontend, your apiKey, projectId, and so on. Seeing it in your page source is normal and safe: it only identifies your project, it doesn't grant access. What actually decides who can read and write your data is your Security Rules. So, exactly like Supabase, the exposed config isn't the danger, open rules are.
The "test mode" trap
When you create a Firestore database, Firebase offers "test mode." It's convenient during building because it lets anyone read and write your data, but it's meant to expire after 30 days, and apps constantly ship with it left on. A rule like this means your entire database is open to the public:
allow read, write: if true;
or one with a future expiry date. If you ever clicked "start in test mode," this is the first thing to check.
How to check your Firebase rules
- Open the Firebase console → Firestore Database (or Realtime Database) → Rules tab.
- Look for any rule that allows
readorwritewithif true, or arequest.time < timestampexpiry date that hasn't passed. Those are open to everyone. - Check both databases if you use both, Firestore and the Realtime Database have separate rules.
What safe rules look like
Secure rules tie access to who's logged in (request.auth) and restrict each person to their own data. For a collection where each document belongs to a user:
match /users/{userId} { allow read, write: if request.auth != null && request.auth.uid == userId; }
The principle: every rule's condition should depend on request.auth, never a blanket if true. Write rules per collection, and separately for reads and writes.
Not sure? Check it from the outside
You can work through the list above yourself, and this guide is meant to let you do exactly that. If you would rather have someone look at it, send me your app's address and I will go through it myself before we speak, then tell you what I found in half an hour. It is free, there is no pitch at the end, and if your app is in good shape I will tell you that.
For the wider list, see the how to check Supabase RLS.
Common questions
Is the Firebase config in my app supposed to be public?
Yes. The Firebase config object (apiKey, projectId, etc.) in your frontend is meant to be public, it identifies your project, it doesn't grant access. Access is controlled entirely by your Security Rules. So like Supabase, the exposed config isn't the danger; open rules are.
What does 'test mode' do in Firestore, and why is it dangerous?
When you create a Firestore database, Firebase offers 'test mode', which sets a rule allowing anyone to read and write your data for 30 days. It's meant for early prototyping, but apps frequently ship with it still on, meaning the entire database is open to the public. If you started in test mode, this is the first thing to check.
How do I check my Firebase rules?
In the Firebase console, open Firestore Database (or Realtime Database) → Rules. Look for anything that allows read or write with 'if true' or an expiry date in the future, those are open. Secure rules tie access to authentication, e.g. allow read: if request.auth.uid == resource.data.ownerId.
What do safe Firebase rules look like?
Rules that require a logged-in user and restrict each user to their own data. For example: 'allow read, write: if request.auth != null && request.auth.uid == userId'. The key is that access checks depend on request.auth (who's logged in), never a blanket 'if true'.
Not sure if yours is affected?
Send me your app's address. I'll look at it myself before we speak, then we take half an hour and I'll tell you what I found in normal words. Free, no pitch, and if it's in good shape I'll tell you that too.
Pouyan Ahmadpour · engineer · Amsterdam
Keep reading
- Is My AI-Built App Ready for Real Users? What Breaks First
The parts that only fail on the day you succeed.
- Is My Claude Code App Secure? What Agents Quietly Skip
What the agent built, and what it never mentioned it skipped.
- Is My Lovable App Secure? A Plain-English Safety Check
The checks that matter before you let real users in.
- Supabase Row-Level Security
The single most common way vibe-coded apps leak user data.
- The Vibe-Coding Security Checklist
12 checks between a working prototype and a safe product.
- My Vibe-Coded App Got Hacked
The calm, step-by-step response when the worst has happened.
- My Supabase API Key Is Exposed
Found your key in the code? Here's what's actually at risk.
- Is My Bolt App Secure? The Checks That Matter Before Launch
What to check on a Bolt.new app before real users arrive.
- Is My Replit App Secure? A Plain-English Safety Check
The Replit-specific gotchas, plus the universal checks.
- What Does It Cost to Secure a Vibe-Coded App?
What an audit and fixes actually cost, and what you get.