Over-open rules
Any signed-in Firebase user can read the whole database
Cataloged October 16, 2026 · Firebase · Cursor · v0 · Lovable · Bolt
Symptom
Signed-out visitors are blocked. Any account, including one you just created, can read and write every document.
Root cause
Firebase documents a second insecure pattern: rules that only check request.auth.uid != null, or auth.uid !== null, and then allow read and write on the whole database. The guide says if a rule includes auth != null, confirm you actually want every logged-in user to have that access. The fix it shows is to narrow the condition with an owner id or a role, not to stop at "someone is signed in."
Before and after
Firebase documents the before rule as too wide when it is the only condition on private documents. Narrow it so the owner matches.
Before
allow read, write: if request.auth != null;
After
allow read: if request.auth != null && request.auth.uid == resource.data.owner_uid;
Fix prompt
In this project's Firebase rules, find allow read, write: if request.auth != null and Realtime Database rules that only check auth.uid !== null. Replace them so the path or document owner must match request.auth.uid. Do not treat a role field on a document the user can edit as proof of admin. Put admin claims in custom claims or in a document the user cannot write. Deploy to your own project and simulate user B reading user A's document. It must be denied.
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.
- Open the rules for your own Firebase project and search for auth != null and auth.uid !== null.
- If that is the only condition on a collection of private documents, the rule is too wide.
- In the Rules Simulator, as a second test user in your project, request another user's document. It should be denied.
Common questions
Signed-out visitors are blocked, but a brand-new account can read every document. Which rule is that?
Firebase documents rules that only check request.auth.uid != null, or auth.uid !== null, and then allow read and write on the whole database. If a rule includes auth != null, confirm you actually want every logged-in user to have that access. Signing in is not the same as owning the document.
Can I store an admin flag on the document the user can edit?
No. The fix prompt says not to treat a role field on a document the user can write as proof of admin. Put admin claims in custom claims or in a document the user cannot write. In the Rules Simulator, as a second test user, a read of another user's document should be denied.
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.