-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.rules
More file actions
24 lines (20 loc) · 786 Bytes
/
Copy pathstorage.rules
File metadata and controls
24 lines (20 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
// ========== PROFILE PICTURES ==========
match /profilePictures/{userId}.jpg {
// Read: Only the owner can read their profile picture
allow read: if request.auth != null && request.auth.uid == userId;
// Write: Only the owner can upload their profile picture
// Constraints: Max 1MB, must be an image
allow write: if request.auth != null &&
request.auth.uid == userId &&
request.resource.size < 1 * 1024 * 1024 &&
request.resource.contentType.matches('image/.*');
}
// ========== DEFAULT DENY ALL ==========
match /{allPaths=**} {
allow read, write: if false;
}
}
}