SuperAPI AI Directory

auth-security-audit

Security & auditing

View repository

Updated 10-16 09:30

About this skill

Auth Security Audit

Applicable Scenarios

  • Authorization bypass detection (horizontal / vertical)
  • IDOR (Insecure Direct Object Reference)
  • Token security (JWT / Session)
  • Session management
  • Password policy
  • Multi-tenant isolation

Core Principles

1. 每个写操作都测越权
2. 每个读操作都测跨用户
3. Token 必须有过期 + 可撤销
4. 不暴露资源存在性
5. 多租户必须隔离

Test Matrix

对每个端点:
  □ 无 Token → 401
  □ 过期 Token → 401
  □ 篡改 Token → 401
  □ 低权限角色 → 403
  □ 同角色跨用户 → 403/404
  □ 跨租户 → 403/404
  □ Admin 可访问 → 200

IDOR Detection

方法:
  1. 用 User A 创建资源(ID=123)
  2. 用 User B 的 Token 访问 /resources/123
  3. 预期:403 或 404
  4. 实际:如果 200 = IDOR 漏洞

常见位置:
  - GET /orders/{id}
  - PATCH /users/{id}
  - DELETE /files/{id}
  - GET /invoices/{id}/pdf

Supporting Templates

  • templates/auth-audit-checklist.md — Authentication and authorization audit checklist

Quality Self-Check

□ 每个端点测越权
□ IDOR 全覆盖
□ Token 安全(过期 / 篡改 / 撤销)
□ 会话管理(并发 / 超时)
□ 密码策略(强度 / 重置)
□ 多租户隔离
□ 不暴露存在性

Common Pitfalls

  1. Only testing your own role——missing cross-role authorization bypass
  2. Not testing IDOR——the most common high-risk issue
  3. Not testing cross-tenant——data leakage
  4. Not testing Token tampering——forgery risk
  5. Not testing password reset——account takeover

Collaboration with Other Skills

上游:
  api-designer auth-permission → 权限矩阵

下游:
  security-report → 发现纳入报告
  backend-engineer → 修复