north-star / files / config / firebase / database.rules.json
database.rules.json
2ba7a9cc 2026-03-15 Pavel Safronov | 1 | { |
211ceca3 2026-03-15 Pavel Safronov | 2 | "rules": { |
| 3 | ".read": false, | |
| 4 | ".write": false, | |
| 5 | "rooms": { | |
| 6 | "$roomId": { | |
| 7 | ".read": "auth != null && $roomId.matches(/^[a-z0-9]{8}$/)", | |
e790982a 2026-03-16 Pavel Safronov | 8 | "friends": { |
211ceca3 2026-03-15 Pavel Safronov | 9 | "$uid": { |
c18940ae 2026-03-16 Pavel Safronov | 10 | ".write": "auth != null && (auth.uid === $uid || (!newData.exists() && data.child('lastSeen').isNumber() && data.child('lastSeen').val() < now - 2592000000))", |
211ceca3 2026-03-15 Pavel Safronov | 11 | ".validate": "!newData.exists() || (newData.hasChildren(['encryptedState']) && newData.child('encryptedState').isString() && newData.child('encryptedState').val().length > 0 && !newData.child('id').exists() && !newData.child('name').exists() && !newData.child('color').exists() && !newData.child('position').exists() && !newData.child('timestamp').exists()) || (newData.hasChildren(['id','name','color','position','timestamp']) && newData.child('id').isString() && newData.child('id').val() === auth.uid && newData.child('name').isString() && newData.child('name').val().length > 0 && newData.child('name').val().length <= 32 && newData.child('color').isString() && newData.child('color').val().matches(/^#[0-9a-fA-F]{6}$/) && newData.child('position').hasChildren(['lat','lon']) && newData.child('position/lat').isNumber() && newData.child('position/lon').isNumber() && newData.child('timestamp').isNumber())" |
| 12 | } | |
| 13 | } | |
| 14 | } | |
2ba7a9cc 2026-03-15 Pavel Safronov | 15 | } |
| 16 | } | |
211ceca3 2026-03-15 Pavel Safronov | 17 | } |