FB-RULES-OPEN
Firebase security rules open to everyone
- Severity
- Critical / High
- Confidence
- High
- Stack
- Firebase
- Runs
- On by default
What the CLI looks for
Firestore, Realtime Database or Storage rules with allow …: if true, test-mode rules with an expiry date, or request.auth != null as the only condition.
Why it matters
if true opens the data to the whole internet. Test-mode rules open everything until a date that is easy to forget. request.auth != null only checks that someone is signed in, and with open sign-up or anonymous auth, that is anyone.
How to fix it
Write rules that check ownership, not just sign-in, and deny everything that isn't explicitly allowed.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
}
}