opencode-api-security-testing 3.0.8 → 3.0.10

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 (79) hide show
  1. package/agents/api-cyber-supervisor.md +9 -3
  2. package/agents/api-probing-miner.md +10 -2
  3. package/agents/api-resource-specialist.md +44 -35
  4. package/agents/api-vuln-verifier.md +56 -24
  5. package/package.json +1 -1
  6. package/postinstall.mjs +1 -0
  7. package/preuninstall.mjs +43 -32
  8. package/src/index.ts +3 -100
  9. package/README.md +0 -74
  10. package/SKILL.md +0 -1797
  11. package/core/advanced_recon.py +0 -788
  12. package/core/agentic_analyzer.py +0 -445
  13. package/core/analyzers/api_parser.py +0 -210
  14. package/core/analyzers/response_analyzer.py +0 -212
  15. package/core/analyzers/sensitive_finder.py +0 -184
  16. package/core/api_fuzzer.py +0 -422
  17. package/core/api_interceptor.py +0 -525
  18. package/core/api_parser.py +0 -955
  19. package/core/browser_tester.py +0 -479
  20. package/core/cloud_storage_tester.py +0 -1330
  21. package/core/collectors/__init__.py +0 -23
  22. package/core/collectors/api_path_finder.py +0 -300
  23. package/core/collectors/browser_collect.py +0 -645
  24. package/core/collectors/browser_collector.py +0 -411
  25. package/core/collectors/http_client.py +0 -111
  26. package/core/collectors/js_collector.py +0 -490
  27. package/core/collectors/js_parser.py +0 -780
  28. package/core/collectors/url_collector.py +0 -319
  29. package/core/context_manager.py +0 -682
  30. package/core/deep_api_tester_v35.py +0 -844
  31. package/core/deep_api_tester_v55.py +0 -366
  32. package/core/dynamic_api_analyzer.py +0 -532
  33. package/core/http_client.py +0 -179
  34. package/core/models.py +0 -296
  35. package/core/orchestrator.py +0 -890
  36. package/core/prerequisite.py +0 -227
  37. package/core/reasoning_engine.py +0 -1042
  38. package/core/response_classifier.py +0 -606
  39. package/core/runner.py +0 -938
  40. package/core/scan_engine.py +0 -599
  41. package/core/skill_executor.py +0 -435
  42. package/core/skill_executor_v2.py +0 -670
  43. package/core/skill_executor_v3.py +0 -704
  44. package/core/smart_analyzer.py +0 -687
  45. package/core/strategy_pool.py +0 -707
  46. package/core/testers/auth_tester.py +0 -264
  47. package/core/testers/idor_tester.py +0 -200
  48. package/core/testers/sqli_tester.py +0 -211
  49. package/core/testing_loop.py +0 -655
  50. package/core/utils/base_path_dict.py +0 -255
  51. package/core/utils/payload_lib.py +0 -167
  52. package/core/utils/ssrf_detector.py +0 -220
  53. package/core/verifiers/vuln_verifier.py +0 -536
  54. package/references/README.md +0 -72
  55. package/references/asset-discovery.md +0 -119
  56. package/references/fuzzing-patterns.md +0 -129
  57. package/references/graphql-guidance.md +0 -108
  58. package/references/intake.md +0 -84
  59. package/references/pua-agent.md +0 -192
  60. package/references/report-template.md +0 -156
  61. package/references/rest-guidance.md +0 -76
  62. package/references/severity-model.md +0 -76
  63. package/references/test-matrix.md +0 -86
  64. package/references/validation.md +0 -78
  65. package/references/vulnerabilities/01-sqli-tests.md +0 -1128
  66. package/references/vulnerabilities/02-user-enum-tests.md +0 -423
  67. package/references/vulnerabilities/03-jwt-tests.md +0 -499
  68. package/references/vulnerabilities/04-idor-tests.md +0 -362
  69. package/references/vulnerabilities/05-sensitive-data-tests.md +0 -466
  70. package/references/vulnerabilities/06-biz-logic-tests.md +0 -501
  71. package/references/vulnerabilities/07-security-config-tests.md +0 -511
  72. package/references/vulnerabilities/08-brute-force-tests.md +0 -457
  73. package/references/vulnerabilities/09-vulnerability-chains.md +0 -465
  74. package/references/vulnerabilities/10-auth-tests.md +0 -537
  75. package/references/vulnerabilities/11-graphql-tests.md +0 -355
  76. package/references/vulnerabilities/12-ssrf-tests.md +0 -396
  77. package/references/vulnerabilities/README.md +0 -148
  78. package/references/workflows.md +0 -192
  79. package/src/hooks/directory-agents-injector.ts +0 -106
@@ -1,8 +1,14 @@
1
1
  ---
2
- version: ">=1.0.0"
3
- requires: ">=1.0.0"
4
- description: API安全测试编排者。协调完整扫描流程,永不停止,主动推进测试进度。
2
+ description: API安全测试编排者。协调完整扫描流程,主动推进测试进度。
5
3
  mode: primary
4
+ model: anthropic/claude-sonnet-4-20250514
5
+ permission:
6
+ edit: ask
7
+ bash:
8
+ "*": ask
9
+ webfetch: allow
10
+ temperature: 0.3
11
+ color: "#FF5733"
6
12
  ---
7
13
 
8
14
  你是 API 安全测试的**赛博监工**,代号"P9"。
@@ -1,8 +1,16 @@
1
1
  ---
2
- version: ">=1.0.0"
3
- requires: ">=1.0.0"
4
2
  description: 漏洞挖掘专家。专注发现和验证 API 安全漏洞。
5
3
  mode: subagent
4
+ model: anthropic/claude-haiku-4-20250514
5
+ permission:
6
+ edit: deny
7
+ bash:
8
+ "curl *": allow
9
+ "python3 *": allow
10
+ "*": deny
11
+ webfetch: allow
12
+ temperature: 0.5
13
+ hidden: false
6
14
  ---
7
15
 
8
16
  你是**API漏洞挖掘专家**,专注于发现和验证安全漏洞。
@@ -1,56 +1,65 @@
1
1
  ---
2
- version: ">=1.0.0"
3
- requires: ">=1.0.0"
4
- description: 资源探测专家。专注采集和发现 API 端点。
2
+ description: 资源探测专家。发现隐藏端点和API资源。
5
3
  mode: subagent
4
+ model: anthropic/claude-haiku-4-20250514
5
+ permission:
6
+ edit: deny
7
+ bash:
8
+ "curl *": allow
9
+ "python3 *": allow
10
+ "*": deny
11
+ webfetch: allow
12
+ temperature: 0.4
13
+ hidden: false
6
14
  ---
7
15
 
8
- 你是**API资源探测专家**,专注于发现和采集 API 端点。
16
+ 你是**API资源探测专家**,专注于发现隐藏的端点和API资源。
9
17
 
10
18
  ## 职责
11
19
 
12
- 1. **全面发现** - 不遗漏任何端点
13
- 2. **动态采集** - 拦截真实请求
14
- 3. **静态分析** - 提取 API 模式
20
+ 1. **端点发现** - 发现所有可用的API端点
21
+ 2. **参数枚举** - 识别所有查询参数和请求体字段
22
+ 3. **技术栈识别** - 分析服务器响应头和技术特征
15
23
 
16
- ## 采集技术
24
+ ## 探测方法
17
25
 
18
- ### 1. 浏览器动态采集
19
- 使用 browser_collect 拦截 XHR/Fetch 请求
26
+ ### 目录爆破
27
+ - 常见API路径: /api/v1/, /api/v2/, /graphql, /admin
28
+ - 配置文件: /.env, /config.json, /swagger.json
29
+ - 备份文件: /.git/, /backup/, /old/
20
30
 
21
- ### 2. JS 静态分析
22
- 使用 js_parse 解析 JavaScript 文件
31
+ ### 参数发现
32
+ - 查询参数: ?id=, ?page=, ?limit=
33
+ - 请求头: Authorization, X-API-Key, X-Request-ID
34
+ - Cookie分析
23
35
 
24
- ### 3. 目录探测
25
- 常见路径:
26
- - /api/v1/*, /graphql
27
- - /swagger, /api-docs
28
- - /.well-known/*
29
-
30
- ## 端点分类
31
-
32
- | 风险 | 类型 | 示例 |
33
- |------|------|------|
34
- | 高 | 认证 | /login, /oauth/* |
35
- | 高 | 数据 | /api/*/list, /search |
36
- | 中 | 用户 | /users, /profile |
37
- | 极高 | 管理 | /admin, /manage |
36
+ ### 版本控制
37
+ - API版本枚举: /api/v1, /api/v2, /api/beta
38
+ - 废弃端点发现
39
+ - 内部端点探测
38
40
 
39
41
  ## 可用工具
40
42
 
41
- - browser_collect: 浏览器采集
42
- - js_parse: JS 文件解析
43
- - api_fuzz_test: 端点探测
43
+ - browser_collect: 浏览器采集动态内容
44
+ - js_parse: JavaScript文件解析
45
+ - api_fuzz_test: API模糊测试
46
+ - api_security_scan: 完整扫描
44
47
 
45
48
  ## 输出格式
46
49
 
47
50
  ```
48
- ## 端点发现报告
51
+ ## 资源发现报告
52
+
53
+ ### 发现的端点
54
+ | # | 端点 | 方法 | 认证 | 状态码 |
55
+ |---|------|------|------|--------|
56
+ | 1 | /api/users | GET | 需要 | 200 |
49
57
 
50
- - 总数: {count}
51
- - 高风险: {high}
52
- - 中风险: {medium}
58
+ ### 技术栈
59
+ - 框架: {framework}
60
+ - 语言: {language}
61
+ - 数据库: {database}
53
62
 
54
- ### 高风险端点
55
- 1. {method} {path} - {reason}
63
+ ### 可疑资源
64
+ - {resource_url} - {reason}
56
65
  ```
@@ -1,51 +1,83 @@
1
1
  ---
2
- version: ">=1.0.0"
3
- requires: ">=1.0.0"
4
- description: 漏洞验证专家。验证和确认安全漏洞。
2
+ description: 漏洞验证专家。确认和验证发现的安全漏洞。
5
3
  mode: subagent
4
+ model: anthropic/claude-haiku-4-20250514
5
+ permission:
6
+ edit: deny
7
+ bash:
8
+ "curl *": allow
9
+ "python3 *": allow
10
+ "*": deny
11
+ webfetch: allow
12
+ temperature: 0.2
13
+ hidden: false
6
14
  ---
7
15
 
8
- 你是**漏洞验证专家**,专注于验证和确认安全漏洞。
16
+ 你是**漏洞验证专家**,专注于确认和验证发现的安全漏洞。
9
17
 
10
18
  ## 职责
11
19
 
12
- 1. **快速验证** - 确认漏洞是否存在
13
- 2. **风险评估** - 判断实际影响
14
- 3. **PoC 生成** - 提供可执行的证明
20
+ 1. **漏洞确认** - 验证漏洞是否真实存在
21
+ 2. **误报排除** - 排除假阳性结果
22
+ 3. **严重程度评估** - 准确评估漏洞风险等级
15
23
 
16
- ## 验证流程
24
+ ## 验证方法
17
25
 
18
- 1. 构造 payload
19
- 2. 发送测试请求
20
- 3. 分析响应
21
- 4. 判断结果
22
- 5. 生成 PoC
26
+ ### SQL 注入验证
27
+ - 确认注入点: 使用不同payload验证
28
+ - 数据提取: 尝试提取数据库版本信息
29
+ - 影响评估: 确定可访问的数据范围
30
+
31
+ ### IDOR 验证
32
+ - 权限确认: 验证是否真的可以访问其他用户数据
33
+ - 影响范围: 测试多个资源ID
34
+ - 认证绕过: 检查是否需要特殊权限
35
+
36
+ ### XSS 验证
37
+ - 执行确认: 验证脚本是否真的执行
38
+ - 上下文分析: 确定注入上下文
39
+ - 过滤器绕过: 测试WAF规则
40
+
41
+ ### 敏感数据泄露
42
+ - 数据确认: 验证数据是否真的敏感
43
+ - 访问控制: 确认是否应该公开
44
+ - 合规检查: 检查是否符合数据保护法规
23
45
 
24
46
  ## 可用工具
25
47
 
26
48
  - vuln_verify: 漏洞验证
27
- - sqli_test: SQL 注入测试
28
- - idor_test: IDOR 测试
49
+ - sqli_test: SQL注入测试
50
+ - idor_test: IDOR测试
29
51
  - api_fuzz_test: 模糊测试
30
52
 
31
53
  ## 输出格式
32
54
 
33
55
  ```
34
- ## 验证结果
56
+ ## 漏洞验证报告
57
+
58
+ ### 漏洞信息
59
+ - **类型**: {vuln_type}
60
+ - **端点**: {endpoint}
61
+ - **参数**: {parameter}
35
62
 
36
- **漏洞类型**: {type}
37
- **端点**: {endpoint}
38
- **验证状态**: CONFIRMED / INVALID / UNCERTAIN
39
- **严重程度**: Critical / High / Medium / Low / Info
63
+ ### 验证结果
64
+ - **状态**: 已确认/误报/需要进一步测试
65
+ - **严重程度**: Critical/High/Medium/Low
66
+ - **CVSS评分**: {score}
40
67
 
41
- ### 测试步骤
42
- 1. {step}
68
+ ### 验证步骤
69
+ 1. {step_1}
70
+ 2. {step_2}
71
+ 3. {step_3}
43
72
 
44
73
  ### PoC
45
74
  ```bash
46
- {command}
75
+ curl -X POST "{endpoint}" \
76
+ -H "Content-Type: application/json" \
77
+ -d '{"payload": "..."}'
47
78
  ```
48
79
 
49
80
  ### 修复建议
50
- {fix}
81
+ - {recommendation_1}
82
+ - {recommendation_2}
51
83
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-api-security-testing",
3
- "version": "3.0.8",
3
+ "version": "3.0.10",
4
4
  "description": "API Security Testing Plugin for OpenCode - Automated vulnerability scanning and penetration testing",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/postinstall.mjs CHANGED
@@ -110,6 +110,7 @@ function main() {
110
110
  console.log(`✓ Installed ${totalInstalled} file(s)`);
111
111
  console.log(`\nAgents: ${agentsTargetDir}`);
112
112
  console.log(`Skill: ${skillTargetDir}`);
113
+ console.log(`\n⚠️ IMPORTANT: Restart OpenCode to discover new agents`);
113
114
  } else {
114
115
  console.log(`⚠ Installed ${totalInstalled}, failed ${totalFailed}`);
115
116
  process.exit(1);
package/preuninstall.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * preuninstall.mjs - API Security Testing Plugin Cleanup
4
+ * preuninstall.mjs - API Security Testing Plugin
5
5
  *
6
6
  * Removes:
7
7
  * 1. agents from ~/.config/opencode/agents/
8
8
  * 2. SKILL.md and references from ~/.config/opencode/skills/api-security-testing/
9
9
  */
10
10
 
11
- import { unlinkSync, existsSync, readdirSync, rmdirSync, rmSync } from "node:fs";
11
+ import { unlinkSync, existsSync, readdirSync, rmdirSync } from "node:fs";
12
12
  import { join } from "node:path";
13
13
  import { fileURLToPath } from "node:url";
14
14
 
@@ -20,54 +20,65 @@ function getOpencodeBaseDir() {
20
20
  return join(home, ".config", "opencode");
21
21
  }
22
22
 
23
- const AGENTS_TO_REMOVE = [
24
- "api-cyber-supervisor.md",
25
- "api-probing-miner.md",
26
- "api-resource-specialist.md",
27
- "api-vuln-verifier.md",
28
- ];
29
-
30
23
  function main() {
31
24
  const agentsTargetDir = join(getOpencodeBaseDir(), "agents");
32
25
  const skillTargetDir = join(getOpencodeBaseDir(), "skills", "api-security-testing");
33
26
 
34
- console.log("[api-security-testing] Cleaning up...");
35
- console.log(` Home: ${getOpencodeBaseDir()}`);
27
+ console.log("[api-security-testing] Uninstalling...");
36
28
 
37
29
  let totalRemoved = 0;
38
30
  let totalFailed = 0;
39
31
 
32
+ // 1. Remove agents
40
33
  console.log("\n[1/2] Removing agents...");
41
- for (const agent of AGENTS_TO_REMOVE) {
42
- const agentPath = join(agentsTargetDir, agent);
43
- try {
44
- if (existsSync(agentPath)) {
45
- unlinkSync(agentPath);
46
- console.log(` ✓ ${agent}`);
47
- totalRemoved++;
34
+ if (existsSync(agentsTargetDir)) {
35
+ const agentFiles = ["api-cyber-supervisor.md", "api-probing-miner.md", "api-resource-specialist.md", "api-vuln-verifier.md"];
36
+ for (const file of agentFiles) {
37
+ const filePath = join(agentsTargetDir, file);
38
+ try {
39
+ if (existsSync(filePath)) {
40
+ unlinkSync(filePath);
41
+ console.log(` ✓ Removed ${file}`);
42
+ totalRemoved++;
43
+ }
44
+ } catch (err) {
45
+ console.error(` ✗ Failed to remove ${file}: ${err.message}`);
46
+ totalFailed++;
48
47
  }
49
- } catch (err) {
50
- console.error(` ✗ ${agent}: ${err.message}`);
51
- totalFailed++;
52
48
  }
53
49
  }
54
50
 
55
- console.log("\n[2/2] Removing skill files...");
56
- try {
57
- if (existsSync(skillTargetDir)) {
58
- rmSync(skillTargetDir, { recursive: true, force: true });
59
- console.log(` ✓ ${skillTargetDir}`);
60
- totalRemoved++;
51
+ // 2. Remove SKILL.md and references
52
+ console.log("\n[2/2] Removing SKILL.md and references...");
53
+ if (existsSync(skillTargetDir)) {
54
+ try {
55
+ function removeDir(dir) {
56
+ const items = readdirSync(dir);
57
+ for (const item of items) {
58
+ const itemPath = join(dir, item);
59
+ try {
60
+ unlinkSync(itemPath);
61
+ totalRemoved++;
62
+ } catch {
63
+ if (existsSync(itemPath)) {
64
+ removeDir(itemPath);
65
+ }
66
+ }
67
+ }
68
+ rmdirSync(dir);
69
+ }
70
+
71
+ removeDir(skillTargetDir);
72
+ console.log(" ✓ Removed skill directory");
73
+ } catch (err) {
74
+ console.error(` ✗ Failed to remove skill directory: ${err.message}`);
75
+ totalFailed++;
61
76
  }
62
- } catch (err) {
63
- console.error(` ✗ ${skillTargetDir}: ${err.message}`);
64
- totalFailed++;
65
77
  }
66
78
 
67
79
  console.log(`\n========================================`);
68
80
  if (totalFailed === 0) {
69
- console.log(`✓ Removed ${totalRemoved} item(s)`);
70
- console.log(`\nThanks for using api-security-testing!`);
81
+ console.log(`✓ Removed ${totalRemoved} file(s)`);
71
82
  } else {
72
83
  console.log(`⚠ Removed ${totalRemoved}, failed ${totalFailed}`);
73
84
  }
package/src/index.ts CHANGED
@@ -1,12 +1,9 @@
1
1
  import type { Plugin } from "@opencode-ai/plugin";
2
2
  import { tool } from "@opencode-ai/plugin";
3
- import { join, dirname, resolve } from "path";
4
- import { existsSync, readFileSync } from "fs";
3
+ import { join } from "path";
5
4
 
6
5
  const SKILL_DIR = "skills/api-security-testing";
7
6
  const CORE_DIR = `${SKILL_DIR}/core`;
8
- const AGENTS_DIR = ".config/opencode/agents";
9
- const AGENTS_FILENAME = "AGENTS.md";
10
7
 
11
8
  function getSkillPath(ctx: { directory: string }): string {
12
9
  return join(ctx.directory, SKILL_DIR);
@@ -17,43 +14,14 @@ function getCorePath(ctx: { directory: string }): string {
17
14
  }
18
15
 
19
16
  function checkDeps(ctx: { directory: string }): string {
20
- const skillPath = getSkillPath(ctx);
21
- const reqFile = join(skillPath, "requirements.txt");
17
+ const { existsSync } = require("fs");
18
+ const reqFile = join(getSkillPath(ctx), "requirements.txt");
22
19
  if (existsSync(reqFile)) {
23
20
  return `pip install -q -r "${reqFile}" 2>/dev/null; `;
24
21
  }
25
22
  return "";
26
23
  }
27
24
 
28
- function getAgentsDir(): string {
29
- const home = process.env.HOME || process.env.USERPROFILE || "/root";
30
- return join(home, AGENTS_DIR);
31
- }
32
-
33
- function getInjectedAgentsPrompt(): string {
34
- const agentsDir = getAgentsDir();
35
- const agentsPath = join(agentsDir, "api-cyber-supervisor.md");
36
-
37
- if (!existsSync(agentsPath)) {
38
- return "";
39
- }
40
-
41
- try {
42
- const content = readFileSync(agentsPath, "utf-8");
43
- return `
44
-
45
- [API Security Testing Agents Available]
46
- When performing security testing tasks, you can use the following specialized agents:
47
-
48
- ${content}
49
-
50
- To activate these agents, simply mention their name in your response (e.g., "@api-cyber-supervisor" to coordinate security testing).
51
- `;
52
- } catch {
53
- return "";
54
- }
55
- }
56
-
57
25
  async function execShell(ctx: unknown, cmd: string): Promise<string> {
58
26
  const shell = ctx as { $: (strings: TemplateStringsArray, ...expr: unknown[]) => Promise<{ toString(): string }> };
59
27
  const result = await shell.$`${cmd}`;
@@ -63,8 +31,6 @@ async function execShell(ctx: unknown, cmd: string): Promise<string> {
63
31
  const ApiSecurityTestingPlugin: Plugin = async (ctx) => {
64
32
  console.log("[api-security-testing] Plugin loaded");
65
33
 
66
- const injectedSessions = new Set<string>();
67
-
68
34
  return {
69
35
  tool: {
70
36
  api_security_scan: tool({
@@ -274,69 +240,6 @@ print(result)
274
240
  },
275
241
  }),
276
242
  },
277
-
278
- "chat.message": async (input, output) => {
279
- const sessionID = input.sessionID;
280
-
281
- if (!injectedSessions.has(sessionID)) {
282
- injectedSessions.add(sessionID);
283
-
284
- const agentsPrompt = getInjectedAgentsPrompt();
285
- if (agentsPrompt) {
286
- const parts = output.parts as Array<{ type: string; text?: string }>;
287
- const textPart = parts.find(p => p.type === "text");
288
- if (textPart && textPart.text) {
289
- textPart.text += agentsPrompt;
290
- }
291
- }
292
- }
293
- },
294
-
295
- "tool.execute.after": async (input, output) => {
296
- const toolName = input.tool.toLowerCase();
297
- const agentsDir = getAgentsDir();
298
-
299
- if (!existsSync(agentsDir)) return;
300
-
301
- if (toolName === "read") {
302
- const filePath = output.title;
303
- if (!filePath) return;
304
-
305
- const resolved = resolve(filePath);
306
- const dir = dirname(resolved);
307
-
308
- if (!dir.includes(agentsDir)) return;
309
-
310
- const agentsPath = join(agentsDir, AGENTS_FILENAME);
311
- if (!existsSync(agentsPath)) return;
312
-
313
- try {
314
- const content = readFileSync(agentsPath, "utf-8");
315
- output.output += `\n\n[Agents Definition]\n${content}`;
316
- } catch (err) {
317
- console.error("[api-security-testing] Failed to inject agents:", err);
318
- }
319
- }
320
- },
321
-
322
- event: async (input) => {
323
- const { event } = input;
324
-
325
- if (event.type === "session.deleted" || event.type === "session.compacted") {
326
- const props = event.properties as Record<string, unknown> | undefined;
327
- let sessionID: string | undefined;
328
-
329
- if (event.type === "session.deleted") {
330
- sessionID = (props?.info as { id?: string })?.id;
331
- } else {
332
- sessionID = (props?.sessionID ?? (props?.info as { id?: string })?.id) as string | undefined;
333
- }
334
-
335
- if (sessionID) {
336
- injectedSessions.delete(sessionID);
337
- }
338
- }
339
- },
340
243
  };
341
244
  };
342
245
 
package/README.md DELETED
@@ -1,74 +0,0 @@
1
- # API Security Testing Plugin
2
-
3
- OpenCode 插件,提供完整的 API 安全测试能力。
4
-
5
- ## 安装
6
-
7
- ```bash
8
- npm install opencode-api-security-testing
9
- ```
10
-
11
- ## 配置
12
-
13
- 在 `opencode.json` 中添加:
14
-
15
- ```json
16
- {
17
- "plugin": ["opencode-api-security-testing"]
18
- }
19
- ```
20
-
21
- ## Agents (4个)
22
-
23
- | Agent | 模式 | 描述 |
24
- |-------|------|------|
25
- | `@api-cyber-supervisor` | Primary | 编排者,协调完整扫描流程,永不停止 |
26
- | `@api-probing-miner` | Subagent | 漏洞挖掘专家 |
27
- | `@api-resource-specialist` | Subagent | 资源探测专家 |
28
- | `@api-vuln-verifier` | Subagent | 漏洞验证专家 |
29
-
30
- ## Tools (10个)
31
-
32
- | Tool | 功能 | 调用方式 |
33
- |------|------|---------|
34
- | `api_security_scan` | 完整 API 安全扫描 | `api_security_scan target="url"` |
35
- | `api_fuzz_test` | API 模糊测试 | `api_fuzz_test endpoint="url"` |
36
- | `browser_collect` | 浏览器采集动态内容 | `browser_collect url="url"` |
37
- | `js_parse` | JavaScript 文件解析 | `js_parse file_path="/path/to/file.js"` |
38
- | `graphql_test` | GraphQL 安全测试 | `graphql_test endpoint="url"` |
39
- | `cloud_storage_test` | 云存储安全测试 | `cloud_storage_test bucket_url="url"` |
40
- | `vuln_verify` | 漏洞验证 | `vuln_verify vuln_type="sqli" endpoint="url"` |
41
- | `sqli_test` | SQL 注入测试 | `sqli_test endpoint="url" param="id"` |
42
- | `idor_test` | IDOR 越权测试 | `idor_test endpoint="url" resource_id="1"` |
43
- | `auth_test` | 认证安全测试 | `auth_test endpoint="url"` |
44
-
45
- ## 使用方式
46
-
47
- ### 方式一:使用 Agent(推荐)
48
-
49
- ```
50
- @api-cyber-supervisor 对 https://example.com 进行全面安全测试
51
- ```
52
-
53
- ### 方式二:使用 Skill
54
-
55
- ```
56
- skill({ name: "api-security-testing" })
57
- ```
58
-
59
- ### 方式三:直接使用 Tool
60
-
61
- ```
62
- api_security_scan target="https://example.com" scan_type="full"
63
- ```
64
-
65
- ## 依赖
66
-
67
- Python 依赖会自动安装。也可手动安装:
68
- ```bash
69
- pip install -r skills/api-security-testing/requirements.txt
70
- ```
71
-
72
- ## 重要
73
-
74
- **仅用于合法授权的安全测试,测试前确保有书面授权。**