Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a simulator for Firestore security rules?

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.

like image 536
Vincent Avatar asked Oct 06 '17 02:10

Vincent


People also ask

How do I set firestore security rules?

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.

What is firestore security rules?

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.


2 Answers

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.

like image 157
Frank van Puffelen Avatar answered Oct 12 '22 09:10

Frank van Puffelen


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.

like image 42
Kartik Shandilya Avatar answered Oct 12 '22 07:10

Kartik Shandilya