opencode-api-security-testing 5.2.0 → 5.2.2

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.
package/SKILL.md CHANGED
@@ -69,12 +69,6 @@ tools:
69
69
  - name: report_generator
70
70
  description: "Compile evidence-based security report."
71
71
  usage: "During 报告 to generate deliverables."
72
- - name: endpoint_discover
73
- description: "Auto-discover API endpoints from JS, HTML, sitemap, robots.txt, and common paths."
74
- usage: "During 侦察 to automatically map the attack surface without manual input."
75
- - name: env_checker
76
- description: "Auto-detect and install missing dependencies (Python, pip, Playwright, etc.)."
77
- usage: "Runs automatically during postinstall; can be triggered manually to fix environment issues."
78
72
  notes:
79
73
  - "All tools must be used within their defined phases; avoid cross-phase misuse."
80
74
  - "Preserve evidence with timestamps; ensure traceability for audits."
@@ -31,7 +31,6 @@ color: "#FF5733"
31
31
 
32
32
  | 工具 | 用途 | 场景 |
33
33
  |------|------|------|
34
- | endpoint_discover | 端点自动发现 | 从 JS/HTML/Sitemap 提取 |
35
34
  | api_security_scan | 完整扫描 | 全面测试 |
36
35
  | api_fuzz_test | 模糊测试 | 发现未知端点 |
37
36
  | browser_collect | 浏览器采集 | SPA 应用 |
@@ -41,14 +40,13 @@ color: "#FF5733"
41
40
  | cloud_storage_test | 云存储测试 | OSS/S3 |
42
41
  | idor_test | IDOR 测试 | 越权漏洞 |
43
42
  | sqli_test | SQLi 测试 | 注入漏洞 |
44
- | report_generate | 报告生成 | Markdown/HTML/JSON 格式 |
45
43
 
46
44
  ## 测试流程
47
45
 
48
46
  ### Phase 1: 侦察
49
- 1. endpoint_discover 自动发现所有 API 端点
50
- 2. browser_collect 采集动态端点
51
- 3. js_parse 分析 JS 文件
47
+ 1. browser_collect 采集动态端点
48
+ 2. js_parse 分析 JS 文件
49
+ 3. url_discover 发现隐藏端点
52
50
 
53
51
  ### Phase 2: 分析
54
52
  1. 识别技术栈
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-api-security-testing",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
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/src/index.ts CHANGED
@@ -2,6 +2,10 @@ import type { Plugin } from "@opencode-ai/plugin";
2
2
  import { tool } from "@opencode-ai/plugin";
3
3
  import { join } from "path";
4
4
  import { existsSync, readFileSync } from "fs";
5
+ import { exec } from "child_process";
6
+ import { promisify } from "util";
7
+
8
+ const execAsync = promisify(exec);
5
9
 
6
10
  const SKILL_DIR = "skills/api-security-testing";
7
11
  const CORE_DIR = `${SKILL_DIR}/core`;
@@ -183,9 +187,24 @@ To activate these agents, simply mention their name in your response (e.g., "@ap
183
187
  }
184
188
 
185
189
  async function execShell(ctx: unknown, cmd: string): Promise<string> {
186
- const shell = ctx as { $: (strings: TemplateStringsArray, ...expr: unknown[]) => Promise<{ toString(): string }> };
187
- const result = await shell.$`${cmd}`;
188
- return result.toString();
190
+ try {
191
+ const { stdout, stderr } = await execAsync(cmd, {
192
+ maxBuffer: 1024 * 1024 * 10, // 10MB buffer
193
+ timeout: 120000, // 2 minutes timeout
194
+ shell: process.platform === "win32" ? "powershell.exe" : undefined
195
+ });
196
+ if (stderr && !stdout) {
197
+ return `Error: ${stderr}`;
198
+ }
199
+ return stdout || stderr;
200
+ } catch (error: unknown) {
201
+ const err = error as { message?: string; stdout?: string; stderr?: string };
202
+ // 如果有 stdout 输出,即使命令失败也返回输出
203
+ if (err.stdout) {
204
+ return err.stdout;
205
+ }
206
+ return `Error: ${err.message || "Unknown error"}`;
207
+ }
189
208
  }
190
209
 
191
210
  function getFailureCount(sessionID: string): number {