rules_version='2' service cloud.firestore { match /databases/{database}/documents { match /users/{uid} { allow read: if request.auth != null && request.auth.uid == uid; allow update: if request.auth != null && request.auth.uid == uid && request.resource.data.diff(resource.data) .affectedKeys().hasOnly(['fcmToken']); allow create, delete: if false; match /voteHistory/{date} { allow read: if request.auth != null && request.auth.uid == uid; allow write: if false; } match /attendance/{month} { allow read: if request.auth != null && request.auth.uid == uid; allow write: if false; } match /pointLedger/{id} { allow read: if request.auth != null && request.auth.uid == uid; allow write: if false; } // AI 채팅(짹) — 전부 Admin SDK(서버) 전용. 클라이언트가 직접 읽으면 // 프롬프트 노출, 직접 쓰면 한도 우회·이력 위조(영속 인젝션)가 가능해진다. // 이력 조회도 GET /chat/messages 경유. (ai-chat-tech-design.md §4.6) match /chatThreads/{threadId} { match /{document=**} { allow read, write: if false; } allow read, write: if false; } match /chatQuota/{date} { allow read, write: if false; } match /chatRequests/{clientMessageId} { allow read, write: if false; } } // 시스템 프롬프트·필터 사전·한도 설정 평문 보관 — 노출 시 §7.5 무력화 match /config/{doc} { allow read, write: if false; } // 신고 적재함 — Admin(운영) 전용. 생성도 서버(POST /chat/.../report) 경유 match /chatReports/{reportId} { allow read, write: if false; } match /games/{gameId} { allow read: if true; allow write: if false; } match /kboCache/{key} { allow read: if true; allow write: if false; } match /kboLocks/{key} { allow read, write: if false; } match /{document=**} { allow read, write: if false; } } }