@agenticcli/shipguard 0.5.0 → 0.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.
@@ -0,0 +1,1307 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "description": "Offline free rule bundle compiled from rule-corpus/*/rule.yaml where bundleEligible=true and enabled=true. Governed by rules.md §4/§5/§9. Generated by scripts/build-free-bundle.ts — never hand-edited.",
4
+ "corpusVersion": 17,
5
+ "corpusHash": "sha256:9092293614f1346c3eb5081d345126090393979296d6ea35688c42d7da3dc55d",
6
+ "ruleCount": 30,
7
+ "contentHash": "sha256:058228a9d82ff3c4fcdc1039c453855cdc5dac28841ab9b2e44268e680498d95",
8
+ "rules": [
9
+ {
10
+ "id": "generic.auth.jwt-none-algorithm",
11
+ "framework": [
12
+ "generic"
13
+ ],
14
+ "category": "auth",
15
+ "tier": "free",
16
+ "severity": "critical",
17
+ "confidence": "HIGH",
18
+ "action": "block",
19
+ "version": 3,
20
+ "status": "experimental",
21
+ "cwe": [
22
+ "CWE-347"
23
+ ],
24
+ "owasp": [
25
+ "A02:2021"
26
+ ],
27
+ "matcher": {
28
+ "type": "pattern",
29
+ "fileGlob": "**/*.{ts,js,tsx,jsx}",
30
+ "patterns": [
31
+ "algorithm[s]?\\s*[=:]\\s*['\"]none['\"]",
32
+ "algorithms\\s*[=:]\\s*\\[['\"]\\s*none\\s*['\"]",
33
+ "algorithms\\s*[=:]\\s*\\[\\s*['\"]\\w{2,10}['\"]\\s*,\\s*['\"]none['\"]",
34
+ "verify\\s*\\([^)]{0,40},\\s*['\"]['\"]\\s*[,)]"
35
+ ],
36
+ "antiPatterns": [
37
+ "test|spec|\\.mock\\.",
38
+ "//\\s*disable"
39
+ ],
40
+ "flags": "i",
41
+ "antiPatternScope": {
42
+ "lines": 3
43
+ }
44
+ },
45
+ "explanation": "JWT verification accepts the \"none\" algorithm, allowing attackers to forge tokens by stripping the signature. This is a critical authentication bypass.",
46
+ "recommendation": "Explicitly allowlist accepted algorithms (e.g., [\"HS256\", \"RS256\"]) when calling jwt.verify(). Never accept an empty string or array as a valid secret.",
47
+ "fix": "Pass `algorithms: [\"HS256\"]` to `jwt.verify()` and never accept an empty secret.",
48
+ "findingType": "vulnerability",
49
+ "aiCodeTarget": true
50
+ },
51
+ {
52
+ "id": "generic.config.debug-endpoint-env-dump",
53
+ "framework": [
54
+ "generic"
55
+ ],
56
+ "category": "config",
57
+ "tier": "free",
58
+ "severity": "critical",
59
+ "confidence": "HIGH",
60
+ "action": "block",
61
+ "version": 1,
62
+ "status": "experimental",
63
+ "cwe": [
64
+ "CWE-215",
65
+ "CWE-200"
66
+ ],
67
+ "owasp": [
68
+ "A05:2021"
69
+ ],
70
+ "matcher": {
71
+ "type": "pattern",
72
+ "fileGlob": "**/*.{ts,js,tsx,jsx,mjs,cjs,py}",
73
+ "patterns": [
74
+ "res\\.(?:json|send|write|end)\\([^\\n;)]{0,30}process\\.env[^.\\w]",
75
+ "Response\\.json\\([^\\n;)]{0,30}process\\.env[^.\\w]",
76
+ "jsonify\\([^\\n;)]{0,16}os\\.environ[^.\\w]",
77
+ "return[ \\t]dict\\(os\\.environ\\)"
78
+ ],
79
+ "antiPatterns": [
80
+ "\\.test\\.|\\bspec\\b|__tests__|__fixtures__|__mocks__",
81
+ "eslint-disable|shipguard-ignore"
82
+ ],
83
+ "flags": ""
84
+ },
85
+ "explanation": "An HTTP handler returns the whole environment object (process.env / os.environ) in its response body. Every secret the process holds — API keys, database URLs, signing keys, cloud credentials — is handed to anyone who can reach the route. This is the classic \"one quick debug endpoint to inspect config\" that an AI coding agent adds mid-session and nobody removes; it needs no authentication bypass and no exploit, only the URL. Unlike a debug FLAG left on, this is a live exfiltration sink in the response body itself.",
86
+ "recommendation": "Delete the endpoint. If you genuinely need runtime introspection, return a hand-picked allowlist of non-secret keys (for example only NODE_ENV and a build id), never the environment object, and put the route behind an authentication and authorization check.",
87
+ "fix": "Remove the endpoint, or replace `process.env` with an explicit allowlist such as `{ nodeEnv: process.env.NODE_ENV }`.",
88
+ "findingType": "vulnerability",
89
+ "aiCodeTarget": true,
90
+ "references": [
91
+ "https://cwe.mitre.org/data/definitions/215.html",
92
+ "https://cwe.mitre.org/data/definitions/200.html"
93
+ ]
94
+ },
95
+ {
96
+ "id": "generic.config.debug-mode-enabled",
97
+ "framework": [
98
+ "generic"
99
+ ],
100
+ "category": "config",
101
+ "tier": "free",
102
+ "severity": "medium",
103
+ "confidence": "MEDIUM",
104
+ "action": "warn",
105
+ "version": 3,
106
+ "status": "experimental",
107
+ "cwe": [
108
+ "CWE-489",
109
+ "CWE-215"
110
+ ],
111
+ "owasp": [
112
+ "A05:2021"
113
+ ],
114
+ "matcher": {
115
+ "type": "pattern",
116
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,rb,php,go,env,yaml,yml,conf,ini,toml,json}",
117
+ "patterns": [
118
+ "DEBUG\\s*=\\s*(True|true|1|\"true\"|'true')",
119
+ "debug\\s*:\\s*true",
120
+ "FLASK_DEBUG\\s*=\\s*1",
121
+ "display_errors\\s*=\\s*On"
122
+ ],
123
+ "antiPatterns": [
124
+ "\\.env\\.development|\\.env\\.local|\\.env\\.test|test_settings|dev\\.config",
125
+ "\\.test\\.|\\bspec\\b|__tests__|__fixtures__",
126
+ "dev only|development only"
127
+ ],
128
+ "flags": "i"
129
+ },
130
+ "explanation": "Debug mode is enabled in application configuration. Debug mode typically enables verbose error pages with stack traces, environment details, and internal paths visible to end users. This information aids attackers in understanding the application internals and finding exploitable weaknesses.",
131
+ "recommendation": "Set DEBUG=False (or equivalent) for production deployments. Use environment variables to control debug settings so they differ between development and production. Ensure production config files never contain debug=true.",
132
+ "fix": "Set `DEBUG=False` in production config. Use `NODE_ENV=production` to disable debug output automatically.",
133
+ "findingType": "vulnerability",
134
+ "aiCodeTarget": true,
135
+ "references": [
136
+ "https://cwe.mitre.org/data/definitions/489.html",
137
+ "https://cwe.mitre.org/data/definitions/215.html"
138
+ ]
139
+ },
140
+ {
141
+ "id": "generic.cors.reflected-origin",
142
+ "framework": [
143
+ "generic"
144
+ ],
145
+ "category": "deployment",
146
+ "tier": "free",
147
+ "severity": "high",
148
+ "confidence": "MEDIUM",
149
+ "action": "warn",
150
+ "version": 4,
151
+ "status": "experimental",
152
+ "cwe": [
153
+ "CWE-942",
154
+ "CWE-346"
155
+ ],
156
+ "owasp": [
157
+ "A05:2021"
158
+ ],
159
+ "matcher": {
160
+ "type": "pattern",
161
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go}",
162
+ "patterns": [
163
+ "Access-Control-Allow-Origin[^\\n]{0,40}req\\.(headers|get)\\s*\\(\\s*['\"]origin['\"]",
164
+ "setHeader\\s*\\(\\s*['\"]Access-Control-Allow-Origin['\"]\\s*,[^\\n]{0,60}origin",
165
+ "res\\.header\\s*\\(\\s*['\"]Access-Control-Allow-Origin['\"]\\s*,[^\\n]{0,60}req\\.headers\\.origin",
166
+ "response\\.setHeader\\s*\\(\\s*['\"]Access-Control-Allow-Origin['\"]\\s*,[^\\n]{0,60}request\\.headers"
167
+ ],
168
+ "antiPatterns": [
169
+ "\\btest\\b|\\bspec\\b|__tests__|__fixtures__",
170
+ "allowedOrigins|allowList|whitelist|validOrigins",
171
+ "includes\\s*\\(|indexOf\\s*\\(|has\\s*\\(|===|\\.test\\s*\\(|switch\\s*\\("
172
+ ],
173
+ "flags": "",
174
+ "antiPatternScope": "block"
175
+ },
176
+ "explanation": "The server reflects the incoming Origin request header back into Access-Control-Allow-Origin without validating it against an allowlist. This is more dangerous than a static wildcard: any attacker-controlled origin can read authenticated API responses. CVE-2024-25124 (CVSS 9.8) in the Fiber Go framework exploited exactly this pattern, granting any origin full credentialed access to protected endpoints (CWE-942, CWE-346).\nv4 (task #27 triage, rule-corpus/triage/2026-07-15-absence-block-candidates.md #5): downgraded HIGH/block -> MEDIUM/warn. FOUNDER-FYI: this rule ships in the offline FREE/bundled tier (tier: free, bundleEligible: true), so this downgrade reaches every CLI user, logged in or not — a wider blast radius than the Pro-only rules in this same wave. The sink itself is precise (reflecting req.headers.origin into Access-Control-Allow-Origin IS the specific dangerous act, not an over-broad capture) — the false positives come from the antiPattern vocabulary being too narrow: origin validation written as `const allowed = origin === 'https://example.com'; if (allowed) ...` (variable named \"allowed\", comparison via ===, not includes()/allowList) or `/^https:\\/\\/(www\\.)?example\\.com$/.test(req.headers.origin)` (.test(), not in the antiPattern vocabulary either) are both common, correct validation idioms this rule's fixed vocabulary did not recognize. Expanded the antiPattern vocabulary to also cover ===, .test(, and switch( as a complementary fix, and downgraded to warn because the underlying gap (an unbounded set of ways to write \"compare against an allowlist\") cannot be fully enumerated by any fixed vocabulary — per rule-corpus/rule-logic.md Section 4, a rule with a residual absence-style blind spot is capped at warn, never block, regardless of confidence.",
177
+ "recommendation": "Validate the incoming Origin header against a server-side allowlist before reflecting it. Store allowed origins in an environment variable (ALLOWED_ORIGINS) and check membership before setting Access-Control-Allow-Origin. Never reflect req.headers.origin directly.",
178
+ "fix": "const allowed = (process.env.ALLOWED_ORIGINS || '').split(','); if (allowed.includes(req.headers.origin)) res.setHeader('Access-Control-Allow-Origin', req.headers.origin);",
179
+ "findingType": "vulnerability",
180
+ "aiCodeTarget": true,
181
+ "references": [
182
+ "https://nvd.nist.gov/vuln/detail/CVE-2024-25124",
183
+ "https://cwe.mitre.org/data/definitions/942.html",
184
+ "https://cwe.mitre.org/data/definitions/346.html"
185
+ ]
186
+ },
187
+ {
188
+ "id": "generic.cors.wildcard-origin",
189
+ "framework": [
190
+ "generic"
191
+ ],
192
+ "category": "deployment",
193
+ "tier": "free",
194
+ "severity": "high",
195
+ "confidence": "MEDIUM",
196
+ "action": "warn",
197
+ "version": 4,
198
+ "status": "experimental",
199
+ "cwe": [
200
+ "CWE-942"
201
+ ],
202
+ "owasp": [
203
+ "A05:2021"
204
+ ],
205
+ "matcher": {
206
+ "type": "pattern",
207
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,rb,java,yaml,yml,conf}",
208
+ "patterns": [
209
+ "Access-Control-Allow-Origin['\",:\\s]+[*]",
210
+ "(setHeader|header|res\\.set)\\s*\\(\\s*['\"]Access-Control-Allow-Origin['\"]\\s*,\\s*['\"][*]['\"]",
211
+ "cors\\s*\\(\\s*\\{\\s*origin\\s*:\\s*['\"][*]['\"]",
212
+ "allow_origins\\s*=\\s*\\[\\s*['\"][*]['\"]"
213
+ ],
214
+ "antiPatterns": [
215
+ "\\btest\\b|\\bspec\\b|__fixtures__|__tests__",
216
+ "static|assets|cdn|fonts|images|public-api|intentional-wildcard"
217
+ ],
218
+ "flags": ""
219
+ },
220
+ "explanation": "A wildcard CORS origin (Access-Control-Allow-Origin: *) was detected. For API endpoints returning user data, this allows any origin on the internet to read responses. Combined with credentials: 'include', wildcard origins are rejected by browsers — but without credentials, sensitive data is still exposed to cross-origin requests from attacker-controlled pages.\nv4 (founder ruling 2026-08-08, batch item 11): upgraded MEDIUM -> HIGH. This closes a severity disagreement the CLI's own dedup logic had been surfacing since it shipped (packages/cli/src/core/legacy-corpus-map.ts, `dedupeLegacyAgainstCorpus` doc comment): the legacy hand-written deployment check already rates the same wildcard-CORS defect `high` (packages/cli/src/checks/deployment.ts, `deployment_cors_wildcard` / `deployment_config_cors_wildcard_origin`) and dedup kept both findings because it can never silently soften a report. Canonical ruling: CORS misconfiguration is HIGH severity — nothing about the detection pattern, confidence, or action (warn) changed, only the severity label.",
221
+ "recommendation": "Replace the wildcard with an explicit allowlist of trusted origins. Use environment variables for origin configuration (ALLOWED_ORIGINS) so production and development settings can differ. Audit whether this endpoint requires CORS at all.",
222
+ "fix": "Replace `'*'` with `process.env.ALLOWED_ORIGIN` and validate against an allowlist.",
223
+ "findingType": "vulnerability",
224
+ "aiCodeTarget": true,
225
+ "references": [
226
+ "https://cwe.mitre.org/data/definitions/942.html"
227
+ ]
228
+ },
229
+ {
230
+ "id": "generic.crypto.aes-ecb-mode",
231
+ "framework": [
232
+ "generic"
233
+ ],
234
+ "category": "crypto",
235
+ "tier": "free",
236
+ "severity": "high",
237
+ "confidence": "HIGH",
238
+ "action": "block",
239
+ "version": 3,
240
+ "status": "experimental",
241
+ "cwe": [
242
+ "CWE-327"
243
+ ],
244
+ "owasp": [
245
+ "A02:2021"
246
+ ],
247
+ "matcher": {
248
+ "type": "pattern",
249
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,java,go,rb,cs}",
250
+ "patterns": [
251
+ "AES[-/]ECB",
252
+ "createCipheriv\\s*\\(\\s*['\"]aes-[0-9]+-ecb['\"]",
253
+ "Cipher\\.getInstance\\s*\\(\\s*['\"]AES/ECB",
254
+ "AES\\.new\\s*\\([^,)]{0,60},\\s*AES\\.MODE_ECB"
255
+ ],
256
+ "antiPatterns": [
257
+ "\\btest\\b|\\bspec\\b|__fixtures__|__tests__",
258
+ "nosec|eslint-disable"
259
+ ],
260
+ "flags": "i",
261
+ "antiPatternScope": "statement",
262
+ "boundary": "token"
263
+ },
264
+ "explanation": "AES encryption in ECB (Electronic Code Book) mode was detected. ECB mode encrypts each block independently — identical plaintext blocks produce identical ciphertext. This leaks data patterns (the 'penguin effect') and does not provide semantic security. ECB is universally considered cryptographically broken for data encryption.",
265
+ "recommendation": "Replace ECB mode with an authenticated encryption mode: AES-GCM (preferred) or AES-CBC with a random IV and HMAC authentication. Always include authentication to prevent ciphertext tampering.",
266
+ "fix": "Replace AES-ECB with AES-GCM: `createCipheriv('aes-256-gcm', key, iv)` and store the IV alongside the ciphertext.",
267
+ "findingType": "vulnerability",
268
+ "aiCodeTarget": true,
269
+ "references": [
270
+ "https://cwe.mitre.org/data/definitions/327.html"
271
+ ]
272
+ },
273
+ {
274
+ "id": "generic.crypto.des-rc4-3des",
275
+ "framework": [
276
+ "generic"
277
+ ],
278
+ "category": "crypto",
279
+ "tier": "free",
280
+ "severity": "high",
281
+ "confidence": "HIGH",
282
+ "action": "block",
283
+ "version": 3,
284
+ "status": "experimental",
285
+ "cwe": [
286
+ "CWE-327"
287
+ ],
288
+ "owasp": [
289
+ "A02:2021"
290
+ ],
291
+ "matcher": {
292
+ "type": "pattern",
293
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,java}",
294
+ "patterns": [
295
+ "createCipheriv\\s*\\(\\s*['\"](?:des|3des|des3|rc4|arcfour)['\"]",
296
+ "createCipheriv\\s*\\(\\s*['\"](?:des|3des|des3|rc4|arcfour)-",
297
+ "Cipher\\.getInstance\\s*\\(\\s*['\"](?:DES|DESede|RC4|ARCFOUR)",
298
+ "from Crypto\\.Cipher import (?:DES|DES3|ARC4)",
299
+ "from Cryptodome\\.Cipher import (?:DES|DES3|ARC4)"
300
+ ],
301
+ "antiPatterns": [
302
+ "\\btest\\b|\\bspec\\b|__tests__|__fixtures__",
303
+ "legacy.compat|compat.legacy"
304
+ ],
305
+ "flags": ""
306
+ },
307
+ "explanation": "A deprecated symmetric cipher (DES, Triple-DES/3DES, or RC4) was detected. NIST SP 800-131A Rev.3 (2024 Draft) formally disallows 2-key 3DES (2TDEA) and marks 3TDEA as deprecated. DES has a 56-bit key space brute-forceable in hours with modern hardware. RC4 has known statistical biases exploited in WEP cracking and BEAST/CRIME attacks. These algorithms remain in AI training data from legacy Stack Overflow answers, causing AI tools to reproduce them in new code.",
308
+ "recommendation": "Replace with AES-256-GCM (authenticated encryption). For Node.js: createCipheriv('aes-256-gcm', key, iv). For Python pycryptodome: AES.new(key, AES.MODE_GCM). For Java: Cipher.getInstance('AES/GCM/NoPadding'). AES-GCM provides both confidentiality and integrity.",
309
+ "fix": "Replace DES/3DES/RC4 with AES-256-GCM. Generate a 256-bit key with crypto.randomBytes(32) and a 12-byte IV with crypto.randomBytes(12).",
310
+ "findingType": "vulnerability",
311
+ "aiCodeTarget": true,
312
+ "references": [
313
+ "https://csrc.nist.gov/pubs/sp/800/131/a/r3/ipd",
314
+ "https://cwe.mitre.org/data/definitions/327.html"
315
+ ]
316
+ },
317
+ {
318
+ "id": "generic.crypto.math-random-token",
319
+ "framework": [
320
+ "generic"
321
+ ],
322
+ "category": "crypto",
323
+ "tier": "free",
324
+ "severity": "high",
325
+ "confidence": "HIGH",
326
+ "action": "block",
327
+ "version": 3,
328
+ "status": "experimental",
329
+ "cwe": [
330
+ "CWE-338"
331
+ ],
332
+ "owasp": [
333
+ "A02:2021"
334
+ ],
335
+ "matcher": {
336
+ "type": "pattern",
337
+ "fileGlob": "**/*.{ts,js,tsx,jsx}",
338
+ "patterns": [
339
+ "(token|session|secret|password|nonce|csrf|otp|apiKey|authToken)\\s*=\\s*Math\\.random\\s*\\(",
340
+ "(token|session|secret|password|nonce|csrf|otp|apiKey|authToken)\\s*=\\s*[a-z_]+\\s*\\+\\s*Math\\.random\\s*\\(",
341
+ "Math\\.random\\s*\\(\\s*\\)\\.toString\\s*\\(\\)"
342
+ ],
343
+ "antiPatterns": [
344
+ "\\btest\\b|\\bspec\\b|__fixtures__|jitter|delay|sample|color|position",
345
+ "eslint-disable"
346
+ ],
347
+ "flags": "i"
348
+ },
349
+ "explanation": "Math.random() was detected in a security token or session generation context. Math.random() is a pseudo-random number generator seeded with a predictable internal state — an attacker who can observe a few outputs can predict future values, allowing session hijacking or CSRF token forgery.",
350
+ "recommendation": "Replace with the Web Crypto API: `crypto.randomUUID()` for UUIDs, or `crypto.getRandomValues(new Uint8Array(32))` for raw bytes. In Node.js use `crypto.randomBytes(32)`.",
351
+ "fix": "Replace `Math.random()` with `crypto.randomBytes(32).toString('hex')` for token generation.",
352
+ "findingType": "vulnerability",
353
+ "aiCodeTarget": true,
354
+ "references": [
355
+ "https://cwe.mitre.org/data/definitions/338.html"
356
+ ]
357
+ },
358
+ {
359
+ "id": "generic.crypto.md5-sha1-password-hash",
360
+ "framework": [
361
+ "generic"
362
+ ],
363
+ "category": "crypto",
364
+ "tier": "free",
365
+ "severity": "high",
366
+ "confidence": "HIGH",
367
+ "action": "block",
368
+ "version": 5,
369
+ "status": "experimental",
370
+ "cwe": [
371
+ "CWE-916",
372
+ "CWE-327"
373
+ ],
374
+ "owasp": [
375
+ "A02:2021"
376
+ ],
377
+ "matcher": {
378
+ "type": "pattern",
379
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,rb,go,java,php}",
380
+ "patterns": [
381
+ "hashlib\\.(md5|sha1)\\s{0,8}\\(\\s{0,8}(password|passwd|pwd|secret|credential|raw_password|auth_pass|user_input|new_password|old_password)",
382
+ "(password|passwd|pwd|secret|credential|raw_password|auth_pass|user_input|new_password|old_password)\\s{0,8}=\\s{0,8}hashlib\\.(md5|sha1)\\s{0,8}\\(",
383
+ "createHash\\s{0,8}\\(\\s{0,8}['\"]sha1['\"]\\)\\s{0,8}\\.update\\s{0,8}\\(\\s{0,8}(password|passwd|pwd|secret|credential|raw_password|auth_pass|user_input)",
384
+ "createHash\\s{0,8}\\(\\s{0,8}['\"]md5['\"]\\)\\s{0,8}\\.update\\s{0,8}\\(\\s{0,8}(password|passwd|pwd|secret|credential|raw_password|auth_pass|user_input)"
385
+ ],
386
+ "antiPatterns": [
387
+ "\\btest\\b|\\bspec\\b|__fixtures__|checksum|etag|fingerprint|cache",
388
+ "nosec|eslint-disable"
389
+ ],
390
+ "flags": "i"
391
+ },
392
+ "explanation": "MD5 or SHA-1 was detected in a password hashing context. These algorithms are fast, unkeyed hash functions without work factors — susceptible to GPU-accelerated brute-force attacks and precomputed rainbow tables. Password databases hashed with MD5/SHA1 are regularly cracked within hours.",
393
+ "recommendation": "Replace with a purpose-built password hashing algorithm with a cost factor: bcrypt (cost 12+), scrypt, or Argon2id. Never use general-purpose hash functions for password storage.",
394
+ "fix": "Use bcrypt: `const hash = await bcrypt.hash(password, 12)` or Argon2id via the argon2 package.",
395
+ "findingType": "vulnerability",
396
+ "aiCodeTarget": true,
397
+ "references": [
398
+ "https://cwe.mitre.org/data/definitions/916.html",
399
+ "https://cwe.mitre.org/data/definitions/327.html"
400
+ ]
401
+ },
402
+ {
403
+ "id": "generic.crypto.static-iv",
404
+ "framework": [
405
+ "generic"
406
+ ],
407
+ "category": "crypto",
408
+ "tier": "free",
409
+ "severity": "high",
410
+ "confidence": "MEDIUM",
411
+ "action": "warn",
412
+ "version": 3,
413
+ "status": "experimental",
414
+ "cwe": [
415
+ "CWE-329",
416
+ "CWE-327"
417
+ ],
418
+ "owasp": [
419
+ "A02:2021"
420
+ ],
421
+ "matcher": {
422
+ "type": "pattern",
423
+ "fileGlob": "**/*.{ts,js,tsx,jsx}",
424
+ "patterns": [
425
+ "Buffer\\.alloc\\s*\\(\\s*(?:12|16)\\s*,\\s*0\\s*\\)",
426
+ "Buffer\\.from\\s*\\(\\s*['\"]0{16,32}['\"]\\s*,\\s*['\"]hex['\"]\\s*\\)",
427
+ "const\\s+iv\\s*=\\s*['\"]0{16,32}['\"]"
428
+ ],
429
+ "antiPatterns": [
430
+ "\\btest\\b|\\bspec\\b|__tests__|__fixtures__",
431
+ "crypto\\.randomBytes|randomBytes|randomFill|randomUUID"
432
+ ],
433
+ "flags": ""
434
+ },
435
+ "explanation": "A static or zero-initialized IV (Initialization Vector) was detected. Using a hardcoded or all-zero IV in AES-CBC, AES-GCM, or other IV-dependent modes destroys semantic security: identical plaintext always produces identical ciphertext, enabling pattern recognition. For AES-GCM, reusing a nonce with the same key is catastrophic — it allows recovery of the authentication key. IVs and nonces MUST be generated fresh using a CSPRNG for each encryption operation.",
436
+ "recommendation": "Replace Buffer.alloc(16, 0) with crypto.randomBytes(16) for CBC mode or crypto.randomBytes(12) for GCM mode. Generate a new IV for every encryption call. Store the IV alongside the ciphertext so it is available for decryption without needing to be secret.",
437
+ "fix": "Replace Buffer.alloc(16, 0) with crypto.randomBytes(16). For GCM use crypto.randomBytes(12). Store IV with ciphertext.",
438
+ "findingType": "vulnerability",
439
+ "aiCodeTarget": true,
440
+ "references": [
441
+ "https://cwe.mitre.org/data/definitions/329.html",
442
+ "https://cwe.mitre.org/data/definitions/327.html"
443
+ ]
444
+ },
445
+ {
446
+ "id": "generic.injection.child-process-exec",
447
+ "framework": [
448
+ "generic"
449
+ ],
450
+ "category": "injection",
451
+ "tier": "free",
452
+ "severity": "high",
453
+ "confidence": "MEDIUM",
454
+ "action": "warn",
455
+ "version": 3,
456
+ "status": "experimental",
457
+ "cwe": [
458
+ "CWE-78"
459
+ ],
460
+ "owasp": [
461
+ "A03:2021"
462
+ ],
463
+ "matcher": {
464
+ "type": "pattern",
465
+ "fileGlob": "**/*.{ts,js,tsx,jsx}",
466
+ "patterns": [
467
+ "\\bexec\\s*\\(\\s*[a-zA-Z_$][a-zA-Z0-9_.]*\\s*\\+",
468
+ "\\bexec\\s*\\(\\s*`[^`]{0,200}\\$\\{",
469
+ "\\bexecSync\\s*\\(\\s*[a-zA-Z_$][a-zA-Z0-9_.]*\\s*\\+",
470
+ "\\bexecSync\\s*\\(\\s*`[^`]{0,200}\\$\\{"
471
+ ],
472
+ "antiPatterns": [
473
+ "\\btest\\b|\\bspec\\b|__tests__|__fixtures__",
474
+ "eslint-disable"
475
+ ],
476
+ "flags": ""
477
+ },
478
+ "explanation": "Node.js child_process.exec() or execSync() is called with a dynamically constructed command string (variable concatenation or template literal with interpolation). exec() invokes the system shell (/bin/sh) and is therefore vulnerable to shell injection when any portion of the command string is derived from user input. This is the Node.js equivalent of Python subprocess with shell=True.",
479
+ "recommendation": "Replace exec() with execFile() or spawn() which do NOT use a shell and pass arguments as an array. This prevents shell injection even with user-controlled arguments. Alternatively, validate and sanitize all input before constructing shell commands.",
480
+ "fix": "Replace exec('ls ' + userPath) with execFile('ls', [userPath]) to avoid shell interpretation.",
481
+ "findingType": "vulnerability",
482
+ "aiCodeTarget": true,
483
+ "references": [
484
+ "https://cwe.mitre.org/data/definitions/78.html"
485
+ ]
486
+ },
487
+ {
488
+ "id": "generic.injection.eval-user-input",
489
+ "framework": [
490
+ "generic"
491
+ ],
492
+ "category": "injection",
493
+ "tier": "free",
494
+ "severity": "high",
495
+ "confidence": "HIGH",
496
+ "action": "block",
497
+ "version": 4,
498
+ "status": "experimental",
499
+ "cwe": [
500
+ "CWE-95"
501
+ ],
502
+ "owasp": [
503
+ "A03:2021"
504
+ ],
505
+ "matcher": {
506
+ "type": "pattern",
507
+ "fileGlob": "**/*.{ts,js,tsx,jsx}",
508
+ "patterns": [
509
+ "eval\\s*\\(\\s*[a-zA-Z_$][a-zA-Z0-9_.\\[\\]]*\\s*\\)",
510
+ "eval\\s*\\(\\s*[a-zA-Z_$][a-zA-Z0-9_.\\[\\]]*\\s*\\+\\s*[a-zA-Z_$]",
511
+ "eval\\s*\\(`[^`]*`\\)",
512
+ "new\\s+Function\\s*\\(\\s*[a-zA-Z_$][a-zA-Z0-9_.]*\\s*\\)"
513
+ ],
514
+ "antiPatterns": [
515
+ "eval\\s*\\(\\s*['\"][^'\"]{0,200}['\"]\\s*\\)",
516
+ "\\btest\\b|\\bspec\\b|__fixtures__|__tests__",
517
+ "eslint-disable"
518
+ ],
519
+ "flags": "",
520
+ "antiPatternScope": "block"
521
+ },
522
+ "explanation": "eval() or new Function() is called with a non-literal argument. If any part of the evaluated expression is derived from user input, this is a direct code injection vulnerability (CWE-95, CVE-2024-4181) allowing arbitrary JavaScript execution in the server or browser context. CSA 2026 research found 24.2% of AI-generated JS snippets contained this weakness. HIGH confidence — antiPatterns filter string-literal eval calls that are provably safe.",
523
+ "recommendation": "Avoid eval() and new Function() entirely. Replace dynamic code evaluation with safe alternatives: JSON.parse for data parsing, Function.prototype.call for dynamic dispatch, or a sandboxed interpreter for user-provided expressions.",
524
+ "fix": "Remove eval(). For JSON use JSON.parse(). For dynamic dispatch use a lookup table { [key]: handler }.",
525
+ "findingType": "vulnerability",
526
+ "aiCodeTarget": true,
527
+ "references": [
528
+ "https://cwe.mitre.org/data/definitions/95.html"
529
+ ]
530
+ },
531
+ {
532
+ "id": "generic.injection.eval-user-input-python",
533
+ "framework": [
534
+ "generic"
535
+ ],
536
+ "category": "injection",
537
+ "tier": "free",
538
+ "severity": "high",
539
+ "confidence": "HIGH",
540
+ "action": "block",
541
+ "version": 3,
542
+ "status": "experimental",
543
+ "cwe": [
544
+ "CWE-95",
545
+ "CWE-94"
546
+ ],
547
+ "owasp": [
548
+ "A03:2021"
549
+ ],
550
+ "matcher": {
551
+ "type": "pattern",
552
+ "fileGlob": "**/*.py",
553
+ "patterns": [
554
+ "eval\\s*\\(\\s*(?:request|req)\\b",
555
+ "exec\\s*\\(\\s*(?:request|req)\\b",
556
+ "eval\\s*\\(\\s*input\\s*\\(",
557
+ "exec\\s*\\(\\s*input\\s*\\(",
558
+ "eval\\s*\\(\\s*f['\"]",
559
+ "exec\\s*\\(\\s*f['\"]"
560
+ ],
561
+ "antiPatterns": [
562
+ "\\.test\\.|\\bspec\\b|__tests__|test_|_test\\.py|conftest\\.py",
563
+ "#\\s*nosec"
564
+ ],
565
+ "flags": ""
566
+ },
567
+ "explanation": "Python eval() or exec() is called with a user-controlled or externally-sourced argument. This enables Remote Code Execution — any attacker who controls the evaluated string can execute arbitrary Python code with the application's privilege level. CSA 2026 research found 29.5% of AI-generated Python snippets contained code-injection weaknesses (CWE-94/95). AI tools frequently generate eval() for dynamic config evaluation without considering that the input source may be attacker-controlled.",
568
+ "recommendation": "Avoid eval() and exec() entirely. Replace with safe alternatives: use json.loads() for JSON parsing, ast.literal_eval() for safe Python literal evaluation (no function calls), or a sandboxed expression evaluator like simpleeval. Never evaluate user-provided strings.",
569
+ "fix": "Replace eval() with ast.literal_eval() for safe Python literal parsing, or json.loads() for JSON data.",
570
+ "findingType": "vulnerability",
571
+ "aiCodeTarget": true,
572
+ "references": [
573
+ "https://cwe.mitre.org/data/definitions/95.html",
574
+ "https://cwe.mitre.org/data/definitions/94.html"
575
+ ]
576
+ },
577
+ {
578
+ "id": "generic.injection.shell-true",
579
+ "framework": [
580
+ "generic"
581
+ ],
582
+ "category": "injection",
583
+ "tier": "free",
584
+ "severity": "high",
585
+ "confidence": "HIGH",
586
+ "action": "block",
587
+ "version": 3,
588
+ "status": "experimental",
589
+ "cwe": [
590
+ "CWE-78"
591
+ ],
592
+ "owasp": [
593
+ "A03:2021"
594
+ ],
595
+ "matcher": {
596
+ "type": "pattern",
597
+ "fileGlob": "**/*.{py,rb,sh}",
598
+ "patterns": [
599
+ "subprocess\\.(run|Popen|call|check_output)\\s*\\(\\s*shell\\s*=\\s*True",
600
+ "shell\\s*=\\s*True",
601
+ "os\\.system\\s*\\(\\s*f['\"]",
602
+ "os\\.system\\s*\\([a-zA-Z_][a-zA-Z0-9_]*\\s*\\+"
603
+ ],
604
+ "antiPatterns": [
605
+ "\\btest\\b|\\bspec\\b|__fixtures__",
606
+ "#\\s*safe"
607
+ ],
608
+ "flags": ""
609
+ },
610
+ "explanation": "subprocess is called with shell=True, or os.system is called with a non-literal argument (f-string or concatenation). When shell=True, the command is passed to the shell interpreter — if any part of the command string includes user-controlled input, an attacker can inject arbitrary OS commands using shell metacharacters.",
611
+ "recommendation": "Replace shell=True with the list form: subprocess.run([\"cmd\", arg1, arg2]) where each argument is a separate list element. The shell never interprets the arguments when using list form. Validate and sanitize any external input used in command construction.",
612
+ "fix": "Replace `subprocess.run(cmd_string, shell=True)` with `subprocess.run(['cmd', arg], shell=False)`.",
613
+ "findingType": "vulnerability",
614
+ "aiCodeTarget": true,
615
+ "references": [
616
+ "https://cwe.mitre.org/data/definitions/78.html",
617
+ "https://github.com/PyCQA/bandit"
618
+ ]
619
+ },
620
+ {
621
+ "id": "generic.injection.unsafe-deserialization-python",
622
+ "framework": [
623
+ "generic"
624
+ ],
625
+ "category": "injection",
626
+ "tier": "free",
627
+ "severity": "high",
628
+ "confidence": "HIGH",
629
+ "action": "block",
630
+ "version": 3,
631
+ "status": "experimental",
632
+ "cwe": [
633
+ "CWE-502"
634
+ ],
635
+ "owasp": [
636
+ "A08:2021"
637
+ ],
638
+ "matcher": {
639
+ "type": "pattern",
640
+ "fileGlob": "**/*.py",
641
+ "patterns": [
642
+ "yaml\\.load\\s*\\(",
643
+ "yaml\\.unsafe_load\\s*\\(",
644
+ "pickle\\.loads\\s*\\(",
645
+ "pickle\\.load\\s*\\("
646
+ ],
647
+ "antiPatterns": [
648
+ "\\.test\\.|\\bspec\\b|__tests__|test_|_test\\.py|conftest\\.py",
649
+ "SafeLoader|yaml\\.safe_load"
650
+ ],
651
+ "flags": ""
652
+ },
653
+ "explanation": "Unsafe deserialization was detected. yaml.load() without SafeLoader allows instantiation of arbitrary Python objects, enabling Remote Code Execution through specially crafted YAML. pickle.load/loads() on untrusted data enables RCE through the __reduce__ method — unpickling untrusted data is equivalent to remote code execution. AI tools reproduce the vulnerable yaml.load() call from documentation examples that predated the SafeLoader warning.",
654
+ "recommendation": "For YAML: replace yaml.load(data) with yaml.safe_load(data). Never use yaml.load() unless you control 100% of the input source. For pickle: avoid deserializing untrusted data entirely. Use JSON, msgpack, or protobuf for data interchange. If pickle is required for trusted internal data, add input validation and integrity verification before unpickling.",
655
+ "fix": "Replace yaml.load(data) with yaml.safe_load(data). For pickle, switch to json.loads() for untrusted external data.",
656
+ "findingType": "vulnerability",
657
+ "aiCodeTarget": true,
658
+ "references": [
659
+ "https://cwe.mitre.org/data/definitions/502.html",
660
+ "https://pyyaml.org/wiki/PyYAMLDocumentation"
661
+ ]
662
+ },
663
+ {
664
+ "id": "generic.injection.vm-runcontext",
665
+ "framework": [
666
+ "generic"
667
+ ],
668
+ "category": "injection",
669
+ "tier": "free",
670
+ "severity": "high",
671
+ "confidence": "MEDIUM",
672
+ "action": "warn",
673
+ "version": 3,
674
+ "status": "experimental",
675
+ "cwe": [
676
+ "CWE-95"
677
+ ],
678
+ "owasp": [
679
+ "A03:2021"
680
+ ],
681
+ "matcher": {
682
+ "type": "pattern",
683
+ "fileGlob": "**/*.{ts,js,tsx,jsx}",
684
+ "patterns": [
685
+ "vm\\.runInThisContext\\s*\\(",
686
+ "vm\\.runInNewContext\\s*\\(",
687
+ "new vm\\.Script\\s*\\("
688
+ ],
689
+ "antiPatterns": [
690
+ "\\btest\\b|\\bspec\\b|__tests__|__fixtures__",
691
+ "eslint-disable"
692
+ ],
693
+ "flags": ""
694
+ },
695
+ "explanation": "Node.js vm.runInThisContext(), vm.runInNewContext(), or new vm.Script() is used for dynamic code execution. The Node.js vm module is NOT a security boundary — sandbox escape techniques are well-documented and have been exploited in production. AI tools generate vm module usage to \"safely sandbox\" user code, but this provides no actual isolation from the Node.js process. This is functionally equivalent to eval() for security purposes.",
696
+ "recommendation": "Avoid the vm module for untrusted code execution. Consider vm2 (archived but more restrictive), isolated-vm, or a subprocess-based sandbox. For expression evaluation, use safer alternatives like mathjs or safe-eval with a restricted environment.",
697
+ "fix": "Remove vm.runInThisContext/runInNewContext. Use isolated-vm or subprocess sandboxing for untrusted code execution.",
698
+ "findingType": "vulnerability",
699
+ "aiCodeTarget": true,
700
+ "references": [
701
+ "https://cwe.mitre.org/data/definitions/95.html",
702
+ "https://nodejs.org/api/vm.html"
703
+ ]
704
+ },
705
+ {
706
+ "id": "generic.secrets.anthropic-api-key",
707
+ "framework": [
708
+ "generic"
709
+ ],
710
+ "category": "secrets",
711
+ "tier": "local",
712
+ "severity": "critical",
713
+ "confidence": "HIGH",
714
+ "action": "block",
715
+ "version": 4,
716
+ "status": "experimental",
717
+ "cwe": [
718
+ "CWE-798"
719
+ ],
720
+ "owasp": [
721
+ "A07:2021"
722
+ ],
723
+ "matcher": {
724
+ "type": "pattern",
725
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,env,.env*}",
726
+ "patterns": [
727
+ "sk-ant-api03-[a-zA-Z0-9]{80,100}"
728
+ ],
729
+ "antiPatterns": [
730
+ "YOUR_API_KEY|REPLACE_ME|example|placeholder|sk-ant-test",
731
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
732
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)"
733
+ ],
734
+ "flags": ""
735
+ },
736
+ "explanation": "A hardcoded Anthropic API key (sk-ant-api03- prefix) was detected in source code. Committing Anthropic API keys to version control exposes them to anyone with repository access. Anthropic API spend can reach thousands of dollars per day with an exposed key. This is particularly relevant for ShipGuard's target market of AI-heavy Next.js and Vercel applications where Anthropic SDK usage is common.",
737
+ "recommendation": "Remove the key from source immediately. Store it in environment variables (ANTHROPIC_API_KEY) and load via process.env.ANTHROPIC_API_KEY. Rotate the exposed key at console.anthropic.com. Never commit API keys to version control.",
738
+ "fix": "Replace the literal key with `process.env.ANTHROPIC_API_KEY` and add ANTHROPIC_API_KEY to .env.local (gitignored).",
739
+ "findingType": "vulnerability",
740
+ "aiCodeTarget": true,
741
+ "references": [
742
+ "https://cwe.mitre.org/data/definitions/798.html"
743
+ ]
744
+ },
745
+ {
746
+ "id": "generic.secrets.aws-access-key",
747
+ "framework": [
748
+ "generic"
749
+ ],
750
+ "category": "secrets",
751
+ "tier": "local",
752
+ "severity": "high",
753
+ "confidence": "HIGH",
754
+ "action": "block",
755
+ "version": 4,
756
+ "status": "experimental",
757
+ "cwe": [
758
+ "CWE-798"
759
+ ],
760
+ "owasp": [
761
+ "A07:2021"
762
+ ],
763
+ "matcher": {
764
+ "type": "pattern",
765
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,rb,java,yaml,yml,json,toml,cfg,conf,ini,sh,env}",
766
+ "patterns": [
767
+ "(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}"
768
+ ],
769
+ "antiPatterns": [
770
+ "YOUR_KEY|REPLACE_ME|EXAMPLE|PLACEHOLDER|FAKE|DUMMY|example|placeholder",
771
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
772
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)",
773
+ "ENV\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
774
+ "secrets\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)(?:[,;)}\\]]|$)",
775
+ "secrets\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
776
+ "\\.test\\.|\\bspec\\b|__tests__"
777
+ ],
778
+ "flags": ""
779
+ },
780
+ "explanation": "A hardcoded AWS access key ID (AKIA/ASIA/AGPA prefix) was detected in source. Committing AWS credentials to version control enables full cloud account takeover, unauthorized resource provisioning, and billing fraud.",
781
+ "recommendation": "Remove the key immediately and rotate it in the AWS IAM console. Store credentials via environment variables, AWS credential files (~/.aws/credentials), or IAM roles for compute resources. Never commit access key IDs or secret access keys.",
782
+ "fix": "Replace the literal key with `process.env.AWS_ACCESS_KEY_ID` and use IAM roles or AWS credential providers in production.",
783
+ "findingType": "vulnerability",
784
+ "aiCodeTarget": true,
785
+ "references": [
786
+ "https://cwe.mitre.org/data/definitions/798.html",
787
+ "https://github.com/gitleaks/gitleaks"
788
+ ]
789
+ },
790
+ {
791
+ "id": "generic.secrets.azure-storage-key",
792
+ "framework": [
793
+ "generic"
794
+ ],
795
+ "category": "secrets",
796
+ "tier": "local",
797
+ "severity": "high",
798
+ "confidence": "HIGH",
799
+ "action": "block",
800
+ "version": 4,
801
+ "status": "experimental",
802
+ "cwe": [
803
+ "CWE-798"
804
+ ],
805
+ "owasp": [
806
+ "A07:2021"
807
+ ],
808
+ "matcher": {
809
+ "type": "pattern",
810
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,cs,env,yaml,yml,json,conf,ini,xml,config}",
811
+ "patterns": [
812
+ "AccountKey\\s*=\\s*[a-zA-Z0-9+/]{40,100}={0,2}"
813
+ ],
814
+ "antiPatterns": [
815
+ "AccountKey=YOUR_KEY|AccountKey=REPLACE_ME|AccountKey=example|AccountKey=test",
816
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
817
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)",
818
+ "ENV\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
819
+ "secrets\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)(?:[,;)}\\]]|$)",
820
+ "secrets\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
821
+ "\\.test\\.|\\bspec\\b|__tests__"
822
+ ],
823
+ "flags": ""
824
+ },
825
+ "explanation": "A hardcoded Azure Storage Account key (AccountKey= with base64 value) was detected in source. This key grants full read/write/delete access to all blobs, tables, queues, and file shares in the storage account.",
826
+ "recommendation": "Rotate the storage account key immediately in the Azure Portal. Use Azure Managed Identity, Azure Key Vault references, or connection strings loaded from environment variables (AZURE_STORAGE_CONNECTION_STRING) at runtime.",
827
+ "fix": "Replace with `process.env.AZURE_STORAGE_CONNECTION_STRING` and rotate the account key in Azure Portal.",
828
+ "findingType": "vulnerability",
829
+ "aiCodeTarget": true,
830
+ "references": [
831
+ "https://cwe.mitre.org/data/definitions/798.html",
832
+ "https://github.com/gitleaks/gitleaks"
833
+ ]
834
+ },
835
+ {
836
+ "id": "generic.secrets.db-connection-string",
837
+ "framework": [
838
+ "generic"
839
+ ],
840
+ "category": "secrets",
841
+ "tier": "local",
842
+ "severity": "high",
843
+ "confidence": "HIGH",
844
+ "action": "block",
845
+ "version": 4,
846
+ "status": "experimental",
847
+ "cwe": [
848
+ "CWE-259",
849
+ "CWE-798"
850
+ ],
851
+ "owasp": [
852
+ "A07:2021"
853
+ ],
854
+ "matcher": {
855
+ "type": "pattern",
856
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,rb,java,env,yaml,yml,json,conf,ini,toml}",
857
+ "patterns": [
858
+ "(postgres|postgresql|mysql|mongodb|mongodb\\+srv|redis|mssql|sqlserver)://[a-zA-Z0-9._%-]+:[a-zA-Z0-9._@!#$%^&*()-]+@[a-zA-Z0-9._-]+"
859
+ ],
860
+ "antiPatterns": [
861
+ "YOUR_DB_PASSWORD|REPLACE_ME|password_here|<password>",
862
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
863
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)",
864
+ "ENV\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
865
+ "secrets\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)(?:[,;)}\\]]|$)",
866
+ "secrets\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
867
+ "\\.test\\.|\\bspec\\b|__tests__"
868
+ ],
869
+ "flags": "i"
870
+ },
871
+ "explanation": "A database connection string with embedded credentials was detected in source. The URI contains a non-empty password segment in the form scheme://user:pass@host. Committing connection strings exposes database credentials to all repository readers.",
872
+ "recommendation": "Replace the hardcoded connection string with an environment variable reference (DATABASE_URL). Use connection poolers or secrets managers for production deployments. Rotate the exposed database password immediately.",
873
+ "fix": "Replace with `process.env.DATABASE_URL` and rotate the database password.",
874
+ "findingType": "vulnerability",
875
+ "aiCodeTarget": true,
876
+ "references": [
877
+ "https://cwe.mitre.org/data/definitions/259.html",
878
+ "https://cwe.mitre.org/data/definitions/798.html"
879
+ ]
880
+ },
881
+ {
882
+ "id": "generic.secrets.gcp-service-account-key",
883
+ "framework": [
884
+ "generic"
885
+ ],
886
+ "category": "secrets",
887
+ "tier": "local",
888
+ "severity": "high",
889
+ "confidence": "HIGH",
890
+ "action": "block",
891
+ "version": 4,
892
+ "status": "experimental",
893
+ "cwe": [
894
+ "CWE-798"
895
+ ],
896
+ "owasp": [
897
+ "A07:2021"
898
+ ],
899
+ "matcher": {
900
+ "type": "pattern",
901
+ "fileGlob": "**/*.{json,js,ts,py,go,yaml,yml,conf,env}",
902
+ "patterns": [
903
+ "\"type\"\\s*:\\s*\"service_account\"",
904
+ "\"private_key_id\"\\s*:\\s*\"[a-f0-9]{40}\""
905
+ ],
906
+ "antiPatterns": [
907
+ "YOUR_KEY_ID|REPLACE_ME|test_service_account",
908
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)",
909
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
910
+ "\\.test\\.|\\bspec\\b|__tests__"
911
+ ],
912
+ "flags": ""
913
+ },
914
+ "explanation": "A GCP service account private key JSON literal was detected in source. The \"type\": \"service_account\" field is a unique identifier for GCP service account credential files. Committing these credentials grants impersonation of the service account and all its IAM permissions to anyone with repository access.",
915
+ "recommendation": "Remove the key from source and rotate it in the GCP IAM console. Use Application Default Credentials (ADC) with Workload Identity for compute environments, or load the credentials file path from an environment variable at runtime.",
916
+ "fix": "Delete the key JSON from source. Use `GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json` loaded at runtime outside the repo.",
917
+ "findingType": "vulnerability",
918
+ "aiCodeTarget": true,
919
+ "references": [
920
+ "https://cwe.mitre.org/data/definitions/798.html",
921
+ "https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys"
922
+ ]
923
+ },
924
+ {
925
+ "id": "generic.secrets.github-token",
926
+ "framework": [
927
+ "generic"
928
+ ],
929
+ "category": "secrets",
930
+ "tier": "local",
931
+ "severity": "high",
932
+ "confidence": "HIGH",
933
+ "action": "block",
934
+ "version": 4,
935
+ "status": "experimental",
936
+ "cwe": [
937
+ "CWE-798"
938
+ ],
939
+ "owasp": [
940
+ "A07:2021"
941
+ ],
942
+ "matcher": {
943
+ "type": "pattern",
944
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,rb,yaml,yml,env,json,sh,conf}",
945
+ "patterns": [
946
+ "(ghp_|gho_|ghu_|ghs_|ghr_|github_pat_)[a-zA-Z0-9_]{20,80}"
947
+ ],
948
+ "antiPatterns": [
949
+ "YOUR_TOKEN|REPLACE_ME|ghp_example|ghp_xxxx|github_pat_example",
950
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
951
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)",
952
+ "ENV\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
953
+ "secrets\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)(?:[,;)}\\]]|$)",
954
+ "secrets\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
955
+ "\\.test\\.|\\bspec\\b|__tests__"
956
+ ],
957
+ "flags": ""
958
+ },
959
+ "explanation": "A hardcoded GitHub Personal Access Token (ghp_, gho_, ghu_, ghs_, github_pat_ prefix) was detected in source. This token grants repository read/write access, workflow triggering, and API access to GitHub resources associated with the account or org.",
960
+ "recommendation": "Revoke the token immediately at github.com/settings/tokens. Store tokens in environment variables or a secrets manager. For CI/CD, use GITHUB_TOKEN with minimum-privilege scopes rather than a personal access token.",
961
+ "fix": "Replace with `process.env.GITHUB_TOKEN` and revoke the exposed token at github.com/settings/tokens.",
962
+ "findingType": "vulnerability",
963
+ "aiCodeTarget": true,
964
+ "references": [
965
+ "https://cwe.mitre.org/data/definitions/798.html",
966
+ "https://github.com/gitleaks/gitleaks"
967
+ ]
968
+ },
969
+ {
970
+ "id": "generic.secrets.huggingface-token",
971
+ "framework": [
972
+ "generic"
973
+ ],
974
+ "category": "secrets",
975
+ "tier": "local",
976
+ "severity": "high",
977
+ "confidence": "HIGH",
978
+ "action": "block",
979
+ "version": 4,
980
+ "status": "experimental",
981
+ "cwe": [
982
+ "CWE-798"
983
+ ],
984
+ "owasp": [
985
+ "A07:2021"
986
+ ],
987
+ "matcher": {
988
+ "type": "pattern",
989
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,env,.env*}",
990
+ "patterns": [
991
+ "hf_[a-zA-Z0-9]{34}"
992
+ ],
993
+ "antiPatterns": [
994
+ "YOUR_TOKEN|REPLACE_ME|example|placeholder",
995
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
996
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)"
997
+ ],
998
+ "flags": ""
999
+ },
1000
+ "explanation": "A hardcoded Hugging Face API token (hf_ prefix) was detected. Hugging Face tokens grant access to private model repositories, inference endpoints, and training datasets. With the growth of AI-generated code in machine-learning applications, these tokens appear frequently in AI-generated data-pipeline scripts and model-serving code.",
1001
+ "recommendation": "Remove the token from source code. Store it in environment variables (HUGGINGFACE_TOKEN or HF_TOKEN) and load via process.env. Rotate the exposed token at huggingface.co/settings/tokens.",
1002
+ "fix": "Replace the literal token with `process.env.HF_TOKEN` and add HF_TOKEN to .env.local (gitignored).",
1003
+ "findingType": "vulnerability",
1004
+ "aiCodeTarget": true,
1005
+ "references": [
1006
+ "https://cwe.mitre.org/data/definitions/798.html",
1007
+ "https://huggingface.co/docs/hub/security-tokens"
1008
+ ]
1009
+ },
1010
+ {
1011
+ "id": "generic.secrets.openai-api-key",
1012
+ "framework": [
1013
+ "generic"
1014
+ ],
1015
+ "category": "secrets",
1016
+ "tier": "local",
1017
+ "severity": "critical",
1018
+ "confidence": "HIGH",
1019
+ "action": "block",
1020
+ "version": 4,
1021
+ "status": "experimental",
1022
+ "cwe": [
1023
+ "CWE-798"
1024
+ ],
1025
+ "owasp": [
1026
+ "A07:2021"
1027
+ ],
1028
+ "matcher": {
1029
+ "type": "pattern",
1030
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,env,.env*}",
1031
+ "patterns": [
1032
+ "sk-[a-zA-Z0-9]{48}",
1033
+ "sk-proj-[a-zA-Z0-9_-]{43}"
1034
+ ],
1035
+ "antiPatterns": [
1036
+ "YOUR_API_KEY|REPLACE_ME|example|placeholder|sk-test",
1037
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
1038
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)"
1039
+ ],
1040
+ "flags": ""
1041
+ },
1042
+ "explanation": "A hardcoded OpenAI API key was detected. Committing API keys to source control exposes them to anyone with repository access and can lead to unauthorized usage and billing charges.",
1043
+ "recommendation": "Remove the key from source. Store it in environment variables (OPENAI_API_KEY) and load via process.env. Rotate the exposed key immediately at platform.openai.com.",
1044
+ "fix": "Replace the literal key with `process.env.OPENAI_API_KEY` and add OPENAI_API_KEY to .env.local (gitignored).",
1045
+ "findingType": "vulnerability",
1046
+ "aiCodeTarget": true
1047
+ },
1048
+ {
1049
+ "id": "generic.secrets.private-key-pem",
1050
+ "framework": [
1051
+ "generic"
1052
+ ],
1053
+ "category": "secrets",
1054
+ "tier": "local",
1055
+ "severity": "high",
1056
+ "confidence": "HIGH",
1057
+ "action": "block",
1058
+ "version": 4,
1059
+ "status": "experimental",
1060
+ "cwe": [
1061
+ "CWE-321"
1062
+ ],
1063
+ "owasp": [
1064
+ "A02:2021"
1065
+ ],
1066
+ "matcher": {
1067
+ "type": "pattern",
1068
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,rb,java,pem,key,env,yaml,yml,json,conf}",
1069
+ "patterns": [
1070
+ "-----BEGIN (RSA |EC |DSA |OPENSSH |ENCRYPTED |PRIVATE KEY|)[^-]{0,30}PRIVATE KEY-----(?:\\n|\\\\n)[ \\t]{0,20}[A-Za-z0-9+/=]{40,1000}"
1071
+ ],
1072
+ "antiPatterns": [
1073
+ "REPLACE_ME|YOUR_PRIVATE_KEY|example_key|test_key|dummy_key",
1074
+ "readFileSync|loadKey|fs\\.read|open\\(|path\\.join",
1075
+ "\\.test\\.|\\bspec\\b|__tests__|__fixtures__"
1076
+ ],
1077
+ "flags": ""
1078
+ },
1079
+ "explanation": "A PEM-encoded private key header was detected in source (RSA, EC, DSA, OPENSSH, or PKCS8 format). Committing private keys enables impersonation, decryption of data, and signing forgery by anyone with repository access.",
1080
+ "recommendation": "Remove the key from source immediately. Load private keys from the filesystem at runtime using an environment variable for the path, or use a secrets manager (AWS Secrets Manager, HashiCorp Vault, GCP Secret Manager). Rotate all potentially compromised keys.",
1081
+ "fix": "Store the key in a file outside the repository and load with `fs.readFileSync(process.env.PRIVATE_KEY_PATH, 'utf8')`.",
1082
+ "findingType": "vulnerability",
1083
+ "aiCodeTarget": true,
1084
+ "references": [
1085
+ "https://cwe.mitre.org/data/definitions/321.html",
1086
+ "https://github.com/gitleaks/gitleaks"
1087
+ ]
1088
+ },
1089
+ {
1090
+ "id": "generic.secrets.slack-token",
1091
+ "framework": [
1092
+ "generic"
1093
+ ],
1094
+ "category": "secrets",
1095
+ "tier": "local",
1096
+ "severity": "high",
1097
+ "confidence": "HIGH",
1098
+ "action": "block",
1099
+ "version": 4,
1100
+ "status": "experimental",
1101
+ "cwe": [
1102
+ "CWE-798"
1103
+ ],
1104
+ "owasp": [
1105
+ "A07:2021"
1106
+ ],
1107
+ "matcher": {
1108
+ "type": "pattern",
1109
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,rb,env,yaml,yml,json,conf,ini}",
1110
+ "patterns": [
1111
+ "xox[bpoas]-[0-9a-zA-Z-]{10,120}"
1112
+ ],
1113
+ "antiPatterns": [
1114
+ "xoxb-REPLACE|xoxb-example|YOUR_SLACK_TOKEN|xox.-xxxx",
1115
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
1116
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)",
1117
+ "ENV\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
1118
+ "secrets\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)(?:[,;)}\\]]|$)",
1119
+ "secrets\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
1120
+ "\\.test\\.|\\bspec\\b|__tests__"
1121
+ ],
1122
+ "flags": ""
1123
+ },
1124
+ "explanation": "A hardcoded Slack token (xoxb- bot, xoxp- user, xoxa- app, xoxs- workspace, or xoxo- org prefix) was detected in source. This token grants access to Slack workspace messages, channels, and user data.",
1125
+ "recommendation": "Revoke the token immediately at api.slack.com/apps. Store tokens in environment variables (SLACK_BOT_TOKEN). Use the Slack SDK's built-in env var loading instead of hardcoding credentials in source files.",
1126
+ "fix": "Replace with `process.env.SLACK_BOT_TOKEN` and revoke the exposed token at api.slack.com/apps.",
1127
+ "findingType": "vulnerability",
1128
+ "aiCodeTarget": true,
1129
+ "references": [
1130
+ "https://cwe.mitre.org/data/definitions/798.html",
1131
+ "https://docs.slack.dev/authentication/tokens/"
1132
+ ]
1133
+ },
1134
+ {
1135
+ "id": "generic.secrets.stripe-live-key",
1136
+ "framework": [
1137
+ "generic"
1138
+ ],
1139
+ "category": "secrets",
1140
+ "tier": "local",
1141
+ "severity": "critical",
1142
+ "confidence": "HIGH",
1143
+ "action": "block",
1144
+ "version": 5,
1145
+ "status": "experimental",
1146
+ "cwe": [
1147
+ "CWE-798"
1148
+ ],
1149
+ "owasp": [
1150
+ "A07:2021"
1151
+ ],
1152
+ "matcher": {
1153
+ "type": "pattern",
1154
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,rb,go,yaml,yml,json,conf,ini,env}",
1155
+ "patterns": [
1156
+ "sk_live_[a-zA-Z0-9]{20,64}"
1157
+ ],
1158
+ "antiPatterns": [
1159
+ "sk_live_xxxx|YOUR_STRIPE_KEY|REPLACE_ME",
1160
+ "process\\.env\\.[A-Za-z0-9_]+!?\\s*(?:[,;)}\\]]|$)",
1161
+ "os\\.environ(?:\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)|\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\])?(?:[,;)}\\]]|$)",
1162
+ "ENV\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
1163
+ "secrets\\.get\\([A-Za-z0-9_'\". :/+=@-]{0,64}\\)(?:[,;)}\\]]|$)",
1164
+ "secrets\\[[A-Za-z0-9_'\". :/+=@-]{0,64}\\](?:[,;)}\\]]|$)",
1165
+ "\\.test\\.|\\bspec\\b|__tests__"
1166
+ ],
1167
+ "flags": ""
1168
+ },
1169
+ "explanation": "A hardcoded Stripe live secret key (sk_live_ prefix) was detected in source. This key grants full access to the Stripe account including charges, refunds, customer data, and payouts — immediate payment account compromise if exposed.\nv5 (founder ruling 2026-08-08, batch item 11): upgraded HIGH -> CRITICAL. This closes a severity disagreement the CLI's own dedup logic had been surfacing since it shipped (packages/cli/src/core/legacy-corpus-map.ts, `dedupeLegacyAgainstCorpus` doc comment): the legacy hand-written secrets check already rates this same defect `critical` (packages/cli/src/checks/secrets.ts, 'Stripe Live Secret Key' pattern) and dedup kept both findings because it can never silently soften a report. A live Stripe secret key is a complete, immediate payment-account takeover — charges, refunds, payouts, customer PII — which is a canonical CRITICAL-severity secret exposure, not merely HIGH. Canon set by the founder ruling; nothing about the detection pattern itself changed.",
1170
+ "recommendation": "Remove the key immediately and roll it in the Stripe dashboard under Developers > API Keys. Store the key in an environment variable (STRIPE_SECRET_KEY) loaded at runtime. Never commit live API keys to version control.",
1171
+ "fix": "Replace with `process.env.STRIPE_SECRET_KEY` and add it to .env.local (gitignored). Rotate the exposed key immediately.",
1172
+ "findingType": "vulnerability",
1173
+ "aiCodeTarget": true,
1174
+ "references": [
1175
+ "https://cwe.mitre.org/data/definitions/798.html",
1176
+ "https://docs.stripe.com/keys-best-practices"
1177
+ ]
1178
+ },
1179
+ {
1180
+ "id": "generic.tls.reject-unauthorized-disabled",
1181
+ "framework": [
1182
+ "generic"
1183
+ ],
1184
+ "category": "config",
1185
+ "tier": "free",
1186
+ "severity": "high",
1187
+ "confidence": "HIGH",
1188
+ "action": "block",
1189
+ "version": 4,
1190
+ "status": "experimental",
1191
+ "cwe": [
1192
+ "CWE-295"
1193
+ ],
1194
+ "owasp": [
1195
+ "A02:2021"
1196
+ ],
1197
+ "matcher": {
1198
+ "type": "pattern",
1199
+ "fileGlob": "**/*.{ts,js,tsx,jsx,py,go,rb,yaml,yml,conf,env}",
1200
+ "patterns": [
1201
+ "rejectUnauthorized\\s*:\\s*false",
1202
+ "NODE_TLS_REJECT_UNAUTHORIZED\\s*[=:]\\s*['\"]?0['\"]?",
1203
+ "verify\\s*=\\s*False",
1204
+ "ssl\\._create_unverified_context\\s*\\(",
1205
+ "verify_mode\\s*=\\s*ssl\\.CERT_NONE",
1206
+ "InsecureSkipVerify\\s*:\\s*true"
1207
+ ],
1208
+ "antiPatterns": [
1209
+ "\\.test\\.|\\bspec\\b|__tests__|__fixtures__",
1210
+ "dev-only|local-only|localhost_only"
1211
+ ],
1212
+ "flags": "",
1213
+ "antiPatternScope": {
1214
+ "lines": 3
1215
+ }
1216
+ },
1217
+ "explanation": "TLS certificate validation is disabled via rejectUnauthorized: false or NODE_TLS_REJECT_UNAUTHORIZED=0. This allows man-in-the-middle attacks where an attacker intercepts TLS connections without detection, potentially exposing credentials, session tokens, and sensitive data in transit.",
1218
+ "recommendation": "Remove rejectUnauthorized: false. If connecting to a server with a self-signed certificate, add the CA certificate to the trusted store instead of disabling validation. Never disable TLS certificate verification in production code.",
1219
+ "fix": "Remove `rejectUnauthorized: false`. For self-signed certs use `ca: [fs.readFileSync('ca.crt')]` instead.",
1220
+ "findingType": "vulnerability",
1221
+ "aiCodeTarget": true,
1222
+ "references": [
1223
+ "https://cwe.mitre.org/data/definitions/295.html"
1224
+ ]
1225
+ },
1226
+ {
1227
+ "id": "generic.tls.verify-disabled-python",
1228
+ "framework": [
1229
+ "generic"
1230
+ ],
1231
+ "category": "config",
1232
+ "tier": "free",
1233
+ "severity": "high",
1234
+ "confidence": "HIGH",
1235
+ "action": "block",
1236
+ "version": 3,
1237
+ "status": "experimental",
1238
+ "cwe": [
1239
+ "CWE-295"
1240
+ ],
1241
+ "owasp": [
1242
+ "A02:2021"
1243
+ ],
1244
+ "matcher": {
1245
+ "type": "pattern",
1246
+ "fileGlob": "**/*.py",
1247
+ "patterns": [
1248
+ "verify\\s*=\\s*False",
1249
+ "ssl\\._create_unverified_context\\s*\\(",
1250
+ "\\.verify_mode\\s*=\\s*ssl\\.CERT_NONE"
1251
+ ],
1252
+ "antiPatterns": [
1253
+ "\\.test\\.|\\bspec\\b|__tests__|test_|_test\\.py|conftest\\.py",
1254
+ "dev-only|local-only|localhost_only"
1255
+ ],
1256
+ "flags": ""
1257
+ },
1258
+ "explanation": "Python TLS certificate validation is disabled via verify=False (requests library) or ssl._create_unverified_context() / ssl.CERT_NONE (ssl module). This downgrades HTTPS to an unencrypted channel vulnerable to man-in-the-middle attacks, exposing credentials, session tokens, and sensitive data in transit. This is the most common AI-generated TLS vulnerability pattern in Python — AI tools suggest verify=False to resolve SSL errors without explaining the security impact.",
1259
+ "recommendation": "Remove verify=False. For self-signed or custom CA certificates, provide the CA bundle path: requests.get(url, verify='/path/to/ca-bundle.crt'). Never disable certificate validation in production code. In Python ssl module, use ssl.create_default_context() which enables validation by default.",
1260
+ "fix": "Replace verify=False with verify=True (default) or verify='/path/to/ca.crt'. For ssl module use ssl.create_default_context() instead of ssl._create_unverified_context().",
1261
+ "findingType": "vulnerability",
1262
+ "aiCodeTarget": true,
1263
+ "references": [
1264
+ "https://cwe.mitre.org/data/definitions/295.html",
1265
+ "https://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification"
1266
+ ]
1267
+ },
1268
+ {
1269
+ "id": "postgresql.auth.trust-auth-method",
1270
+ "framework": [
1271
+ "postgresql"
1272
+ ],
1273
+ "category": "auth",
1274
+ "tier": "free",
1275
+ "severity": "critical",
1276
+ "confidence": "HIGH",
1277
+ "action": "block",
1278
+ "version": 3,
1279
+ "status": "experimental",
1280
+ "cwe": [
1281
+ "CWE-287",
1282
+ "CWE-306"
1283
+ ],
1284
+ "owasp": [
1285
+ "A07:2021"
1286
+ ],
1287
+ "matcher": {
1288
+ "type": "pattern",
1289
+ "fileGlob": "**/{pg_hba.conf,docker-compose*.yml,docker-compose*.yaml,.env*}",
1290
+ "patterns": [
1291
+ "POSTGRES_HOST_AUTH_METHOD[ \\t]*[:=][ \\t]*trust",
1292
+ "^(host|local)[ \\t]+[^ \\t\\n]+[ \\t]+[^ \\t\\n]+[ \\t]+[^ \\t\\n]+[ \\t]+trust"
1293
+ ],
1294
+ "antiPatterns": [
1295
+ "__tests__|test_migration",
1296
+ "# trust|#trust"
1297
+ ],
1298
+ "flags": "im"
1299
+ },
1300
+ "explanation": "PostgreSQL trust authentication is configured, meaning any connection from the allowed host is accepted without password verification. Anyone on the network (or local machine) can connect as any database user — including the postgres superuser — without credentials.\nAI-generated Docker configurations frequently omit the POSTGRES_PASSWORD environment variable, causing the official PostgreSQL Docker image to silently write 'host all all all trust' into pg_hba.conf. This makes the database fully accessible to anyone with network access to the PostgreSQL port.\nPostgreSQL official docs: \"Trust authentication is only suitable for TCP/IP connections if you trust every user on every machine that is allowed to connect to the server.\"",
1301
+ "recommendation": "Set a strong POSTGRES_PASSWORD in docker-compose.yml and .env files. In pg_hba.conf, replace 'trust' with 'scram-sha-256' (PostgreSQL 10+) or 'md5' as the authentication method. Never use trust authentication for TCP/IP connections in any environment.",
1302
+ "fix": "Replace 'trust' with 'scram-sha-256' in pg_hba.conf and set POSTGRES_PASSWORD in your Docker configuration.",
1303
+ "findingType": "vulnerability",
1304
+ "aiCodeTarget": true
1305
+ }
1306
+ ]
1307
+ }