Firebase Database Open to Everyone? Fix Test-Mode Security Rules
Firebase test mode leaves Firestore or the Realtime Database readable by anyone. How to check your rules and replace them with rules that require sign-in.
Updated 2026-10-28
The Firebase apiKey is public; the rules are your lock
The Firebase web config (apiKey, projectId, databaseURL) sits in your app's JavaScript, and that is expected. It identifies your project. It does not protect it. Firestore and Realtime Database security rules decide who can read and write.
How test mode bites
When you create a database in test mode, Firebase writes rules that let anyone read and write, sometimes with an expiry date. Many vibe-coded apps launch with those rules still in place. Rules that look like these leave your data open:
// Firestore
allow read, write: if true;
// Realtime Database
{ "rules": { ".read": true, ".write": true } }Safer starting rules
Require sign-in, and limit each user to their own documents. For Firestore:
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;
}
}
}Then check it
Publish the rules, test them in the Firebase console's Rules Playground, and try loading your data while logged out. You should get a permission error, not data.
Check your live app for free
If your page includes a Firebase config, Freedom Check makes a logged-out, shallow read of the Realtime Database (when the config has a databaseURL) and a one-document read of Firestore (when it has a projectId and apiKey), using only the public config already in the page, and reports whether data came back. It never writes.
The free scan shows how many issues turned up and explains the most serious one with a fix prompt. The full report is $19 one time, or $29/month for unlimited.
Run a free scan →See pricing