My Firebase rules allow everyone. How do I fix them?
Short answer: replace public read/write rules with checks for authenticated identity, resource ownership, and the exact operations each feature needs. This guide explains what to verify and what the public scan cannot prove, without logging in, changing records, or treating an inconclusive response as a pass.
What the open Firebase Security Rules check covers
A rule that grants access to everyone can expose or alter data through the Firebase client APIs. The impact depends on the matched path, service, operations, and whether the rule is currently deployed.
The finding describes a public condition, not proof that someone has abused it. First preserve the relevant deployment details, then rotate exposed credentials or close the access path before investigating billing, logs, or affected records.
Firebase web configuration can be public; Security Rules enforce access. Review Firestore, Realtime Database, and Storage separately because each service has its own rules syntax and deployed ruleset.
Understand the evidence before changing code
List the collections or paths and define which roles need read, create, update, and delete. Avoid broad recursive matches unless every descendant is intended to share the same access policy.
Severity reflects potential impact and reach, not certainty of exploitation. A public key can be intentionally visible; the important distinction is what the provider allows that key to do and which server-side policy still applies.
Apply the narrow, safe change
Use authenticated identity and resource ownership checks where appropriate. Validate new data with rule conditions, and avoid using request.auth != null as the only rule when users should see only their own records.
match /users/{userId}/private/{docId} {
allow read, write: if request.auth != null
&& request.auth.uid == userId;
}Prefer the smallest repair that restores the intended boundary. Keep public client configuration public, move privileged operations behind an authenticated server route, and make data rules depend on the authenticated owner or an explicit role.
Verify the production result
Test with the Firebase Emulator Suite or rules unit tests as anonymous, as the owner, and as another user. Deploy the reviewed rules, then confirm the production project uses the expected ruleset.
Use the snippet as a starting point, not a blind migration. Confirm the real table, environment, route, identity claim, and deployment platform first; a copied policy with the wrong owner field can block legitimate users or expose the wrong records.
Keep the issue from returning
Keep rules in version control, run tests in CI, and review each new collection or bucket. A generated client feature should not silently widen access to existing data.
Verify the repair from the same public vantage point that exposed it. Check the deployed response, confirm the finding is gone, and test the intended signed-in user and an unrelated user through the normal application flow.
Limits and next steps
A public scan cannot test every query shape or authenticated claim. Use service-specific rules tests and inspect the deployed rules before declaring the backend secure.
Prevent recurrence with a reviewed migration, a secret scanner, and a small regression test that runs before deploy. Store only the minimum required credential, scope it to one project, and define who can rotate it.
A public scanner cannot establish whether private records were accessed or whether an account was compromised. If a real secret shipped, revoke it with the provider and review the provider's usage and audit history.
Key facts
- Firebase Authentication and Security Rules solve different parts of access control.
- Firestore and Storage rules must be reviewed independently.
- The Emulator Suite can test rules before deployment.
Questions
Can a clean open Firebase Security Rules check prove the app is secure?
What should I do first if the finding is real?
Does ProofForge change application data?
What should I do after the repair?
Official documentation referenced
Related
Last updated 2026-11-25 · Reviewed by ProofForge · Methodology · Markdown