Relative Content

Tag Archive for firebasegoogle-cloud-firestorefirebase-security

Encrypt and decrypt resource.data.value in firestore rule

I am making a functionality in which when a user will hit a perticular node it will check the request.auth.token.crc is equal to the value stored in the resource.data.crc as i need to encrypt the resource.data.crc because the value in request.auth.token.crc also encrypted i want to check if both values are same

Encrypt and decrypt resource.data.value in firestore rule

I am making a functionality in which when a user will hit a perticular node it will check the request.auth.token.crc is equal to the value stored in the resource.data.crc as i need to encrypt the resource.data.crc because the value in request.auth.token.crc also encrypted i want to check if both values are same

Firebase Security Rules: evaluate field values of an Array (just add for loops??)

I may indeed be a blunt object but I’ve been trying to figure out the best way to iterate through my high scores array which contains ‘scoreEntry’ maps. As I understand it, such behavior is prohibited by Google to avoid infinite looping issues & ‘abuse’ of the security rules system. Not that any of that makes sense to a smooth brain such as myself, but maybe there is already an easy solution which I just can’t find at the moment. Here is the db structure as it lies:

Handling Firebase security for Firestore

I am very new to Firebase security and this project needs to have strong security due to the sensitive nature of the information. But my situation is very complicated.
I have 3 interconnected websites that utilize the same Firebase project and Firestore. The 1st website has authentication setup so I could have controlled security from there with uid but the other two websites do not require login, but still need read and write access to certain documents. Is there any solution possible to this?
Currently I’m in dev mode so my rules are read write all.

Firestore rules to not allow additional queries

getDocs(query(orderBy(‘createdAt’, ‘desc’))) with rules, i can enforce a query allow list: if request.query.orderBy.createdAt == “DESC” How do i make it so users cannot apply query to any other fields getDocs(query(orderBy(‘createdAt’, ‘desc’), where(‘status’, ‘==’, 0))) status is an additional query And how do i make it so users may apply queries to specific fields so… createdAt […]

Firestore security rules are not being respected

I’m creating a website with a whitelabel system that I need to limit the access to the firestore collections and documents based on a Role system. The rules are: Users will receive a custom claim called “role” that is the ID of a document of the role collection This Role document can allow the user […]