agent-security-scanner-mcp 3.2.0 → 3.4.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/README.md +283 -3
- package/analyzer.py +22 -5
- package/cross_file_analyzer.py +216 -0
- package/index.js +191 -2
- package/package.json +15 -5
- package/pattern_matcher.py +1 -0
- package/regex_fallback.py +199 -1
- package/rules/openclaw.security.yaml +283 -0
- package/scripts/postinstall.js +25 -0
- package/skills/openclaw/SKILL.md +102 -0
- package/skills/security-scan-batch.md +107 -0
- package/skills/security-scanner.md +76 -0
- package/src/cli/init-hooks.js +164 -0
- package/src/cli/init.js +93 -0
- package/src/config.js +181 -0
- package/src/context.js +228 -0
- package/src/dedup.js +129 -0
- package/src/fix-patterns.js +66 -17
- package/src/tools/fix-security.js +31 -4
- package/src/tools/scan-diff.js +151 -0
- package/src/tools/scan-project.js +308 -0
- package/src/tools/scan-prompt.js +71 -1
- package/src/tools/scan-security.js +33 -5
- package/src/utils.js +76 -7
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# OpenClaw-specific security rules
|
|
2
|
+
# Detects attacks targeting autonomous AI assistants with broad system access
|
|
3
|
+
# These rules are loaded by scan_agent_prompt for OpenClaw integration
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
# ===========================================
|
|
7
|
+
# DATA EXFILTRATION
|
|
8
|
+
# ===========================================
|
|
9
|
+
- id: openclaw.exfiltration.email-forward
|
|
10
|
+
severity: CRITICAL
|
|
11
|
+
category: data_exfiltration
|
|
12
|
+
patterns:
|
|
13
|
+
- "forward\\s+(all\\s+)?(my\\s+)?emails?\\s+to"
|
|
14
|
+
- "send\\s+(all\\s+)?(my\\s+)?emails?\\s+to"
|
|
15
|
+
- "copy\\s+(all\\s+)?(my\\s+)?emails?\\s+to"
|
|
16
|
+
- "export\\s+(all\\s+)?(my\\s+)?emails?\\s+to"
|
|
17
|
+
- "redirect\\s+(my\\s+)?mail\\s+to"
|
|
18
|
+
message: "Potential email exfiltration attempt"
|
|
19
|
+
action: BLOCK
|
|
20
|
+
|
|
21
|
+
- id: openclaw.exfiltration.contacts-export
|
|
22
|
+
severity: CRITICAL
|
|
23
|
+
category: data_exfiltration
|
|
24
|
+
patterns:
|
|
25
|
+
- "export\\s+(all\\s+)?(my\\s+)?contacts\\s+to"
|
|
26
|
+
- "send\\s+(all\\s+)?(my\\s+)?contacts\\s+to"
|
|
27
|
+
- "send\\s+(my\\s+)?contact\\s+list\\s+to"
|
|
28
|
+
- "share\\s+(my\\s+)?address\\s+book"
|
|
29
|
+
- "upload\\s+(my\\s+)?contacts"
|
|
30
|
+
message: "Potential contacts exfiltration attempt"
|
|
31
|
+
action: BLOCK
|
|
32
|
+
|
|
33
|
+
- id: openclaw.exfiltration.calendar-export
|
|
34
|
+
severity: HIGH
|
|
35
|
+
category: data_exfiltration
|
|
36
|
+
patterns:
|
|
37
|
+
- "export\\s+(all\\s+)?(my\\s+)?calendar"
|
|
38
|
+
- "share\\s+(my\\s+)?schedule\\s+with"
|
|
39
|
+
- "send\\s+(my\\s+)?appointments\\s+to"
|
|
40
|
+
- "upload\\s+(my\\s+)?calendar"
|
|
41
|
+
message: "Potential calendar data exfiltration"
|
|
42
|
+
action: WARN
|
|
43
|
+
|
|
44
|
+
- id: openclaw.exfiltration.file-upload
|
|
45
|
+
severity: CRITICAL
|
|
46
|
+
category: data_exfiltration
|
|
47
|
+
patterns:
|
|
48
|
+
- "upload\\s+(all\\s+)?(my\\s+)?files?\\s+to"
|
|
49
|
+
- "send\\s+(all\\s+)?(my\\s+)?documents?\\s+to"
|
|
50
|
+
- "transfer\\s+(my\\s+)?data\\s+to"
|
|
51
|
+
- "copy\\s+(my\\s+)?files?\\s+to\\s+(external|remote|cloud)"
|
|
52
|
+
- "sync\\s+(my\\s+)?files?\\s+to\\s+\\S+\\.(com|io|net|org)"
|
|
53
|
+
message: "Potential file exfiltration to external service"
|
|
54
|
+
action: BLOCK
|
|
55
|
+
|
|
56
|
+
- id: openclaw.exfiltration.browser-session
|
|
57
|
+
severity: CRITICAL
|
|
58
|
+
category: data_exfiltration
|
|
59
|
+
patterns:
|
|
60
|
+
- "share\\s+(my\\s+)?browser\\s+(cookies?|session)"
|
|
61
|
+
- "export\\s+(my\\s+)?cookies?"
|
|
62
|
+
- "send\\s+(my\\s+)?session\\s+(data|tokens?)"
|
|
63
|
+
- "copy\\s+(my\\s+)?browser\\s+data"
|
|
64
|
+
- "extract\\s+(my\\s+)?login\\s+sessions?"
|
|
65
|
+
message: "Potential browser session/cookie theft"
|
|
66
|
+
action: BLOCK
|
|
67
|
+
|
|
68
|
+
- id: openclaw.exfiltration.browsing-history
|
|
69
|
+
severity: HIGH
|
|
70
|
+
category: data_exfiltration
|
|
71
|
+
patterns:
|
|
72
|
+
- "export\\s+(my\\s+)?browsing\\s+history"
|
|
73
|
+
- "send\\s+(my\\s+)?browser\\s+history"
|
|
74
|
+
- "share\\s+(my\\s+)?search\\s+history"
|
|
75
|
+
message: "Potential browsing history exfiltration"
|
|
76
|
+
action: WARN
|
|
77
|
+
|
|
78
|
+
# ===========================================
|
|
79
|
+
# MESSAGING ABUSE
|
|
80
|
+
# ===========================================
|
|
81
|
+
- id: openclaw.messaging.mass-send
|
|
82
|
+
severity: CRITICAL
|
|
83
|
+
category: messaging_abuse
|
|
84
|
+
patterns:
|
|
85
|
+
- "send\\s+(this\\s+)?message\\s+to\\s+all\\s+(my\\s+)?contacts"
|
|
86
|
+
- "message\\s+everyone\\s+in\\s+(my\\s+)?contacts?"
|
|
87
|
+
- "broadcast\\s+to\\s+all\\s+(my\\s+)?(contacts|friends)"
|
|
88
|
+
- "send\\s+to\\s+all\\s+(my\\s+)?(whatsapp|telegram|discord|slack)"
|
|
89
|
+
- "spam\\s+(all\\s+)?(my\\s+)?contacts"
|
|
90
|
+
message: "Mass messaging to all contacts detected"
|
|
91
|
+
action: BLOCK
|
|
92
|
+
|
|
93
|
+
- id: openclaw.messaging.auto-reply
|
|
94
|
+
severity: HIGH
|
|
95
|
+
category: messaging_abuse
|
|
96
|
+
patterns:
|
|
97
|
+
- "auto(-|\\s)?reply\\s+to\\s+(all|every)\\s+message"
|
|
98
|
+
- "automatically\\s+respond\\s+to\\s+(all|every)"
|
|
99
|
+
- "reply\\s+to\\s+all\\s+messages?\\s+with"
|
|
100
|
+
- "set\\s+up\\s+auto(-|\\s)?responder"
|
|
101
|
+
message: "Auto-reply configuration may be abused"
|
|
102
|
+
action: WARN
|
|
103
|
+
|
|
104
|
+
- id: openclaw.messaging.impersonation
|
|
105
|
+
severity: CRITICAL
|
|
106
|
+
category: messaging_abuse
|
|
107
|
+
patterns:
|
|
108
|
+
- "pretend\\s+to\\s+be\\s+(me|someone)"
|
|
109
|
+
- "impersonate\\s+(me|someone)"
|
|
110
|
+
- "send\\s+as\\s+if\\s+(from\\s+)?(me|I)"
|
|
111
|
+
- "message\\s+(them|him|her)\\s+as\\s+(me|if)"
|
|
112
|
+
message: "Potential impersonation/social engineering"
|
|
113
|
+
action: BLOCK
|
|
114
|
+
|
|
115
|
+
- id: openclaw.messaging.phishing-content
|
|
116
|
+
severity: CRITICAL
|
|
117
|
+
category: messaging_abuse
|
|
118
|
+
patterns:
|
|
119
|
+
- "send\\s+.*(urgent|verify|confirm)\\s+(your\\s+)?(account|password|login)"
|
|
120
|
+
- "message\\s+.*click\\s+(this|here|the)\\s+link"
|
|
121
|
+
- "tell\\s+(them|everyone)\\s+to\\s+(update|verify|confirm)"
|
|
122
|
+
message: "Potential phishing content in message"
|
|
123
|
+
action: BLOCK
|
|
124
|
+
|
|
125
|
+
# ===========================================
|
|
126
|
+
# CREDENTIAL/SECRET THEFT
|
|
127
|
+
# ===========================================
|
|
128
|
+
- id: openclaw.credentials.api-keys
|
|
129
|
+
severity: CRITICAL
|
|
130
|
+
category: credential_theft
|
|
131
|
+
patterns:
|
|
132
|
+
- "show\\s+(me\\s+)?(my\\s+)?api\\s+keys?"
|
|
133
|
+
- "list\\s+(all\\s+)?(my\\s+)?api\\s+keys?"
|
|
134
|
+
- "what\\s+(are|is)\\s+(my\\s+)?api\\s+(key|token|secret)"
|
|
135
|
+
- "display\\s+(my\\s+)?tokens?"
|
|
136
|
+
- "reveal\\s+(my\\s+)?secrets?"
|
|
137
|
+
message: "Attempt to access API keys/tokens"
|
|
138
|
+
action: BLOCK
|
|
139
|
+
|
|
140
|
+
- id: openclaw.credentials.passwords
|
|
141
|
+
severity: CRITICAL
|
|
142
|
+
category: credential_theft
|
|
143
|
+
patterns:
|
|
144
|
+
- "show\\s+(me\\s+)?(my\\s+)?(saved\\s+)?passwords?"
|
|
145
|
+
- "what\\s+(are|is)\\s+(my\\s+)?passwords?"
|
|
146
|
+
- "list\\s+(all\\s+)?(my\\s+)?passwords?"
|
|
147
|
+
- "display\\s+(my\\s+)?login\\s+credentials?"
|
|
148
|
+
- "export\\s+(my\\s+)?passwords?"
|
|
149
|
+
message: "Attempt to access saved passwords"
|
|
150
|
+
action: BLOCK
|
|
151
|
+
|
|
152
|
+
- id: openclaw.credentials.keychain
|
|
153
|
+
severity: CRITICAL
|
|
154
|
+
category: credential_theft
|
|
155
|
+
patterns:
|
|
156
|
+
- "access\\s+(my\\s+)?keychain"
|
|
157
|
+
- "read\\s+(from\\s+)?(my\\s+)?keychain"
|
|
158
|
+
- "export\\s+(my\\s+)?keychain"
|
|
159
|
+
- "dump\\s+(my\\s+)?credential\\s+store"
|
|
160
|
+
- "show\\s+(my\\s+)?secure\\s+storage"
|
|
161
|
+
message: "Attempt to access system keychain/credential store"
|
|
162
|
+
action: BLOCK
|
|
163
|
+
|
|
164
|
+
- id: openclaw.credentials.env-secrets
|
|
165
|
+
severity: CRITICAL
|
|
166
|
+
category: credential_theft
|
|
167
|
+
patterns:
|
|
168
|
+
- "show\\s+(me\\s+)?(all\\s+)?environment\\s+variables?"
|
|
169
|
+
- "print\\s+(all\\s+)?env\\s+vars?"
|
|
170
|
+
- "list\\s+.env\\s+file"
|
|
171
|
+
- "cat\\s+.*\\.env"
|
|
172
|
+
- "display\\s+(my\\s+)?secrets?"
|
|
173
|
+
message: "Attempt to access environment secrets"
|
|
174
|
+
action: BLOCK
|
|
175
|
+
|
|
176
|
+
- id: openclaw.credentials.ssh-keys
|
|
177
|
+
severity: CRITICAL
|
|
178
|
+
category: credential_theft
|
|
179
|
+
patterns:
|
|
180
|
+
- "show\\s+(me\\s+)?(my\\s+)?ssh\\s+keys?"
|
|
181
|
+
- "read\\s+(my\\s+)?private\\s+key"
|
|
182
|
+
- "export\\s+(my\\s+)?ssh\\s+keys?"
|
|
183
|
+
- "copy\\s+(my\\s+)?\\.ssh"
|
|
184
|
+
- "send\\s+(my\\s+)?id_rsa"
|
|
185
|
+
message: "Attempt to access SSH private keys"
|
|
186
|
+
action: BLOCK
|
|
187
|
+
|
|
188
|
+
# ===========================================
|
|
189
|
+
# AUTONOMOUS HARM / SAFETY BYPASS
|
|
190
|
+
# ===========================================
|
|
191
|
+
- id: openclaw.autonomous.scheduled-harm
|
|
192
|
+
severity: CRITICAL
|
|
193
|
+
category: autonomous_harm
|
|
194
|
+
patterns:
|
|
195
|
+
- "run\\s+this\\s+(every|each)\\s+(hour|minute|day)"
|
|
196
|
+
- "schedule\\s+this\\s+to\\s+run\\s+(repeatedly|continuously)"
|
|
197
|
+
- "set\\s+up\\s+(a\\s+)?cron\\s+(job\\s+)?to"
|
|
198
|
+
- "automatically\\s+run\\s+this\\s+without\\s+asking"
|
|
199
|
+
message: "Scheduled task without confirmation requested"
|
|
200
|
+
action: WARN
|
|
201
|
+
|
|
202
|
+
- id: openclaw.autonomous.no-confirm
|
|
203
|
+
severity: HIGH
|
|
204
|
+
category: autonomous_harm
|
|
205
|
+
patterns:
|
|
206
|
+
- "don'?t\\s+(ask|confirm|prompt)\\s+(me\\s+)?before"
|
|
207
|
+
- "without\\s+(asking|confirmation|prompting)"
|
|
208
|
+
- "skip\\s+(the\\s+)?confirmation"
|
|
209
|
+
- "auto(-|\\s)?approve\\s+(all|everything)"
|
|
210
|
+
- "don'?t\\s+wait\\s+for\\s+(my\\s+)?approval"
|
|
211
|
+
message: "Request to bypass confirmation prompts"
|
|
212
|
+
action: WARN
|
|
213
|
+
|
|
214
|
+
- id: openclaw.autonomous.disable-safety
|
|
215
|
+
severity: CRITICAL
|
|
216
|
+
category: autonomous_harm
|
|
217
|
+
patterns:
|
|
218
|
+
- "disable\\s+(all\\s+)?safety\\s+(checks?|features?)"
|
|
219
|
+
- "turn\\s+off\\s+(security|safety)"
|
|
220
|
+
- "bypass\\s+(the\\s+)?security"
|
|
221
|
+
- "ignore\\s+(the\\s+)?restrictions?"
|
|
222
|
+
- "remove\\s+(the\\s+)?guardrails?"
|
|
223
|
+
message: "Attempt to disable safety mechanisms"
|
|
224
|
+
action: BLOCK
|
|
225
|
+
|
|
226
|
+
- id: openclaw.autonomous.unlimited-access
|
|
227
|
+
severity: HIGH
|
|
228
|
+
category: autonomous_harm
|
|
229
|
+
patterns:
|
|
230
|
+
- "give\\s+(me|yourself)\\s+(full|unlimited|complete)\\s+access"
|
|
231
|
+
- "grant\\s+(me|yourself)\\s+(all|admin)\\s+permissions?"
|
|
232
|
+
- "escalate\\s+(your|my)\\s+privileges?"
|
|
233
|
+
- "run\\s+(as|with)\\s+(root|admin|sudo)"
|
|
234
|
+
message: "Privilege escalation attempt"
|
|
235
|
+
action: BLOCK
|
|
236
|
+
|
|
237
|
+
# ===========================================
|
|
238
|
+
# SERVICE-SPECIFIC ATTACKS
|
|
239
|
+
# ===========================================
|
|
240
|
+
- id: openclaw.service.payment-fraud
|
|
241
|
+
severity: CRITICAL
|
|
242
|
+
category: service_attack
|
|
243
|
+
patterns:
|
|
244
|
+
- "make\\s+(a\\s+)?payment\\s+to"
|
|
245
|
+
- "transfer\\s+(money|funds)\\s+to"
|
|
246
|
+
- "send\\s+\\$?\\d+\\s+to"
|
|
247
|
+
- "buy\\s+(this|something)\\s+using\\s+(my\\s+)?(card|account)"
|
|
248
|
+
- "purchase\\s+.*without\\s+(asking|confirmation)"
|
|
249
|
+
message: "Unauthorized payment/transaction attempt"
|
|
250
|
+
action: BLOCK
|
|
251
|
+
|
|
252
|
+
- id: openclaw.service.account-changes
|
|
253
|
+
severity: HIGH
|
|
254
|
+
category: service_attack
|
|
255
|
+
patterns:
|
|
256
|
+
- "change\\s+(my\\s+)?password\\s+to"
|
|
257
|
+
- "update\\s+(my\\s+)?email\\s+to"
|
|
258
|
+
- "modify\\s+(my\\s+)?account\\s+settings"
|
|
259
|
+
- "add\\s+(a\\s+)?(new\\s+)?recovery\\s+(email|phone)"
|
|
260
|
+
message: "Account modification request - verify intent"
|
|
261
|
+
action: WARN
|
|
262
|
+
|
|
263
|
+
- id: openclaw.service.github-destructive
|
|
264
|
+
severity: CRITICAL
|
|
265
|
+
category: service_attack
|
|
266
|
+
patterns:
|
|
267
|
+
- "delete\\s+(all\\s+)?(my\\s+)?repositories"
|
|
268
|
+
- "remove\\s+(all\\s+)?(my\\s+)?github\\s+(repos?|projects?)"
|
|
269
|
+
- "force\\s+push\\s+to\\s+(main|master)"
|
|
270
|
+
- "make\\s+(all\\s+)?(my\\s+)?repos?\\s+public"
|
|
271
|
+
message: "Potentially destructive GitHub operation"
|
|
272
|
+
action: BLOCK
|
|
273
|
+
|
|
274
|
+
- id: openclaw.service.social-destructive
|
|
275
|
+
severity: HIGH
|
|
276
|
+
category: service_attack
|
|
277
|
+
patterns:
|
|
278
|
+
- "delete\\s+(all\\s+)?(my\\s+)?(posts?|tweets?|messages?)"
|
|
279
|
+
- "unfollow\\s+(everyone|all)"
|
|
280
|
+
- "block\\s+(everyone|all\\s+my\\s+contacts)"
|
|
281
|
+
- "deactivate\\s+(my\\s+)?account"
|
|
282
|
+
message: "Potentially destructive social media operation"
|
|
283
|
+
action: WARN
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* postinstall.js - Attempt to install Python dependencies for tree-sitter AST engine.
|
|
4
|
+
* If installation fails, the scanner gracefully falls back to regex-only mode.
|
|
5
|
+
*/
|
|
6
|
+
import { execFileSync } from "child_process";
|
|
7
|
+
import { join, dirname } from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const requirementsPath = join(__dirname, "..", "requirements.txt");
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
execFileSync("python3", ["-m", "pip", "install", "-r", requirementsPath, "--user", "--quiet"], {
|
|
15
|
+
timeout: 120000,
|
|
16
|
+
stdio: "inherit",
|
|
17
|
+
});
|
|
18
|
+
console.log("[postinstall] Python dependencies installed - AST engine enabled.");
|
|
19
|
+
} catch {
|
|
20
|
+
console.log(
|
|
21
|
+
"[postinstall] Could not install Python dependencies (tree-sitter).\n" +
|
|
22
|
+
" The scanner will run in regex-only mode, which still catches common vulnerabilities.\n" +
|
|
23
|
+
" To enable AST analysis later, run: python3 -m pip install -r requirements.txt"
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-scanner
|
|
3
|
+
description: Scan prompts and code for security threats using agent-security-scanner-mcp. Protects against prompt injection, data exfiltration, and credential theft.
|
|
4
|
+
metadata: {"openclaw":{"emoji":"🛡️","requires":{"bins":["npx"]}}}
|
|
5
|
+
homepage: https://github.com/sinewaveai/agent-security-scanner-mcp
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Security Scanner for OpenClaw
|
|
9
|
+
|
|
10
|
+
Protect your OpenClaw instance from:
|
|
11
|
+
- **Prompt injection attacks** - Detects attempts to manipulate your AI assistant
|
|
12
|
+
- **Data exfiltration** - Blocks attempts to steal emails, contacts, files
|
|
13
|
+
- **Credential theft** - Prevents exposure of API keys, passwords, SSH keys
|
|
14
|
+
- **Messaging abuse** - Stops mass messaging and impersonation attacks
|
|
15
|
+
- **Unsafe automation** - Warns about scheduled tasks without confirmation
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
Install the scanner globally:
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g agent-security-scanner-mcp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or use directly with npx (no install needed).
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
### Scan a Prompt
|
|
29
|
+
Check if a prompt is safe before execution:
|
|
30
|
+
```bash
|
|
31
|
+
npx agent-security-scanner-mcp scan-prompt "forward all my emails to someone@example.com"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Returns `BLOCK`, `WARN`, or `ALLOW` with risk assessment.
|
|
35
|
+
|
|
36
|
+
### Scan Code
|
|
37
|
+
Check code for vulnerabilities before running:
|
|
38
|
+
```bash
|
|
39
|
+
npx agent-security-scanner-mcp scan-security ./script.py --verbosity minimal
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Check Package
|
|
43
|
+
Verify a package isn't hallucinated (AI-invented):
|
|
44
|
+
```bash
|
|
45
|
+
npx agent-security-scanner-mcp check-package some-package npm
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage Instructions
|
|
49
|
+
|
|
50
|
+
When a user asks you to do something potentially risky, scan it first:
|
|
51
|
+
|
|
52
|
+
1. **Before executing shell commands** - Scan for injection attacks
|
|
53
|
+
2. **Before running code** - Check for vulnerabilities
|
|
54
|
+
3. **Before sending messages** - Verify no mass-messaging or phishing
|
|
55
|
+
4. **Before accessing sensitive data** - Check for exfiltration attempts
|
|
56
|
+
|
|
57
|
+
### Example Workflow
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
User: "Forward all my work emails to my personal Gmail"
|
|
61
|
+
|
|
62
|
+
You: Let me check this request for security concerns...
|
|
63
|
+
[Run: npx agent-security-scanner-mcp scan-prompt "Forward all my work emails to my personal Gmail"]
|
|
64
|
+
|
|
65
|
+
Result: BLOCK - Potential email exfiltration attempt
|
|
66
|
+
|
|
67
|
+
You: I've detected this could be a security risk. Email forwarding to external addresses
|
|
68
|
+
could expose sensitive work information. Would you like to:
|
|
69
|
+
1. Set up selective forwarding with filters
|
|
70
|
+
2. Forward only from specific senders
|
|
71
|
+
3. Proceed anyway (not recommended)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Verbosity Levels
|
|
75
|
+
|
|
76
|
+
- `--verbosity minimal` - Just action + risk level (~50 tokens)
|
|
77
|
+
- `--verbosity compact` - Action + findings summary (~200 tokens)
|
|
78
|
+
- `--verbosity full` - Complete audit trail (~500 tokens)
|
|
79
|
+
|
|
80
|
+
## What It Detects
|
|
81
|
+
|
|
82
|
+
### OpenClaw-Specific Threats
|
|
83
|
+
| Category | Examples |
|
|
84
|
+
|----------|----------|
|
|
85
|
+
| Data Exfiltration | "Forward emails to...", "Upload files to...", "Share cookies" |
|
|
86
|
+
| Messaging Abuse | "Send to all contacts", "Auto-reply to everyone" |
|
|
87
|
+
| Credential Theft | "Show my passwords", "Access keychain", "List API keys" |
|
|
88
|
+
| Unsafe Automation | "Run hourly without asking", "Disable safety checks" |
|
|
89
|
+
| Service Attacks | "Delete all repos", "Make payment to..." |
|
|
90
|
+
|
|
91
|
+
### General Security
|
|
92
|
+
- SQL injection, XSS, command injection in code
|
|
93
|
+
- Hardcoded secrets and API keys
|
|
94
|
+
- Weak cryptography
|
|
95
|
+
- Insecure deserialization
|
|
96
|
+
|
|
97
|
+
## Exit Codes
|
|
98
|
+
|
|
99
|
+
- `0` - Safe / No issues
|
|
100
|
+
- `1` - Issues found / Action required
|
|
101
|
+
|
|
102
|
+
Use exit codes in scripts to automatically block risky operations.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-scan-batch
|
|
3
|
+
description: Use when scanning multiple files or entire directories for security vulnerabilities. Dispatches parallel subagents for efficient batch scanning with consolidated results.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Batch Security Scanner Skill
|
|
7
|
+
|
|
8
|
+
You are a batch security scanning coordinator. Scan multiple files efficiently and return consolidated results that minimize context consumption.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. **Identify files to scan** - Use glob patterns or file list provided
|
|
13
|
+
2. **Scan each file** using `mcp__security-scanner__scan_security` with `verbosity: 'minimal'`
|
|
14
|
+
3. **For files with issues**, get details with `verbosity: 'compact'`
|
|
15
|
+
4. **Consolidate results** - Merge findings, deduplicate, prioritize
|
|
16
|
+
5. **Return executive summary**
|
|
17
|
+
|
|
18
|
+
## Response Format
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
## Security Scan Summary
|
|
22
|
+
|
|
23
|
+
**Files Scanned:** {N}
|
|
24
|
+
**Files with Issues:** {N}
|
|
25
|
+
**Total Issues:** {critical} critical, {warning} warning
|
|
26
|
+
|
|
27
|
+
### Files Requiring Attention
|
|
28
|
+
|
|
29
|
+
| File | Critical | Warning | Top Issue |
|
|
30
|
+
|------|----------|---------|-----------|
|
|
31
|
+
| path/file1.py | 2 | 3 | SQL Injection (L15) |
|
|
32
|
+
| path/file2.js | 0 | 1 | XSS (L42) |
|
|
33
|
+
|
|
34
|
+
### Priority Fixes (Top 10)
|
|
35
|
+
1. **path/file1.py:15** - SQL Injection: Use parameterized query
|
|
36
|
+
2. **path/file1.py:28** - Hardcoded secret: Move to env var
|
|
37
|
+
3. **path/file2.js:42** - XSS: Use textContent instead of innerHTML
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
### Quick Fix
|
|
41
|
+
To auto-fix all issues: scan each file with fix_security tool.
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Rules
|
|
45
|
+
|
|
46
|
+
- DO scan files using `verbosity: 'minimal'` first for quick triage
|
|
47
|
+
- DO only fetch `verbosity: 'compact'` for files that have issues
|
|
48
|
+
- DO consolidate into single summary
|
|
49
|
+
- DO NOT return individual file JSON details
|
|
50
|
+
- DO prioritize by: critical severity > file count > line number
|
|
51
|
+
- DO limit to top 10 priority fixes in summary
|
|
52
|
+
|
|
53
|
+
## Scanning Patterns
|
|
54
|
+
|
|
55
|
+
For common batch operations:
|
|
56
|
+
|
|
57
|
+
**Python project:**
|
|
58
|
+
```
|
|
59
|
+
Glob: **/*.py
|
|
60
|
+
Exclude: **/venv/**, **/__pycache__/**
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**JavaScript/TypeScript project:**
|
|
64
|
+
```
|
|
65
|
+
Glob: **/*.{js,ts,jsx,tsx}
|
|
66
|
+
Exclude: **/node_modules/**, **/dist/**
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Full project scan:**
|
|
70
|
+
```
|
|
71
|
+
Glob: **/*.{py,js,ts,java,go,rb,php}
|
|
72
|
+
Exclude: **/vendor/**, **/node_modules/**, **/venv/**
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Example
|
|
76
|
+
|
|
77
|
+
User asks: "Scan all Python files in src/"
|
|
78
|
+
|
|
79
|
+
You run:
|
|
80
|
+
1. Glob for `src/**/*.py` - find 15 files
|
|
81
|
+
2. Scan each with `verbosity: 'minimal'` - 4 have issues
|
|
82
|
+
3. Get `verbosity: 'compact'` for those 4 files
|
|
83
|
+
4. Consolidate and return summary
|
|
84
|
+
|
|
85
|
+
Response:
|
|
86
|
+
```
|
|
87
|
+
## Security Scan Summary
|
|
88
|
+
|
|
89
|
+
**Files Scanned:** 15
|
|
90
|
+
**Files with Issues:** 4
|
|
91
|
+
**Total Issues:** 3 critical, 8 warning
|
|
92
|
+
|
|
93
|
+
### Files Requiring Attention
|
|
94
|
+
|
|
95
|
+
| File | Critical | Warning | Top Issue |
|
|
96
|
+
|------|----------|---------|-----------|
|
|
97
|
+
| src/db.py | 2 | 1 | SQL Injection (L23) |
|
|
98
|
+
| src/auth.py | 1 | 3 | Hardcoded secret (L15) |
|
|
99
|
+
| src/api.py | 0 | 2 | SSL disabled (L67) |
|
|
100
|
+
| src/utils.py | 0 | 2 | Weak crypto (L12) |
|
|
101
|
+
|
|
102
|
+
### Priority Fixes (Top 10)
|
|
103
|
+
1. **src/db.py:23** - SQL Injection: Use parameterized query
|
|
104
|
+
2. **src/db.py:45** - SQL Injection: Use parameterized query
|
|
105
|
+
3. **src/auth.py:15** - Hardcoded secret: Move API_KEY to env var
|
|
106
|
+
...
|
|
107
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-scanner
|
|
3
|
+
description: Use when scanning files for security vulnerabilities. Runs comprehensive security analysis via subagent, returns concise actionable summary to main context.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Security Scanner Skill
|
|
7
|
+
|
|
8
|
+
You are a security scanning subagent. Your job is to run comprehensive security analysis and return a concise, actionable summary that minimizes context consumption in the main conversation.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. **Scan the file** using `mcp__security-scanner__scan_security` with `verbosity: 'full'`
|
|
13
|
+
2. **Analyze findings** - group by severity, identify patterns
|
|
14
|
+
3. **If fixes needed**, use `mcp__security-scanner__fix_security` with `verbosity: 'full'`
|
|
15
|
+
4. **Return concise summary** (not the full JSON output)
|
|
16
|
+
|
|
17
|
+
## Response Format
|
|
18
|
+
|
|
19
|
+
Return ONLY this format to the main conversation:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
## Security Scan: {filename}
|
|
23
|
+
|
|
24
|
+
**Status:** {PASS | WARN | FAIL}
|
|
25
|
+
**Issues:** {critical} critical, {warning} warning, {info} info
|
|
26
|
+
|
|
27
|
+
{If issues found:}
|
|
28
|
+
### Priority Fixes
|
|
29
|
+
1. **Line {N}**: {rule} - {one-line fix description}
|
|
30
|
+
2. **Line {N}**: {rule} - {one-line fix description}
|
|
31
|
+
{limit to top 5}
|
|
32
|
+
|
|
33
|
+
### Auto-Fix Available
|
|
34
|
+
Run `mcp__security-scanner__fix_security` to automatically apply {N} fixes.
|
|
35
|
+
|
|
36
|
+
{If no issues:}
|
|
37
|
+
No security issues detected.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Rules
|
|
41
|
+
|
|
42
|
+
- DO use `verbosity: 'full'` internally for complete analysis
|
|
43
|
+
- DO return only the summary format above to the main conversation
|
|
44
|
+
- DO NOT include raw JSON in your response
|
|
45
|
+
- DO NOT include metadata, CWE references, or verbose explanations
|
|
46
|
+
- DO prioritize fixes by severity (critical > warning > info)
|
|
47
|
+
- DO limit to top 5 issues if more than 5 found
|
|
48
|
+
- DO mention auto-fix availability if fixes can be applied
|
|
49
|
+
|
|
50
|
+
## Example
|
|
51
|
+
|
|
52
|
+
User asks: "Scan app.py for security issues"
|
|
53
|
+
|
|
54
|
+
You run internally:
|
|
55
|
+
```
|
|
56
|
+
mcp__security-scanner__scan_security({ file_path: "app.py", verbosity: "full" })
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
You return:
|
|
60
|
+
```
|
|
61
|
+
## Security Scan: app.py
|
|
62
|
+
|
|
63
|
+
**Status:** WARN
|
|
64
|
+
**Issues:** 1 critical, 3 warning, 0 info
|
|
65
|
+
|
|
66
|
+
### Priority Fixes
|
|
67
|
+
1. **Line 15**: sql-injection - Use parameterized query instead of string concat
|
|
68
|
+
2. **Line 28**: hardcoded-secret - Move API key to environment variable
|
|
69
|
+
3. **Line 42**: weak-crypto-md5 - Replace MD5 with SHA-256
|
|
70
|
+
4. **Line 67**: ssl-verify-disabled - Enable SSL certificate verification
|
|
71
|
+
|
|
72
|
+
### Auto-Fix Available
|
|
73
|
+
Run fix_security to automatically apply 4 fixes.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This approach keeps main conversation context minimal (~200 tokens vs 2000+ for raw output).
|