Firebase Security Rules Review
Skill7 starsChanged 5 months agoMITView on GitHub
Detects over-permissive Firestore/Storage rules (allow read, write: if true / auth-only without ownership), missing auth checks on writes, and admin SDK private key exposure to client bundles.
In this repository140 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- static/llms.txtllms.txt
- ask-codexSkill
- river-review-disciplineSkill
- skill-creatorSkill
- skill-ops-plannerSkill
- skill-optimizerSkill
- commandsSkill
- adversarial-reviewSkill
- review-teamSkill
- river-review-architectureSkill
- river-review-codeSkill
- river-review-docsSkill
- river-review-frontendSkill
- river-review-performanceSkill
- river-review-security-auditSkill
- river-review-securitySkill
- river-reviewSkill
- river-review-testingSkill
- unknown-coverage-reviewSkill
- Coverage and Failure Path GapsSkill
- Flaky Test Risk CheckSkill
- GitHub Actions Workflow Security ReviewSkill
- Standard Review Policy for DownstreamSkill
- Test Assertion Effectiveness 常に PASS するテストの検出Skill
- Test Presence for Changed CodeSkill
- Test Naming and StructureSkill
- テスト観点レビュー(差分ドリブン)Skill
- a11y Accessible Name BasicsSkill
- Agent Skill Bridge ReviewSkill
- Altitude Generalization GuardSkill
- API Compatibility and Test Gap ReviewSkill
- Assumption Resolution Trace Plan の前提解消トレーサビリティSkill
- Async Correctness 非同期処理の正しさ検証Skill
- Behavior-Structure Separation 振る舞い変更と構造変更の分離・外部挙動維持Skill
- Closure Scope Retention GuardSkill
- Component Variants / States Documentation コンポーネント状態の文書化Skill
- Configuration File ReviewSkill
- Cross-File Leakage リファクタ後の caller 側残骸検出Skill
- Design Source-of-Truth Conformance デザイン定義準拠Skill
- Design System Component Reuse GuardSkill
- Design Token EnforcementSkill
- Detector Detection Power 検査器の検出力の検証Skill
- Documentation Hygiene ドキュメント衛生Skill
- End-to-End Wiring 末端到達・貫通の検証Skill
- Existing-Pattern Conformance 既存パターン準拠の確認Skill
- Fix Scope Integrity 指摘対応ループのスコープ逸脱・前提破壊検出Skill
- GitHubレビューコメント対応(修正案つき)Skill
- Hallucinated Reference 幻覚的参照の実在確認Skill
- Hello Skill (Always-On Sample)Skill
- i18n Unused Key ReviewSkill
- Impact Evidence Coverage 影響・失敗系・外部依存の証拠充足Skill
- Independent Review SynthesisSkill
- Invisible Unicode Injection Scan 不可視 Unicode コード注入検出Skill
- Knowledge-to-Code Alignment 新知識のコード反映・設計知識の保全Skill
- Laravel Eloquent N+1 and Query Efficiency ReviewSkill
- Laravel Mass Assignment and Authorization ReviewSkill
- The first 60 shown.
The file
Files
Pattern declaration
Primary pattern: Reviewer Secondary patterns: Inversion Why: Firebase Security Rules の過剰許可と認可漏れ、機密 config 露出をチェックリスト型で検査する
Goal / 目的
allow read, write: if true;やrequest.auth != nullだけの所有者チェック欠如ルールを検出し、他人のドキュメント書き換えを防ぐ。allow writeにrequest.auth条件が無い認証チェック欠如を検出する。- admin SDK の秘密鍵(service account の
private_key)がソースに混入しクライアントバンドルへ露出するのを検出する。
Non-goals / 扱わないこと
- Firestore のクエリ効率やインデックス設計。
- Cloud Functions のロジック妥当性。
- ルールの粒度(コレクション分割方針)の良し悪し(要件依存のため一律指摘しない)。
Pre-execution Gate / 実行前ゲート
このスキルは以下の条件がすべて満たされない限りNO_REVIEWを返す。
- 差分に Security Rules(
*.rules/ firestore.rules / storage.rules)の追加・変更、またはfirebase*.{ts,js}の config 変更が含まれている - diff コンテキストが利用可能である
ゲート不成立時の出力: NO_REVIEW: firebase-security-rules — Security Rules / config の変更なし
False-positive guards / 抑制条件
- 公開コレクション(公開ブログ記事等)で
allow readの公開が要件上正当であり、その旨のコメントが明記されている場合は read の公開を指摘しない(writeの公開は別途指摘する)。 - Firebase の API key(
apiKey)はクライアント公開が公式仕様であり秘密情報ではない。これを「秘密露出」と誤検出しない(admin SDK のprivate_keyとは明確に区別する)。 - emulator / test 用のルールファイル(
*.test.rules等)は別スコープのため指摘しない。
Rule / ルール
allow read, write: if true;のような無条件許可は禁止。所有者・認可条件を必須とする。request.auth != nullのみで write を許可しているものは所有者チェック(request.auth.uid == resource.data.ownerId等)を追加する。allow writeにrequest.auth条件が無いものは認証チェックを追加する。- service account の
private_key/ admin SDK 初期化用秘密鍵がクライアント側コードに含まれていないか確認する(サーバー専用に隔離する)。
Evidence / 根拠の取り方
- 指摘は
<file>:<line>で差分に紐づけ、公式規約(rules/basics / rules-and-auth)を 1 行で添える。 - 所有者条件が diff 外の関数定義にある可能性がある場合は断定せず慎重に扱う。
Output / 出力(短文版の推奨)
コメントは日本語で返す。
- Finding: 過剰許可 / 認可欠如 / 秘密露出のどれか(1文)
- Impact: 他人のデータ書き換え / 不正アクセス / 鍵漏洩
- Fix: 所有者条件追加 /
request.auth条件追加 / 秘密鍵のサーバー隔離の最小案
Sources / 出典
- Firebase — Security Rules basics: https://firebase.google.com/docs/rules/basics
- Firebase — Rules and authentication: https://firebase.google.com/docs/rules/rules-and-auth
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

