firebase-security-rules-auditor

作者: firebase

评估 Firestore 安全规则安全性的技能。当 Firestore 安全规则更新时使用此技能,以确保生成的规则…

npx skills add https://github.com/firebase/agent-skills --skill firebase-security-rules-auditor

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 == '[email protected]'), 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" } ] }

来自 firebase 的更多技能

firebase-remote-config-basics
firebase
Firebase Remote Config 的全面指南,涵盖模板管理和 SDK 使用。当用户需要帮助设置 Remote Config、管理功能标志或动态更新应用行为时,使用此技能。
officialdevelopmentapi
developing-genkit-dart
firebase
面向 Dart 的统一 AI SDK,支持代码生成、结构化输出、工具、流程和智能体。提供核心 API,涵盖生成、工具定义、流程编排、嵌入和流式处理,采用统一接口。包含 8 个以上插件,支持 LLM 提供商(Google Gemini、Anthropic Claude、OpenAI GPT)、Firebase AI、模型上下文协议、Chrome 浏览器集成,以及通过 Shelf 托管 HTTP 服务器。内置 CLI 和本地开发 UI,用于流程执行、追踪、模型实验等。
official
developing-genkit-go
firebase
使用 Go 语言中的 Genkit 开发 AI 驱动的应用程序。当用户要求使用 Genkit 在 Go 中构建 AI 功能、代理、流程或工具时使用,或在处理…
official
developing-genkit-js
firebase
使用Genkit流程、工具和多模型支持,构建AI驱动的Node.js/TypeScript应用程序。Genkit与提供商无关;通过插件支持Google AI、OpenAI、Anthropic、Ollama及其他LLM提供商。使用Zod定义类型安全的模式流程,执行生成请求,并在TypeScript中组合多步骤AI工作流。需要Genkit CLI v1.29.0及以上版本;近期主要API变更意味着您必须查阅genkit文档:read和common-errors.md以获取当前模式,而非依赖先前知识...
official
developing-genkit-python
firebase
使用 Python 中的 Genkit 开发 AI 驱动的应用程序。当用户询问关于 Genkit、AI 代理、流程或 Python 中的工具,或遇到 Genkit 相关问题时使用。
official
firebase-ai-logic
firebase
客户端Gemini集成,适用于网页应用,支持多模态推理、流式传输及设备端混合执行。支持纯文本和多模态输入(图像、音频、视频、PDF);超过20MB的文件通过Cloud Storage路由。包含自动历史记录的聊天会话、用于实时显示的流式响应,以及结构化JSON输出强制。通过Chrome中的Gemini Nano提供混合设备端推理,并自动回退到云端执行。生产环境需启用App Check...
official
firebase-ai-logic-basics
firebase
用于将Firebase AI Logic(Gemini API)集成到Web应用程序中的官方技能。涵盖设置、多模态推理、结构化输出和安全性。
official
firebase-app-hosting-basics
firebase
使用Firebase App Hosting部署和管理基于Next.js、Angular及其他支持框架的全栈Web应用。需使用Blaze定价计划的Firebase项目;支持服务端渲染(SSR)和增量静态再生(ISR)工作流。通过firebase.json配置部署,可选apphosting.yaml进行后端设置,或通过GitHub集成启用自动化"git push部署"。包含通过CLI命令进行密钥管理,以安全访问敏感密钥...
official