so I'm trying to figure out how cloud firestore rules work and made a simple app to learn how to write secure rules. the app basically show news to all users and allows users to share suggestions to admin without getting user authentication (no sign up required). so I thought if I used allow write: if true;
for the document that contains users suggestions, that it will be secure, but I'm receiving warning from firebase that my firestore cloud rules are not secure. so I thought it's not secure cause maybe anyone can rewrite/delete the whole data in users_suggestion
document. I still need to achieve secure rules without getting user's authentication, if you know how please help
this is how the rules look like:
service cloud.firestore {
match /databases/{database}/documents {
match /users_suggestion/{documents}{
allow read: if request.auth != null
allow write: if true;
}
match /news/{documents}{
allow read;
allow write: if request.auth != null
}
}
}
the collections are: users_suggestion
and news
/users_suggestion/{documents}
authenticated users has been allowed forread
, then write is higher level action and for that too the user should get authenticated. – Muthu Thavamani