@clawmaster/skillguard-cli 0.1.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/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/index.js +1887 -0
- package/package.json +60 -0
- package/rules/rules.yaml +303 -0
- package/skills/audit/SKILL.md +88 -0
- package/skills/explain-report/SKILL.md +52 -0
- package/skills/suggest-fixes/SKILL.md +82 -0
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clawmaster/skillguard-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Security audit CLI for AI agent skills — scans 10 dimensions with 109 rules",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"skillguard": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"rules",
|
|
12
|
+
"skills"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup",
|
|
22
|
+
"dev": "tsx src/index.ts",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"security",
|
|
28
|
+
"audit",
|
|
29
|
+
"claude-code",
|
|
30
|
+
"skill",
|
|
31
|
+
"ai-agent",
|
|
32
|
+
"owasp"
|
|
33
|
+
],
|
|
34
|
+
"author": "Cydiar",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/clawmaster-ai/skillguard-cli.git"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/clawmaster-ai/skillguard-cli#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/clawmaster-ai/skillguard-cli/issues"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"chalk": "^5.3.0",
|
|
46
|
+
"commander": "^12.1.0",
|
|
47
|
+
"js-yaml": "^4.1.0",
|
|
48
|
+
"tar": "^7.4.0",
|
|
49
|
+
"unzipper": "^0.12.3"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/js-yaml": "^4.0.9",
|
|
53
|
+
"@types/node": "^22.0.0",
|
|
54
|
+
"@types/unzipper": "^0.10.10",
|
|
55
|
+
"tsup": "^8.3.0",
|
|
56
|
+
"tsx": "^4.19.0",
|
|
57
|
+
"typescript": "^5.6.0",
|
|
58
|
+
"vitest": "^2.1.0"
|
|
59
|
+
}
|
|
60
|
+
}
|
package/rules/rules.yaml
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# SkillGuard 可配置规则 (Configurable Rules)
|
|
2
|
+
# 用户可修改此文件来调整规则行为 — 也可通过 /rules 页面可视化编辑
|
|
3
|
+
#
|
|
4
|
+
# enabled: true/false — 开关(false 则跳过该规则)
|
|
5
|
+
# severity: CRITICAL / HIGH / MEDIUM / LOW / INFO — 覆盖严重级别
|
|
6
|
+
# whitelist: [] — 白名单(命中任一条则跳过),支持子字符串匹配
|
|
7
|
+
|
|
8
|
+
data_exfiltration:
|
|
9
|
+
- id: DE-01
|
|
10
|
+
pattern: \.env\b
|
|
11
|
+
description: Reads .env file (may contain secrets)
|
|
12
|
+
severity: MEDIUM
|
|
13
|
+
enabled: true
|
|
14
|
+
whitelist: []
|
|
15
|
+
- id: DE-02
|
|
16
|
+
pattern: ~/\.ssh/
|
|
17
|
+
description: Accesses SSH directory
|
|
18
|
+
severity: HIGH
|
|
19
|
+
enabled: true
|
|
20
|
+
whitelist: []
|
|
21
|
+
- id: DE-03
|
|
22
|
+
pattern: /etc/passwd\b
|
|
23
|
+
description: Reads /etc/passwd
|
|
24
|
+
severity: HIGH
|
|
25
|
+
enabled: true
|
|
26
|
+
whitelist: []
|
|
27
|
+
- id: DE-04
|
|
28
|
+
pattern: /etc/shadow\b
|
|
29
|
+
description: Reads /etc/shadow
|
|
30
|
+
severity: CRITICAL
|
|
31
|
+
enabled: true
|
|
32
|
+
whitelist: []
|
|
33
|
+
- id: DE-05
|
|
34
|
+
pattern: ~/.aws/credentials
|
|
35
|
+
description: Reads AWS credentials
|
|
36
|
+
severity: HIGH
|
|
37
|
+
enabled: true
|
|
38
|
+
whitelist: []
|
|
39
|
+
- id: DE-06
|
|
40
|
+
pattern: ~/.kube/config
|
|
41
|
+
description: Reads Kubernetes config
|
|
42
|
+
severity: HIGH
|
|
43
|
+
enabled: true
|
|
44
|
+
whitelist: []
|
|
45
|
+
- id: DE-07
|
|
46
|
+
pattern: credentials\.json
|
|
47
|
+
description: Reads credentials file
|
|
48
|
+
severity: MEDIUM
|
|
49
|
+
enabled: true
|
|
50
|
+
whitelist: []
|
|
51
|
+
- id: DE-08
|
|
52
|
+
pattern: \.claude/settings
|
|
53
|
+
description: Reads Claude settings
|
|
54
|
+
severity: MEDIUM
|
|
55
|
+
enabled: true
|
|
56
|
+
whitelist: []
|
|
57
|
+
- id: DE-09
|
|
58
|
+
pattern: curl\s+.*-X\s*POST\b
|
|
59
|
+
description: curl POST - potential data exfiltration
|
|
60
|
+
severity: HIGH
|
|
61
|
+
enabled: true
|
|
62
|
+
whitelist:
|
|
63
|
+
- api.github.com
|
|
64
|
+
- registry.npmjs.org
|
|
65
|
+
- id: DE-10
|
|
66
|
+
pattern: curl\s+.*--data\b
|
|
67
|
+
description: curl with data payload
|
|
68
|
+
severity: HIGH
|
|
69
|
+
enabled: true
|
|
70
|
+
whitelist:
|
|
71
|
+
- api.github.com
|
|
72
|
+
- id: DE-11
|
|
73
|
+
pattern: requests\.post\s*\(
|
|
74
|
+
description: Python requests.post - outbound data
|
|
75
|
+
severity: HIGH
|
|
76
|
+
enabled: true
|
|
77
|
+
whitelist: []
|
|
78
|
+
- id: DE-12
|
|
79
|
+
pattern: fetch\s*\([^)]*method\s*:\s*["']POST["']
|
|
80
|
+
description: fetch POST - outbound data
|
|
81
|
+
severity: HIGH
|
|
82
|
+
enabled: true
|
|
83
|
+
whitelist: []
|
|
84
|
+
- id: DE-13
|
|
85
|
+
pattern: urllib\.request\.urlopen
|
|
86
|
+
description: urllib outbound request
|
|
87
|
+
severity: MEDIUM
|
|
88
|
+
enabled: true
|
|
89
|
+
whitelist: []
|
|
90
|
+
- id: DE-14
|
|
91
|
+
pattern: http\.client\.HTTP
|
|
92
|
+
description: http.client outbound connection
|
|
93
|
+
severity: MEDIUM
|
|
94
|
+
enabled: true
|
|
95
|
+
whitelist: []
|
|
96
|
+
- id: DE-15
|
|
97
|
+
pattern: webhook
|
|
98
|
+
description: Webhook URL reference
|
|
99
|
+
severity: MEDIUM
|
|
100
|
+
enabled: true
|
|
101
|
+
whitelist: []
|
|
102
|
+
- id: DE-16
|
|
103
|
+
pattern: ngrok
|
|
104
|
+
description: ngrok tunnel - external exposure
|
|
105
|
+
severity: HIGH
|
|
106
|
+
enabled: true
|
|
107
|
+
whitelist: []
|
|
108
|
+
- id: DE-17
|
|
109
|
+
pattern: bigquery
|
|
110
|
+
description: URL pointing to data collection/analytics endpoint
|
|
111
|
+
severity: HIGH
|
|
112
|
+
enabled: true
|
|
113
|
+
whitelist: []
|
|
114
|
+
- id: DE-18
|
|
115
|
+
pattern: (?:analytics|telemetry|tracking|collect)
|
|
116
|
+
description: URL pointing to data collection/analytics endpoint
|
|
117
|
+
severity: HIGH
|
|
118
|
+
enabled: true
|
|
119
|
+
whitelist: []
|
|
120
|
+
supply_chain:
|
|
121
|
+
- id: SC-01
|
|
122
|
+
pattern: curl\s+[^|]*\|\s*(bash|sh|python|perl)\b
|
|
123
|
+
description: 'Pipe-to-shell: curl | bash - remote code execution'
|
|
124
|
+
severity: CRITICAL
|
|
125
|
+
enabled: true
|
|
126
|
+
whitelist: []
|
|
127
|
+
- id: SC-02
|
|
128
|
+
pattern: wget\s+[^|]*\|\s*(bash|sh|python|perl)\b
|
|
129
|
+
description: 'Pipe-to-shell: wget | sh - remote code execution'
|
|
130
|
+
severity: CRITICAL
|
|
131
|
+
enabled: true
|
|
132
|
+
whitelist: []
|
|
133
|
+
- id: SC-03
|
|
134
|
+
pattern: curl\s+.*\|\s*sudo\b
|
|
135
|
+
description: 'Pipe-to-sudo: curl | sudo - elevated remote execution'
|
|
136
|
+
severity: CRITICAL
|
|
137
|
+
enabled: true
|
|
138
|
+
whitelist: []
|
|
139
|
+
- id: SC-04
|
|
140
|
+
pattern: git\s+clone\s+
|
|
141
|
+
description: git clone - pulls external code
|
|
142
|
+
severity: MEDIUM
|
|
143
|
+
enabled: true
|
|
144
|
+
whitelist:
|
|
145
|
+
- github.com/anthropics
|
|
146
|
+
- github.com/modelcontextprotocol
|
|
147
|
+
- id: SC-05
|
|
148
|
+
pattern: pip\s+install\s+(?!.*==)(?!.*>=)(?!.*~=)(\S+)
|
|
149
|
+
description: pip install without version pinning
|
|
150
|
+
severity: LOW
|
|
151
|
+
enabled: true
|
|
152
|
+
whitelist: []
|
|
153
|
+
- id: SC-06
|
|
154
|
+
pattern: npm\s+install\s+(?!.*@\d)
|
|
155
|
+
description: npm install without version pinning
|
|
156
|
+
severity: LOW
|
|
157
|
+
enabled: true
|
|
158
|
+
whitelist: []
|
|
159
|
+
- id: SC-07
|
|
160
|
+
pattern: go\s+get\s+
|
|
161
|
+
description: go get - pulls external dependency
|
|
162
|
+
severity: LOW
|
|
163
|
+
enabled: true
|
|
164
|
+
whitelist: []
|
|
165
|
+
- id: SC-08
|
|
166
|
+
pattern: ^FROM\s+\S+(?!.*@sha256:)
|
|
167
|
+
description: Dockerfile FROM without digest pinning
|
|
168
|
+
severity: LOW
|
|
169
|
+
enabled: true
|
|
170
|
+
whitelist:
|
|
171
|
+
- 'python:'
|
|
172
|
+
- 'node:'
|
|
173
|
+
- alpine
|
|
174
|
+
resource_abuse:
|
|
175
|
+
- id: RA-01
|
|
176
|
+
pattern: 'while\s+True\s*:'
|
|
177
|
+
description: while True loop - potential infinite loop
|
|
178
|
+
severity: MEDIUM
|
|
179
|
+
enabled: true
|
|
180
|
+
whitelist: []
|
|
181
|
+
- id: RA-02
|
|
182
|
+
pattern: 'while\s+1\s*:'
|
|
183
|
+
description: while 1 loop - potential infinite loop
|
|
184
|
+
severity: MEDIUM
|
|
185
|
+
enabled: true
|
|
186
|
+
whitelist: []
|
|
187
|
+
- id: RA-03
|
|
188
|
+
pattern: while\s*\(\s*true\s*\)
|
|
189
|
+
description: while(true) loop - potential infinite loop
|
|
190
|
+
severity: MEDIUM
|
|
191
|
+
enabled: true
|
|
192
|
+
whitelist: []
|
|
193
|
+
- id: RA-04
|
|
194
|
+
pattern: for\s*\(\s*;\s*;\s*\)
|
|
195
|
+
description: for(;;) infinite loop
|
|
196
|
+
severity: MEDIUM
|
|
197
|
+
enabled: true
|
|
198
|
+
whitelist: []
|
|
199
|
+
- id: RA-05
|
|
200
|
+
pattern: retmax\s*=\s*\d{5,}
|
|
201
|
+
description: Very large retmax value - excessive data fetch
|
|
202
|
+
severity: MEDIUM
|
|
203
|
+
enabled: true
|
|
204
|
+
whitelist: []
|
|
205
|
+
- id: RA-06
|
|
206
|
+
pattern: limit\s*=\s*\d{5,}
|
|
207
|
+
description: Very large limit value
|
|
208
|
+
severity: LOW
|
|
209
|
+
enabled: true
|
|
210
|
+
whitelist: []
|
|
211
|
+
- id: RA-07
|
|
212
|
+
pattern: time\.sleep\s*\(\s*0\s*\)
|
|
213
|
+
description: sleep(0) in potential busy loop
|
|
214
|
+
severity: LOW
|
|
215
|
+
enabled: true
|
|
216
|
+
whitelist: []
|
|
217
|
+
- id: RA-08
|
|
218
|
+
pattern: retry.*=\s*(?:True|-1|999|float\(["']inf)
|
|
219
|
+
description: Unlimited/excessive retry configuration
|
|
220
|
+
severity: MEDIUM
|
|
221
|
+
enabled: true
|
|
222
|
+
whitelist: []
|
|
223
|
+
license_compliance:
|
|
224
|
+
- id: LC-01
|
|
225
|
+
pattern: proprietary\s+and\s+confidential
|
|
226
|
+
description: Proprietary and confidential license
|
|
227
|
+
severity: MEDIUM
|
|
228
|
+
enabled: true
|
|
229
|
+
whitelist: []
|
|
230
|
+
- id: LC-02
|
|
231
|
+
pattern: all\s+rights\s+reserved
|
|
232
|
+
description: All rights reserved notice
|
|
233
|
+
severity: LOW
|
|
234
|
+
enabled: true
|
|
235
|
+
whitelist: []
|
|
236
|
+
- id: LC-03
|
|
237
|
+
pattern: unauthorized\s+copying.*strictly\s+prohibited
|
|
238
|
+
description: Copying prohibited notice
|
|
239
|
+
severity: MEDIUM
|
|
240
|
+
enabled: true
|
|
241
|
+
whitelist: []
|
|
242
|
+
- id: LC-04
|
|
243
|
+
pattern: non-?commercial
|
|
244
|
+
description: Non-commercial license restriction
|
|
245
|
+
severity: MEDIUM
|
|
246
|
+
enabled: true
|
|
247
|
+
whitelist: []
|
|
248
|
+
- id: LC-05
|
|
249
|
+
pattern: \bbilling\b|\bsubscription\b|\benterprise\b|\bpaid\s+(?:plan|tier|api)\b
|
|
250
|
+
description: References commercial service (billing/subscription/enterprise/paid)
|
|
251
|
+
severity: LOW
|
|
252
|
+
enabled: true
|
|
253
|
+
whitelist: []
|
|
254
|
+
- id: LC-06
|
|
255
|
+
pattern: \bKEGG\b|\bBenchling\b|\bSnowflake\b
|
|
256
|
+
description: Known commercial/academic-license platform referenced
|
|
257
|
+
severity: INFO
|
|
258
|
+
enabled: true
|
|
259
|
+
whitelist: []
|
|
260
|
+
- id: LC-07
|
|
261
|
+
pattern: \bBigQuery\b
|
|
262
|
+
description: Google BigQuery (commercial service, data collection risk)
|
|
263
|
+
severity: MEDIUM
|
|
264
|
+
enabled: true
|
|
265
|
+
whitelist: []
|
|
266
|
+
least_privilege:
|
|
267
|
+
- id: LP-01
|
|
268
|
+
pattern: missing allowed-tools
|
|
269
|
+
description: No allowed-tools declared in frontmatter - implicit all-tools access
|
|
270
|
+
severity: LOW
|
|
271
|
+
enabled: true
|
|
272
|
+
whitelist: []
|
|
273
|
+
- id: LP-02
|
|
274
|
+
pattern: 'allowed-tools: shell'
|
|
275
|
+
description: Shell access declared in allowed-tools
|
|
276
|
+
severity: MEDIUM
|
|
277
|
+
enabled: true
|
|
278
|
+
whitelist: []
|
|
279
|
+
- id: LP-03
|
|
280
|
+
pattern: shell + network + write
|
|
281
|
+
description: 'Dangerous tool combination: shell + network + file write access'
|
|
282
|
+
severity: HIGH
|
|
283
|
+
enabled: true
|
|
284
|
+
whitelist: []
|
|
285
|
+
prompt_injection_auxiliary:
|
|
286
|
+
- id: PI-AUX-01
|
|
287
|
+
pattern: '[\u200b\u200c\u200d\ufeff\u2060]'
|
|
288
|
+
description: Zero-width character detected (possible steganographic injection)
|
|
289
|
+
severity: MEDIUM
|
|
290
|
+
enabled: true
|
|
291
|
+
whitelist: []
|
|
292
|
+
- id: PI-AUX-02
|
|
293
|
+
pattern: '[A-Za-z0-9+/]{200,}={0,2}'
|
|
294
|
+
description: Long base64-like string - may hide injected payload
|
|
295
|
+
severity: MEDIUM
|
|
296
|
+
enabled: true
|
|
297
|
+
whitelist: []
|
|
298
|
+
- id: PI-AUX-03
|
|
299
|
+
pattern: <!--.*(?:instruction|ignore|override|system prompt|you must|you are now).*-->
|
|
300
|
+
description: Hidden instruction detected in HTML comment
|
|
301
|
+
severity: HIGH
|
|
302
|
+
enabled: true
|
|
303
|
+
whitelist: []
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run SkillGuard security audit on AI agent skills — scans 10 dimensions with 109 rules based on OWASP LLM Top 10, SLSA, and Google SAIF
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Bash
|
|
5
|
+
- Read
|
|
6
|
+
- Glob
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# SkillGuard Audit
|
|
10
|
+
|
|
11
|
+
Security audit tool for Claude Code Skills and AI agent plugins. Scans across 10 security dimensions with 109 detection rules, providing A–F risk grading and token cost estimation.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Scan a local skill directory
|
|
17
|
+
npx skillguard /path/to/skill
|
|
18
|
+
|
|
19
|
+
# Scan a GitHub repository
|
|
20
|
+
npx skillguard https://github.com/owner/repo
|
|
21
|
+
|
|
22
|
+
# Scan a ClawHub skill
|
|
23
|
+
npx skillguard https://clawhub.ai/author/skill-name
|
|
24
|
+
|
|
25
|
+
# Scan all skills in a marketplace directory
|
|
26
|
+
npx skillguard /path/to/marketplace --all
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Output Formats
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Terminal output (default) — colored, human-readable
|
|
33
|
+
npx skillguard <target>
|
|
34
|
+
|
|
35
|
+
# JSON output to stdout
|
|
36
|
+
npx skillguard <target> --json
|
|
37
|
+
|
|
38
|
+
# JSON output to file
|
|
39
|
+
npx skillguard <target> --json report.json
|
|
40
|
+
|
|
41
|
+
# Markdown report
|
|
42
|
+
npx skillguard <target> --md report.md
|
|
43
|
+
|
|
44
|
+
# Chinese language output
|
|
45
|
+
npx skillguard <target> --lang zh
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Options
|
|
49
|
+
|
|
50
|
+
- `--all` — Scan all skill subdirectories (marketplace mode)
|
|
51
|
+
- `--json [file]` — Output as JSON (to stdout or file)
|
|
52
|
+
- `--md <file>` — Output as Markdown report
|
|
53
|
+
- `--rules <path>` — Custom rules.yaml file
|
|
54
|
+
- `--min-level <A-F>` — Filter output by minimum risk level
|
|
55
|
+
- `--min-severity <severity>` — Filter by minimum severity (CRITICAL, HIGH, MEDIUM, LOW, INFO)
|
|
56
|
+
- `--lang <en|zh>` — Output language (default: en)
|
|
57
|
+
|
|
58
|
+
## 10 Security Dimensions
|
|
59
|
+
|
|
60
|
+
1. **Prompt Injection** — Direct/indirect injection patterns, zero-width chars, base64 payloads
|
|
61
|
+
2. **Permission Escalation** — Sandbox bypass, sudo, chmod 777, dangerous tool combos
|
|
62
|
+
3. **Data Exfiltration** — Credential theft, env leaks, outbound HTTP
|
|
63
|
+
4. **Destructive Operations** — rm -rf, DROP TABLE, git reset --hard
|
|
64
|
+
5. **Supply Chain** — Pipe-to-shell, unpinned deps, Docker without digest
|
|
65
|
+
6. **Code Security** — eval(), shell=True, SQL injection, XSS
|
|
66
|
+
7. **Credential Leaks** — Hardcoded API keys, JWT tokens, PEM keys
|
|
67
|
+
8. **Least Privilege** — Missing allowed-tools, dangerous tool combinations
|
|
68
|
+
9. **License Compliance** — Proprietary restrictions, non-commercial clauses
|
|
69
|
+
10. **Resource Abuse** — Infinite loops, excessive retries, unbounded fetching
|
|
70
|
+
|
|
71
|
+
## Risk Grading
|
|
72
|
+
|
|
73
|
+
| Grade | Score | Meaning |
|
|
74
|
+
|-------|-------|---------|
|
|
75
|
+
| A | 0–9 | Safe |
|
|
76
|
+
| B | 10–29 | Acceptable |
|
|
77
|
+
| C | 30–49 | Warning |
|
|
78
|
+
| D | 50–69 | Unsafe |
|
|
79
|
+
| F | 70–100 | Dangerous |
|
|
80
|
+
|
|
81
|
+
## Example Workflow
|
|
82
|
+
|
|
83
|
+
When a user asks to audit a skill:
|
|
84
|
+
|
|
85
|
+
1. Run `npx skillguard <target>` to get the terminal report
|
|
86
|
+
2. If the user wants details, use `--json report.json` and read the JSON file
|
|
87
|
+
3. Explain findings in context — what each risk means and whether it's a real threat
|
|
88
|
+
4. Suggest concrete fixes using the remediation guidance in each finding
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Explain a SkillGuard security audit report — analyze findings, assess real risk vs false positives, and provide context
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Bash
|
|
5
|
+
- Read
|
|
6
|
+
- Glob
|
|
7
|
+
- Grep
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Explain SkillGuard Report
|
|
11
|
+
|
|
12
|
+
Reads a SkillGuard JSON report and explains each finding in context, helping users understand what the risks actually mean and which findings need attention vs which are false positives.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
1. First generate a JSON report:
|
|
17
|
+
```bash
|
|
18
|
+
npx skillguard <target> --json report.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Then ask to explain the report — read `report.json` and analyze each finding.
|
|
22
|
+
|
|
23
|
+
## How to Analyze
|
|
24
|
+
|
|
25
|
+
For each finding, evaluate:
|
|
26
|
+
|
|
27
|
+
1. **Context** — Is this pattern in actual executable code, or in documentation/comments?
|
|
28
|
+
2. **Intent** — Is the pattern used for a legitimate purpose (e.g., `eval()` in a build tool)?
|
|
29
|
+
3. **Scope** — Is the finding isolated or part of a broader pattern (e.g., multiple exfiltration signals)?
|
|
30
|
+
4. **Severity** — Does the assigned severity match the actual risk given the context?
|
|
31
|
+
|
|
32
|
+
### Common False Positives
|
|
33
|
+
|
|
34
|
+
- `eval()` in documentation explaining what NOT to do
|
|
35
|
+
- API key patterns in `.env.example` with placeholder values
|
|
36
|
+
- `rm -rf` in cleanup scripts with proper path validation
|
|
37
|
+
- `sudo` in installation instructions (README)
|
|
38
|
+
- `shell=True` with hardcoded safe commands (no user input)
|
|
39
|
+
|
|
40
|
+
### Red Flags That Need Attention
|
|
41
|
+
|
|
42
|
+
- Combined signals: env var reading + outbound HTTP in same skill
|
|
43
|
+
- `dangerouslyDisableSandbox` — almost always a real risk
|
|
44
|
+
- Base64-encoded strings in markdown files (possible payload hiding)
|
|
45
|
+
- Missing `allowed-tools` with shell access patterns in code
|
|
46
|
+
|
|
47
|
+
## Output Format
|
|
48
|
+
|
|
49
|
+
For each finding group by dimension, explain:
|
|
50
|
+
- What was detected and why it matters
|
|
51
|
+
- Whether it's likely a real risk or false positive
|
|
52
|
+
- What action (if any) the user should take
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Suggest concrete code fixes for SkillGuard security findings — generate remediation patches
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Bash
|
|
5
|
+
- Read
|
|
6
|
+
- Glob
|
|
7
|
+
- Grep
|
|
8
|
+
- Edit
|
|
9
|
+
- Write
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Suggest Fixes for SkillGuard Findings
|
|
13
|
+
|
|
14
|
+
Reads SkillGuard scan findings and generates concrete code fixes. Can either suggest fixes or directly apply them with user approval.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
1. Generate a JSON report:
|
|
19
|
+
```bash
|
|
20
|
+
npx skillguard <target> --json report.json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. Ask to fix the findings. Read the report and the source files to generate patches.
|
|
24
|
+
|
|
25
|
+
## Fix Strategies by Dimension
|
|
26
|
+
|
|
27
|
+
### Prompt Injection
|
|
28
|
+
- Remove injection phrases from prompts
|
|
29
|
+
- Use structured prompt templates instead of string concatenation
|
|
30
|
+
- Remove zero-width characters with text sanitization
|
|
31
|
+
|
|
32
|
+
### Permission Escalation
|
|
33
|
+
- Remove `dangerouslyDisableSandbox` — run in sandbox
|
|
34
|
+
- Replace `sudo` with user-level operations
|
|
35
|
+
- Change `chmod 777` to `chmod 755` or `644`
|
|
36
|
+
- Add `allowed-tools` to SKILL.md frontmatter
|
|
37
|
+
|
|
38
|
+
### Data Exfiltration
|
|
39
|
+
- Isolate env var reads from network requests
|
|
40
|
+
- Add URL allowlists for outbound HTTP
|
|
41
|
+
- Remove direct .env file reading — use injected env vars
|
|
42
|
+
|
|
43
|
+
### Destructive Operations
|
|
44
|
+
- Add path allowlist validation before `rm -rf`
|
|
45
|
+
- Replace `git push --force` with `--force-with-lease`
|
|
46
|
+
- Add confirmation prompts before destructive ops
|
|
47
|
+
|
|
48
|
+
### Supply Chain
|
|
49
|
+
- Pin dependency versions: `package@1.2.3` instead of `package`
|
|
50
|
+
- Replace `curl | bash` with download-then-review-then-execute
|
|
51
|
+
- Add `@sha256:` digests to Docker FROM statements
|
|
52
|
+
|
|
53
|
+
### Code Security
|
|
54
|
+
- Replace `shell=True` with `shell=False` and argument lists
|
|
55
|
+
- Replace `eval()` with `JSON.parse()` or safe alternatives
|
|
56
|
+
- Use parameterized SQL queries instead of f-strings
|
|
57
|
+
|
|
58
|
+
### Credential Leaks
|
|
59
|
+
- Move hardcoded secrets to environment variables
|
|
60
|
+
- Add `.env` to `.gitignore`
|
|
61
|
+
- Replace hardcoded API keys with `process.env.KEY_NAME`
|
|
62
|
+
|
|
63
|
+
### Least Privilege
|
|
64
|
+
- Add `allowed-tools` frontmatter listing only needed tools
|
|
65
|
+
- Split skills with shell+network+write into focused sub-skills
|
|
66
|
+
|
|
67
|
+
### License Compliance
|
|
68
|
+
- Check dependency license compatibility
|
|
69
|
+
- Add license declarations to SKILL.md frontmatter
|
|
70
|
+
|
|
71
|
+
### Resource Abuse
|
|
72
|
+
- Add `maxIterations` or timeout to loops
|
|
73
|
+
- Set reasonable retry limits with exponential backoff
|
|
74
|
+
- Add recursion depth limits
|
|
75
|
+
|
|
76
|
+
## Workflow
|
|
77
|
+
|
|
78
|
+
1. Read the JSON report to identify findings
|
|
79
|
+
2. Read each affected source file
|
|
80
|
+
3. For each finding, propose a minimal, targeted fix
|
|
81
|
+
4. Apply fixes with Edit tool (with user approval)
|
|
82
|
+
5. Re-run `npx skillguard <target>` to verify the fix reduced the risk score
|