Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all the firestore security rules using firestore command

I am creating a deployment script for firebase where all the indexes and security rules of firestore are fetched and then saved in my firestore.indexes/rules.json and then project is switched and deployed. I know how to read Rules from firebase "firebase firestore:indexes > save.json" which will fetch all the indexes in my firestore and save it But not able to get how to pull all my firestore rules in local file.

Can anyone help me out for this

like image 307
Geetanshu Gulati Avatar asked May 02 '26 18:05

Geetanshu Gulati


2 Answers

If you run the command firebase init firestore in a new folder (not an existing project folder), it will put all of your indexes and rules in that new workspace.

That said, this is not the most convenient way to get your rules, but it does work. If you're up to writing your own code, there is an API for working with security rules programmatically.

like image 58
Doug Stevenson Avatar answered May 04 '26 13:05

Doug Stevenson


firebaser here

There is currently no command in the Firebase CLI to read the security rules from the server. The only way to get your rules right now is to copy them from the Firebase console.

Adding this feature is actively being discussed though, so I highly recommend weighing in by filing a feature request.

like image 36
Frank van Puffelen Avatar answered May 04 '26 12:05

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!