@pwddd/skills-scanner 3.0.4 → 3.0.6

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/README.md CHANGED
@@ -71,7 +71,7 @@ openclaw plugins install @openclaw/skills-scanner
71
71
  ```
72
72
  /skills-scanner scan <路径> [选项] # 扫描 Skill
73
73
  /skills-scanner scan clawhub <URL> [选项] # 扫描 ClawHub Skill
74
- /skills-scanner status # 查看状态
74
+ /skills-scanner health # 健康检查
75
75
  /skills-scanner config [操作] # 配置管理
76
76
  /skills-scanner cron [操作] # 定时任务管理
77
77
  /skills-scanner help # 帮助信息
@@ -92,7 +92,7 @@ openclaw plugins install @openclaw/skills-scanner
92
92
  /skills-scanner scan ~/.openclaw/skills --report
93
93
  /skills-scanner scan clawhub https://clawhub.ai/username/project
94
94
  /skills-scanner scan clawhub https://clawhub.ai/Asleep123/caldav-calendar --detailed
95
- /skills-scanner status
95
+ /skills-scanner health
96
96
  ```
97
97
 
98
98
  ### CLI 命令
@@ -111,12 +111,21 @@ openclaw skills-scan batch <directory> [--recursive] [--detailed]
111
111
  openclaw skills-scan report
112
112
 
113
113
  # 检查 API 服务健康状态
114
- openclaw skills-scan health
114
+ openclaw skills-scanner health
115
115
  ```
116
116
 
117
117
  ## 前置要求
118
118
 
119
- ### 1. 安装 uv(Python 包管理器)
119
+ ### 1. Python 3.10+(必需)
120
+
121
+ ```bash
122
+ # 检查 Python 版本
123
+ python3 --version
124
+ ```
125
+
126
+ ### 2. 包管理器(二选一)
127
+
128
+ **选项 A:uv(推荐,更快)**
120
129
 
121
130
  ```bash
122
131
  # macOS/Linux
@@ -126,6 +135,10 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
126
135
  brew install uv
127
136
  ```
128
137
 
138
+ **选项 B:标准 pip(无需额外安装)**
139
+
140
+ 如果没有 uv,插件会自动使用 Python 自带的 `pip`。
141
+
129
142
  ### 2. 启动扫描 API 服务
130
143
 
131
144
  插件需要连接到 skill-scanner-api 服务进行实际的安全扫描。
@@ -152,8 +165,14 @@ skill-scanner-api
152
165
  ```bash
153
166
  # 手动安装依赖
154
167
  cd extensions/skills-scanner/skills/skills-scanner
168
+
169
+ # 使用 uv(推荐)
155
170
  uv venv .venv --python 3.10
156
171
  uv pip install --python .venv/bin/python requests>=2.31.0
172
+
173
+ # 或使用标准 Python
174
+ python3 -m venv .venv
175
+ .venv/bin/python -m pip install requests>=2.31.0
157
176
  ```
158
177
 
159
178
  ### API 服务连接失败
@@ -286,8 +305,8 @@ AI: 好的,让我先进行安全扫描...
286
305
  # 生成日报
287
306
  /skills-scanner scan ~/.openclaw/skills --report
288
307
 
289
- # 查看状态
290
- /skills-scanner status
308
+ # 健康检查
309
+ /skills-scanner health
291
310
 
292
311
  # 配置管理
293
312
  /skills-scanner config show
package/index.ts CHANGED
@@ -213,7 +213,7 @@ export default function register(api: OpenClawPluginApi) {
213
213
  "",
214
214
  "可用命令:",
215
215
  "• `/skills-scanner scan <路径> [选项]` - 扫描 Skill",
216
- "• `/skills-scanner status` - 查看状态",
216
+ "• `/skills-scanner health` - 健康检查",
217
217
  "• `/skills-scanner config [操作]` - 配置管理",
218
218
  "• `/skills-scanner cron [操作]` - 定时任务管理",
219
219
  "",
@@ -227,7 +227,7 @@ export default function register(api: OpenClawPluginApi) {
227
227
  "```",
228
228
  "/skills-scanner scan ~/my-skill",
229
229
  "/skills-scanner scan ~/skills --recursive",
230
- "/skills-scanner status",
230
+ "/skills-scanner health",
231
231
  "```",
232
232
  "",
233
233
  "💡 使用 `/skills-scanner help` 查看详细帮助",
@@ -241,8 +241,8 @@ export default function register(api: OpenClawPluginApi) {
241
241
 
242
242
  if (subCommand === "scan") {
243
243
  return await handlers.handleScanCommand(subArgs);
244
- } else if (subCommand === "status") {
245
- return await handlers.handleStatusCommand();
244
+ } else if (subCommand === "health") {
245
+ return await handlers.handleHealthCommand();
246
246
  } else if (subCommand === "config") {
247
247
  return await handlers.handleConfigCommand(subArgs);
248
248
  } else if (subCommand === "cron") {
@@ -2,7 +2,7 @@
2
2
  "id": "skills-scanner",
3
3
  "name": "Skills Scanner",
4
4
  "description": "Security scanner for OpenClaw Skills to detect potential threats",
5
- "version": "3.0.4",
5
+ "version": "3.0.6",
6
6
  "author": "pwddd",
7
7
  "skills": ["./skills"],
8
8
  "configSchema": {
@@ -54,6 +54,16 @@
54
54
  "type": "boolean",
55
55
  "description": "Inject Skills security guidance into system prompt (requires AI to scan before installing Skills)",
56
56
  "default": true
57
+ },
58
+ "enablePromptInjectionGuard": {
59
+ "type": "boolean",
60
+ "description": "Enable prompt injection detection guard",
61
+ "default": true
62
+ },
63
+ "enableHighRiskOperationGuard": {
64
+ "type": "boolean",
65
+ "description": "Enable high-risk operation confirmation guard",
66
+ "default": true
57
67
  }
58
68
  }
59
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pwddd/skills-scanner",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "OpenClaw Skills security scanner plugin - detect malicious code, data exfiltration, and prompt injection",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -3,7 +3,7 @@ name: skills-scanner
3
3
  description: OpenClaw Skills 安全扫描工具,使用 AI Skill Scanner 检测恶意代码、数据窃取、提示注入等威胁。
4
4
  version: 1.0.0
5
5
  user-invocable: true
6
- metadata: {"openclaw": {"emoji": "🔍", "requires": {"bins": ["uv", "python3"]}, "install": [{"id": "uv-brew", "kind": "brew", "formula": "uv", "bins": ["uv"], "label": "安装 uv (macOS)", "os": ["darwin"]}, {"id": "uv-curl", "kind": "download", "url": "https://astral.sh/uv/install.sh", "label": "安装 uv (Linux)", "os": ["linux"]}]}}
6
+ metadata: {"openclaw": {"emoji": "🔍", "requires": {"bins": ["python3"]}}}
7
7
  ---
8
8
 
9
9
  # Skills 安全扫描工具 🔍
@@ -143,15 +143,20 @@ VirusTotal 是业界权威的多引擎病毒扫描服务,其结果具有极高
143
143
  首次运行前,检查并安装依赖:
144
144
 
145
145
  ```bash
146
- # 检查 uv 是否可用
147
- which uv || echo "请安装 uv: brew install uv 或 curl -LsSf https://astral.sh/uv/install.sh | sh"
146
+ # 检查 Python 是否可用
147
+ which python3 || echo "请安装 Python 3.10+"
148
148
 
149
- # 安装依赖到隔离虚拟环境
149
+ # 方式 1:使用 uv(推荐,更快)
150
+ which uv || echo "安装 uv: brew install uv 或 curl -LsSf https://astral.sh/uv/install.sh | sh"
150
151
  uv venv {baseDir}/.venv --python 3.10 --quiet
151
152
  uv pip install --python {baseDir}/.venv/bin/python requests --quiet
153
+
154
+ # 方式 2:使用标准 Python(无需 uv)
155
+ python3 -m venv {baseDir}/.venv
156
+ {baseDir}/.venv/bin/python -m pip install --quiet requests
152
157
  ```
153
158
 
154
- 安装只需执行一次。
159
+ 安装只需执行一次。插件会自动选择可用的工具(优先使用 uv,回退到 python3)。
155
160
 
156
161
  ## 配置
157
162
 
@@ -26,7 +26,7 @@ try:
26
26
  except ImportError as e:
27
27
  print("❌ requests 未安装。")
28
28
  print(f" 导入错误: {e}")
29
- print(" 请运行: uv pip install requests")
29
+ print(" 请运行: pip install requests 或 uv pip install requests")
30
30
  sys.exit(1)
31
31
 
32
32
 
package/src/commands.ts CHANGED
@@ -118,7 +118,7 @@ export function createCommandHandlers(
118
118
  }
119
119
  }
120
120
 
121
- async function handleStatusCommand(): Promise<any> {
121
+ async function handleHealthCommand(): Promise<any> {
122
122
  const state = loadState() as any;
123
123
  const alerts: string[] = state.pendingAlerts ?? [];
124
124
 
@@ -286,7 +286,7 @@ export function createCommandHandlers(
286
286
  "```",
287
287
  "",
288
288
  "═══ 其他命令 ═══",
289
- "• `/skills-scanner status` - 查看状态",
289
+ "• `/skills-scanner health` - 健康检查",
290
290
  "• `/skills-scanner config [show|reset]` - 配置管理",
291
291
  "• `/skills-scanner cron [register|unregister|status]` - 定时任务管理",
292
292
  ].join("\n");
@@ -294,7 +294,7 @@ export function createCommandHandlers(
294
294
 
295
295
  return {
296
296
  handleScanCommand,
297
- handleStatusCommand,
297
+ handleHealthCommand,
298
298
  handleConfigCommand,
299
299
  handleCronCommand,
300
300
  getHelpText,
package/src/config.ts CHANGED
@@ -162,7 +162,7 @@ export function generateConfigGuide(
162
162
  "",
163
163
  "🚀 快速开始:",
164
164
  " 编辑配置文件后重启 Gateway",
165
- " /skills-scanner status",
165
+ " /skills-scanner health",
166
166
  "",
167
167
  "提示:此消息只在首次运行时显示。",
168
168
  "════════════════════════════════════════════════════════════════",
package/src/deps.ts CHANGED
@@ -19,6 +19,29 @@ export function hasUv(): boolean {
19
19
  }
20
20
  }
21
21
 
22
+ export function hasPython(): boolean {
23
+ try {
24
+ execSync("python3 --version", { stdio: "ignore" });
25
+ return true;
26
+ } catch {
27
+ try {
28
+ execSync("python --version", { stdio: "ignore" });
29
+ return true;
30
+ } catch {
31
+ return false;
32
+ }
33
+ }
34
+ }
35
+
36
+ export function getPythonCommand(): string {
37
+ try {
38
+ execSync("python3 --version", { stdio: "ignore" });
39
+ return "python3";
40
+ } catch {
41
+ return "python";
42
+ }
43
+ }
44
+
22
45
  export function isVenvReady(venvPython: string): boolean {
23
46
  if (!existsSync(venvPython)) return false;
24
47
 
@@ -40,14 +63,19 @@ export async function ensureDeps(
40
63
  return true;
41
64
  }
42
65
 
43
- if (!hasUv()) {
44
- logger.warn(
45
- "[skills-scanner] uv not installed: brew install uv or curl -LsSf https://astral.sh/uv/install.sh | sh"
66
+ const useUv = hasUv();
67
+ const usePython = !useUv && hasPython();
68
+
69
+ if (!useUv && !usePython) {
70
+ logger.error(
71
+ "[skills-scanner] Neither uv nor python3 found. Please install one of them:"
46
72
  );
73
+ logger.error("[skills-scanner] - uv: brew install uv or curl -LsSf https://astral.sh/uv/install.sh | sh");
74
+ logger.error("[skills-scanner] - python3: brew install python3 or apt-get install python3 python3-venv python3-pip");
47
75
  return false;
48
76
  }
49
77
 
50
- logger.info("[skills-scanner] Installing Python dependencies...");
78
+ logger.info(`[skills-scanner] Installing Python dependencies using ${useUv ? "uv" : "python3"}...`);
51
79
 
52
80
  try {
53
81
  const venvDir = join(skillDir, ".venv");
@@ -57,11 +85,22 @@ export async function ensureDeps(
57
85
  rmSync(venvDir, { recursive: true, force: true });
58
86
  }
59
87
 
60
- await execAsync(`uv venv "${venvDir}" --python 3.10`);
61
- logger.info("[skills-scanner] Virtual environment created");
88
+ if (useUv) {
89
+ // Use uv (faster)
90
+ await execAsync(`uv venv "${venvDir}" --python 3.10`);
91
+ logger.info("[skills-scanner] Virtual environment created (uv)");
92
+
93
+ logger.info("[skills-scanner] Installing requests...");
94
+ await execAsync(`uv pip install --python "${venvPython}" requests>=2.31.0`);
95
+ } else {
96
+ // Fallback to standard Python venv + pip
97
+ const pythonCmd = getPythonCommand();
98
+ await execAsync(`${pythonCmd} -m venv "${venvDir}"`);
99
+ logger.info("[skills-scanner] Virtual environment created (python -m venv)");
62
100
 
63
- logger.info("[skills-scanner] Installing requests...");
64
- await execAsync(`uv pip install --python "${venvPython}" requests>=2.31.0`);
101
+ logger.info("[skills-scanner] Installing requests...");
102
+ await execAsync(`"${venvPython}" -m pip install --quiet requests>=2.31.0`);
103
+ }
65
104
 
66
105
  execSync(`"${venvPython}" -c "import requests"`, { stdio: "ignore" });
67
106
  logger.info("[skills-scanner] ✅ Dependencies installed successfully");