1

I'm a newbie to Firestore. In my project, I have written few rules through the firestore console. How to make sure that these rules are working? Is there any way to test these rules through GoLang code? Please help.

EDIT: I want to query from GoLang SDK or code to check the output and see what happens with the rules. My understanding is we write rules in Firestore then we write code to perform operations (let's say CRUD operations) and if rules don't allow it then we should get some error.

Is this possible? Please help me and correct if I am wrong.

yogesh_desai
  • 449
  • 9
  • 21
  • 1
    There is currently no easy way to test your rules outside of your actual application code. Also see my answer here about a simulator: https://stackoverflow.com/questions/46597614/is-there-a-simulator-for-firestore-security-rules – Frank van Puffelen Dec 30 '17 at 15:59
  • 1
    Possible duplicate of [Is there a simulator for Firestore security rules?](https://stackoverflow.com/questions/46597614/is-there-a-simulator-for-firestore-security-rules) – Rosário Pereira Fernandes Dec 31 '17 at 16:38
  • Apparently Firebase have recently (and so far quietly) added a simulator to the security rules tab. Check it out! – blap May 25 '18 at 22:04

2 Answers2

2

If you are using Go, note that security rules only apply to mobile and web. Server libraries like those for Java, Python, and Go use Google Cloud IAM for security.

Juan Lara
  • 6,454
  • 1
  • 22
  • 31
2

Good news, Firestore now has a security rules simulator built into the Firebase console.

You can read about it in Google's Firebase blog post here.

Doug Allrich
  • 827
  • 1
  • 6
  • 18