Is your Firebase Realtime Database publicly readable? Check it in one request
By Abbi Labs · Last updated 19 November 2026
Built with Firebase, Lovable, Bolt or FlutterFlow?
The Abbi Labs quick check scans your live app for leaked keys in its JavaScript, open Supabase tables, exposed .env/.git files, security headers, CORS, cookie flags and TLS certificate expiry, and tells you if it spots a Firebase Realtime Database. Verified full scans test whether that database is publicly readable. No sign-up for the quick check.
Why this keeps happening
Every Firebase web app ships a config object with apiKey, authDomain, projectId and, if it uses the Realtime Database, databaseURL. That's normal: the browser needs them. What protects the data is the database's security rules. If they say ".read": true at the root, or still have the test-mode rule, anyone who copies databaseURL from your JavaScript can download the database with a single request, no login, no app needed.
Check your own database (2 minutes)
- Find your database URL: the Firebase console → Realtime Database (top of the Data tab), or
databaseURLin your app's Firebase config. It looks likehttps://NAME-default-rtdb.firebaseio.comorhttps://NAME-default-rtdb.REGION.firebasedatabase.app. - From a terminal, signed out:
curl -s -o /dev/null -w "%{http_code}\n" "https://YOUR-DB-default-rtdb.firebaseio.com/.json?shallow=true"- 401 or 403: public read is blocked at the root. Still check the rules for open child paths (step 3).
- 200: the root is readable by anyone. Fix the rules now.
- In the console, open Realtime Database → Rules and look for
".read": true,".write": true,"now < ..."(test mode) or"auth != null"on per-user data.
Only test databases you own. A request that reads someone else's data is still reading someone else's data.
The fix: deny by default, allow per user
{
"rules": {
".read": false,
".write": false,
"users": {
"$uid": {
".read": "auth != null && auth.uid === $uid",
".write": "auth != null && auth.uid === $uid"
}
},
"public_posts": {
".read": true,
"$postId": {
".write": "auth != null && (!data.exists() || data.child('owner').val() === auth.uid)",
".validate": "newData.child('owner').val() === auth.uid"
}
}
}
}- The root denies everything. Rules cascade down, so a
truehigh up can't be undone lower down; keep grants as deep and narrow as possible. users/$uidis readable and writable only by that user.public_postsshows how to make one path public on purpose: readable by all, writable only by the post's owner, with.validateso nobody can set someone else as owner.- Publish in the console, or keep the rules in
database.rules.jsonand deploy withfirebase deploy --only database.
Verify
- Rules Playground: simulate an unauthenticated read of
/. It must be denied. - Simulate user A reading
/users/B. Denied. - Run the curl again: you should get 401 or 403.
- Assume anything that was public has been copied. Check what was stored there and tell affected users if it was personal data.
Fix it with AI
Paste this into Cursor, Claude Code, Lovable or Bolt:
My Firebase Realtime Database allows public read. Find every path the app reads or writes, list who should access each, and write database.rules.json that denies everything at the root (".read": false, ".write": false) and allows each user only their own path ("auth != null && auth.uid === $uid"). Never use ".read": true or ".write": true at the root, and don't treat "auth != null" as enough for per-user data. Make sure firebase.json references the rules file. Show me the rules and a Rules Playground test plan before deploying.Keep it that way
Rules get loosened during a late-night "permission denied" fix and nobody notices. Abbi Labs re-scans your live app and alerts you when something opens up: leaked keys, readable Supabase tables, exposed files, and on verified scans, a publicly readable Firebase Realtime Database.
FAQ
Is the Firebase apiKey in my JavaScript the problem?
No. The web apiKey and databaseURL are public by design: every visitor's browser needs them. Rotating the key doesn't protect anything. Your Realtime Database security rules are the only thing deciding who can read and write.
How do I know if my database is open?
Request the root as JSON without signing in: curl 'https://YOUR-DB.firebaseio.com/.json?shallow=true' (or your *.firebasedatabase.app URL). A 401 or 403 "Permission denied" means public read is blocked. A 200 with data means anyone can read it. shallow=true returns only the top-level key names, not the data under them. Only test databases you own.
What does "test mode" do?
Creating a database in test mode sets rules that allow anyone to read and write until a date about 30 days later. Apps often ship before anyone revisits them, and some builders replace the date rule with ".read": true to stop the errors.
Is "auth != null" enough?
Not for per-user data. Anyone can create an account in most apps, so "any signed-in user" is one sign-up away from public. Compare auth.uid to the owner of the path, as in the rules below.
Does this apply to Firestore too?
The same idea, different syntax: Firestore uses rules like allow read: if request.auth != null && request.auth.uid == userId; and its own test-mode expiry. This guide and the Abbi Labs check cover the Realtime Database.
What does the Abbi Labs check do?
On a verified full scan, if your site's JavaScript references a Realtime Database URL, it makes one read-only GET to <database>/.json?shallow=true with a short timeout. A 200 with data is reported as critical. It stores only yes/no and the number of top-level keys, never key names or data, and it never writes. The free quick check only tells you a database was detected.