I have an app using the Cloud FireStore from Firebase.
It is mainly a website which data is stored on Firestore. By data, I mean text and image displayed on the web site for every user to see.
So I get a mail each day from Firebase telling me my rules are not secured because every user can read every data (which is mainly the goal, if not, they would not see any text on the web site).
I did it this way, because I used the Firebase Authentification for some kind of admin mode of the web site where you can write and update new data.
Currently, my rules are as follow:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
allow write: if request.auth.uid != null;
}
match /users/{userId} {
allow write: if isOwner(userId);
}
}
function isOwner(userId) {
return request.auth.uid == userId;
}
}
As a beginner with Firebase, I would appreciate any help.
Cheers