Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Firebase security rules/permissions

In Firebase 2 a user could create a custom token and specify a debug flag, this in turn would return a lot of debugging information about the permissions. In Firebase 3, it appears this has been removed.

Is there any way, maybe through the REST API to get this permission debugging data back on web (javascript)? Attempting to debug a permissions file with over 1k lines isn't exactly feasible through the simulator at times.

like image 602
Ramzi C. Avatar asked Sep 09 '16 17:09

Ramzi C.


People also ask

How do you debug a Firebase rule?

1 Answer. Show activity on this post. firebase have it's own simulator for rules for read and write operations, for the write and validation operation you can write your data as JSON and it will show you if it works or not and the rules where the problem is. go to console > database > rules > click on SIMULATOR.

What are Firebase security rules?

Firebase Security Rules work by matching a pattern against database paths, and then applying custom conditions to allow access to data at those paths. All Rules across Firebase products have a path-matching component and a conditional statement allowing read or write access.

How do I edit rules in Firebase?

Edit and update your rulesOpen the Firebase console and select your project. Then, select Realtime Database, Cloud Firestore or Storage from the product navigation, then click Rules to navigate to the Rules editor. Edit your rules directly in the editor.


1 Answers

I have to say that I'm evaluating Firebase for a project and really like so much about it but the debugging of security rules is so painful that I'm really getting ready to scrap use of it. I'm just putting together a few updates to process and all I get back is "FIREBASE WARNING: update at / failed: permission_denied "

And this is with using Bolt to make things a little more readable. And having painstakingly gone through the Simulator to test everything.

like image 136
Dominic Tracey Avatar answered Oct 01 '22 13:10

Dominic Tracey