Is Firebase secure?
Published 21 October 2026 · 6 min read
Yes — Firebase is secure, when it's configured correctly. Google runs the infrastructure, encrypts your data, and gives you a powerful system called Security Rules to control who can read and write what. The platform itself is not the weak point.
The problem is that Firebase trusts you to write those rules. And the single most common mistake — leaving your database in "test mode" — makes every record you store readable and writable by anyone on the internet. If you built your app quickly and never touched the rules, this article will help you find out whether your data is actually protected or wide open.
Why your Firebase config is public (and why that's fine)
First, clear up a myth. Your Firebase config object — the one with apiKey, projectId, and your database URL — ships inside your app's front-end code. Anyone can open their browser's developer tools and read it. This is by design and it is not a leak.
That config isn't a password. It just tells the browser which project to talk to. The thing that actually protects your data is your Security Rules, which run on Google's servers every time someone tries to read or write. Because the config is public, your rules are the only line of defence. If the rules say "allow everyone," then everyone is allowed — config in hand, no hacking required.
The "test mode" disaster
When you create a Firestore or Realtime Database, Firebase offers a quick-start option often called test mode. It drops in rules that look roughly like this:
allow read, write: if true;— Firestore, meaning anyone can read and write anything.{ "rules": { ".read": true, ".write": true } }— the Realtime Database equivalent.
Test mode is meant to last a few days while you build. But projects ship, deadlines hit, and these rules quietly stay in place. The result: anyone who finds your public config — or just guesses your project's database URL — can download every user record, every email address, every private note, and can also overwrite or delete your data. No login required.
How Security Rules actually work
Security Rules are a small set of conditions that Firebase checks on the server for every single request. They sit between the request and your data, and they can't be bypassed from the client. The key building blocks are:
- The path — which collection or document the rule applies to (for example, a user's own profile).
- The operation — read, create, update, or delete.
- The condition — a true/false check that must pass. If it's false, Firebase rejects the request.
The most important variable you'll use in a condition is request.auth. When a user signs in through Firebase Authentication, Firebase knows who they are, and request.auth.uid holds their unique ID. Your rules can use that to make sure people only touch their own data.
The auth-based patterns to use instead
Good rules start by assuming nothing is allowed, then open up access deliberately. A few patterns cover most small apps:
- Require a login for everything:
allow read, write: if request.auth != null;. Better than test mode, but note that any signed-in user can still see everyone's data. - Lock records to their owner:
allow read, write: if request.auth.uid == resource.data.ownerId;. This is the pattern most apps actually want — users only read and write rows that belong to them. - Read-only public data: allow
readfor everyone but restrictwriteto the owner, for things like public listings or profiles.
Rules can also validate the shape of incoming data, but for most founders the owner-check pattern above is the one that closes the big hole.
How to check your own rules right now
You don't need to be technical to do this. Take five minutes:
- Open the Firebase Console, select your project, and go to Firestore Database (or Realtime Database) → the Rules tab.
- Look for the words
if true,".read": true, or".write": true. If you see them with no other conditions, your database is open to the public. Fix this first. - Firebase often shows a warning banner like "Your security rules are defined as public" — if that banner is there, believe it.
- Use the built-in Rules Playground in the console to simulate an unauthenticated read. If a request with no login succeeds on your private data, your rules aren't doing their job.
- Don't forget Firebase Storage — uploaded files have their own separate rules, and they ship in test mode too.
Is your Firebase app exposed?
Run Faultline's free surface scan on any app in seconds. (Deep data-exposure scanning is live for Base44, with more platforms rolling out.)
Run a free scanThe bottom line
Firebase is as secure as the rules you write. The platform gives you everything you need to lock data down to the right person — but it ships with the door unlocked so you can move fast during development. If you never went back and changed it, now is the time. Check the Rules tab, kill any if true, and make sure every path requires the right user. That one change is the difference between a secure app and a public database.
Related: Broken access control, explained · The no-code security checklist