🛡️
QualityPython

Multi-Tenant Safety

by doccker

Multi-Tenant Safety is a Quality skill for Claude Code, published by doccker in cc-use-exp.

1K stars105 forkson doccker/cc-use-expAdded 2026/08/21Repository updated 2026/06/30
antigravityclaude-codecodexcursorgemini-cligithub-copilot
Install in seconds
Install Multi-Tenant Safety
Copy Multi-Tenant Safety into your Claude Code skills folder. Run the command in your terminal, or review the source on GitHub before installing.
terminal
npx degit https://github.com/doccker/cc-use-exp/tree/main/.antigravity/skills/multi-tenant-safety ~/.claude/skills/multi-tenant-safety

Requires Node.js. Downloads this skill only — not the rest of the repository — into your Claude Code skills folder.

Without Node.js

git clone https://github.com/doccker/cc-use-exp.git

Clones the whole repository, then copy the skill’s own directory into your skills folder yourself.

In this catalog

Source file
.antigravity/skills/multi-tenant-safety/SKILL.md in doccker/cc-use-exp
Installs to
~/.claude/skills/multi-tenant-safety
Collection
One of 23 skills cataloged from this repository
Category
Quality1354 skills

What Multi-Tenant Safety does

Multi-Tenant Safety covers checks for tenant isolation in multi-tenant systems. Use it when code touches TenantContext, tenantId, tenant headers, filters, or repository access to prevent cross-tenant data leaks.

Multi-Tenant Safety is cataloged under Quality on DirSkills. Multi-Tenant Safety comes from a repository tagged antigravity, claude-code, codex, cursor and gemini-cli.

Documentation

README

多租户隔离安全规范

当系统涉及多租户架构时,防止租户间数据越权访问。


陷阱 #1: 租户上下文来源信任错误

场景: 拦截器/过滤器从请求头(如 X-Tenant-Code)设置租户上下文,但未与认证 token 中的 tenantId 做一致性校验

问题根因

请求头可以被客户端任意伪造。如果后端只信任请求头中的租户标识,攻击者只需修改 header 就能访问其他租户的数据。

错误示例

// ❌ 错误: 只信任请求头,未校验 token
@Override
public boolean preHandle(HttpServletRequest request, ...) {
    String tenantCode = request.getHeader("X-Tenant-Code");
    TenantMiniAppConfig config = configRepository.findByTenantCode(tenantCode);
    TenantContext.setTenantId(config.getTenantId());  // 直接信任 header
    return true;
}
// 攻击者拿着 tenantId=1 的 token,配上 X-Tenant-Code: OTHER_TENANT
// 就能读到其他租户的数据

正确做法

This is the opening of the README. Read the full README on GitHub.

Frequently asked about Multi-Tenant Safety

  • What else does doccker publish alongside Multi-Tenant Safety?

    Multi-Tenant Safety is one of 23 skills that DirSkills catalogs from doccker/cc-use-exp, the repository it ships in. Its siblings there include API Design Safety, Api Design Safety and Api Proxy Safety. Each one is a separate skill with its own page in this directory, installs the same way Multi-Tenant Safety does, and is maintained by doccker in that same repository. The rest of the collection is listed on the doccker/cc-use-exp page.

  • How does Multi-Tenant Safety compare to other Quality skills?

    Multi-Tenant Safety ranks #840 by stars among the 1354 Quality skills in this catalog. The most-starred ones next to it are Benchmark, Benchmark Optimization Loop and API Design Patterns. DirSkills ranks by the star count of the repository each skill ships in, so that order reflects how popular those repositories are rather than any review of Multi-Tenant Safety against them. Open each page to compare what they document and how they install.

More from doccker/cc-use-exp

Multi-Tenant Safety is one of 23 skills cataloged on DirSkills from doccker/cc-use-exp.

See all 23 skills
🛡️
1w ago

API Design Safety

API Design Safety helps you design REST API responses and generated outputs with consistent field semantics, null handling, and status codes. It also checks required fields before exporting files or sending downstream payloads to avoid silent failures.
Quality
1K105
🧩
1w ago

Api Design Safety

Api Design Safety helps prevent REST API response design mistakes such as field mix-ups, ambiguous return types, and inconsistent empty values. Use it when designing or changing API responses and handling returned data.
AI Engineering
1K105
🛡️
1w ago

Api Proxy Safety

Api Proxy Safety defines safe keyword matching for gateways, proxies, WAFs, and CDNs so normal content is not misclassified as an error. It is used when implementing heuristic checks for response bodies, status codes, and error schemas.
DevOps
1K105
1w ago

Async Task Pattern

Async Task Pattern provides a standard triggerAsync/getStatus flow for operations that may run longer than 10 seconds. Use it for batch processing, remote API fan-out, or scans that would otherwise time out or be triggered twice.
Automation
1K105
🐚
1w ago

Bash Style

Bash Style provides shell scripting and command-writing conventions for .sh files, Dockerfiles, Makefiles, YAML, and Markdown bash blocks. Use it to format commands, heredocs, file writes, permissions, and script safety.
Writing
1K105
🧩
1w ago

Code Quality Principles

Code Quality Principles provides a checklist for modular design, refactoring, and code review. Use it to assess module size, call depth, fan-in/fan-out, boundaries, scope cohesion, and predictability.
Quality
1K105