So I have a bucket of images in my Firebase Storage. Everyone's images go in there and I am concerned about security because if a user is authenticated, I think they can read and write everyone's images. This is not good.
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /images/{imageId} {
allow read: if request.auth != null;
// Only allow uploads of any image file that's less than 10MB
allow write: if request.auth != null && request.resource.size < 10 * 1024 * 1024;
}
}
}
I want multiple/specific users that have access to the files to be able to access them and no one else. Also, access should be dynamic (a user can gain or lose access). I've seen others secure files specific to one user by adding a {userId} wildcard in the match statement but I want MULTIPLE users. From my research, it sounds like the only way to do this would be through custom claims. I want to make this is correct before I dive too deep into it. It looks like custom claims can only store 1000 bytes of data too so that might be a bottleneck in my case.
Thanks!