Reputation: 1759
I have following use case.. I don't want to allow user control document limit in cloud firestore, I want to have firebase rule restrict it.
For eg. I have a products collection, user can do pagination (max=10) per page. if its browser side, user can easily change and get all the products list. Is there any settings or rules to control this?
Upvotes: 5
Views: 2337
Reputation: 26313
You can protect this using the query
property of the request
object (see docs). Basically you can write a rule with a condition on the limit
:
allow read: if request.query.limit != 10
The above rule will prevent the query from going through if the limit is not set to 10.
Upvotes: 8