Over-open rules
Firebase rules allow every read and write
Cataloged October 16, 2026 · Firebase · Cursor · v0 · Lovable · Bolt · Replit
Symptom
The app was created in Firebase Test mode, or the rules say allow read, write: if true. Anyone who knows the project can read and overwrite the data.
Root cause
Firebase's insecure-rules guide says the console offers Locked mode or Test mode. Test mode grants access to all users. The guide's open-access example is allow read, write: if true, and the comment in that example says never use it in production because anyone can overwrite the database. The same page says a deployed app is on the internet even if you think you are the only user. This applies when the generated app uses Cloud Firestore, Realtime Database, or Cloud Storage.
Before and after
The before rule is Firebase's documented open-access example. The after line is the owner check from this card's fix prompt. Adapt the field name.
Before
allow read, write: if true;
After
allow read, delete: if request.auth != null && request.auth.uid == resource.data.owner_uid;
Fix prompt
In this project's Firebase rules only, replace open rules.
For Cloud Firestore, start from owner checks rather than if true. Example shape, adapted to the real field name:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /items/{id} {
allow read, delete: if request.auth != null && request.auth.uid == resource.data.owner_uid;
allow create: if request.auth != null && request.auth.uid == request.resource.data.owner_uid;
allow update: if request.auth != null
&& request.auth.uid == resource.data.owner_uid
&& request.auth.uid == request.resource.data.owner_uid;
}
}
}
Do the same for Storage paths. Deploy the rules to your own project. Do not leave if true on production data.Paste this into the coding tool that has your own project open.
2-minute self-check
These steps are for an app you own. Do not run them against someone else's project.
- In your own Firebase console, open Rules for Firestore, Realtime Database, and Storage.
- Confirm production rules are not allow read, write: if true, and not ".read": true / ".write": true.
- Use the Rules Simulator in your project as a signed-out user. Reads and writes of private documents should be denied.
Common questions
What does allow read, write: if true mean?
Firebase's insecure-rules guide uses that rule as the open-access example, and the comment on the example says never use it in production because anyone can overwrite the database. Test mode grants access to all users. A deployed app is on the internet even if you think you are the only user. This applies to Cloud Firestore, Realtime Database, and Cloud Storage.
What should the Rules Simulator show for a signed-out user?
Reads and writes of private documents in your own project should be denied. Production rules should not be allow read, write: if true, and Realtime Database rules should not be ".read": true or ".write": true. The fix prompt's example compares request.auth.uid to the owner field. Adapt the field name.
Longer guide
- Firebase security rules allow read, write if true: check your own project
What Firebase's open rules and the CLI's 30-day Firestore template allow, what one public-web scan counted, and a check you run only on a project you own.