Abbi Labs

Guides

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.

Scan your app free →

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)

  1. Find your database URL: the Firebase console → Realtime Database (top of the Data tab), or databaseURL in your app's Firebase config. It looks like https://NAME-default-rtdb.firebaseio.com or https://NAME-default-rtdb.REGION.firebasedatabase.app.
  2. From a terminal, signed out:
curl -s -o /dev/null -w "%{http_code}\n" "https://YOUR-DB-default-rtdb.firebaseio.com/.json?shallow=true"
  1. 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"
      }
    }
  }
}

Verify

  1. Rules Playground: simulate an unauthenticated read of /. It must be denied.
  2. Simulate user A reading /users/B. Denied.
  3. Run the curl again: you should get 401 or 403.
  4. 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.

Run a free scan

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.

Related

Weekly AI-app security checklist

One short email a week: a practical check for apps built with Supabase, Next.js and AI tools (RLS, leaked keys, headers and more). Unsubscribe anytime.