opencode-api-security-testing 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +98 -0
  2. package/agents/cyber-supervisor.md +55 -0
  3. package/agents/probing-miner.md +42 -0
  4. package/agents/resource-specialist.md +31 -0
  5. package/commands/api-security-testing-scan.md +59 -0
  6. package/commands/api-security-testing-test.md +49 -0
  7. package/commands/api-security-testing.md +72 -0
  8. package/index.ts +9 -0
  9. package/package.json +37 -0
  10. package/references/README.md +72 -0
  11. package/references/asset-discovery.md +612 -0
  12. package/references/fuzzing-patterns.md +129 -0
  13. package/references/graphql-guidance.md +684 -0
  14. package/references/pua-agent.md +192 -0
  15. package/references/report-template.md +63 -0
  16. package/references/rest-guidance.md +547 -0
  17. package/references/severity-model.md +288 -0
  18. package/references/test-matrix.md +284 -0
  19. package/references/validation.md +425 -0
  20. package/references/vulnerabilities/01-sqli-tests.md +1128 -0
  21. package/references/vulnerabilities/02-user-enum-tests.md +423 -0
  22. package/references/vulnerabilities/03-jwt-tests.md +499 -0
  23. package/references/vulnerabilities/04-idor-tests.md +362 -0
  24. package/references/vulnerabilities/05-sensitive-data-tests.md +466 -0
  25. package/references/vulnerabilities/06-biz-logic-tests.md +501 -0
  26. package/references/vulnerabilities/07-security-config-tests.md +511 -0
  27. package/references/vulnerabilities/08-brute-force-tests.md +457 -0
  28. package/references/vulnerabilities/09-vulnerability-chains.md +465 -0
  29. package/references/vulnerabilities/10-auth-tests.md +537 -0
  30. package/references/vulnerabilities/11-graphql-tests.md +355 -0
  31. package/references/vulnerabilities/12-ssrf-tests.md +396 -0
  32. package/references/vulnerabilities/README.md +148 -0
  33. package/references/workflows.md +192 -0
  34. package/src/index.ts +108 -0
  35. package/tsconfig.json +17 -0
@@ -0,0 +1,129 @@
1
+ # Fuzzing 字典
2
+
3
+ ## API前缀字典
4
+
5
+ ```python
6
+ common_api_prefixes = [
7
+ # 协议/网关
8
+ "/gateway", "/proxy", "/route", "/ingress",
9
+ "/api-gateway", "/openapi", "/open/api",
10
+ # 版本前缀
11
+ "/v1", "/v2", "/v3", "/v4", "/v5",
12
+ "/api/v1", "/api/v2", "/api/v3",
13
+ "/rest", "/rest/api", "/graphql",
14
+ # 管理后台
15
+ "/admin", "/admin/api", "/manager", "/backend",
16
+ "/backoffice", "/cms",
17
+ # 业务模块
18
+ "/user", "/users", "/member", "/members",
19
+ "/order", "/orders", "/trade", "/transaction",
20
+ "/product", "/goods", "/shop", "/store",
21
+ "/payment", "/pay", "/finance", "/account",
22
+ "/file", "/upload", "/oss", "/storage",
23
+ "/message", "/notify", "/sms", "/email",
24
+ "/admin", "/authority", "/system", "/config",
25
+ # 微服务
26
+ "/service", "/services", "/rpc", "/grpc",
27
+ "/auth", "/oauth", "/sso", "/cas",
28
+ # 移动端
29
+ "/mobile", "/app", "/ios", "/android",
30
+ "/miniapp", "/wechat", "/applet",
31
+ ]
32
+ ```
33
+
34
+ ## API端点字典
35
+
36
+ ```python
37
+ common_api_endpoints = [
38
+ # 通用CRUD
39
+ "login", "logout", "register", "list", "add", "delete", "modify",
40
+ "getList", "getListOfPage", "detail", "getInfo", "profile",
41
+ # 用户相关
42
+ "user", "user/list", "user/add", "user/delete", "user/modify",
43
+ "user/profile", "user/restPassword", "user/enable", "user/disable",
44
+ # 角色权限
45
+ "role", "role/list", "role/add", "role/delete", "role/modify",
46
+ "menu", "menu/list", "menu/add", "menu/delete", "menu/modify",
47
+ # 文件操作
48
+ "file", "upload", "download", "import", "export",
49
+ "imgUpload", "avatar", "attachment",
50
+ ]
51
+ ```
52
+
53
+ ## Fuzzing测试流程
54
+
55
+ ```python
56
+ for prefix in common_api_prefixes:
57
+ for endpoint in common_api_endpoints:
58
+ url = target + prefix + "/" + endpoint
59
+ response = requests.get(url)
60
+ # 记录返回200的接口
61
+ ```
62
+
63
+ ## API根路径探测
64
+
65
+ ```python
66
+ root_paths = [
67
+ "/", "/login", "/auth", "/oauth", "/sso", "/cas",
68
+ "/health", "/healthz", "/ready", "/status", "/info",
69
+ "/metrics", "/ping", "/actuator",
70
+ ]
71
+
72
+ for path in root_paths:
73
+ url = api_base + path
74
+ response = requests.get(url)
75
+ if "json" in response.headers.get("Content-Type", ""):
76
+ # 发现可访问的接口
77
+ ```
78
+
79
+ ## 业务端点模板扩展
80
+
81
+ ```
82
+ 发现的模式: /{module}/{operation}
83
+ 可能存在的端点:
84
+ - /{module}/list → 列表查询
85
+ - /{module}/add → 新增创建
86
+ - /{module}/modify → 修改更新
87
+ - /{module}/delete → 删除操作
88
+ - /{module}/detail → 详情查看
89
+ - /{module}/getInfo → 信息获取
90
+ - /{module}/export → 导出数据
91
+ - /{module}/import → 导入数据
92
+
93
+ RESTful风格:
94
+ - GET /{resource}/{id} → 获取详情
95
+ - PUT /{resource}/{id} → 完整更新
96
+ - DELETE /{resource}/{id} → 删除资源
97
+ - PATCH /{resource}/{id} → 部分更新
98
+ ```
99
+
100
+ ## 非通用base_path字典
101
+
102
+ ```python
103
+ extended_base_paths = [
104
+ # 协议/网关
105
+ "/gateway", "/proxy", "/route", "/ingress",
106
+ "/api-gateway", "/openapi", "/open/api",
107
+ # 版本前缀
108
+ "/v1", "/v2", "/v3", "/v4", "/v5",
109
+ "/api/v1", "/api/v2", "/api/v3",
110
+ "/rest", "/rest/api", "/graphql",
111
+ # 管理后台
112
+ "/admin", "/manager", "/manage", "/console",
113
+ "/backend", "/backoffice", "/cms",
114
+ # 业务模块
115
+ "/user", "/users", "/member", "/members",
116
+ "/order", "/orders", "/trade", "/transaction",
117
+ "/product", "/goods", "/shop", "/store",
118
+ "/payment", "/pay", "/finance", "/account",
119
+ "/file", "/upload", "/oss", "/storage",
120
+ "/message", "/notify", "/sms", "/email",
121
+ "/admin", "/authority", "/system", "/config",
122
+ # 微服务
123
+ "/service", "/services", "/rpc", "/grpc",
124
+ "/auth", "/oauth", "/sso", "/cas",
125
+ # 移动端
126
+ "/mobile", "/app", "/ios", "/android",
127
+ "/miniapp", "/wechat", "/applet",
128
+ ]
129
+ ```