firebase-firestore-enterprise-native-mode
配置 Firestore 企业版安全规则
企业级应用需要安全、可扩展的数据库以及完善的访问控制。本技能将指导您完成 Firestore 企业版原生模式的配置、安全规则编写,以及使用生产级模式集成 SDK。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“firebase-firestore-enterprise-native-mode”。 为包含用户、帖子和评论集合的博客应用生成安全规则。
预期结果:
- 顶部包含数据模型文档的安全规则文件
- 用于身份验证、所有权和数据验证的辅助函数
- 强制执行 CRUD 操作和数据约束的集合级规则
- 记录已测试漏洞向量的反向攻击测试结果
正在使用“firebase-firestore-enterprise-native-mode”。 创建一个复合索引,用于按类别过滤帖子并按日期排序。
预期结果:
- 包含复合索引定义的 firestore.indexes.json 配置文件
- 将新索引部署到生产环境的 CLI 命令
- 此索引支持的查询模式说明
安全审计
低风险Static analyzer flagged 304 patterns across 7 documentation files, but all findings are false positives. The scanner misinterpreted markdown code fence backticks as shell command execution (247 external_commands findings). Blocker findings for weak cryptography and system reconnaissance were triggered by documentation text such as field ordering descriptions and workflow instructions. The network findings reference localhost emulator URLs and URL validation regex patterns in examples. This skill contains pure reference documentation with no executable code, no network calls, and no credential handling. Safe for publication.
中风险问题 (1)
低风险问题 (2)
风险因素
质量评分
你能构建什么
企业级数据库配置
为生产环境部署设置新的 Firestore 企业版数据库,包含正确的配置文件、安全规则和索引定义。
安全规则生成
通过分析您的应用代码库,生成包含数据验证、基于角色的访问控制和所有权模式的综合 Firebase 安全规则。
SDK 集成指导
学习使用 Firestore Web 和 Python SDK 在应用中进行读取、写入、查询和实时数据同步。
试试这些提示
我需要为我的 Firebase 项目配置 Firestore 企业版原生模式。请帮我配置新数据库并创建初始配置文件(firebase.json、firestore.rules、firestore.indexes.json)。
分析我的应用代码库以识别所有 Firestore 集合路径、数据模型和访问模式。生成包含适当数据验证、基于角色的访问控制和所有权检查的 Firebase 安全规则。
我的 Firestore 查询速度很慢。请根据我的查询模式帮我识别需要哪些复合索引,并生成 firestore.indexes.json 配置文件以部署它们。
我正在使用 Firebase 模块化 Web SDK 构建一个 Web 应用。请展示如何为文档集合设置实时监听器、处理文档变更(添加、修改、删除),以及正确清理订阅。
最佳实践
- 始终从拒绝所有的安全规则开始,仅显式允许所需的访问模式
- 在安全规则中使用验证器函数模式,在创建和更新操作时强制执行数据模式
- 在配置文件中定义所有索引并通过 CLI 部署,而不是在控制台中手动创建
避免
- 切勿允许对包含个人身份信息的集合进行无限制的读取访问
- 生成安全规则时不要跳过反向攻击测试阶段,因为未经测试的规则通常存在权限提升漏洞
- 避免将公开的个人资料数据与私人用户数据混合存储在同一文档中,因为安全规则是在文档级别应用的
常见问题
Firestore 企业版和标准 Firestore 有什么区别?
使用本技能是否需要 Firebase CLI?
生成的安全规则是否可以直接用于生产环境?
本技能能否用于现有的 Firestore 数据库?
本技能涵盖哪些 SDK?
部署前如何在本地测试 Firestore 规则?
开发者详情
作者
firebase许可证
MIT
仓库
https://github.com/firebase/agent-skills/tree/main/skills/firebase-firestore-enterprise-native-mode/引用
main
文件结构