技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
firebase-security-rules-auditor【数据与研究】Audit Firestore and Cloud Storage rules for authorization, tenant isolation, field validation, and emulator coverage when data models or rules change.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
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.
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.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:
Return your assessment in JSON format using the following structure:
{
"score": 1,
"summary": "overall assessment",
"findings": [
{
"check": "checklist item",
"severity": "critical|major|moderate|minor",
"issue": "description",
"recommendation": "fix"
}
]
}
This supplement is maintained by the repository sync pipeline. It keeps the imported upstream skill usable inside this curated collection when the upstream source is intentionally concise.
1. Confirm that the user's task matches the skill trigger.
2. Read the relevant project files or user-provided context before acting.
3. Choose the smallest reversible action that advances the task.
4. Run the verification command or manual check that proves the result.
5. Report the outcome, evidence, and any remaining risk.
Read the rules and application queries together:
rg --files -g 'firestore.rules' -g 'storage.rules' -g 'firebase.json'
rg -n "collection\\(|doc\\(|query\\(|where\\(|orderBy\\(|limit\\(" src app functions
rg -n "rules-unit-testing|initializeTestEnvironment|assertFails|assertSucceeds" .
Security Rules are not filters. Flag queries that are not constrained tightly enough for the rule engine to prove every possible result is authorized. Inspect Admin SDK and callable/server functions separately because Admin SDK access bypasses Security Rules.
Require emulator tests for unauthenticated access, cross-tenant access, immutable owner/role fields, self-escalation, invalid types, oversized values, and insufficiently constrained queries:
firebase emulators:exec --only firestore,storage "npm test"
For every finding include the rules path, actor, initial resource, attempted request, relevant expression, minimal reproducing test, and remediation. Distinguish confirmed exploit paths from defense-in-depth recommendations.
Block deployment for unauthenticated protected-data access, cross-tenant read/write, self-assigned roles, Admin SDK endpoints without equivalent server authorization, or missing negative tests for a changed sensitive path.