opencode-api-security-testing 4.0.0 → 5.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.
- package/SKILL.md +74 -1795
- package/agents/api-cyber-supervisor.md +9 -3
- package/agents/api-probing-miner.md +10 -2
- package/agents/api-resource-specialist.md +44 -35
- package/agents/api-vuln-verifier.md +56 -24
- package/package.json +48 -29
- package/postinstall.mjs +149 -0
- package/preuninstall.mjs +87 -0
- package/references/references/README.md +72 -0
- package/references/references/asset-discovery.md +119 -0
- package/references/references/fuzzing-patterns.md +129 -0
- package/references/references/graphql-guidance.md +108 -0
- package/references/references/intake.md +84 -0
- package/references/references/pua-agent.md +192 -0
- package/references/references/report-template.md +156 -0
- package/references/references/rest-guidance.md +76 -0
- package/references/references/severity-model.md +76 -0
- package/references/references/test-matrix.md +86 -0
- package/references/references/validation.md +78 -0
- package/references/references/vulnerabilities/01-sqli-tests.md +1128 -0
- package/references/references/vulnerabilities/02-user-enum-tests.md +423 -0
- package/references/references/vulnerabilities/03-jwt-tests.md +499 -0
- package/references/references/vulnerabilities/04-idor-tests.md +362 -0
- package/references/references/vulnerabilities/05-sensitive-data-tests.md +466 -0
- package/references/references/vulnerabilities/06-biz-logic-tests.md +501 -0
- package/references/references/vulnerabilities/07-security-config-tests.md +511 -0
- package/references/references/vulnerabilities/08-brute-force-tests.md +457 -0
- package/references/references/vulnerabilities/09-vulnerability-chains.md +465 -0
- package/references/references/vulnerabilities/10-auth-tests.md +537 -0
- package/references/references/vulnerabilities/11-graphql-tests.md +355 -0
- package/references/references/vulnerabilities/12-ssrf-tests.md +396 -0
- package/references/references/vulnerabilities/README.md +148 -0
- package/references/references/workflows.md +192 -0
- package/src/index.ts +450 -91
- package/src/src/index.ts +535 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
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
|
-
|
|
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
|
|
16
|
+
你是**API资源探测专家**,专注于发现隐藏的端点和API资源。
|
|
9
17
|
|
|
10
18
|
## 职责
|
|
11
19
|
|
|
12
|
-
1.
|
|
13
|
-
2.
|
|
14
|
-
3.
|
|
20
|
+
1. **端点发现** - 发现所有可用的API端点
|
|
21
|
+
2. **参数枚举** - 识别所有查询参数和请求体字段
|
|
22
|
+
3. **技术栈识别** - 分析服务器响应头和技术特征
|
|
15
23
|
|
|
16
|
-
##
|
|
24
|
+
## 探测方法
|
|
17
25
|
|
|
18
|
-
###
|
|
19
|
-
|
|
26
|
+
### 目录爆破
|
|
27
|
+
- 常见API路径: /api/v1/, /api/v2/, /graphql, /admin
|
|
28
|
+
- 配置文件: /.env, /config.json, /swagger.json
|
|
29
|
+
- 备份文件: /.git/, /backup/, /old/
|
|
20
30
|
|
|
21
|
-
###
|
|
22
|
-
|
|
31
|
+
### 参数发现
|
|
32
|
+
- 查询参数: ?id=, ?page=, ?limit=
|
|
33
|
+
- 请求头: Authorization, X-API-Key, X-Request-ID
|
|
34
|
+
- Cookie分析
|
|
23
35
|
|
|
24
|
-
###
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
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:
|
|
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
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
58
|
+
### 技术栈
|
|
59
|
+
- 框架: {framework}
|
|
60
|
+
- 语言: {language}
|
|
61
|
+
- 数据库: {database}
|
|
53
62
|
|
|
54
|
-
###
|
|
55
|
-
|
|
63
|
+
### 可疑资源
|
|
64
|
+
- {resource_url} - {reason}
|
|
56
65
|
```
|
|
@@ -1,51 +1,83 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
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.
|
|
20
|
+
1. **漏洞确认** - 验证漏洞是否真实存在
|
|
21
|
+
2. **误报排除** - 排除假阳性结果
|
|
22
|
+
3. **严重程度评估** - 准确评估漏洞风险等级
|
|
15
23
|
|
|
16
|
-
##
|
|
24
|
+
## 验证方法
|
|
17
25
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
63
|
+
### 验证结果
|
|
64
|
+
- **状态**: 已确认/误报/需要进一步测试
|
|
65
|
+
- **严重程度**: Critical/High/Medium/Low
|
|
66
|
+
- **CVSS评分**: {score}
|
|
40
67
|
|
|
41
|
-
###
|
|
42
|
-
1. {
|
|
68
|
+
### 验证步骤
|
|
69
|
+
1. {step_1}
|
|
70
|
+
2. {step_2}
|
|
71
|
+
3. {step_3}
|
|
43
72
|
|
|
44
73
|
### PoC
|
|
45
74
|
```bash
|
|
46
|
-
{
|
|
75
|
+
curl -X POST "{endpoint}" \
|
|
76
|
+
-H "Content-Type: application/json" \
|
|
77
|
+
-d '{"payload": "..."}'
|
|
47
78
|
```
|
|
48
79
|
|
|
49
80
|
### 修复建议
|
|
50
|
-
{
|
|
81
|
+
- {recommendation_1}
|
|
82
|
+
- {recommendation_2}
|
|
51
83
|
```
|
package/package.json
CHANGED
|
@@ -1,29 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "opencode-api-security-testing",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "API Security Testing Plugin for OpenCode -
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "src/index.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"src/",
|
|
9
|
-
"agents/",
|
|
10
|
-
"core/",
|
|
11
|
-
"references/",
|
|
12
|
-
"SKILL.md"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-api-security-testing",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "API Security Testing Plugin for OpenCode - Automated vulnerability scanning and penetration testing",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src/",
|
|
9
|
+
"agents/",
|
|
10
|
+
"core/",
|
|
11
|
+
"references/",
|
|
12
|
+
"SKILL.md",
|
|
13
|
+
"postinstall.mjs",
|
|
14
|
+
"preuninstall.mjs"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"postinstall": "node postinstall.mjs",
|
|
18
|
+
"preuninstall": "node preuninstall.mjs",
|
|
19
|
+
"init": "node init.mjs"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"opencode",
|
|
23
|
+
"opencode-plugin",
|
|
24
|
+
"security",
|
|
25
|
+
"api-security",
|
|
26
|
+
"pentest",
|
|
27
|
+
"vulnerability-scanning"
|
|
28
|
+
],
|
|
29
|
+
"author": "steveopen1",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/steveopen1/skill-play"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/steveopen1/skill-play/tree/main/agent-plugins/OPENCODE/api-security-testing",
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@opencode-ai/plugin": "^1.1.19",
|
|
38
|
+
"@opencode-ai/sdk": "^1.1.19"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@opencode-ai/plugin": "^1.1.19",
|
|
42
|
+
"@opencode-ai/sdk": "^1.1.19"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^25.5.2",
|
|
46
|
+
"typescript": "^6.0.2"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* postinstall.mjs - API Security Testing Plugin
|
|
3
|
+
*
|
|
4
|
+
* Installs:
|
|
5
|
+
* 1. agents to ~/.claude/agents/ (oh-my-opencode discovery path)
|
|
6
|
+
* 2. agents to ~/.config/opencode/agents/ (OpenCode native discovery path)
|
|
7
|
+
* 3. SKILL.md and references to ~/.config/opencode/skills/api-security-testing/
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = join(__filename, "..");
|
|
16
|
+
|
|
17
|
+
function getOpencodeBaseDir() {
|
|
18
|
+
const home = process.env.HOME || process.env.USERPROFILE || "/root";
|
|
19
|
+
return join(home, ".config", "opencode");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getClaudeBaseDir() {
|
|
23
|
+
const home = process.env.HOME || process.env.USERPROFILE || "/root";
|
|
24
|
+
return join(home, ".claude");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function copyDirRecursive(src, dest) {
|
|
28
|
+
if (!existsSync(dest)) {
|
|
29
|
+
mkdirSync(dest, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
const items = readdirSync(src, { withFileTypes: true });
|
|
32
|
+
let count = 0;
|
|
33
|
+
for (const item of items) {
|
|
34
|
+
const srcPath = join(src, item.name);
|
|
35
|
+
const destPath = join(dest, item.name);
|
|
36
|
+
try {
|
|
37
|
+
if (item.isDirectory()) {
|
|
38
|
+
copyDirRecursive(srcPath, destPath);
|
|
39
|
+
} else {
|
|
40
|
+
copyFileSync(srcPath, destPath);
|
|
41
|
+
count++;
|
|
42
|
+
}
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.error(` ✗ ${item.name}: ${err.message}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return count;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function main() {
|
|
51
|
+
const packageRoot = __dirname;
|
|
52
|
+
const agentsSourceDir = join(packageRoot, "agents");
|
|
53
|
+
const opencodeBaseDir = getOpencodeBaseDir();
|
|
54
|
+
const claudeBaseDir = getClaudeBaseDir();
|
|
55
|
+
const opencodeAgentsDir = join(opencodeBaseDir, "agents");
|
|
56
|
+
const claudeAgentsDir = join(claudeBaseDir, "agents");
|
|
57
|
+
const skillTargetDir = join(opencodeBaseDir, "skills", "api-security-testing");
|
|
58
|
+
|
|
59
|
+
console.log("[api-security-testing] Installing...");
|
|
60
|
+
console.log(` Package root: ${packageRoot}`);
|
|
61
|
+
|
|
62
|
+
let totalInstalled = 0;
|
|
63
|
+
let totalFailed = 0;
|
|
64
|
+
|
|
65
|
+
// 1. Install agents to BOTH locations (oh-my-opencode + OpenCode native)
|
|
66
|
+
console.log("\n[1/4] Installing agents to ~/.claude/agents/ (oh-my-opencode)...");
|
|
67
|
+
if (existsSync(agentsSourceDir)) {
|
|
68
|
+
if (!existsSync(claudeAgentsDir)) {
|
|
69
|
+
mkdirSync(claudeAgentsDir, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const files = readdirSync(agentsSourceDir).filter(f => f.endsWith(".md"));
|
|
73
|
+
for (const file of files) {
|
|
74
|
+
try {
|
|
75
|
+
copyFileSync(join(agentsSourceDir, file), join(claudeAgentsDir, file));
|
|
76
|
+
console.log(` ✓ ${file}`);
|
|
77
|
+
totalInstalled++;
|
|
78
|
+
} catch (err) {
|
|
79
|
+
console.error(` ✗ ${file}: ${err.message}`);
|
|
80
|
+
totalFailed++;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
console.log("\n[2/4] Installing agents to ~/.config/opencode/agents/ (OpenCode native)...");
|
|
86
|
+
if (existsSync(agentsSourceDir)) {
|
|
87
|
+
if (!existsSync(opencodeAgentsDir)) {
|
|
88
|
+
mkdirSync(opencodeAgentsDir, { recursive: true });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const files = readdirSync(agentsSourceDir).filter(f => f.endsWith(".md"));
|
|
92
|
+
for (const file of files) {
|
|
93
|
+
try {
|
|
94
|
+
copyFileSync(join(agentsSourceDir, file), join(opencodeAgentsDir, file));
|
|
95
|
+
console.log(` ✓ ${file}`);
|
|
96
|
+
totalInstalled++;
|
|
97
|
+
} catch (err) {
|
|
98
|
+
console.error(` ✗ ${file}: ${err.message}`);
|
|
99
|
+
totalFailed++;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 3. Install SKILL.md
|
|
105
|
+
console.log("\n[3/4] Installing SKILL.md...");
|
|
106
|
+
const skillSource = join(packageRoot, "SKILL.md");
|
|
107
|
+
if (existsSync(skillSource)) {
|
|
108
|
+
if (!existsSync(skillTargetDir)) {
|
|
109
|
+
mkdirSync(skillTargetDir, { recursive: true });
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
copyFileSync(skillSource, join(skillTargetDir, "SKILL.md"));
|
|
113
|
+
console.log(" ✓ SKILL.md");
|
|
114
|
+
totalInstalled++;
|
|
115
|
+
} catch (err) {
|
|
116
|
+
console.error(` ✗ SKILL.md: ${err.message}`);
|
|
117
|
+
totalFailed++;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 4. Install references
|
|
122
|
+
console.log("\n[4/4] Installing references...");
|
|
123
|
+
const refsSourceDir = join(packageRoot, "references");
|
|
124
|
+
const refsTargetDir = join(skillTargetDir, "references");
|
|
125
|
+
if (existsSync(refsSourceDir)) {
|
|
126
|
+
try {
|
|
127
|
+
const count = copyDirRecursive(refsSourceDir, refsTargetDir);
|
|
128
|
+
totalInstalled += count;
|
|
129
|
+
console.log(` ✓ references/ (${count} files)`);
|
|
130
|
+
} catch (err) {
|
|
131
|
+
console.error(` ✗ references/: ${err.message}`);
|
|
132
|
+
totalFailed++;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log(`\n========================================`);
|
|
137
|
+
if (totalFailed === 0) {
|
|
138
|
+
console.log(`✓ Installed ${totalInstalled} file(s)`);
|
|
139
|
+
console.log(`\nAgents (oh-my-opencode): ${claudeAgentsDir}`);
|
|
140
|
+
console.log(`Agents (OpenCode native): ${opencodeAgentsDir}`);
|
|
141
|
+
console.log(`Skill: ${skillTargetDir}`);
|
|
142
|
+
console.log(`\n⚠️ IMPORTANT: Restart OpenCode to discover new agents`);
|
|
143
|
+
} else {
|
|
144
|
+
console.log(`⚠ Installed ${totalInstalled}, failed ${totalFailed}`);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
main();
|
package/preuninstall.mjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* preuninstall.mjs - API Security Testing Plugin
|
|
5
|
+
*
|
|
6
|
+
* Removes:
|
|
7
|
+
* 1. agents from ~/.config/opencode/agents/
|
|
8
|
+
* 2. SKILL.md and references from ~/.config/opencode/skills/api-security-testing/
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { unlinkSync, existsSync, readdirSync, rmdirSync } from "node:fs";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = join(__filename, "..");
|
|
17
|
+
|
|
18
|
+
function getOpencodeBaseDir() {
|
|
19
|
+
const home = process.env.HOME || process.env.USERPROFILE || "/root";
|
|
20
|
+
return join(home, ".config", "opencode");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function main() {
|
|
24
|
+
const agentsTargetDir = join(getOpencodeBaseDir(), "agents");
|
|
25
|
+
const skillTargetDir = join(getOpencodeBaseDir(), "skills", "api-security-testing");
|
|
26
|
+
|
|
27
|
+
console.log("[api-security-testing] Uninstalling...");
|
|
28
|
+
|
|
29
|
+
let totalRemoved = 0;
|
|
30
|
+
let totalFailed = 0;
|
|
31
|
+
|
|
32
|
+
// 1. Remove agents
|
|
33
|
+
console.log("\n[1/2] Removing agents...");
|
|
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++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
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++;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
console.log(`\n========================================`);
|
|
80
|
+
if (totalFailed === 0) {
|
|
81
|
+
console.log(`✓ Removed ${totalRemoved} file(s)`);
|
|
82
|
+
} else {
|
|
83
|
+
console.log(`⚠ Removed ${totalRemoved}, failed ${totalFailed}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
main();
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# API Security Testing 参考资源
|
|
2
|
+
|
|
3
|
+
## 核心文件
|
|
4
|
+
|
|
5
|
+
| 文件 | 内容 |
|
|
6
|
+
|------|------|
|
|
7
|
+
| `pua-agent.md` | PUA自动测试Agent,强制深入不放弃 |
|
|
8
|
+
| `fuzzing-patterns.md` | API Fuzzing字典 |
|
|
9
|
+
| `report-template.md` | 安全测试报告模板 |
|
|
10
|
+
|
|
11
|
+
## vulnerabilities/ 漏洞测试方法
|
|
12
|
+
|
|
13
|
+
| 文件 | 内容 |
|
|
14
|
+
|------|------|
|
|
15
|
+
| `vulnerabilities/01-sqli-tests.md` | SQL注入测试 + WAF绕过 |
|
|
16
|
+
| `vulnerabilities/02-user-enum-tests.md` | 用户枚举测试 |
|
|
17
|
+
| `vulnerabilities/03-jwt-tests.md` | JWT认证测试 |
|
|
18
|
+
| `vulnerabilities/04-idor-tests.md` | IDOR越权测试 |
|
|
19
|
+
| `vulnerabilities/05-sensitive-data-tests.md` | 敏感信息泄露 |
|
|
20
|
+
| `vulnerabilities/06-biz-logic-tests.md` | 业务逻辑漏洞 |
|
|
21
|
+
| `vulnerabilities/07-security-config-tests.md` | 安全配置漏洞 |
|
|
22
|
+
| `vulnerabilities/08-brute-force-tests.md` | 暴力破解测试 |
|
|
23
|
+
| `vulnerabilities/09-vulnerability-chains.md` | 漏洞关联联想 |
|
|
24
|
+
| `vulnerabilities/10-auth-tests.md` | OAuth/SAML/2FA测试 |
|
|
25
|
+
| `vulnerabilities/11-graphql-tests.md` | GraphQL安全测试 |
|
|
26
|
+
| `vulnerabilities/12-ssrf-tests.md` | SSRF测试 |
|
|
27
|
+
|
|
28
|
+
## PUA Agent 使用
|
|
29
|
+
|
|
30
|
+
### 核心思想
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
【PUA自动模式】
|
|
34
|
+
- 发现线索 → 自动深入
|
|
35
|
+
- 不等待用户指令
|
|
36
|
+
- 压力升级直到完成
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 压力升级机制
|
|
40
|
+
|
|
41
|
+
| 失败次数 | 级别 | 行动 |
|
|
42
|
+
|---------|------|------|
|
|
43
|
+
| 1次 | L1 | 换方法继续 |
|
|
44
|
+
| 2次 | L2 | 强制检查清单 |
|
|
45
|
+
| 3次 | L3 | 报告进度并继续 |
|
|
46
|
+
| 4次+ | L4 | 尝试其他方向 |
|
|
47
|
+
|
|
48
|
+
### 不放弃原则
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
遇到以下情况必须继续:
|
|
52
|
+
□ 端点404 → 尝试POST方法
|
|
53
|
+
□ 被WAF拦截 → 换payload
|
|
54
|
+
□ 返回HTML → 继续API测试
|
|
55
|
+
□ 找不到配置 → 搜索其他JS
|
|
56
|
+
□ 一个端点失败 → 测试同类端点
|
|
57
|
+
□ 说"无法测试" → 必须穷举所有方法
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 进度追踪表
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
阶段1: [████████░░] 80%
|
|
64
|
+
阶段2: [████░░░░░░░] 40%
|
|
65
|
+
阶段3: [░░░░░░░░░░░] 0%
|
|
66
|
+
阶段4: [░░░░░░░░░░░] 0%
|
|
67
|
+
|
|
68
|
+
发现:
|
|
69
|
+
├─ CORS漏洞: 18个端点
|
|
70
|
+
├─ SQL注入: 待测试
|
|
71
|
+
└─ 新线索: /ipark-wxlite/*
|
|
72
|
+
```
|