Repository navigation
Expand file tree
/
Copy pathfirestore.rules
More file actions
92 lines (69 loc) · 2.41 KB
/
Copy pathfirestore.rules
File metadata and controls
92 lines (69 loc) · 2.41 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// ============================================
// PUBLIC COLLECTIONS (readable without auth)
// ============================================
// Public campaign info (no PII)
match /campaigns_public/{campaignId} {
allow read: if true; // Anyone can read
allow write: if false; // Only backend (Admin SDK) can write
}
// Public campaign stats
match /campaign_stats_public/{campaignId} {
allow read: if true;
allow write: if false;
}
// Public donations (anonymous-safe)
match /donations_public/{campaignId}/items/{donationId} {
allow read: if true;
allow write: if false;
}
// Public payment intents
match /payment_intents_public/{intentId} {
allow read: if true;
allow write: if false;
}
// ============================================
// PRIVATE COLLECTIONS (admin/server only)
// ============================================
match /donations_private/{donationId} {
allow read, write: if false; // Only server (Admin SDK)
}
match /payment_intents_private/{intentId} {
allow read, write: if false;
}
match /chain_txs_private/{docId} {
allow read, write: if false;
}
// ============================================
// EXISTING COLLECTIONS (legacy, migrate gradually)
// ============================================
// Keep existing collections restricted until migration complete
match /campaigns/{campaignId} {
allow read: if request.auth != null; // Require auth for now
allow write: if false;
}
match /donations/{donationId} {
allow read, write: if false;
}
match /payment_intents/{intentId} {
allow read: if request.auth != null; // Temporary: allow auth'd reads during migration
allow write: if false;
}
match /campaign_deposits/{depositId} {
allow read, write: if false;
}
match /crypto_networks/{networkId} {
allow read: if true; // Public registry
allow write: if false;
}
match /crypto_assets/{assetId} {
allow read: if true; // Public registry
allow write: if false;
}
match /campaign_stats/{campaignId} {
allow read, write: if false; // Migrate to campaign_stats_public
}
}
}