-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathfirestore.rules
More file actions
26 lines (22 loc) · 853 Bytes
/
firestore.rules
File metadata and controls
26 lines (22 loc) · 853 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
25
26
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users collection - users can only access their own data
match /users/{userId} {
// Allow read/write only if authenticated and accessing own data
allow read, write: if request.auth != null && request.auth.uid == userId;
// Subscription history subcollection
match /subscriptions/{purchaseToken} {
// Users can read their own subscription history
allow read: if request.auth != null && request.auth.uid == userId;
// Only backend (Cloud Functions) can write subscriptions
// This prevents client-side manipulation
allow write: if false;
}
}
// Deny all other access by default
match /{document=**} {
allow read, write: if false;
}
}
}