-
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.15 KB
/
storage.rules
File metadata and controls
40 lines (34 loc) · 1.15 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 function: Check if user is authenticated
function isAuthenticated() {
return request.auth != null;
}
// Helper function: Check if user is admin
function isAdmin() {
return isAuthenticated() &&
request.auth.token.admin == true;
}
// Repository cache (backend functions only)
match /repositories/{repoId}/{allPaths=**} {
allow read: if isAuthenticated();
allow write: if false; // Only backend functions can write
}
// Embeddings (backend functions only)
match /embeddings/{allPaths=**} {
allow read: if false; // Private to backend
allow write: if false; // Only backend functions can write
}
// User data exports (GDPR compliance)
match /exports/{userId}/{fileName} {
allow read: if isAuthenticated() && request.auth.uid == userId;
allow write: if false; // Only backend functions can write
}
// Backups (admin only)
match /backups/{allPaths=**} {
allow read: if isAdmin();
allow write: if false; // Only backend functions can write
}
}
}