Home › Security notes › Firebase security rules left in test mode
Weekly security note
Firebase security rules left in test mode
What it is
Firebase projects often start with test-mode rules so you can build quickly. Those rules allow anyone to read and write the database. If they're never replaced, the live app keeps them.
Why it's risky
Your Firebase config is public and ships in your frontend. With open rules, anyone can use it to read every document, change data, or delete it.
This applies to Firestore, the Realtime Database and Cloud Storage, each of which has its own rules.
How to check
- In the Firebase console, open Firestore Database (and Realtime Database and Storage, if you use them) and go to the Rules tab.
- Look for rules like allow read, write: if true; or a time-based rule such as if request.time < timestamp.date(...).
- Use the Rules Playground to simulate an unauthenticated read.
Example
// Example of an open (unsafe) Firestore rule
match /{document=**} {
allow read, write: if true;
}
Or run a free scan. It checks your app's public surface for this and other common exposures.
How to fix it
- Replace the open catch-all rule. Remove any match /{document=**} rule that allows everyone.
- Require sign-in and scope access to each user's own data.
Example
// Example Firestore rules rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /users/{userId} { allow read, write: if request.auth != null && request.auth.uid == userId; } } } - Write explicit rules for any shared or public collections, and allow only the operations you need.
- Test with the Rules Playground or the Firebase emulator, then publish the rules.
After you fix it
If your data was open, review it for changes you didn't make. Consider enabling App Check to limit access to your own app.
Re-run a scan to confirm the database no longer answers without auth.
To catch it if this comes back, Warditor Monitor re-scans your app every 6 days for $19/month.
FAQ
Is my Firebase config (apiKey) a secret?
No. Firebase web config is meant to be public. Security comes from your rules.
Test mode had an expiry date. Isn't that enough?
No. Until it expires, anyone can read and write, and many projects extend or remove the date to keep the app working.
Do Storage rules need fixing too?
Yes. Cloud Storage has its own rules, separate from the database.
Does Warditor change my data?
No. The scan only checks whether data answers without auth. It never writes, and it doesn't keep what it reads.
Scan your app free
Look-only check of what any visitor can already see. No login, no changes to your app.
Scan your app freeNeed help fixing it? See Fix Pack, Monitor and Shield.
More security notes
- Row-level security turned off on a Supabase table
- A secret API key shipped in frontend code
- A public .env file or .git folder on a live site
This page describes a generic mistake pattern. It is not about any specific app, site or person.