Install any skill in seconds. Free to start, no credit card required.
Get Started Free →doccker/cc-multi-tenant-safety
多租户隔离安全检查,防止租户越权访问和数据串租户。
Passed 22 of 22 test cases with the skill, and 17 of 22 without it.
and 4 more in the full report
5 fixed17 passed either way0 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
Please review this Java Spring Service method for multi-tenant order retrieval: `public Order getOrder(Long orderId) { return orderRepository.findByTenantIdAndId(TenantContext.getTenantId(), orderId).orElseThrow(); }`. Provide a brief security review and code confirmation.
| Checked | Without skill | With skill |
|---|---|---|
| The response includes the rule sourcing footer starting with > 📋 本回复遵循: | 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);
// 从认证 token 中取出 tenantId(真相源)
Long tokenTenantId = (Long) request.getAttribute("tokenTenantId");
test cases passed, vs 17 / 22 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.