Install any skill in seconds. Free to start, no credit card required.
Get Started Free →doccker/multi-tenant-safety
当代码涉及多租户隔离(TenantContext、tenantId、租户拦截器/过滤器、X-Tenant-Code)时触发。防止租户越权访问、数据串租户等安全问题。
Passed 23 of 23 test cases with the skill, and 13 of 23 without it.
and 15 more in the full report
10 fixed13 passed either way0 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 10 test cases the skill fixed. Same model, same prompt, with and without the skill.
We want to ensure all AI-generated multi-tenant security code reviews adhere to our internal formatting standard for citations. What specific markdown tag line must end every multi-tenant safety response?
| Checked | Without skill | With skill |
|---|---|---|
| Requires ending the response with `> 📋 本回复遵循:`multi-tenant-safety` - [章节名]`. | Missed | Passed |
The instructions your model reads when the skill loads.
当系统涉及多租户架构时,防止租户间数据越权访问。
场景: 拦截器/过滤器从请求头(如 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
// 就能读到其他租户的数据
// ✅ 正确: header 只做路由定位,必须与 token tenantId 校验一致
@Override
public boolean preHandle(HttpServletRequest request, ...) {
String tenantCode = request.getHeader("X-Tenant-Code");
TenantMiniAppConfig config = configRepository.findByTenantCode(tenantCode);
test cases passed, vs 13 / 23 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.