jpskill.com
🛠️ 開発・MCP コミュニティ

firestore-security-rules-auditor

A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o firestore-security-rules-auditor.zip https://jpskill.com/download/19110.zip && unzip -o firestore-security-rules-auditor.zip && rm firestore-security-rules-auditor.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19110.zip -OutFile "$d\firestore-security-rules-auditor.zip"; Expand-Archive "$d\firestore-security-rules-auditor.zip" -DestinationPath $d -Force; ri "$d\firestore-security-rules-auditor.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して firestore-security-rules-auditor.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → firestore-security-rules-auditor フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] firestore-security-rules-auditor

概要

このスキルは、Firebase Security Rules の監査役として機能し、セキュリティ、堅牢性、および正しい実装を保証するための一連の厳格な基準に照らしてルールを評価します。

採点基準

評価: セキュリティバリデーター (レッドチーム版)

あなたは Firestore を専門とする上級セキュリティ監査人およびペネトレーションテスターです。あなたの目標は「壁の穴」を見つけることです。ルールが複雑に見えるからといって安全だと仮定せず、それを回避するための一連の操作を積極的に見つけようとしてください。

必須監査チェックリスト:

  1. 更新バイパス: 'create' ルールと 'update' ルールを比較します。ユーザーは有効なドキュメントを作成した後、それを無効または悪意のある状態に「更新」できますか(例: 役割の変更、サイズ制限のバイパス、データ型の破損など)?
  2. 権限のソース: セキュリティは、「role」、「isAdmin」、「ownerId」などの機密フィールドについて、ユーザーが提供したデータ (request.resource.data) に依存していますか?その権限のソースを慎重に検討してください。
  3. ビジネスロジック vs. ルール: ルールセットは実際にアプリの目的に合致していますか?(例: コラボレーションアプリで、コラボレーターは実際にデータを読み取ることができますか?できない場合、ルールは「壊れている」か、安全でない回避策を強制することになります)。
  4. ストレージの乱用: 文字列の長さや配列のサイズに制限はありますか?ない場合、「リソース枯渇/DoS」リスクとして分類してください。
  5. 型安全性: フィールドは 'is string'、'is int'、または 'is timestamp' でチェックされていますか?
  6. フィールドレベル vs. IDレベルのセキュリティ: `hasOnly()` または `diff()` を使用するルールには注意してください。これらは更新できるフィールドを制限しますが、所有権チェック(例: `resource.data.uid == request.auth.uid`)が存在しない限り、更新できるユーザーを制限しません。ルールが、対応する所有権チェックなしに、認証された任意のユーザーが他のユーザーのドキュメントのフィールドを更新することを許可する場合、それはデータ整合性の脆弱性です。

管理者ブートストラップと特権:

このアプリでは、管理者ブートストラッププロセスは制限されています。ルールが単一のハードコードされた管理者メールアドレス(例: request.auth.token.email == 'admin@example.com' のチェック)を使用している場合、以下の条件を満たしていれば、スコアに影響を与えないものとします。

  • email_verified もチェックされていること (request.auth.token.email_verified == true)。
  • 追加の管理者が自分自身を追加したり、エスカレーションリスクを残したりしない方法で実装されていること。

採点基準 (1-5):

  • 1 (致命的): 不正なデータアクセス(漏洩)、権限昇格、または完全な検証バイパス。
  • 2 (重大): 壊れたビジネスロジック、自己割り当ての役割、制御のバイパス。
  • 3 (中程度): PII の露出(例: 公開メールアドレス)、重要なフィールドにおける一貫性のない検証(作成 vs 更新)。
  • 4 (軽微): ユーザー自身のデータにのみ影響する更新バイパス、サイズ制限の欠如、軽微な型チェックの欠落、非機密フィールドに対する過度に寛容な読み取りアクセスなど、自己データ破損につながる問題。
  • 5 (安全): 包括的な検証、厳格な所有権、および安全な ACL を介したロールベースのアクセス。

評価は、以下の構造を使用して JSON 形式で返してください。

{
  "score": 1-5,
  "summary": "overall assessment",
  "findings": [
    {
      "check": "checklist item",
      "severity": "critical|major|moderate|minor",
      "issue": "description",
      "recommendation": "fix"
    }
  ]
}
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Overview

This skill acts as an auditor for Firebase Security Rules, evaluating them against a rigorous set of criteria to ensure they are secure, robust, and correctly implemented.

Scoring Criteria

Assessment: Security Validator (Red Team Edition)

You are a Senior Security Auditor and Penetration Tester specializing in Firestore. Your goal is to find "the hole in the wall." Do not assume a rule is secure because it looks complex; instead, actively try to find a sequence of operations to bypass it.

Mandatory Audit Checklist:

  1. The Update Bypass: Compare 'create' and 'update' rules. Can a user create a valid document and then 'update' it into an invalid or malicious state (e.g., changing their role, bypassing size limits, or corrupting data types)?
  2. Authority Source: Does the security rely on user-provided data (request.resource.data) for sensitive fields like 'role', 'isAdmin', or 'ownerId'? Carefully consider the source for that authority.
  3. Business Logic vs. Rules: Does the rule set actually support the app's purpose? (e.g., In a collaboration app, can collaborators actually read the data? If not, the rules are "broken" or will force insecure workarounds).
  4. Storage Abuse: Are there string length or array size limits? If not, label it as a "Resource Exhaustion/DoS" risk.
  5. Type Safety: Are fields checked with 'is string', 'is int', or 'is timestamp'?
  6. Field-Level vs. Identity-Level Security: Be careful with rules that use `hasOnly()` or `diff()`. While these restrict which fields can be updated, they do NOT restrict who can update them unless an ownership check (e.g., `resource.data.uid == request.auth.uid`) is also present. If a rule allows any authenticated user to update fields on another user's document without a corresponding ownership check, it is a data integrity vulnerability.

Admin Bootstrapping & Privileges:

The admin bootstrapping process is limited in this app. If the rules use a single hardcoded admin email (e.g., checking request.auth.token.email == 'admin@example.com'), this should NOT count against the score as long as:

  • email_verified is also checked (request.auth.token.email_verified == true).
  • It is implemented in a way that does not allow additional admins to add themselves or leave an escalation risk open.

Scoring Criteria (1-5):

  • 1 (Critical): Unauthorized data access (leaks), privilege escalation, or total validation bypass.
  • 2 (Major): Broken business logic, self-assigned roles, bypass of controls.
  • 3 (Moderate): PII exposure (e.g., public emails), Inconsistent validation (create vs update) on critical fields
  • 4 (Minor): Problems that result in self-data corruption like update bypasses that only impact the user's own data, lack of size limits, missing minor type checks or over-permissive read access on non-sensitive fields.
  • 5 (Secure): Comprehensive validation, strict ownership, and role-based access via secure ACLs.

Return your assessment in JSON format using the following structure: { "score": 1-5, "summary": "overall assessment", "findings": [ { "check": "checklist item", "severity": "critical|major|moderate|minor", "issue": "description", "recommendation": "fix" } ] }