Harden Firestore fold update rule
This prevents editing fields on the fold that would lead to strange and disruptive results, for example, changing the curatorId to another user, or manually changing followCount.
This commit is contained in:
		
							parent
							
								
									c0d6e17060
								
							
						
					
					
						commit
						262ce38bc1
					
				|  | @ -56,7 +56,10 @@ service cloud.firestore { | |||
| 
 | ||||
|     match /folds/{foldId} { | ||||
|       allow read; | ||||
|       allow update, delete: if request.auth.uid == resource.data.curatorId; | ||||
|       allow update: if request.auth.uid == resource.data.curatorId | ||||
|         && request.resource.data.diff(resource.data).affectedKeys() | ||||
|         .hasOnly(['name', 'about', 'tags', 'lowercaseTags']); | ||||
|       allow delete: if request.auth.uid == resource.data.curatorId; | ||||
|     } | ||||
| 
 | ||||
|     match /{somePath=**}/followers/{userId} { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user