coverme-scanner 1.5.1 → 1.6.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/dist/prompts/coverme-command.md +140 -911
- package/package.json +1 -1
|
@@ -1,1021 +1,250 @@
|
|
|
1
1
|
# CoverMe - Ultimate AI Security Scanner
|
|
2
2
|
|
|
3
|
-
The most comprehensive AI-powered code scanner. 22 specialized agents + validators
|
|
3
|
+
The most comprehensive AI-powered code scanner. 22 specialized agents + validators.
|
|
4
4
|
|
|
5
5
|
$ARGUMENTS
|
|
6
6
|
|
|
7
|
-
## CRITICAL INSTRUCTIONS
|
|
7
|
+
## CRITICAL INSTRUCTIONS
|
|
8
8
|
|
|
9
|
-
1. **DO NOT ASK ANY QUESTIONS** - Run
|
|
10
|
-
2. **DO NOT STOP FOR CONFIRMATION** -
|
|
11
|
-
3. **
|
|
12
|
-
4. **
|
|
13
|
-
5. **
|
|
14
|
-
6. **RUN AGENTS IN BACKGROUND** - Use `run_in_background: true` for all Task tool calls
|
|
15
|
-
7. **RUN BASH IN BACKGROUND** - Use `run_in_background: true` for long Bash commands
|
|
16
|
-
|
|
17
|
-
Execute ALL phases automatically. Do NOT stop until the HTML report is open.
|
|
9
|
+
1. **DO NOT ASK ANY QUESTIONS** - Run autonomously
|
|
10
|
+
2. **DO NOT STOP FOR CONFIRMATION** - Keep going
|
|
11
|
+
3. **COMPLETE EVERYTHING** - All phases without interruption
|
|
12
|
+
4. **AGENTS WRITE TO FILES** - Each agent writes results to `.coverme/agents/{ID}.json`
|
|
13
|
+
5. **AGENTS RETURN ONLY "done" or "skipped"** - Never return findings in response
|
|
18
14
|
|
|
19
15
|
---
|
|
20
16
|
|
|
21
|
-
## Phase 0:
|
|
22
|
-
|
|
23
|
-
### Step 1: Gather Project Statistics
|
|
17
|
+
## Phase 0: Setup
|
|
24
18
|
|
|
25
19
|
```bash
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# Count lines of code (approximate)
|
|
30
|
-
find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.tsx" -o -name "*.jsx" -o -name "*.py" -o -name "*.go" \) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" 2>/dev/null | head -100 | xargs wc -l 2>/dev/null | tail -1
|
|
31
|
-
|
|
32
|
-
# Generate project tree (max 3 levels deep, exclude node_modules etc)
|
|
33
|
-
find . -maxdepth 3 -type d -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" -not -path "*/__pycache__/*" | head -30 | sort
|
|
20
|
+
mkdir -p .coverme/agents
|
|
21
|
+
rm -f .coverme/agents/*.json 2>/dev/null
|
|
34
22
|
```
|
|
35
23
|
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
Get project stats:
|
|
38
25
|
```bash
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ls src/ 2>/dev/null || ls app/ 2>/dev/null || ls lib/ 2>/dev/null
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Step 3: Load Custom Agents (if exists)
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
cat .coverme/agents.json 2>/dev/null || echo "NO_CUSTOM_AGENTS"
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Step 4: Check for Runtime Verification (SSH)
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
cat .coverme/runtime.json 2>/dev/null || echo "NO_RUNTIME_CONFIG"
|
|
26
|
+
FILES=$(find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" -o -name "*.go" \) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" 2>/dev/null | wc -l | tr -d ' ')
|
|
27
|
+
LINES=$(find . -type f \( -name "*.ts" -o -name "*.js" -o -name "*.py" \) -not -path "*/node_modules/*" -not -path "*/dist/*" 2>/dev/null | head -50 | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}')
|
|
28
|
+
echo "Files: $FILES, Lines: ~$LINES"
|
|
55
29
|
```
|
|
56
30
|
|
|
57
31
|
---
|
|
58
32
|
|
|
59
|
-
## Phase 1:
|
|
60
|
-
|
|
61
|
-
Launch ALL agents IN PARALLEL using the Task tool with `run_in_background: true`.
|
|
62
|
-
|
|
63
|
-
### Agent 1: Security Core Scanner (SEC)
|
|
64
|
-
```
|
|
65
|
-
Scan for OWASP Top 10 and common vulnerabilities:
|
|
66
|
-
|
|
67
|
-
INJECTION:
|
|
68
|
-
- SQL injection (string concatenation in queries, raw queries)
|
|
69
|
-
- NoSQL injection (MongoDB $where, $regex with user input)
|
|
70
|
-
- Command injection (exec, spawn, system with user input)
|
|
71
|
-
- LDAP injection, XPath injection
|
|
72
|
-
- Template injection (SSTI in Jinja2, EJS, Handlebars)
|
|
73
|
-
- Header injection (CRLF in headers)
|
|
74
|
-
- Log injection (unescaped user input in logs)
|
|
75
|
-
|
|
76
|
-
XSS:
|
|
77
|
-
- Reflected XSS (user input in response without encoding)
|
|
78
|
-
- Stored XSS (database content rendered without escaping)
|
|
79
|
-
- DOM XSS (innerHTML, document.write, eval with user data)
|
|
80
|
-
- dangerouslySetInnerHTML in React without sanitization
|
|
81
|
-
|
|
82
|
-
AUTHENTICATION:
|
|
83
|
-
- Hardcoded credentials (check git ls-files first!)
|
|
84
|
-
- Weak password policies (no complexity, short length)
|
|
85
|
-
- Missing rate limiting on login/register
|
|
86
|
-
- Session fixation (session ID not rotated after login)
|
|
87
|
-
- JWT issues (none algorithm, weak secret, no expiry)
|
|
88
|
-
- Missing MFA on sensitive operations
|
|
89
|
-
|
|
90
|
-
AUTHORIZATION:
|
|
91
|
-
- IDOR (direct object references without ownership check)
|
|
92
|
-
- Missing authorization checks on endpoints
|
|
93
|
-
- Privilege escalation paths
|
|
94
|
-
- Horizontal access (user A accessing user B's data)
|
|
95
|
-
- Vertical access (user accessing admin functions)
|
|
96
|
-
|
|
97
|
-
CRYPTOGRAPHY:
|
|
98
|
-
- MD5/SHA1 for passwords (use bcrypt/argon2)
|
|
99
|
-
- Math.random() for security (use crypto.randomBytes)
|
|
100
|
-
- Hardcoded encryption keys/IVs
|
|
101
|
-
- ECB mode usage
|
|
102
|
-
- Missing HTTPS enforcement
|
|
103
|
-
|
|
104
|
-
DATABASE-SPECIFIC DANGEROUS FUNCTIONS:
|
|
105
|
-
- DuckDB: read_text(), read_blob(), read_csv_auto(), read_parquet(), glob(), getenv(), httpfs
|
|
106
|
-
- SQLite: load_extension(), readfile(), writefile()
|
|
107
|
-
- PostgreSQL: pg_read_file(), pg_ls_dir(), COPY TO/FROM
|
|
108
|
-
- MySQL: LOAD_FILE(), INTO OUTFILE, INTO DUMPFILE
|
|
109
|
-
- MongoDB: $where with user input, mapReduce with user functions
|
|
110
|
-
- Redis: EVAL/EVALSHA with user input, CONFIG, DEBUG commands
|
|
111
|
-
|
|
112
|
-
Output JSON: [{id: "SEC-XXX", title, severity, category, file, line, code, description, impact, recommendation, cwe, confidence, fixOwner, fixType, dread: {damage, reproducibility, exploitability, affectedUsers, discoverability, score}}]
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Agent 2: Auth & Session Scanner (AUTH)
|
|
116
|
-
```
|
|
117
|
-
Deep dive into authentication and session management:
|
|
118
|
-
|
|
119
|
-
FIRST: Detect which auth method(s) this project uses:
|
|
120
|
-
| Auth Type | Detection Pattern |
|
|
121
|
-
|-----------|-------------------|
|
|
122
|
-
| OAuth/OIDC | oauth, oidc, authorization_code, client_id, redirect_uri |
|
|
123
|
-
| JWT | jsonwebtoken, jwt, Bearer, accessToken, refreshToken |
|
|
124
|
-
| Session-based | express-session, cookie-session, session.save, req.session |
|
|
125
|
-
| API Keys | x-api-key, apiKey, api_key, API_SECRET |
|
|
126
|
-
| Clerk | @clerk, useAuth, clerkMiddleware |
|
|
127
|
-
| Auth0 | @auth0, auth0-js, auth0-react |
|
|
128
|
-
| Firebase Auth | firebase/auth, signInWith, onAuthStateChanged |
|
|
129
|
-
| Passport.js | passport, passport-local, passport-jwt |
|
|
130
|
-
| Supabase Auth | @supabase/auth, supabase.auth |
|
|
131
|
-
| NextAuth | next-auth, NextAuth, getServerSession |
|
|
132
|
-
|
|
133
|
-
FOR EACH AUTH TYPE DETECTED, check specific vulnerabilities:
|
|
134
|
-
|
|
135
|
-
OAuth/OIDC:
|
|
136
|
-
- Open redirect in return_url/redirect_uri (CRITICAL!)
|
|
137
|
-
- State parameter missing or predictable
|
|
138
|
-
- PKCE not implemented for public clients
|
|
139
|
-
- Token stored in localStorage (XSS vulnerable)
|
|
140
|
-
|
|
141
|
-
JWT:
|
|
142
|
-
- alg: none accepted (signature bypass)
|
|
143
|
-
- Weak secret (< 256 bits)
|
|
144
|
-
- No expiry (exp claim missing)
|
|
145
|
-
- Token not invalidated on logout
|
|
146
|
-
|
|
147
|
-
Session-based:
|
|
148
|
-
- Session ID in URL (referer leak)
|
|
149
|
-
- Session not invalidated on logout
|
|
150
|
-
- Session fixation
|
|
151
|
-
- Missing secure, httpOnly, sameSite on cookies
|
|
152
|
-
|
|
153
|
-
TIMING ATTACKS:
|
|
154
|
-
- Non-constant-time string comparison for tokens/secrets
|
|
155
|
-
- Early return on auth failure leaking valid usernames
|
|
156
|
-
|
|
157
|
-
Output JSON: [{id: "AUTH-XXX", ...full format with DREAD}]
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Agent 3: API Security Scanner (API)
|
|
161
|
-
```
|
|
162
|
-
Scan API endpoints for security issues:
|
|
163
|
-
|
|
164
|
-
INPUT VALIDATION:
|
|
165
|
-
- Missing input validation on request body
|
|
166
|
-
- Type coercion attacks (string vs number)
|
|
167
|
-
- Array/object pollution
|
|
168
|
-
- Prototype pollution
|
|
169
|
-
- Mass assignment vulnerabilities
|
|
170
|
-
- GraphQL introspection enabled in production
|
|
171
|
-
- GraphQL depth/complexity limits missing
|
|
172
|
-
|
|
173
|
-
RATE LIMITING:
|
|
174
|
-
- No rate limiting on expensive operations
|
|
175
|
-
- Rate limit bypass via headers (X-Forwarded-For)
|
|
176
|
-
- Non-atomic INCR+EXPIRE in Redis
|
|
177
|
-
|
|
178
|
-
CORS MISCONFIGURATION:
|
|
179
|
-
- res.header('Access-Control-Allow-Origin', req.headers.origin)
|
|
180
|
-
- res.header('Access-Control-Allow-Origin', '*')
|
|
181
|
-
- app.use(cors({ origin: true }))
|
|
182
|
-
|
|
183
|
-
FAIL-OPEN vs FAIL-CLOSED PATTERNS (CRITICAL):
|
|
184
|
-
- IP whitelist empty/missing = allow all
|
|
185
|
-
- Auth middleware errors = request passes through
|
|
186
|
-
- Rate limiter Redis down = no limiting
|
|
187
|
-
- Config missing = insecure defaults
|
|
188
|
-
|
|
189
|
-
WEBHOOKS:
|
|
190
|
-
- Webhook signature not verified
|
|
191
|
-
- SSRF via webhook URLs
|
|
192
|
-
- No webhook replay protection
|
|
193
|
-
|
|
194
|
-
Output JSON: [{id: "API-XXX", ...full format with DREAD}]
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### Agent 4: Infrastructure Scanner (INFRA)
|
|
198
|
-
```
|
|
199
|
-
Scan infrastructure and deployment configs:
|
|
200
|
-
|
|
201
|
-
DOCKER:
|
|
202
|
-
- Running as root user
|
|
203
|
-
- Secrets in Dockerfile or build args
|
|
204
|
-
- Latest tag usage (unpinned versions)
|
|
205
|
-
- Sensitive ports exposed
|
|
206
|
-
- Missing health checks
|
|
207
|
-
- No resource limits
|
|
208
|
-
- Privileged mode enabled
|
|
33
|
+
## Phase 1: Launch 22 Agents (parallel, background)
|
|
209
34
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
-
|
|
214
|
-
- Host network/PID enabled
|
|
215
|
-
- Missing network policies
|
|
216
|
-
- Secrets not encrypted at rest
|
|
217
|
-
- Service account auto-mount enabled
|
|
218
|
-
|
|
219
|
-
CI/CD:
|
|
220
|
-
- Secrets in CI config files
|
|
221
|
-
- Missing SAST/DAST in pipeline
|
|
222
|
-
- No branch protection
|
|
223
|
-
|
|
224
|
-
SECRETS IN GIT HISTORY (CRITICAL CHECK!):
|
|
225
|
-
Run: git log --all --full-history -- "**/secrets*" "**/credentials*" "**/*.env"
|
|
226
|
-
If secrets appear in history, they are EXPOSED even if now gitignored!
|
|
35
|
+
**CRITICAL**: Each agent MUST:
|
|
36
|
+
1. Scan the codebase for its specific issues
|
|
37
|
+
2. Write findings to `.coverme/agents/{PREFIX}.json`
|
|
38
|
+
3. Return ONLY the word "done" or "skipped" - NOTHING ELSE
|
|
227
39
|
|
|
228
|
-
|
|
229
|
-
- npm audit or yarn audit in CI pipeline
|
|
230
|
-
- Dependabot/Renovate configuration
|
|
231
|
-
- SBOM generation
|
|
40
|
+
Launch ALL with `run_in_background: true`:
|
|
232
41
|
|
|
233
|
-
|
|
42
|
+
### Agent 1: SEC - Security Core
|
|
234
43
|
```
|
|
235
|
-
|
|
236
|
-
|
|
44
|
+
Scan for: SQL injection, XSS, command injection, SSTI, hardcoded secrets, weak crypto.
|
|
45
|
+
Write to .coverme/agents/SEC.json:
|
|
46
|
+
[{"id":"SEC-001","title":"...","severity":"critical|high|medium|low","file":"...","line":N,"description":"...","recommendation":"..."}]
|
|
47
|
+
Return ONLY: "done" or "skipped"
|
|
237
48
|
```
|
|
238
|
-
Scan for data protection and privacy issues:
|
|
239
|
-
|
|
240
|
-
PII HANDLING:
|
|
241
|
-
- PII logged (emails, IPs, names, phone numbers)
|
|
242
|
-
- PII in URLs/query strings
|
|
243
|
-
- PII in error messages
|
|
244
|
-
- PII not encrypted at rest
|
|
245
|
-
- PII not masked in UI/logs
|
|
246
|
-
|
|
247
|
-
GDPR/PRIVACY:
|
|
248
|
-
- Missing data retention policy implementation
|
|
249
|
-
- No data deletion mechanism (right to erasure)
|
|
250
|
-
- No data export mechanism (data portability)
|
|
251
|
-
- Consent not tracked properly
|
|
252
|
-
- Third-party data sharing without consent
|
|
253
|
-
|
|
254
|
-
DATABASE:
|
|
255
|
-
- Sensitive data not encrypted (column-level)
|
|
256
|
-
- No audit logging for sensitive operations
|
|
257
|
-
- Connection strings with credentials in code
|
|
258
|
-
|
|
259
|
-
SECRETS:
|
|
260
|
-
- API keys in code (check git ls-files!)
|
|
261
|
-
- Secrets in environment files committed
|
|
262
|
-
- .env files not in .gitignore
|
|
263
49
|
|
|
264
|
-
|
|
50
|
+
### Agent 2: AUTH - Authentication
|
|
265
51
|
```
|
|
266
|
-
|
|
267
|
-
|
|
52
|
+
Scan for: JWT issues, session problems, OAuth flaws, weak passwords, missing MFA.
|
|
53
|
+
Write to .coverme/agents/AUTH.json
|
|
54
|
+
Return ONLY: "done" or "skipped"
|
|
268
55
|
```
|
|
269
|
-
CONDITIONAL: First detect if this project uses AI/LLM:
|
|
270
|
-
grep -r -l "openai\|anthropic\|langchain\|ollama\|huggingface\|llama\|gpt-\|claude\|gemini\|bedrock\|vertex" --include="*.ts" --include="*.js" --include="*.py" --include="*.json" .
|
|
271
|
-
|
|
272
|
-
IF NO AI CODE FOUND: Output: {"skipped": true, "reason": "No AI/LLM code detected", "findings": []}
|
|
273
|
-
|
|
274
|
-
IF AI CODE FOUND:
|
|
275
|
-
PROMPT INJECTION:
|
|
276
|
-
- User input directly in prompts without sanitization
|
|
277
|
-
- System prompts exposed to users
|
|
278
|
-
- No input length limits on prompts
|
|
279
|
-
- Missing output validation from LLM
|
|
280
|
-
- Jailbreak vulnerabilities
|
|
281
56
|
|
|
282
|
-
|
|
283
|
-
- LLM generates SQL that gets executed
|
|
284
|
-
- LLM generates code that gets eval'd
|
|
285
|
-
- LLM generates shell commands that get executed
|
|
286
|
-
- LLM output used in template rendering (SSTI)
|
|
287
|
-
|
|
288
|
-
SUPPLY CHAIN:
|
|
289
|
-
- CDN imports without Subresource Integrity (SRI)
|
|
290
|
-
- Unpinned AI model versions
|
|
291
|
-
|
|
292
|
-
Output JSON: [{id: "AI-XXX", ...full format with DREAD}]
|
|
57
|
+
### Agent 3: API - API Security
|
|
293
58
|
```
|
|
294
|
-
|
|
295
|
-
|
|
59
|
+
Scan for: CORS issues, rate limiting, input validation, mass assignment, GraphQL issues.
|
|
60
|
+
Write to .coverme/agents/API.json
|
|
61
|
+
Return ONLY: "done" or "skipped"
|
|
296
62
|
```
|
|
297
|
-
Scan for performance and denial-of-service issues:
|
|
298
63
|
|
|
299
|
-
|
|
300
|
-
- N+1 query patterns
|
|
301
|
-
- Missing indexes on filtered/sorted columns
|
|
302
|
-
- Full table scans
|
|
303
|
-
- Unbounded queries (no LIMIT)
|
|
304
|
-
|
|
305
|
-
MEMORY:
|
|
306
|
-
- Memory leaks (event listeners not removed)
|
|
307
|
-
- Unbounded caches
|
|
308
|
-
- Stream not properly closed
|
|
309
|
-
- SSE/WebSocket buffer accumulation
|
|
310
|
-
|
|
311
|
-
CPU:
|
|
312
|
-
- ReDoS (Regular Expression DoS)
|
|
313
|
-
- Algorithmic complexity attacks
|
|
314
|
-
- Synchronous crypto operations
|
|
315
|
-
- JSON parsing of large payloads
|
|
316
|
-
|
|
317
|
-
DANGEROUS DATABASE OPERATIONS IN HOT PATHS:
|
|
318
|
-
- Redis KEYS command (blocks entire server, O(n) scan)
|
|
319
|
-
- MongoDB find() without limit
|
|
320
|
-
- SQL SELECT without LIMIT
|
|
321
|
-
|
|
322
|
-
Output JSON: [{id: "PERF-XXX", ...full format with DREAD}]
|
|
64
|
+
### Agent 4: INFRA - Infrastructure
|
|
323
65
|
```
|
|
324
|
-
|
|
325
|
-
|
|
66
|
+
Scan for: Docker issues, K8s misconfig, CI/CD secrets, cloud misconfig.
|
|
67
|
+
Write to .coverme/agents/INFRA.json
|
|
68
|
+
Return ONLY: "done" or "skipped"
|
|
326
69
|
```
|
|
327
|
-
Scan for business logic vulnerabilities:
|
|
328
70
|
|
|
329
|
-
|
|
330
|
-
- TOCTOU (time-of-check-time-of-use)
|
|
331
|
-
- Double-spend in transactions
|
|
332
|
-
- Inventory overselling
|
|
333
|
-
- Non-atomic read-modify-write
|
|
334
|
-
|
|
335
|
-
WORKFLOW:
|
|
336
|
-
- Step skipping in multi-step processes
|
|
337
|
-
- State manipulation attacks
|
|
338
|
-
- Workflow replay attacks
|
|
339
|
-
|
|
340
|
-
FINANCIAL:
|
|
341
|
-
- Rounding errors in calculations
|
|
342
|
-
- Currency handling issues
|
|
343
|
-
- Negative amount bypass
|
|
344
|
-
- Discount stacking exploits
|
|
345
|
-
|
|
346
|
-
Output JSON: [{id: "BIZ-XXX", ...full format with DREAD}]
|
|
71
|
+
### Agent 5: DATA - Data & Privacy
|
|
347
72
|
```
|
|
348
|
-
|
|
349
|
-
|
|
73
|
+
Scan for: PII exposure, GDPR issues, unencrypted data, secrets in code.
|
|
74
|
+
Write to .coverme/agents/DATA.json
|
|
75
|
+
Return ONLY: "done" or "skipped"
|
|
350
76
|
```
|
|
351
|
-
Scan for code quality issues that affect security/reliability:
|
|
352
|
-
|
|
353
|
-
COMPLEXITY:
|
|
354
|
-
- Cyclomatic complexity > 10
|
|
355
|
-
- Functions > 50 lines
|
|
356
|
-
- Files > 500 lines
|
|
357
|
-
- Deep nesting (> 4 levels)
|
|
358
77
|
|
|
359
|
-
|
|
360
|
-
- God objects/classes
|
|
361
|
-
- Callback hell
|
|
362
|
-
- Magic numbers/strings
|
|
363
|
-
- Dead code
|
|
364
|
-
- Console.log in production
|
|
365
|
-
- TODO/FIXME comments about security issues
|
|
366
|
-
|
|
367
|
-
ERROR HANDLING:
|
|
368
|
-
- Empty catch blocks
|
|
369
|
-
- Generic error swallowing
|
|
370
|
-
- Missing error boundaries (React)
|
|
371
|
-
- Unhandled promise rejections
|
|
372
|
-
|
|
373
|
-
DEAD CODE WITH SECURITY IMPLICATIONS:
|
|
374
|
-
- Old/commented code that has BETTER security than current code
|
|
375
|
-
- Deprecated functions with security controls not ported
|
|
376
|
-
|
|
377
|
-
Output JSON: [{id: "QUAL-XXX", ...full format with DREAD}]
|
|
78
|
+
### Agent 6: AI - AI/LLM Security
|
|
378
79
|
```
|
|
379
|
-
|
|
380
|
-
|
|
80
|
+
FIRST: Check if AI code exists (openai, anthropic, langchain, etc.)
|
|
81
|
+
If no AI code: Write {"skipped":true} and return "skipped"
|
|
82
|
+
If AI code: Scan for prompt injection, data leakage, output validation.
|
|
83
|
+
Write to .coverme/agents/AI.json
|
|
84
|
+
Return ONLY: "done" or "skipped"
|
|
381
85
|
```
|
|
382
|
-
Scan for testing gaps and reliability issues:
|
|
383
|
-
|
|
384
|
-
TEST COVERAGE:
|
|
385
|
-
- Critical paths without tests (auth, payments, data access)
|
|
386
|
-
- Error handlers not tested
|
|
387
|
-
- No integration tests
|
|
388
|
-
- No E2E tests for main flows
|
|
389
86
|
|
|
390
|
-
|
|
391
|
-
- Tests without assertions
|
|
392
|
-
- Mocked security checks (dangerous!)
|
|
393
|
-
- Flaky tests (time-dependent)
|
|
394
|
-
|
|
395
|
-
RELIABILITY:
|
|
396
|
-
- Missing health checks
|
|
397
|
-
- No graceful shutdown
|
|
398
|
-
- Missing readiness/liveness probes
|
|
399
|
-
- No circuit breakers for external calls
|
|
400
|
-
- Missing retry logic with backoff
|
|
401
|
-
|
|
402
|
-
Output JSON: [{id: "TEST-XXX", ...full format with DREAD}]
|
|
87
|
+
### Agent 7: PERF - Performance & DoS
|
|
403
88
|
```
|
|
404
|
-
|
|
405
|
-
|
|
89
|
+
Scan for: ReDoS, N+1 queries, memory leaks, unbounded operations.
|
|
90
|
+
Write to .coverme/agents/PERF.json
|
|
91
|
+
Return ONLY: "done" or "skipped"
|
|
406
92
|
```
|
|
407
|
-
CONDITIONAL: First detect if this project uses Redis/Cache:
|
|
408
|
-
grep -r -l "redis\|ioredis\|memcached\|node-cache\|lru-cache\|cache-manager" --include="*.ts" --include="*.js" --include="*.json" --include="*.yaml" .
|
|
409
|
-
|
|
410
|
-
IF NO CACHE CODE FOUND: Output: {"skipped": true, "reason": "No Redis/Cache code detected", "findings": []}
|
|
411
|
-
|
|
412
|
-
IF CACHE CODE FOUND:
|
|
413
|
-
DANGEROUS COMMANDS:
|
|
414
|
-
- KEYS * in production code (blocks entire server, use SCAN instead)
|
|
415
|
-
- FLUSHALL, FLUSHDB accessible without protection
|
|
416
|
-
- DEBUG, CONFIG commands enabled in production
|
|
417
|
-
- EVAL/EVALSHA with user-controlled scripts (Lua injection)
|
|
418
|
-
|
|
419
|
-
AUTHENTICATION & ACCESS:
|
|
420
|
-
- Redis without AUTH (requirepass not set)
|
|
421
|
-
- Redis exposed on 0.0.0.0 instead of 127.0.0.1
|
|
422
|
-
- Missing TLS for Redis connections
|
|
423
|
-
- Connection strings with passwords in code/logs
|
|
424
93
|
|
|
425
|
-
|
|
426
|
-
- Sensitive data stored without encryption
|
|
427
|
-
- PII in Redis without TTL
|
|
428
|
-
- Cache keys predictable/enumerable
|
|
429
|
-
- No key prefix separation between tenants (multi-tenant leak)
|
|
430
|
-
|
|
431
|
-
RACE CONDITIONS:
|
|
432
|
-
- Non-atomic read-modify-write patterns
|
|
433
|
-
- Missing WATCH/MULTI/EXEC for transactions
|
|
434
|
-
- INCR + EXPIRE not atomic
|
|
435
|
-
|
|
436
|
-
Output JSON: [{id: "REDIS-XXX", ...full format with DREAD}]
|
|
94
|
+
### Agent 8: BIZ - Business Logic
|
|
437
95
|
```
|
|
438
|
-
|
|
439
|
-
|
|
96
|
+
Scan for: Race conditions, TOCTOU, workflow bypass, financial issues.
|
|
97
|
+
Write to .coverme/agents/BIZ.json
|
|
98
|
+
Return ONLY: "done" or "skipped"
|
|
440
99
|
```
|
|
441
|
-
Scan for resilience patterns and fallback mechanisms:
|
|
442
|
-
|
|
443
|
-
CIRCUIT BREAKERS:
|
|
444
|
-
- External service calls without circuit breaker
|
|
445
|
-
- Circuit breaker without proper thresholds
|
|
446
|
-
- No fallback when circuit is open
|
|
447
|
-
|
|
448
|
-
RETRY PATTERNS:
|
|
449
|
-
- Retries without exponential backoff
|
|
450
|
-
- Retries without jitter (thundering herd)
|
|
451
|
-
- Retries without max attempts limit
|
|
452
|
-
- Retrying non-idempotent operations
|
|
453
100
|
|
|
454
|
-
|
|
455
|
-
- HTTP calls without timeout
|
|
456
|
-
- Database queries without timeout
|
|
457
|
-
- External API calls without timeout
|
|
458
|
-
|
|
459
|
-
FALLBACKS:
|
|
460
|
-
- No fallback for critical external dependencies
|
|
461
|
-
- Missing cached fallback data
|
|
462
|
-
- No degraded mode implementation
|
|
463
|
-
|
|
464
|
-
HEALTH CHECKS:
|
|
465
|
-
- Health check that calls external dependencies
|
|
466
|
-
- No distinction between liveness and readiness
|
|
467
|
-
|
|
468
|
-
Output JSON: [{id: "RESIL-XXX", ...full format with DREAD}]
|
|
101
|
+
### Agent 9: QUAL - Code Quality
|
|
469
102
|
```
|
|
470
|
-
|
|
471
|
-
|
|
103
|
+
Scan for: High complexity, dead code, error swallowing, anti-patterns.
|
|
104
|
+
Write to .coverme/agents/QUAL.json
|
|
105
|
+
Return ONLY: "done" or "skipped"
|
|
472
106
|
```
|
|
473
|
-
Scan for PII exposure and sensitive data handling issues:
|
|
474
|
-
|
|
475
|
-
PII IN LOGS:
|
|
476
|
-
- Email addresses logged
|
|
477
|
-
- Phone numbers logged
|
|
478
|
-
- IP addresses logged without justification
|
|
479
|
-
- Names/addresses in logs
|
|
480
|
-
- Request/response bodies logged without redaction
|
|
481
107
|
|
|
482
|
-
|
|
483
|
-
- PII in URL path (e.g., /user/john@email.com)
|
|
484
|
-
- PII in query parameters
|
|
485
|
-
- Session tokens in URLs (referer leak)
|
|
486
|
-
|
|
487
|
-
PII IN STORAGE:
|
|
488
|
-
- PII stored without encryption at rest
|
|
489
|
-
- PII in local storage/session storage (browser)
|
|
490
|
-
- PII in cookies without encryption
|
|
491
|
-
|
|
492
|
-
GDPR/CCPA COMPLIANCE:
|
|
493
|
-
- No data export functionality
|
|
494
|
-
- No data deletion on request
|
|
495
|
-
- Missing consent tracking
|
|
496
|
-
|
|
497
|
-
SENSITIVE DATA TYPES TO FIND:
|
|
498
|
-
- SSN, passport numbers, national IDs
|
|
499
|
-
- Credit card numbers (even partial)
|
|
500
|
-
- Bank account numbers
|
|
501
|
-
- Health/medical information
|
|
502
|
-
- Authentication credentials
|
|
503
|
-
|
|
504
|
-
Output JSON: [{id: "PII-XXX", ...full format with DREAD}]
|
|
108
|
+
### Agent 10: TEST - Testing
|
|
505
109
|
```
|
|
506
|
-
|
|
507
|
-
|
|
110
|
+
Scan for: Missing tests on critical paths, mocked security, no E2E.
|
|
111
|
+
Write to .coverme/agents/TEST.json
|
|
112
|
+
Return ONLY: "done" or "skipped"
|
|
508
113
|
```
|
|
509
|
-
Scan for dead code, unused dependencies, and technical debt:
|
|
510
114
|
|
|
511
|
-
|
|
512
|
-
- Functions never called
|
|
513
|
-
- Classes never instantiated
|
|
514
|
-
- Variables assigned but never read
|
|
515
|
-
- API endpoints not used by any client
|
|
516
|
-
|
|
517
|
-
COMMENTED CODE:
|
|
518
|
-
- Large blocks of commented-out code
|
|
519
|
-
- TODO/FIXME comments older than 6 months
|
|
520
|
-
- Console.log/print statements
|
|
521
|
-
|
|
522
|
-
UNUSED DEPENDENCIES:
|
|
523
|
-
- npm/pip packages installed but never imported
|
|
524
|
-
- Devdependencies in production bundle
|
|
525
|
-
- Duplicate dependencies (different versions)
|
|
526
|
-
|
|
527
|
-
SECURITY IMPLICATIONS:
|
|
528
|
-
- Commented security checks (why removed?)
|
|
529
|
-
- Unused auth middleware (was security removed?)
|
|
530
|
-
- Dead validation code (security regression?)
|
|
531
|
-
|
|
532
|
-
Output JSON: [{id: "DEAD-XXX", ...full format with DREAD}]
|
|
115
|
+
### Agent 11: REDIS - Cache Security
|
|
533
116
|
```
|
|
534
|
-
|
|
535
|
-
|
|
117
|
+
FIRST: Check if Redis/cache code exists.
|
|
118
|
+
If not: Write {"skipped":true} and return "skipped"
|
|
119
|
+
If yes: Scan for dangerous commands, auth issues, race conditions.
|
|
120
|
+
Write to .coverme/agents/REDIS.json
|
|
121
|
+
Return ONLY: "done" or "skipped"
|
|
536
122
|
```
|
|
537
|
-
AUTO-DETECT DATABASE TYPE(S):
|
|
538
|
-
| Database | Detection Pattern |
|
|
539
|
-
|----------|-------------------|
|
|
540
|
-
| PostgreSQL | pg, postgres, @prisma, typeorm, knex |
|
|
541
|
-
| MySQL | mysql, mysql2, mariadb |
|
|
542
|
-
| SQLite | sqlite, better-sqlite3, sql.js |
|
|
543
|
-
| MongoDB | mongoose, mongodb |
|
|
544
|
-
| DuckDB | duckdb, @duckdb |
|
|
545
|
-
| Supabase | @supabase/supabase-js |
|
|
546
|
-
|
|
547
|
-
IF NO DATABASE FOUND: Output: {"skipped": true, "reason": "No database code detected", "findings": []}
|
|
548
|
-
|
|
549
|
-
SQL INJECTION:
|
|
550
|
-
- String concatenation in queries
|
|
551
|
-
- Template literals with user input in SQL
|
|
552
|
-
- Raw queries without parameterization
|
|
553
|
-
- Dynamic table/column names from user input
|
|
554
|
-
|
|
555
|
-
NOSQL INJECTION:
|
|
556
|
-
- MongoDB: $where with user input
|
|
557
|
-
- MongoDB: operator injection ({$gt: ""})
|
|
558
|
-
|
|
559
|
-
ACCESS CONTROL:
|
|
560
|
-
- Database user with excessive privileges (GRANT ALL)
|
|
561
|
-
- Application using root/admin database user
|
|
562
|
-
- No row-level security (RLS) for multi-tenant
|
|
563
|
-
|
|
564
|
-
CONNECTION SECURITY:
|
|
565
|
-
- Database connection without TLS/SSL
|
|
566
|
-
- Connection strings with credentials in code
|
|
567
|
-
- Database exposed on public IP
|
|
568
123
|
|
|
569
|
-
|
|
570
|
-
- Prisma.$queryRawUnsafe() - VULNERABLE
|
|
571
|
-
- Sequelize.query() with user input - VULNERABLE
|
|
572
|
-
- TypeORM repository.query() with string concat - VULNERABLE
|
|
573
|
-
- Mongoose User.find({ username: req.body.username }) - operator injection
|
|
574
|
-
|
|
575
|
-
Output JSON: [{id: "DB-XXX", ...full format with DREAD}]
|
|
124
|
+
### Agent 12: RESIL - Resilience
|
|
576
125
|
```
|
|
577
|
-
|
|
578
|
-
|
|
126
|
+
Scan for: Missing circuit breakers, no timeouts, no retries, no fallbacks.
|
|
127
|
+
Write to .coverme/agents/RESIL.json
|
|
128
|
+
Return ONLY: "done" or "skipped"
|
|
579
129
|
```
|
|
580
|
-
Scan for network architecture and service boundary issues:
|
|
581
|
-
|
|
582
|
-
SERVICE BOUNDARIES:
|
|
583
|
-
- Internal endpoints exposed externally
|
|
584
|
-
- Missing network segmentation between services
|
|
585
|
-
- Service-to-service communication without mTLS
|
|
586
|
-
- Admin/debug ports accessible from outside
|
|
587
|
-
|
|
588
|
-
For EACH FINDING, determine fixOwner:
|
|
589
|
-
- Fixable by code? → fixOwner: "developer"
|
|
590
|
-
- Fixable by NetworkPolicy/firewall/K8s config? → fixOwner: "devops"
|
|
591
|
-
- Needs architecture redesign? → fixOwner: "architect"
|
|
592
|
-
|
|
593
|
-
KUBERNETES/INFRASTRUCTURE:
|
|
594
|
-
- Missing NetworkPolicies for namespace isolation
|
|
595
|
-
- Services using ClusterIP that should be internal
|
|
596
|
-
- LoadBalancer exposing internal services
|
|
597
|
-
- Pod-to-pod communication without restrictions
|
|
598
130
|
|
|
599
|
-
|
|
131
|
+
### Agent 13: PII - PII Scanner
|
|
600
132
|
```
|
|
601
|
-
|
|
602
|
-
|
|
133
|
+
Scan for: PII in logs, PII in URLs, unencrypted PII, missing GDPR controls.
|
|
134
|
+
Write to .coverme/agents/PII.json
|
|
135
|
+
Return ONLY: "done" or "skipped"
|
|
603
136
|
```
|
|
604
|
-
Scan for intentional design decisions that might look like bugs.
|
|
605
|
-
|
|
606
|
-
GOAL: Prevent false positives by identifying documented/intentional patterns
|
|
607
|
-
|
|
608
|
-
DOCUMENTED DECISIONS:
|
|
609
|
-
- Comments explaining WHY something is done a certain way
|
|
610
|
-
- README/docs explaining architecture choices
|
|
611
|
-
- ADR (Architecture Decision Records) files
|
|
612
|
-
|
|
613
|
-
CODE PATTERNS THAT ARE NOT BUGS:
|
|
614
|
-
- // Intentional: .... or // Design decision: ...
|
|
615
|
-
- // SECURITY: This is safe because...
|
|
616
|
-
- Feature flags controlling security features with documentation
|
|
617
|
-
|
|
618
|
-
FOR EACH PATTERN FOUND, output:
|
|
619
|
-
{
|
|
620
|
-
"id": "DESIGN-001",
|
|
621
|
-
"type": "documented_decision",
|
|
622
|
-
"title": "Content filtering disabled",
|
|
623
|
-
"file": "src/ai/chat.ts",
|
|
624
|
-
"line": 45,
|
|
625
|
-
"reason": "Documented in code comment",
|
|
626
|
-
"relatedFindings": ["AI-001"],
|
|
627
|
-
"recommendation": "Not a bug - document as accepted risk"
|
|
628
|
-
}
|
|
629
137
|
|
|
630
|
-
|
|
138
|
+
### Agent 14: DEAD - Dead Code
|
|
631
139
|
```
|
|
632
|
-
|
|
633
|
-
|
|
140
|
+
Scan for: Unused functions, unused deps, commented code, TODO/FIXME.
|
|
141
|
+
Write to .coverme/agents/DEAD.json
|
|
142
|
+
Return ONLY: "done" or "skipped"
|
|
634
143
|
```
|
|
635
|
-
Scan to understand the CONTEXT of each potential finding.
|
|
636
|
-
|
|
637
|
-
GOAL: Reduce false positives by understanding deployment context
|
|
638
|
-
|
|
639
|
-
FOR EACH FINDING FROM OTHER AGENTS, determine:
|
|
640
|
-
|
|
641
|
-
DEPLOYMENT CONTEXT:
|
|
642
|
-
- Is this code running in a container with network isolation?
|
|
643
|
-
- Is this behind an API gateway that handles auth?
|
|
644
|
-
- Is this internal-only service behind VPN?
|
|
645
144
|
|
|
646
|
-
|
|
647
|
-
- Is this code path actually reachable in production?
|
|
648
|
-
- Is this only used in development/testing?
|
|
649
|
-
- Is this protected by feature flag that's disabled?
|
|
650
|
-
|
|
651
|
-
DATA FLOW CONTEXT:
|
|
652
|
-
- Is the input already validated upstream?
|
|
653
|
-
- Is there middleware that applies to this route?
|
|
654
|
-
|
|
655
|
-
OUTPUT:
|
|
656
|
-
{
|
|
657
|
-
"findingId": "SEC-001",
|
|
658
|
-
"contextAnalysis": {
|
|
659
|
-
"deploymentContext": "Runs in K8s with NetworkPolicy",
|
|
660
|
-
"runtimeContext": "Only reachable from internal services",
|
|
661
|
-
"verdict": "false_positive|confirmed|needs_review",
|
|
662
|
-
"reason": "Protected by network policy"
|
|
663
|
-
}
|
|
664
|
-
}
|
|
145
|
+
### Agent 15: DB - Database Security
|
|
665
146
|
```
|
|
666
|
-
|
|
667
|
-
|
|
147
|
+
Scan for: SQL injection, NoSQL injection, missing RLS, exposed connections.
|
|
148
|
+
Write to .coverme/agents/DB.json
|
|
149
|
+
Return ONLY: "done" or "skipped"
|
|
668
150
|
```
|
|
669
|
-
CONDITIONAL: First detect if this project uses enclaves/TEE:
|
|
670
|
-
grep -r -l "enclave\|nitro\|sgx\|tee\|attestation\|trusted.compute\|confidential.computing\|vsock" --include="*.ts" --include="*.js" --include="*.py" --include="*.yaml" --include="*.yml" .
|
|
671
151
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
ENCLAVE REGISTRATION:
|
|
675
|
-
- Enclave-to-backend registration without attestation
|
|
676
|
-
- IP-based trust without cryptographic verification
|
|
677
|
-
- Enclave secrets transmitted without encryption
|
|
678
|
-
|
|
679
|
-
Output JSON: [{id: "ENC-XXX", ...full format with DREAD}]
|
|
152
|
+
### Agent 16: ARCH - Architecture
|
|
680
153
|
```
|
|
681
|
-
|
|
682
|
-
|
|
154
|
+
Scan for: Internal endpoints exposed, missing mTLS, network issues.
|
|
155
|
+
Write to .coverme/agents/ARCH.json
|
|
156
|
+
Return ONLY: "done" or "skipped"
|
|
683
157
|
```
|
|
684
|
-
After all other agents complete, generate an executive summary.
|
|
685
158
|
|
|
686
|
-
|
|
687
|
-
{
|
|
688
|
-
"executiveSummary": {
|
|
689
|
-
"headline": "3 Critical + 5 High findings require immediate attention",
|
|
690
|
-
"riskLevel": "HIGH",
|
|
691
|
-
"topRisks": [
|
|
692
|
-
"SQL injection in user search allows database access",
|
|
693
|
-
"Missing rate limiting enables brute force attacks"
|
|
694
|
-
],
|
|
695
|
-
"positives": [
|
|
696
|
-
"Authentication flow is well-implemented",
|
|
697
|
-
"Good use of parameterized queries in core modules"
|
|
698
|
-
],
|
|
699
|
-
"recommendedActions": [
|
|
700
|
-
{
|
|
701
|
-
"priority": 1,
|
|
702
|
-
"action": "Fix SQL injection in src/search.ts",
|
|
703
|
-
"owner": "developer",
|
|
704
|
-
"effort": "1-2 hours"
|
|
705
|
-
}
|
|
706
|
-
],
|
|
707
|
-
"byOwner": {
|
|
708
|
-
"developer": 5,
|
|
709
|
-
"devops": 3,
|
|
710
|
-
"architect": 1
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
}
|
|
159
|
+
### Agent 17: DESIGN - Design Decisions
|
|
714
160
|
```
|
|
715
|
-
|
|
716
|
-
|
|
161
|
+
Find documented design decisions that might look like bugs (intentional patterns).
|
|
162
|
+
Write to .coverme/agents/DESIGN.json
|
|
163
|
+
Return ONLY: "done" or "skipped"
|
|
717
164
|
```
|
|
718
|
-
CRITICAL: Before recommending ANY fix, check if a solution ALREADY EXISTS.
|
|
719
|
-
|
|
720
|
-
For EVERY finding from Phase 1, search the codebase for:
|
|
721
|
-
|
|
722
|
-
1. Existing utilities/helpers:
|
|
723
|
-
- Search for similar function names (sanitize, validate, escape)
|
|
724
|
-
- Check utils/, helpers/, lib/, common/ folders
|
|
725
|
-
|
|
726
|
-
2. Existing patterns:
|
|
727
|
-
- How do OTHER files handle the same issue?
|
|
728
|
-
- Is there a project-wide convention?
|
|
729
|
-
|
|
730
|
-
3. Duplicate findings:
|
|
731
|
-
- Is this the same issue reported multiple times?
|
|
732
|
-
- Are multiple findings actually ONE root cause?
|
|
733
165
|
|
|
734
|
-
|
|
735
|
-
- "EXISTING: Found sanitizeHtml() in src/utils/security.ts - use this"
|
|
736
|
-
- "PATTERN: Other files use zod.string().email() - follow same pattern"
|
|
737
|
-
- "DUPLICATE: Same root cause as SEC-003, fix once in middleware"
|
|
738
|
-
|
|
739
|
-
Output:
|
|
740
|
-
{
|
|
741
|
-
"findingId": "SEC-001",
|
|
742
|
-
"existingSolution": "Found: src/utils/sanitize.ts exports sanitizeUserInput()",
|
|
743
|
-
"duplicateOf": null,
|
|
744
|
-
"suggestedApproach": "Import and use existing function"
|
|
745
|
-
}
|
|
166
|
+
### Agent 18: CTX - Context Validator
|
|
746
167
|
```
|
|
747
|
-
|
|
748
|
-
|
|
168
|
+
For critical findings from other agents, check deployment context.
|
|
169
|
+
Write to .coverme/agents/CTX.json
|
|
170
|
+
Return ONLY: "done" or "skipped"
|
|
749
171
|
```
|
|
750
|
-
CONDITIONAL: Only runs if SSH is configured in Phase 0 runtime.json.
|
|
751
|
-
|
|
752
|
-
IF NO runtime.json → Skip this agent entirely
|
|
753
|
-
|
|
754
|
-
PURPOSE: Find dangerous mismatches between code configuration and actual runtime.
|
|
755
172
|
|
|
756
|
-
|
|
757
|
-
grep -E "^USER|^EXPOSE|^ENV" Dockerfile 2>/dev/null
|
|
758
|
-
grep -E "runAsUser|runAsNonRoot|readOnlyRootFilesystem" k8s/*.yaml 2>/dev/null
|
|
759
|
-
|
|
760
|
-
STEP 2: SSH and Check Actual Runtime
|
|
761
|
-
ssh user@server "docker ps -q | head -1 | xargs -I {} docker exec {} id"
|
|
762
|
-
ssh user@server "kubectl get pods -o name | head -1 | xargs -I {} kubectl exec {} -- id"
|
|
763
|
-
|
|
764
|
-
STEP 3: Compare and Generate Findings
|
|
765
|
-
|
|
766
|
-
| Mismatch | Severity |
|
|
767
|
-
|----------|----------|
|
|
768
|
-
| Code says non-root, runs as root | CRITICAL |
|
|
769
|
-
| Dockerfile USER ignored | CRITICAL |
|
|
770
|
-
| ReadOnlyRootFilesystem not enforced | HIGH |
|
|
771
|
-
| Unexpected ports exposed | MEDIUM |
|
|
772
|
-
|
|
773
|
-
Output JSON: [{id: "RUNTIME-XXX", expected: {...}, actual: {...}, ...full format}]
|
|
173
|
+
### Agent 19: ENC - Enclave Security
|
|
774
174
|
```
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
Wait for all Phase 1 background agents to complete using `AgentOutputTool`.
|
|
781
|
-
|
|
782
|
-
### Validator M: Mitigation Hunter
|
|
783
|
-
|
|
784
|
-
For EVERY finding, search the codebase for mitigations:
|
|
785
|
-
|
|
786
|
-
1. **Input Validation** - Is input sanitized before reaching the vulnerable sink?
|
|
787
|
-
2. **Middleware Protection** - Is there middleware that protects this route?
|
|
788
|
-
3. **Framework Auto-Protection** - Does the framework handle this automatically?
|
|
789
|
-
4. **Route Protection** - Is the endpoint protected by auth/authorization?
|
|
790
|
-
|
|
791
|
-
Output Per Finding:
|
|
792
|
-
```json
|
|
793
|
-
{
|
|
794
|
-
"findingId": "SEC-001",
|
|
795
|
-
"verdict": "mitigated|partial|confirmed|false_positive",
|
|
796
|
-
"mitigationType": "input_validation|middleware|framework|config|none",
|
|
797
|
-
"evidence": ["Found Zod validation at src/routes/user.ts:23"],
|
|
798
|
-
"adjustedSeverity": "low"
|
|
799
|
-
}
|
|
175
|
+
FIRST: Check if enclave/TEE code exists.
|
|
176
|
+
If not: Write {"skipped":true} and return "skipped"
|
|
177
|
+
If yes: Scan for attestation issues.
|
|
178
|
+
Write to .coverme/agents/ENC.json
|
|
179
|
+
Return ONLY: "done" or "skipped"
|
|
800
180
|
```
|
|
801
181
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
### Validator A: False Positive Hunter
|
|
809
|
-
Review ALL findings. For each finding:
|
|
810
|
-
1. Read the actual code file
|
|
811
|
-
2. Check if there are mitigating controls elsewhere
|
|
812
|
-
3. For secrets: run "git ls-files <file>" - if not tracked, mark FALSE POSITIVE
|
|
813
|
-
4. Check if code is actually reachable in production
|
|
814
|
-
|
|
815
|
-
Output: { confirmed: ["SEC-001",...], falsePositives: [{id, reason},...] }
|
|
816
|
-
|
|
817
|
-
### Validator B: Evidence Challenger
|
|
818
|
-
Challenge every HIGH and CRITICAL finding:
|
|
819
|
-
1. Read the actual code with 20 lines of context
|
|
820
|
-
2. Trace data flow from source to sink
|
|
821
|
-
3. Check for sanitization/validation in between
|
|
822
|
-
4. Verify the exploit scenario is realistic
|
|
823
|
-
|
|
824
|
-
Output: { confirmed: ["SEC-001",...], falsePositives: [{id, reason},...] }
|
|
182
|
+
### Agent 20: EXEC - Executive Summary
|
|
183
|
+
```
|
|
184
|
+
After scanning, generate executive summary with top risks and positives.
|
|
185
|
+
Write to .coverme/agents/EXEC.json
|
|
186
|
+
Return ONLY: "done"
|
|
187
|
+
```
|
|
825
188
|
|
|
826
|
-
###
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
189
|
+
### Agent 21: DUP - Duplicate Finder
|
|
190
|
+
```
|
|
191
|
+
Find existing solutions in codebase that could fix other findings.
|
|
192
|
+
Write to .coverme/agents/DUP.json
|
|
193
|
+
Return ONLY: "done" or "skipped"
|
|
194
|
+
```
|
|
831
195
|
|
|
832
|
-
|
|
196
|
+
### Agent 22: POSITIVE - Good Patterns
|
|
197
|
+
```
|
|
198
|
+
Find positive security patterns and good practices in the codebase.
|
|
199
|
+
Write to .coverme/agents/POSITIVE.json
|
|
200
|
+
Return ONLY: "done"
|
|
201
|
+
```
|
|
833
202
|
|
|
834
203
|
---
|
|
835
204
|
|
|
836
|
-
## Phase
|
|
837
|
-
|
|
838
|
-
Wait for all Phase 3 background validators to complete using `AgentOutputTool`.
|
|
205
|
+
## Phase 2: Wait for Agents
|
|
839
206
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
2. Remove findings with confidence < 50%
|
|
843
|
-
3. Add missed issues from Validator C
|
|
844
|
-
4. Remove mitigated and false positive findings
|
|
845
|
-
5. Identify positive observations (good patterns found)
|
|
207
|
+
Wait for ALL background agents using `AgentOutputTool`.
|
|
208
|
+
Each should return only "done" or "skipped".
|
|
846
209
|
|
|
847
210
|
---
|
|
848
211
|
|
|
849
|
-
## Phase
|
|
850
|
-
|
|
851
|
-
**DO NOT ASK - JUST OVERWRITE THE FILE!**
|
|
852
|
-
|
|
853
|
-
Update `.coverme/scan.json` with the full scan results including:
|
|
212
|
+
## Phase 3: Aggregate Results
|
|
854
213
|
|
|
855
|
-
|
|
856
|
-
- **projectName**: from package.json or folder name
|
|
857
|
-
- **scanDate**: today's date
|
|
858
|
-
- **filesScanned**: count of source files analyzed
|
|
859
|
-
- **linesOfCode**: total lines in source files
|
|
860
|
-
- **projectTree**: ASCII tree of main directories
|
|
861
|
-
|
|
862
|
-
### projectOverview:
|
|
863
|
-
```json
|
|
864
|
-
{
|
|
865
|
-
"name": "project-name",
|
|
866
|
-
"type": "Backend API | Frontend SPA | Full-stack | CLI | Library",
|
|
867
|
-
"stack": ["Node.js", "TypeScript", "React", "PostgreSQL"],
|
|
868
|
-
"purpose": "Brief description of what this project does",
|
|
869
|
-
"architecture": "Monolith | Microservices | Serverless",
|
|
870
|
-
"keyComponents": ["auth service", "payment processing", "AI chat"]
|
|
871
|
-
}
|
|
872
|
-
```
|
|
214
|
+
Read all agent files and merge:
|
|
873
215
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
"components": [
|
|
878
|
-
{"name": "API Server", "type": "service", "description": "Express.js REST API", "trustLevel": "semi-trusted"},
|
|
879
|
-
{"name": "PostgreSQL", "type": "database", "description": "Primary data store", "trustLevel": "trusted"}
|
|
880
|
-
],
|
|
881
|
-
"trustBoundaries": [
|
|
882
|
-
{"name": "Client to API", "from": "Browser", "to": "API Server", "protocol": "HTTPS"}
|
|
883
|
-
],
|
|
884
|
-
"criticalAssets": [
|
|
885
|
-
{"name": "User Credentials", "type": "credential", "location": "PostgreSQL", "protection": "bcrypt hashed"}
|
|
886
|
-
],
|
|
887
|
-
"dataFlows": ["User Authentication Flow", "Payment Processing Flow"]
|
|
888
|
-
}
|
|
889
|
-
```
|
|
890
|
-
|
|
891
|
-
### executiveSummary:
|
|
892
|
-
```json
|
|
893
|
-
{
|
|
894
|
-
"headline": "3 Critical + 5 High findings require immediate attention",
|
|
895
|
-
"riskLevel": "CRITICAL | HIGH | MEDIUM | LOW",
|
|
896
|
-
"topRisks": ["SQL injection in user search", "Missing rate limiting"],
|
|
897
|
-
"positives": ["Good authentication flow", "Proper input validation"],
|
|
898
|
-
"recommendedActions": [
|
|
899
|
-
{"priority": 1, "action": "Fix SQL injection", "owner": "developer", "effort": "1-2 hours"}
|
|
900
|
-
],
|
|
901
|
-
"byOwner": {"developer": 5, "devops": 3, "architect": 1}
|
|
902
|
-
}
|
|
216
|
+
```bash
|
|
217
|
+
echo "Aggregating results..."
|
|
218
|
+
ls -la .coverme/agents/
|
|
903
219
|
```
|
|
904
220
|
|
|
905
|
-
|
|
906
|
-
```json
|
|
907
|
-
[
|
|
908
|
-
{
|
|
909
|
-
"id": "T-001",
|
|
910
|
-
"threat": "SQL Injection via user input",
|
|
911
|
-
"category": "STRIDE",
|
|
912
|
-
"strideType": "T",
|
|
913
|
-
"status": "open | partial | mitigated",
|
|
914
|
-
"relatedFindings": ["SEC-001", "DB-002"],
|
|
915
|
-
"mitigation": "Use parameterized queries",
|
|
916
|
-
"dreadScore": 8.5
|
|
917
|
-
}
|
|
918
|
-
]
|
|
919
|
-
```
|
|
920
|
-
|
|
921
|
-
### qualityReview:
|
|
922
|
-
```json
|
|
923
|
-
{
|
|
924
|
-
"deleteItems": [
|
|
925
|
-
{"type": "delete", "file": "src/utils/oldHelpers.ts", "lines": 250, "description": "Dead code", "reason": "No imports found"}
|
|
926
|
-
],
|
|
927
|
-
"mergeItems": [
|
|
928
|
-
{"type": "merge", "file": "src/utils/validate.ts, src/helpers/validation.ts", "description": "Overlapping functions", "reason": "DRY violation"}
|
|
929
|
-
],
|
|
930
|
-
"simplifyItems": [
|
|
931
|
-
{"type": "simplify", "file": "src/services/payment.ts", "lines": 450, "description": "Overly complex", "reason": "Can be reduced"}
|
|
932
|
-
],
|
|
933
|
-
"totalLinesRemovable": 680,
|
|
934
|
-
"percentageOfCodebase": 4.2
|
|
935
|
-
}
|
|
936
|
-
```
|
|
221
|
+
Use the Read tool to read each `.coverme/agents/*.json` file.
|
|
937
222
|
|
|
938
|
-
|
|
939
|
-
```json
|
|
940
|
-
[
|
|
941
|
-
{
|
|
942
|
-
"id": "A-001",
|
|
943
|
-
"title": "Fix SQL injection in user search",
|
|
944
|
-
"priority": "immediate | high | medium | long-term",
|
|
945
|
-
"relatedFindings": ["SEC-001"],
|
|
946
|
-
"effort": "low | medium | high",
|
|
947
|
-
"description": "Replace string concatenation with parameterized query"
|
|
948
|
-
}
|
|
949
|
-
]
|
|
950
|
-
```
|
|
951
|
-
|
|
952
|
-
### findings:
|
|
953
|
-
Each finding MUST include ALL these fields:
|
|
223
|
+
Merge all findings into `.coverme/scan.json`:
|
|
954
224
|
```json
|
|
955
225
|
{
|
|
956
|
-
"
|
|
957
|
-
"
|
|
958
|
-
"
|
|
959
|
-
"
|
|
960
|
-
"
|
|
961
|
-
"
|
|
962
|
-
"
|
|
963
|
-
"description": "User search parameter directly concatenated into SQL query",
|
|
964
|
-
"impact": "Attacker can extract entire database contents",
|
|
965
|
-
"attackChain": [
|
|
966
|
-
{"step": 1, "action": "Send malicious search term", "result": "Query returns all users"},
|
|
967
|
-
{"step": 2, "action": "Use UNION SELECT", "result": "Database schema exposed"}
|
|
968
|
-
],
|
|
969
|
-
"recommendation": "Use parameterized queries",
|
|
970
|
-
"cwe": "CWE-89",
|
|
971
|
-
"owasp": "A03:2021",
|
|
972
|
-
"dread": {
|
|
973
|
-
"damage": 10,
|
|
974
|
-
"reproducibility": 10,
|
|
975
|
-
"exploitability": 9,
|
|
976
|
-
"affectedUsers": 10,
|
|
977
|
-
"discoverability": 8,
|
|
978
|
-
"total": 9.4
|
|
979
|
-
},
|
|
980
|
-
"status": "open",
|
|
981
|
-
"confidence": 95,
|
|
982
|
-
"fixOwner": "developer | devops | architect",
|
|
983
|
-
"fixType": "code | config | infrastructure | design"
|
|
226
|
+
"projectName": "...",
|
|
227
|
+
"scanDate": "...",
|
|
228
|
+
"filesScanned": N,
|
|
229
|
+
"linesOfCode": N,
|
|
230
|
+
"findings": [...all from agent files...],
|
|
231
|
+
"positiveObservations": [...from POSITIVE.json...],
|
|
232
|
+
"summary": {"critical":N,"high":N,"medium":N,"low":N}
|
|
984
233
|
}
|
|
985
234
|
```
|
|
986
235
|
|
|
987
|
-
### Other sections:
|
|
988
|
-
- **designDecisions**: Intentional patterns that look like bugs
|
|
989
|
-
- **mitigatedFindings**: Findings with existing protection
|
|
990
|
-
- **falsePositives**: Findings that are not actually vulnerabilities
|
|
991
|
-
- **positiveObservations**: Good practices found
|
|
992
|
-
- **validationSummary**: Stats on mitigation validation
|
|
993
|
-
- **summary**: Total counts by severity
|
|
994
|
-
- **agentsUsed**: List of agents that ran
|
|
995
|
-
- **scanDuration**: Time taken in ms
|
|
996
|
-
|
|
997
|
-
Use the Write tool to overwrite `.coverme/scan.json` with the results.
|
|
998
|
-
|
|
999
236
|
---
|
|
1000
237
|
|
|
1001
|
-
## Phase
|
|
1002
|
-
|
|
1003
|
-
**DO NOT ASK - JUST RUN THE COMMANDS!**
|
|
238
|
+
## Phase 4: Generate Report
|
|
1004
239
|
|
|
1005
|
-
Generate the HTML report and open it automatically:
|
|
1006
240
|
```bash
|
|
1007
241
|
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
|
|
1008
242
|
npx coverme-scanner report .coverme/scan.json -f html -o ".coverme/report_$TIMESTAMP.html"
|
|
1009
|
-
cp .coverme/scan.json ".coverme/scan_$TIMESTAMP.json"
|
|
1010
243
|
open ".coverme/report_$TIMESTAMP.html"
|
|
1011
244
|
```
|
|
1012
245
|
|
|
1013
|
-
Run these commands without asking for permission.
|
|
1014
|
-
|
|
1015
246
|
---
|
|
1016
247
|
|
|
1017
248
|
## DONE
|
|
1018
249
|
|
|
1019
|
-
Tell
|
|
1020
|
-
|
|
1021
|
-
**REMINDER: You should have completed all 6 phases without asking ANY questions or stopping for confirmation.**
|
|
250
|
+
Tell user: "Scan complete! Report opened."
|