secure-review-extension 1.0.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,497 @@
1
+ const STATIC_RULES = [
2
+ {
3
+ id: "hardcoded-secret",
4
+ title: "Hard-coded secret or credential material",
5
+ severity: "critical",
6
+ confidence: "high",
7
+ category: "Secrets",
8
+ subcategory: "Credential Exposure",
9
+ reviewDomain: "security",
10
+ regex: /(api[_-]?key|secret|token|password|passwd|client_secret)\s*[:=]\s*["'][^"']{8,}["']/gi,
11
+ remediation: "Move the secret to environment variables or a secret manager and rotate the exposed credential.",
12
+ suggestion: "Centralize secret access through environment-backed configuration or a dedicated secrets manager.",
13
+ whyItMatters: "Hard-coded credentials can be extracted from source control and abused for unauthorized access.",
14
+ standards: ["CWE-798", "OWASP:A07"]
15
+ },
16
+ {
17
+ id: "aws-access-key",
18
+ title: "AWS access key pattern found in source",
19
+ severity: "critical",
20
+ confidence: "high",
21
+ category: "Secrets",
22
+ subcategory: "Cloud Credential Exposure",
23
+ reviewDomain: "security",
24
+ regex: /\bAKIA[0-9A-Z]{16}\b/g,
25
+ remediation: "Rotate the key immediately and remove it from source control.",
26
+ suggestion: "Use short-lived cloud credentials and never persist them in workspace files.",
27
+ whyItMatters: "Exposed cloud credentials can lead to infrastructure compromise and privilege abuse.",
28
+ standards: ["CWE-798", "OWASP:A07"]
29
+ },
30
+ {
31
+ id: "weak-crypto",
32
+ title: "Weak cryptographic algorithm usage",
33
+ severity: "high",
34
+ confidence: "high",
35
+ category: "Crypto",
36
+ subcategory: "Weak Hashing",
37
+ reviewDomain: "security",
38
+ regex: /\b(md5|sha1)\b/gi,
39
+ remediation: "Use modern algorithms such as SHA-256 or stronger password hashing like bcrypt, scrypt, or Argon2.",
40
+ suggestion: "Replace weak hashes and audit any existing stored values or compatibility assumptions.",
41
+ whyItMatters: "Weak cryptography can allow attackers to forge values or crack secrets more efficiently.",
42
+ standards: ["CWE-327", "OWASP:A02"]
43
+ },
44
+ {
45
+ id: "eval-usage",
46
+ title: "Dynamic code execution sink",
47
+ severity: "high",
48
+ confidence: "high",
49
+ category: "Code Execution",
50
+ subcategory: "Unsafe Execution",
51
+ reviewDomain: "security",
52
+ regex: /\b(eval|new Function|execSync|spawnSync|Runtime\.getRuntime\(\)\.exec)\s*\(/g,
53
+ remediation: "Avoid dynamic execution. Replace with safe, explicit logic or strict allowlisting.",
54
+ suggestion: "Refactor away from string-based execution and use structured command or function dispatch.",
55
+ whyItMatters: "Dynamic execution can become command or code injection when input is attacker influenced.",
56
+ standards: ["CWE-94", "OWASP:A03"]
57
+ },
58
+ {
59
+ id: "sql-concat",
60
+ title: "Possible SQL query built by concatenation",
61
+ severity: "high",
62
+ confidence: "medium",
63
+ category: "Injection",
64
+ subcategory: "SQL Injection",
65
+ reviewDomain: "security",
66
+ regex: /(SELECT|INSERT|UPDATE|DELETE)[\s\S]{0,120}(\+|\$\{|format\(|f["'])/gi,
67
+ remediation: "Use parameterized queries or ORM-bound parameters instead of string concatenation.",
68
+ suggestion: "Adopt parameter binding in all repository or database access layers.",
69
+ whyItMatters: "String-built queries are a common source of SQL injection vulnerabilities.",
70
+ standards: ["CWE-89", "OWASP:A03"]
71
+ },
72
+ {
73
+ id: "xss-innerhtml",
74
+ title: "Potential HTML injection via innerHTML",
75
+ severity: "medium",
76
+ confidence: "high",
77
+ category: "XSS",
78
+ subcategory: "Unsafe DOM Injection",
79
+ reviewDomain: "security",
80
+ regex: /\.innerHTML\s*=/g,
81
+ remediation: "Prefer textContent or sanitize untrusted HTML before rendering.",
82
+ suggestion: "Use safe rendering primitives and sanitize any trusted HTML fragments explicitly.",
83
+ whyItMatters: "Unsafe HTML insertion can allow script execution in the browser.",
84
+ standards: ["CWE-79", "OWASP:A03"]
85
+ },
86
+ {
87
+ id: "dangerously-set-html",
88
+ title: "React dangerouslySetInnerHTML usage",
89
+ severity: "medium",
90
+ confidence: "medium",
91
+ category: "XSS",
92
+ subcategory: "Unsafe Rendering",
93
+ reviewDomain: "security",
94
+ regex: /dangerouslySetInnerHTML/g,
95
+ remediation: "Ensure the HTML is fully sanitized and trusted, or avoid HTML injection entirely.",
96
+ suggestion: "Render structured UI components instead of raw HTML where possible.",
97
+ whyItMatters: "Raw HTML injection expands the attack surface for XSS and content spoofing.",
98
+ standards: ["CWE-79", "OWASP:A03"]
99
+ },
100
+ {
101
+ id: "insecure-random",
102
+ title: "Non-cryptographic randomness in security-sensitive context",
103
+ severity: "medium",
104
+ confidence: "medium",
105
+ category: "Crypto",
106
+ subcategory: "Weak Randomness",
107
+ reviewDomain: "security",
108
+ regex: /\bMath\.random\s*\(/g,
109
+ remediation: "Use a cryptographically secure random source for secrets, tokens, or identifiers.",
110
+ suggestion: "Switch to crypto-secure randomness such as crypto.randomBytes or platform equivalents.",
111
+ whyItMatters: "Predictable randomness can weaken tokens, reset links, or other security-sensitive values.",
112
+ standards: ["CWE-338", "OWASP:A02"]
113
+ },
114
+ {
115
+ id: "path-traversal",
116
+ title: "User-controlled file path construction",
117
+ severity: "high",
118
+ confidence: "medium",
119
+ category: "File Handling",
120
+ subcategory: "Path Traversal",
121
+ reviewDomain: "security",
122
+ regex: /(readFile|writeFile|open|sendFile|File\(|open\().{0,120}(req\.(params|query|body)|input|userInput)/gi,
123
+ remediation: "Validate and normalize file paths against a strict allowlist before file access.",
124
+ suggestion: "Use fixed base directories and reject `..`, absolute paths, and unexpected extensions.",
125
+ whyItMatters: "Unvalidated file paths can allow attackers to read or overwrite arbitrary files.",
126
+ standards: ["CWE-22", "OWASP:A01"]
127
+ },
128
+ {
129
+ id: "ssrf-url",
130
+ title: "Potential server-side request using untrusted URL input",
131
+ severity: "high",
132
+ confidence: "medium",
133
+ category: "Network Access",
134
+ subcategory: "SSRF",
135
+ reviewDomain: "security",
136
+ regex: /(fetch|axios|get|post|request|http\.request|https\.request)\(.{0,100}(req\.(query|body|params)|url|userInput|input)/gi,
137
+ remediation: "Validate outbound destinations against a strict allowlist and block internal address ranges.",
138
+ suggestion: "Centralize outbound HTTP through a vetted client with destination validation.",
139
+ whyItMatters: "Attacker-controlled URLs can be used to reach internal services or metadata endpoints.",
140
+ standards: ["CWE-918", "OWASP:A10"]
141
+ },
142
+ {
143
+ id: "unsafe-deserialization",
144
+ title: "Unsafe deserialization pattern",
145
+ severity: "high",
146
+ confidence: "medium",
147
+ category: "Serialization",
148
+ subcategory: "Deserialization",
149
+ reviewDomain: "security",
150
+ regex: /\b(pickle\.loads|yaml\.load\(|ObjectInputStream|BinaryFormatter|unserialize\()\b/gi,
151
+ remediation: "Use safe parsing APIs and never deserialize untrusted input into executable object graphs.",
152
+ suggestion: "Prefer JSON or schema-validated safe formats for untrusted data interchange.",
153
+ whyItMatters: "Unsafe deserialization can lead to remote code execution or privilege abuse.",
154
+ standards: ["CWE-502", "OWASP:A08"]
155
+ },
156
+ {
157
+ id: "debug-log",
158
+ title: "Verbose logging may expose sensitive data",
159
+ severity: "low",
160
+ confidence: "medium",
161
+ category: "Logging",
162
+ subcategory: "Sensitive Logging",
163
+ reviewDomain: "security",
164
+ regex: /\b(console\.log|print_r|var_dump|System\.out\.println|logger\.debug)\b/g,
165
+ remediation: "Review logs for sensitive material and gate debug logging by environment.",
166
+ suggestion: "Use structured logging with data redaction and environment-controlled verbosity.",
167
+ whyItMatters: "Verbose logs can leak credentials, tokens, or PII into log stores.",
168
+ standards: ["CWE-532", "OWASP:A09"]
169
+ },
170
+ {
171
+ id: "missing-auth-check",
172
+ title: "Sensitive route may lack an authorization guard",
173
+ severity: "high",
174
+ confidence: "low",
175
+ category: "Authorization",
176
+ subcategory: "Access Control",
177
+ reviewDomain: "security",
178
+ regex: /(router\.(get|post|put|delete)|app\.(get|post|put|delete)|@Get|@Post).{0,120}(admin|export|delete|update|account)/gi,
179
+ remediation: "Verify that sensitive routes enforce authentication and resource-level authorization.",
180
+ suggestion: "Add explicit authz middleware or decorators close to the route definition.",
181
+ whyItMatters: "Missing or inconsistent access control is a frequent cause of privilege escalation.",
182
+ standards: ["CWE-862", "OWASP:A01"]
183
+ },
184
+ {
185
+ id: "open-cors",
186
+ title: "Overly permissive CORS configuration",
187
+ severity: "medium",
188
+ confidence: "medium",
189
+ category: "Configuration",
190
+ subcategory: "CORS",
191
+ reviewDomain: "security",
192
+ regex: /(Access-Control-Allow-Origin['"]?\s*[:=]\s*['"]\*['"]|cors\(\s*\{?\s*origin:\s*['"]\*['"])/gi,
193
+ remediation: "Restrict CORS origins to trusted domains and avoid wildcard access for sensitive endpoints.",
194
+ suggestion: "Use environment-specific trusted origin lists instead of permissive defaults.",
195
+ whyItMatters: "Permissive CORS can expose sensitive APIs to unintended web origins.",
196
+ standards: ["CWE-942", "OWASP:A05"]
197
+ },
198
+ {
199
+ id: "open-redirect",
200
+ title: "Potential open redirect using untrusted input",
201
+ severity: "medium",
202
+ confidence: "medium",
203
+ category: "Validation",
204
+ subcategory: "Open Redirect",
205
+ reviewDomain: "security",
206
+ regex: /(redirect|Response\.Redirect|res\.redirect)\(.{0,100}(req\.(query|body|params)|next|redirect|returnUrl|url)/gi,
207
+ remediation: "Validate redirect destinations against a strict allowlist or restrict redirects to relative internal paths.",
208
+ suggestion: "Normalize redirect targets and reject external or attacker-controlled URLs.",
209
+ whyItMatters: "Open redirects can be abused in phishing flows or chained with other attacks.",
210
+ standards: ["CWE-601", "OWASP:A01"]
211
+ },
212
+ {
213
+ id: "cookie-insecure",
214
+ title: "Session cookie appears to disable secure attributes",
215
+ severity: "high",
216
+ confidence: "medium",
217
+ category: "Session Management",
218
+ subcategory: "Cookie Security",
219
+ reviewDomain: "security",
220
+ regex: /(httpOnly\s*:\s*false|secure\s*:\s*false|sameSite\s*:\s*false|SameSite=None(?!; Secure))/gi,
221
+ remediation: "Enable HttpOnly, Secure, and an appropriate SameSite policy for sensitive cookies.",
222
+ suggestion: "Centralize session cookie defaults and make secure flags the default baseline.",
223
+ whyItMatters: "Weak cookie flags increase the risk of session theft, CSRF abuse, and client-side access to session data.",
224
+ standards: ["CWE-614", "OWASP:A07"]
225
+ },
226
+ {
227
+ id: "csrf-risk",
228
+ title: "State-changing endpoint may be missing CSRF protections",
229
+ severity: "medium",
230
+ confidence: "low",
231
+ category: "Session Management",
232
+ subcategory: "CSRF",
233
+ reviewDomain: "security",
234
+ regex: /(router\.(post|put|patch|delete)|app\.(post|put|patch|delete)|@Post|@Put|@Delete).{0,160}(cookie|session|csrf|auth)/gi,
235
+ remediation: "Verify anti-CSRF protections for cookie-based authenticated state-changing requests.",
236
+ suggestion: "Add CSRF tokens, SameSite protections, or stateless auth patterns where appropriate.",
237
+ whyItMatters: "Cookie-authenticated write endpoints are often exposed to CSRF if no explicit protection exists.",
238
+ standards: ["CWE-352", "OWASP:A01"]
239
+ },
240
+ {
241
+ id: "file-upload-any",
242
+ title: "File upload handler may lack validation limits",
243
+ severity: "medium",
244
+ confidence: "medium",
245
+ category: "File Handling",
246
+ subcategory: "Upload Validation",
247
+ reviewDomain: "security",
248
+ regex: /\b(upload\.any\(|multer\(\)|request\.files|req\.files|IFormFile|MultipartFile)\b/gi,
249
+ remediation: "Validate file type, size, storage path, and scanning requirements for uploads.",
250
+ suggestion: "Use explicit upload allowlists and enforce storage and content validation before processing.",
251
+ whyItMatters: "Unrestricted file upload paths can lead to malware upload, storage abuse, or unsafe file processing.",
252
+ standards: ["CWE-434", "OWASP:A05"]
253
+ },
254
+ {
255
+ id: "redos-risk",
256
+ title: "Regular expression may be vulnerable to catastrophic backtracking",
257
+ severity: "medium",
258
+ confidence: "low",
259
+ category: "Validation",
260
+ subcategory: "ReDoS",
261
+ reviewDomain: "security",
262
+ regex: /\/(\([^/]*[+*][^/]*\))[+*][^/]*\//g,
263
+ remediation: "Review the expression for nested quantifiers and use bounded or linear-time patterns.",
264
+ suggestion: "Prefer simpler regexes, input length limits, or safer parsers on untrusted input paths.",
265
+ whyItMatters: "Catastrophic backtracking can create denial-of-service conditions on crafted input.",
266
+ standards: ["CWE-1333", "OWASP:A10"]
267
+ },
268
+ {
269
+ id: "unsafe-redirect-param",
270
+ title: "Redirect or return URL parameter detected",
271
+ severity: "low",
272
+ confidence: "low",
273
+ category: "Validation",
274
+ subcategory: "Redirect Flow",
275
+ reviewDomain: "security",
276
+ regex: /\b(returnUrl|redirectUri|redirect_url|nextUrl|continueUrl)\b/g,
277
+ remediation: "Review redirect parameters and validate them against trusted application routes.",
278
+ suggestion: "Model redirect state with opaque route identifiers rather than raw URLs.",
279
+ whyItMatters: "Redirect parameters are a common source of open redirect and login flow abuse.",
280
+ standards: ["Review Heuristic"]
281
+ },
282
+ {
283
+ id: "todo-security",
284
+ title: "Security-sensitive TODO or FIXME marker",
285
+ severity: "low",
286
+ confidence: "medium",
287
+ category: "Maintainability",
288
+ subcategory: "Deferred Security Work",
289
+ reviewDomain: "maintainability",
290
+ regex: /\b(TODO|FIXME|HACK|TEMP)\b.{0,80}(auth|security|token|password|sanitize|validate|encrypt)/gi,
291
+ remediation: "Resolve or track the deferred security-sensitive work before release.",
292
+ suggestion: "Convert critical TODOs into tickets with owners and release blocking decisions.",
293
+ whyItMatters: "Deferred security work often becomes permanent production risk.",
294
+ standards: ["Internal Review"]
295
+ },
296
+ {
297
+ id: "deprecated-request-lib",
298
+ title: "Deprecated or risky library usage pattern",
299
+ severity: "medium",
300
+ confidence: "medium",
301
+ category: "Outdated Practices",
302
+ subcategory: "Deprecated Dependency Pattern",
303
+ reviewDomain: "outdated-practices",
304
+ regex: /\brequire\(['"]request['"]\)|from ['"]request['"]/g,
305
+ remediation: "Replace deprecated libraries with supported alternatives and review their security posture.",
306
+ suggestion: "Migrate to maintained HTTP client libraries and update surrounding error handling.",
307
+ whyItMatters: "Deprecated dependencies often miss security fixes and drag outdated patterns into the codebase.",
308
+ standards: ["Maintenance"]
309
+ },
310
+ {
311
+ id: "broad-catch",
312
+ title: "Broad exception handling without meaningful action",
313
+ severity: "medium",
314
+ confidence: "medium",
315
+ category: "Reliability",
316
+ subcategory: "Error Handling",
317
+ reviewDomain: "reliability",
318
+ regex: /(catch\s*\(\s*[a-zA-Z_][a-zA-Z0-9_]*\s*\)\s*\{\s*(return|null|pass|\/\/|$)|except\s+Exception\s*:\s*(pass|return))/gmi,
319
+ remediation: "Handle expected errors explicitly and log or surface unexpected failures.",
320
+ suggestion: "Catch narrower exception types and preserve actionable failure context.",
321
+ whyItMatters: "Broad catch blocks can hide broken behavior and make incident response difficult.",
322
+ standards: ["Reliability Review"]
323
+ },
324
+ {
325
+ id: "silent-promise",
326
+ title: "Promise chain may suppress failures",
327
+ severity: "medium",
328
+ confidence: "medium",
329
+ category: "Reliability",
330
+ subcategory: "Async Error Handling",
331
+ reviewDomain: "reliability",
332
+ regex: /\.catch\s*\(\s*\(\s*\)\s*=>\s*\{\s*\}\s*\)|\.catch\s*\(\s*console\.log\s*\)/g,
333
+ remediation: "Handle promise failures explicitly and preserve enough context for debugging or recovery.",
334
+ suggestion: "Propagate or log actionable errors instead of swallowing them in empty catch handlers.",
335
+ whyItMatters: "Suppressed async failures can create data loss, silent corruption, or missing alerts.",
336
+ standards: ["Reliability Review"]
337
+ },
338
+ {
339
+ id: "missing-timeout",
340
+ title: "Outbound network call may lack a timeout",
341
+ severity: "medium",
342
+ confidence: "low",
343
+ category: "Reliability",
344
+ subcategory: "Timeout Handling",
345
+ reviewDomain: "reliability",
346
+ regex: /(fetch|axios\.get|axios\.post|requests\.(get|post)|http\.request|https\.request)\(/gi,
347
+ remediation: "Set explicit timeouts and failure handling for outbound network dependencies.",
348
+ suggestion: "Wrap remote calls in a helper that enforces timeouts, retries, and circuit-breaking rules.",
349
+ whyItMatters: "Unbounded waits on remote calls can degrade throughput and make failures cascade.",
350
+ standards: ["Reliability Review"]
351
+ },
352
+ {
353
+ id: "blocking-io",
354
+ title: "Blocking synchronous I/O on an application path",
355
+ severity: "medium",
356
+ confidence: "medium",
357
+ category: "Performance",
358
+ subcategory: "Blocking Operation",
359
+ reviewDomain: "performance",
360
+ regex: /\b(readFileSync|writeFileSync|execSync|spawnSync)\b/g,
361
+ remediation: "Prefer async I/O for request-handling or interactive code paths.",
362
+ suggestion: "Move heavy or blocking work off the main execution path.",
363
+ whyItMatters: "Blocking operations reduce throughput and can amplify latency under load.",
364
+ standards: ["Performance Review"]
365
+ },
366
+ {
367
+ id: "n-plus-one-heuristic",
368
+ title: "Loop may trigger repeated database or network access",
369
+ severity: "medium",
370
+ confidence: "low",
371
+ category: "Performance",
372
+ subcategory: "Repeated I/O",
373
+ reviewDomain: "performance",
374
+ regex: /(for\s*\(|forEach\s*\(|while\s*\().{0,220}(find\(|select\(|query\(|fetch\(|axios\.|requests\.)/gis,
375
+ remediation: "Batch related queries or requests outside loops where possible.",
376
+ suggestion: "Review the loop for N+1 behavior and add caching or prefetching if needed.",
377
+ whyItMatters: "Repeated I/O in loops can create severe latency and database pressure in production.",
378
+ standards: ["Performance Review"]
379
+ },
380
+ {
381
+ id: "inefficient-render-map-key",
382
+ title: "Frontend list rendering may be using unstable keys",
383
+ severity: "low",
384
+ confidence: "medium",
385
+ category: "Frontend",
386
+ subcategory: "Rendering Stability",
387
+ reviewDomain: "quality",
388
+ regex: /key=\{(index|i)\}/g,
389
+ remediation: "Use stable domain identifiers for list keys rather than indexes.",
390
+ suggestion: "Prefer persistent IDs from the data model to reduce render bugs and stale state.",
391
+ whyItMatters: "Unstable keys can produce rendering glitches, stale state, and hard-to-trace UI bugs.",
392
+ standards: ["Frontend Review"]
393
+ },
394
+ {
395
+ id: "accessibility-click-only",
396
+ title: "Interactive element may be missing keyboard semantics",
397
+ severity: "low",
398
+ confidence: "medium",
399
+ category: "Frontend",
400
+ subcategory: "Accessibility",
401
+ reviewDomain: "quality",
402
+ regex: /<(div|span)[^>]+onClick=/g,
403
+ remediation: "Use semantic interactive elements or add keyboard handlers and accessibility roles.",
404
+ suggestion: "Prefer buttons and links over generic clickable containers.",
405
+ whyItMatters: "Non-semantic interactivity often creates keyboard and assistive technology issues.",
406
+ standards: ["Accessibility Review"]
407
+ },
408
+ {
409
+ id: "nested-complexity",
410
+ title: "Deeply nested control flow may be hard to maintain",
411
+ severity: "low",
412
+ confidence: "low",
413
+ category: "Code Quality",
414
+ subcategory: "Complexity",
415
+ reviewDomain: "quality",
416
+ regex: /(if\s*\([^\n]+\)\s*\{[\s\S]{0,200}if\s*\([^\n]+\)\s*\{[\s\S]{0,200}if\s*\([^\n]+\))/g,
417
+ remediation: "Simplify control flow, extract helpers, and use guard clauses.",
418
+ suggestion: "Refactor nested logic into smaller units with explicit responsibilities.",
419
+ whyItMatters: "Highly nested logic is harder to test, review, and secure correctly.",
420
+ standards: ["Maintainability Review"]
421
+ },
422
+ {
423
+ id: "large-function",
424
+ title: "Long function may be difficult to review and maintain",
425
+ severity: "low",
426
+ confidence: "low",
427
+ category: "Maintainability",
428
+ subcategory: "Large Unit",
429
+ reviewDomain: "maintainability",
430
+ regex: /(function\s+[a-zA-Z0-9_]+\s*\([^)]*\)\s*\{[\s\S]{800,}|def\s+[a-zA-Z0-9_]+\s*\([^)]*\)\s*:[\s\S]{800,})/g,
431
+ remediation: "Break large routines into smaller focused units with clearer responsibilities.",
432
+ suggestion: "Extract validation, transformation, and side-effect code into named helpers.",
433
+ whyItMatters: "Large functions are harder to reason about, test, and secure correctly.",
434
+ standards: ["Maintainability Review"]
435
+ },
436
+ {
437
+ id: "magic-number-threshold",
438
+ title: "Repeated magic numeric literals detected",
439
+ severity: "low",
440
+ confidence: "low",
441
+ category: "Code Quality",
442
+ subcategory: "Magic Values",
443
+ reviewDomain: "quality",
444
+ regex: /(^|[^\w])(86400|3600|1000|9999|65535)([^\w]|$)/g,
445
+ remediation: "Replace unexplained numeric literals with named constants or configuration values.",
446
+ suggestion: "Document the meaning of thresholds, limits, and protocol values explicitly.",
447
+ whyItMatters: "Magic values make correctness and policy reasoning harder during maintenance.",
448
+ standards: ["Code Quality Review"]
449
+ },
450
+ {
451
+ id: "missing-tests-heuristic",
452
+ title: "Critical module may lack nearby automated tests",
453
+ severity: "medium",
454
+ confidence: "low",
455
+ category: "Testing",
456
+ subcategory: "Coverage Gap",
457
+ reviewDomain: "testing",
458
+ regex: /\b(auth|authorize|token|password|payment|transfer|admin)\b/gi,
459
+ remediation: "Add focused tests for sensitive logic and failure paths.",
460
+ suggestion: "Cover authn/authz, input validation, and error paths with regression tests.",
461
+ whyItMatters: "Sensitive code without tests is more likely to regress in security or correctness.",
462
+ standards: ["Quality Review"],
463
+ heuristic: "needs-test-correlation"
464
+ },
465
+ {
466
+ id: "deprecated-react-pattern",
467
+ title: "Legacy React pattern detected",
468
+ severity: "low",
469
+ confidence: "medium",
470
+ category: "Outdated Practices",
471
+ subcategory: "Legacy Framework Pattern",
472
+ reviewDomain: "outdated-practices",
473
+ regex: /\bcomponentWillMount\b|\bcomponentWillReceiveProps\b|\bcomponentWillUpdate\b/g,
474
+ remediation: "Migrate deprecated lifecycle patterns to modern React alternatives.",
475
+ suggestion: "Refactor toward effects, derived state cleanup, or modern lifecycle-safe patterns.",
476
+ whyItMatters: "Deprecated framework APIs increase upgrade friction and often encode unsafe legacy behavior.",
477
+ standards: ["Modernization Review"]
478
+ },
479
+ {
480
+ id: "python-subprocess-shell",
481
+ title: "Python subprocess uses shell=True",
482
+ severity: "high",
483
+ confidence: "high",
484
+ category: "Code Execution",
485
+ subcategory: "Shell Invocation",
486
+ reviewDomain: "security",
487
+ regex: /\bsubprocess\.(run|Popen|call|check_output)\([^)]*shell\s*=\s*True/gi,
488
+ remediation: "Avoid shell=True where possible and pass explicit argument arrays instead.",
489
+ suggestion: "Call subprocesses with validated argument lists and strict allowlisting.",
490
+ whyItMatters: "Shell execution expands the attack surface for command injection and quoting bugs.",
491
+ standards: ["CWE-78", "OWASP:A03"]
492
+ }
493
+ ];
494
+
495
+ module.exports = {
496
+ STATIC_RULES
497
+ };