forked from Bugs-Bunny53/Resume-Analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.rules
More file actions
40 lines (34 loc) · 1.19 KB
/
storage.rules
File metadata and controls
40 lines (34 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
// Helper functions
function isAuthenticated() {
return request.auth != null;
}
function isOwner(userId) {
return isAuthenticated() && request.auth.uid == userId;
}
function isValidResume() {
return request.resource.size < 10 * 1024 * 1024 && // Max 10MB
request.resource.contentType.matches('application/pdf|application/vnd.*|application/msword|text/plain');
}
// Resume uploads - users can only access their own files
match /resumes/{userId}/{fileName} {
allow read: if isOwner(userId);
allow write: if isOwner(userId) && isValidResume();
allow delete: if isOwner(userId);
}
// Profile pictures (if needed in future)
match /profiles/{userId}/{fileName} {
allow read: if true; // Public profile pictures
allow write: if isOwner(userId) &&
request.resource.size < 5 * 1024 * 1024 && // Max 5MB
request.resource.contentType.matches('image/.*');
allow delete: if isOwner(userId);
}
// Block all other paths
match /{allPaths=**} {
allow read, write: if false;
}
}
}