azure-cosmos-db-py
构建 Python Cosmos DB 服务
Cosmos DB 服务层需要安全身份验证、分区隔离和可靠测试。此技能指导 Python 团队使用 client、model、service 和 pytest 模式。
安装前请停下并请求确认。
请审查安装计划,并在更改文件前获得用户明确同意。
使用我的智能体安装
将此请求复制给你的智能体,其中包含权威 Skill 页面和清单。
Review the Skillstore skill "azure-cosmos-db-py" from https://skillstore.io/skills/sickn33-azure-cosmos-db-py.md and its manifest at https://skillstore.io/api/skills/sickn33-azure-cosmos-db-py/manifest. Verify the artifact. Stop and obtain explicit user consent before installing or changing files.你的智能体仍应展示其计划,并按安全策略请求必要确认。
Agent 可读资源
当 AI Agent、爬虫或脚本需要干净上下文,而不是读取完整页面时,请使用这些链接。
测试它
正在使用“azure-cosmos-db-py”。 I need a Cosmos DB client for a FastAPI project.
预期结果:
- 适用于 Azure 和本地模拟器使用的推荐身份验证路径。
- endpoint、database 和 container 名称所需的环境设置。
- Client 模块职责,包括单例初始化和 container 访问。
- 关于模拟器设置仅限本地使用的生产警告。
正在使用“azure-cosmos-db-py”。 I need tests for a service method that reads a project.
预期结果:
- 用于替换 Cosmos container 边界的 fixture 策略。
- 针对成功读取和缺失文档的 mocked container 行为。
- 针对 model 转换、标识符和优雅不可用行为的断言。
正在使用“azure-cosmos-db-py”。 I need a partitioning review for a workspace-based API.
预期结果:
- 根据访问模式评估分区键选择。
- 必须与分区键匹配的授权检查。
- 针对跨分区查询和移动操作的警告。
安全审计
高风险All 31 static alerts are false positives caused by Markdown formatting, documented configuration, loopback literals, environment access, test mocks, and ordinary prose. Semantic review found one high-severity endpoint-classification flaw. A crafted host can receive the emulator key because substring matching enables the emulator branch and disables TLS verification.
已确认安全问题 (1)
风险因素
⚙️ 外部命令 (23)
🌐 网络访问 (3)
🔑 环境变量 (2)
分享与引用此报告
分享版本化评估报告、中性徽章、嵌入卡片和引用。Skillstore 只报告证据,不判断该 Skill 是否安全。
复制报告链接
https://skillstore.io/skills/sickn33-azure-cosmos-db-py/audits/5?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown 徽章
[](https://skillstore.io/skills/sickn33-azure-cosmos-db-py?utm_source=security_passport_badge)HTML 徽章
<a href="https://skillstore.io/skills/sickn33-azure-cosmos-db-py?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/sickn33-azure-cosmos-db-py/security.svg" alt="Skillstore security assessment" loading="lazy"></a>嵌入卡片
<iframe src="https://skillstore.io/embed/skills/sickn33-azure-cosmos-db-py.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>学术引用 (APA · BibTeX · CFF)
APA 引用
sickn33. (2026). azure-cosmos-db-py security audit report (audit version 5) [Author version unspecified]. Skillstore. https://skillstore.io/skills/sickn33-azure-cosmos-db-py/audits/5BibTeX 引用
@techreport{sickn33-sickn33-azure-cosmos-db-py-2026,
author = {sickn33},
title = {azure-cosmos-db-py security audit report (audit version 5)},
institution = {Skillstore},
year = {2026},
number = {5},
url = {https://skillstore.io/skills/sickn33-azure-cosmos-db-py/audits/5},
note = {Author version unspecified}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "azure-cosmos-db-py security audit report (audit version 5)"
version: "unspecified"
type: report
authors:
- name: "sickn33"
date-released: "2026-07-23"
url: "https://skillstore.io/skills/sickn33-azure-cosmos-db-py/audits/5"
identifiers:
- type: other
value: "skillstore:sickn33-azure-cosmos-db-py:audit:5"
description: "Skillstore immutable audit report identifier"
Skillstore 评分
评分依据 证据置信度: 中你能构建什么
实现 FastAPI 服务层
为 Python API 规划 Cosmos DB client 设置、model 转换和 service 方法。
标准化 Cosmos DB 访问
为身份验证、分区键、查询安全性和优雅降级定义团队约定。
规划 Cosmos DB 测试
在实现 Cosmos-backed 行为之前,使用 mocked containers 创建单元测试覆盖。
试试这些提示
Use this skill to outline a Python Cosmos DB client for my FastAPI service. Include environment settings, authentication choice, and emulator notes.
Use this skill to design Pydantic models for a Cosmos DB entity named Project. Include create, update, response, and database models.
Use this skill to plan a service layer for Cosmos DB CRUD operations. Include partition key validation and graceful unavailable behavior.
Use this skill to review my Cosmos DB approach for RBAC, parameterized queries, partition keys, tests, retries, and production safety.
最佳实践
- 在托管环境中使用 DefaultAzureCredential,并避免将密钥放入生产代码。
- 使用参数化查询,并为每个请求验证分区键访问。
- 在实现前编写单元测试,并 mock Cosmos container 边界。
避免
- 不要将模拟器密钥或 TLS 设置复制到生产环境。
- 不要将用户输入拼接到 Cosmos DB 查询中。
- 没有经过衡量的需求时,不要运行跨分区查询。