Guides · Updated Oct 15, 2026 · By Lucy at KeySnare

How to check your Firebase security rules before launch

Firebase apps talk to the database straight from the browser, so your Security Rules are the only thing standing between your data and the internet. Rules left in test mode or set to allow everything are one of the most common launch mistakes.

Red flags to look for

Open firestore.rules, storage.rules or database.rules.json (or the Rules tab in the Firebase console) and look for:

// Firestore / Storage: anyone can read and write
allow read, write: if true;
allow read, write;

// "Test mode": open to everyone until a date
allow read, write: if request.time < timestamp.date(2026, 11, 1);

// Realtime Database
{ "rules": { ".read": true, ".write": true } }

Test mode rules are open to everyone until the date passes, then they block everything. Both are wrong for a live app.

How to check, step by step

  1. In the Firebase console, open Firestore Database → Rules (and Storage → Rules, Realtime Database → Rules if you use them).
  2. Read every allow line. Each one should check request.auth and, for personal data, that the user owns the document.
  3. Use the Rules Playground on the Rules tab to simulate an unauthenticated read of a private document. It should be denied.
  4. For a full test, run your rules in the Firebase Local Emulator Suite before deploying.

A safe starting point

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId}/{document=**} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
    }
  }
}

Anything not matched by an allow rule is denied, so add rules only for the collections your app needs.

KeySnare checks this automatically. If your repo includes Firebase rules files, KeySnare flags rules that allow anyone to read or write. Rules edited only in the console aren't visible to the scan.

Copy-paste prompt for your AI coding tool

Paste this into Cursor, Claude, Lovable, Bolt or whichever AI built your app:

Review my Firebase Security Rules (Firestore, Storage and Realtime Database). Remove any rule that allows reads or writes without authentication, including test-mode date rules. Rewrite them so every collection requires request.auth and users can only read and write their own documents, with validation on the fields they write. Explain each rule in plain English and show me how to test it with the Rules Playground and the Firebase emulator.

Check your repo in about a minute

Paste a public GitHub repo into KeySnare for a free grade and your top 3 issues, each with a copy-paste AI fix prompt.

Run a free scan →

FAQ

Is the Firebase web config (apiKey) a secret?

No. The Firebase web config is meant to be included in your app. Security comes from your Security Rules and, optionally, App Check.

What is Firebase test mode?

A starter rule that allows all reads and writes until a set date. It is meant for development only and must be replaced before launch.

How do I test my rules?

Use the Rules Playground in the Firebase console for quick checks and the Firebase Local Emulator Suite for automated tests.

Does a KeySnare scan see rules changed in the console?

No. KeySnare only scans rules files committed to your repo.

More guides: Is my Supabase app safe? How to check Row Level Security · How to hide API keys in Lovable, Bolt and Cursor apps · NEXT_PUBLIC_ and VITE_ variables: why your secret keys are public · Vibe-coded app security checklist: 12 checks before you launch