I'm looking for a way to test the new rule set efficiently. I'd like to test the rules before I make the decision to switch over to Firestore from the Realtime Database. Please provide a solution or indicate if there are any works-in-progress.
To set up and deploy your first set of rules, open the Rules tab in the Cloud Firestore section of the Firebase console. Write your rules in the online editor, then click Publish.
Cloud Firestore Security Rules allow you to control access to documents and collections in your database. The flexible rules syntax allows you to create rules that match anything, from all writes to the entire database to operations on a specific document.
2018-05-26 UPDATE
There now is simulator for Firestore security rules built right into the Firebase console.
Previous answer:
firebaser here
There currently is no simulator for the Firestore security rules. As far as I know one is in the works, but as usual: no promises and no release dates.
As such you can not 'test' the rules but you can customize them as per your requirement. There are various resources which can help you to switch from the Realtime Database to Firestore.
Both the security rules work similarly and there is not so much difference.
Also as per the docs about Firestore Security Rules:
Rules don't cascade unless you use a wildcard.
Data validation happens automatically.
Rules can constrain queries: If a query's results might contain data the user doesn't have access to, the entire query fails.
So if your project is in beta you can try Firestore otherwise as of now Realtime Database is just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With