@triedotdev/mcp 1.0.169 → 1.0.170

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.
Files changed (145) hide show
  1. package/README.md +54 -545
  2. package/dist/chunk-2YXOBNKW.js +619 -0
  3. package/dist/chunk-2YXOBNKW.js.map +1 -0
  4. package/dist/chunk-QR64Y5TI.js +363 -0
  5. package/dist/chunk-QR64Y5TI.js.map +1 -0
  6. package/dist/cli/main.d.ts +0 -15
  7. package/dist/cli/main.js +356 -3098
  8. package/dist/cli/main.js.map +1 -1
  9. package/dist/index.js +2 -34
  10. package/dist/index.js.map +1 -1
  11. package/dist/server/mcp-server.js +2 -34
  12. package/package.json +8 -31
  13. package/dist/autonomy-config-FSERX3O3.js +0 -30
  14. package/dist/autonomy-config-FSERX3O3.js.map +0 -1
  15. package/dist/chat-store-JNGNTDSN.js +0 -15
  16. package/dist/chat-store-JNGNTDSN.js.map +0 -1
  17. package/dist/chunk-2HF65EHQ.js +0 -311
  18. package/dist/chunk-2HF65EHQ.js.map +0 -1
  19. package/dist/chunk-3XR6WVAW.js +0 -4011
  20. package/dist/chunk-3XR6WVAW.js.map +0 -1
  21. package/dist/chunk-43X6JBEM.js +0 -36
  22. package/dist/chunk-43X6JBEM.js.map +0 -1
  23. package/dist/chunk-6NLHFIYA.js +0 -344
  24. package/dist/chunk-6NLHFIYA.js.map +0 -1
  25. package/dist/chunk-7IO4YUI3.js +0 -1827
  26. package/dist/chunk-7IO4YUI3.js.map +0 -1
  27. package/dist/chunk-AHD2CBQ7.js +0 -846
  28. package/dist/chunk-AHD2CBQ7.js.map +0 -1
  29. package/dist/chunk-BUTOP5EB.js +0 -931
  30. package/dist/chunk-BUTOP5EB.js.map +0 -1
  31. package/dist/chunk-DGUM43GV.js +0 -11
  32. package/dist/chunk-DGUM43GV.js.map +0 -1
  33. package/dist/chunk-EFWVF6TI.js +0 -267
  34. package/dist/chunk-EFWVF6TI.js.map +0 -1
  35. package/dist/chunk-F6WFNUAY.js +0 -216
  36. package/dist/chunk-F6WFNUAY.js.map +0 -1
  37. package/dist/chunk-FBNURWRY.js +0 -662
  38. package/dist/chunk-FBNURWRY.js.map +0 -1
  39. package/dist/chunk-FQ45QP5A.js +0 -361
  40. package/dist/chunk-FQ45QP5A.js.map +0 -1
  41. package/dist/chunk-FVRO5RN3.js +0 -1306
  42. package/dist/chunk-FVRO5RN3.js.map +0 -1
  43. package/dist/chunk-G2TGF6TR.js +0 -573
  44. package/dist/chunk-G2TGF6TR.js.map +0 -1
  45. package/dist/chunk-G3I7SZLW.js +0 -354
  46. package/dist/chunk-G3I7SZLW.js.map +0 -1
  47. package/dist/chunk-GTKYBOXL.js +0 -700
  48. package/dist/chunk-GTKYBOXL.js.map +0 -1
  49. package/dist/chunk-HVCDY3AK.js +0 -850
  50. package/dist/chunk-HVCDY3AK.js.map +0 -1
  51. package/dist/chunk-I2O5OYQT.js +0 -727
  52. package/dist/chunk-I2O5OYQT.js.map +0 -1
  53. package/dist/chunk-JVMBCWKS.js +0 -348
  54. package/dist/chunk-JVMBCWKS.js.map +0 -1
  55. package/dist/chunk-KCUOWRPX.js +0 -816
  56. package/dist/chunk-KCUOWRPX.js.map +0 -1
  57. package/dist/chunk-KDHN2ZQE.js +0 -313
  58. package/dist/chunk-KDHN2ZQE.js.map +0 -1
  59. package/dist/chunk-ME2OERF5.js +0 -345
  60. package/dist/chunk-ME2OERF5.js.map +0 -1
  61. package/dist/chunk-OBQ74FOU.js +0 -27
  62. package/dist/chunk-OBQ74FOU.js.map +0 -1
  63. package/dist/chunk-Q5EKA5YA.js +0 -254
  64. package/dist/chunk-Q5EKA5YA.js.map +0 -1
  65. package/dist/chunk-Q63FFI6D.js +0 -132
  66. package/dist/chunk-Q63FFI6D.js.map +0 -1
  67. package/dist/chunk-SASNMSB5.js +0 -12597
  68. package/dist/chunk-SASNMSB5.js.map +0 -1
  69. package/dist/chunk-T63OHG4Q.js +0 -440
  70. package/dist/chunk-T63OHG4Q.js.map +0 -1
  71. package/dist/chunk-TN5WEKWI.js +0 -173
  72. package/dist/chunk-TN5WEKWI.js.map +0 -1
  73. package/dist/chunk-VUL52BQL.js +0 -402
  74. package/dist/chunk-VUL52BQL.js.map +0 -1
  75. package/dist/chunk-VVITXIHN.js +0 -189
  76. package/dist/chunk-VVITXIHN.js.map +0 -1
  77. package/dist/chunk-WCN7S3EI.js +0 -14
  78. package/dist/chunk-WCN7S3EI.js.map +0 -1
  79. package/dist/chunk-XPZZFPBZ.js +0 -491
  80. package/dist/chunk-XPZZFPBZ.js.map +0 -1
  81. package/dist/chunk-ZJF5FTBX.js +0 -1396
  82. package/dist/chunk-ZJF5FTBX.js.map +0 -1
  83. package/dist/chunk-ZV2K6M7T.js +0 -74
  84. package/dist/chunk-ZV2K6M7T.js.map +0 -1
  85. package/dist/cli/create-agent.d.ts +0 -1
  86. package/dist/cli/create-agent.js +0 -1050
  87. package/dist/cli/create-agent.js.map +0 -1
  88. package/dist/cli/yolo-daemon.d.ts +0 -1
  89. package/dist/cli/yolo-daemon.js +0 -421
  90. package/dist/cli/yolo-daemon.js.map +0 -1
  91. package/dist/client-NJPZE5JT.js +0 -28
  92. package/dist/client-NJPZE5JT.js.map +0 -1
  93. package/dist/codebase-index-VAPF32XX.js +0 -12
  94. package/dist/codebase-index-VAPF32XX.js.map +0 -1
  95. package/dist/fast-analyzer-3GCCZMLK.js +0 -216
  96. package/dist/fast-analyzer-3GCCZMLK.js.map +0 -1
  97. package/dist/git-EO5SRFMN.js +0 -28
  98. package/dist/git-EO5SRFMN.js.map +0 -1
  99. package/dist/github-ingester-ZOKK6GRS.js +0 -11
  100. package/dist/github-ingester-ZOKK6GRS.js.map +0 -1
  101. package/dist/goal-manager-QUKX2W6C.js +0 -25
  102. package/dist/goal-manager-QUKX2W6C.js.map +0 -1
  103. package/dist/goal-validator-2SFSKKVU.js +0 -24
  104. package/dist/goal-validator-2SFSKKVU.js.map +0 -1
  105. package/dist/graph-B3NA4S7I.js +0 -10
  106. package/dist/graph-B3NA4S7I.js.map +0 -1
  107. package/dist/hypothesis-KCPBR652.js +0 -23
  108. package/dist/hypothesis-KCPBR652.js.map +0 -1
  109. package/dist/incident-index-EFNUSGWL.js +0 -11
  110. package/dist/incident-index-EFNUSGWL.js.map +0 -1
  111. package/dist/insight-store-EC4PLSAW.js +0 -22
  112. package/dist/insight-store-EC4PLSAW.js.map +0 -1
  113. package/dist/issue-store-YAXTNRRY.js +0 -36
  114. package/dist/issue-store-YAXTNRRY.js.map +0 -1
  115. package/dist/ledger-TWZTGDFA.js +0 -58
  116. package/dist/ledger-TWZTGDFA.js.map +0 -1
  117. package/dist/linear-ingester-XXPAZZRW.js +0 -11
  118. package/dist/linear-ingester-XXPAZZRW.js.map +0 -1
  119. package/dist/output-manager-RVJ37XKA.js +0 -13
  120. package/dist/output-manager-RVJ37XKA.js.map +0 -1
  121. package/dist/parse-goal-violation-SACGFG3C.js +0 -8
  122. package/dist/parse-goal-violation-SACGFG3C.js.map +0 -1
  123. package/dist/pattern-discovery-F7LU5K6E.js +0 -8
  124. package/dist/pattern-discovery-F7LU5K6E.js.map +0 -1
  125. package/dist/progress-SRQ2V3BP.js +0 -18
  126. package/dist/progress-SRQ2V3BP.js.map +0 -1
  127. package/dist/project-state-AHPA77SM.js +0 -28
  128. package/dist/project-state-AHPA77SM.js.map +0 -1
  129. package/dist/sync-M2FSWPBC.js +0 -12
  130. package/dist/sync-M2FSWPBC.js.map +0 -1
  131. package/dist/terminal-spawn-5YXDMUCF.js +0 -157
  132. package/dist/terminal-spawn-5YXDMUCF.js.map +0 -1
  133. package/dist/tiered-storage-DYNC5CQ6.js +0 -13
  134. package/dist/tiered-storage-DYNC5CQ6.js.map +0 -1
  135. package/dist/trie-agent-I3HAHY2G.js +0 -26
  136. package/dist/trie-agent-I3HAHY2G.js.map +0 -1
  137. package/dist/ui/chat.html +0 -1014
  138. package/dist/ui/goals.html +0 -967
  139. package/dist/ui/hypotheses.html +0 -1011
  140. package/dist/ui/ledger.html +0 -954
  141. package/dist/ui/nudges.html +0 -995
  142. package/dist/vibe-code-signatures-5ZULYP3D.js +0 -987
  143. package/dist/vibe-code-signatures-5ZULYP3D.js.map +0 -1
  144. package/dist/vulnerability-signatures-2URZSXAQ.js +0 -983
  145. package/dist/vulnerability-signatures-2URZSXAQ.js.map +0 -1
@@ -1,983 +0,0 @@
1
- import {
2
- AhoCorasick
3
- } from "./chunk-6NLHFIYA.js";
4
- import {
5
- isInteractiveMode
6
- } from "./chunk-KDHN2ZQE.js";
7
- import "./chunk-DGUM43GV.js";
8
-
9
- // src/trie/vulnerability-signatures.ts
10
- var ALWAYS_EXCLUDED_FILES = [
11
- /vulnerability-signatures\.[jt]s$/,
12
- // CRITICAL: Never scan ourselves!
13
- /vibe-code-signatures\.[jt]s$/,
14
- // Never scan signature files
15
- /legal\.[jt]s$/,
16
- // Legal skill contains detection patterns
17
- /security-scanner\.[jt]s$/,
18
- // Security scanner contains patterns
19
- /agent-smith\.[jt]s$/,
20
- // Agent Smith contains patterns
21
- /security\.[jt]s$/,
22
- // Security skill
23
- /privacy\.[jt]s$/,
24
- // Privacy skill
25
- /soc2\.[jt]s$/,
26
- // SOC2 skill
27
- /skills[\/\\]built-in[\/\\]/,
28
- // Never scan Trie's own skill implementations
29
- /skills[\/\\].*\.[jt]s$/,
30
- // Never scan any skills directory
31
- /trie-agents?[\/\\]src[\/\\]/,
32
- // Never scan Trie's source when installed as dependency
33
- /trie-agents?[\/\\]dist[\/\\]/,
34
- // Never scan Trie's dist when installed
35
- /package-lock\.json$/,
36
- // Lock files
37
- /yarn\.lock$/,
38
- /pnpm-lock\.yaml$/,
39
- /node_modules[\/\\]/,
40
- // Dependencies
41
- /\.d\.ts$/,
42
- // Type definitions
43
- /\.min\.[jt]s$/,
44
- // Minified files
45
- /dist[\/\\]/,
46
- // Build output
47
- /build[\/\\]/
48
- ];
49
- var EXCLUDED_FILE_PATTERNS = [
50
- /\.test\.[jt]sx?$/,
51
- // Test files
52
- /\.spec\.[jt]sx?$/,
53
- // Spec files
54
- /__tests__\//,
55
- // Test directories
56
- /\/test\//,
57
- // test/ directory
58
- /\/tests\//,
59
- // tests/ directory
60
- /\.stories\.[jt]sx?$/,
61
- // Storybook files
62
- /\.config\.[jt]s$/,
63
- // Config files
64
- /example/i,
65
- // Example files
66
- /demo/i,
67
- // Demo files
68
- /fixture/i,
69
- // Test fixtures
70
- /mock/i
71
- // Mock files
72
- ];
73
- function shouldAlwaysExcludeFile(filePath) {
74
- const normalizedPath = filePath.replace(/\\/g, "/");
75
- if (ALWAYS_EXCLUDED_FILES.some((pattern) => pattern.test(normalizedPath))) {
76
- return true;
77
- }
78
- if (normalizedPath.includes("trie") && normalizedPath.includes("/src/")) {
79
- return true;
80
- }
81
- const fileName = normalizedPath.split("/").pop() || "";
82
- const TRIE_SCANNER_FILES = [
83
- "vulnerability-signatures.ts",
84
- "vulnerability-signatures.js",
85
- "vibe-code-signatures.ts",
86
- "vibe-code-signatures.js",
87
- "legal.ts",
88
- "legal.js",
89
- "security-scanner.ts",
90
- "security-scanner.js",
91
- "agent-smith.ts",
92
- "agent-smith.js",
93
- "security.ts",
94
- "security.js",
95
- "privacy.ts",
96
- "privacy.js",
97
- "soc2.ts",
98
- "soc2.js"
99
- ];
100
- if (TRIE_SCANNER_FILES.includes(fileName)) {
101
- if (normalizedPath.includes("/skills/") || normalizedPath.includes("/trie/")) {
102
- return true;
103
- }
104
- }
105
- return false;
106
- }
107
- function shouldExcludeFile(filePath, patternCategory) {
108
- if (shouldAlwaysExcludeFile(filePath)) {
109
- return true;
110
- }
111
- if (patternCategory === "secrets" || patternCategory === "exposed-secrets") {
112
- return false;
113
- }
114
- return EXCLUDED_FILE_PATTERNS.some((pattern) => pattern.test(filePath));
115
- }
116
- var SQL_CONTEXT_KEYWORDS = [
117
- "SELECT",
118
- "INSERT",
119
- "UPDATE",
120
- "DELETE",
121
- "FROM",
122
- "WHERE",
123
- "JOIN",
124
- "query",
125
- "execute",
126
- "sql",
127
- "prisma",
128
- "knex",
129
- "sequelize",
130
- "createQueryBuilder",
131
- "rawQuery",
132
- ".raw("
133
- ];
134
- function isInSQLContext(line, surroundingLines) {
135
- const allContent = [line, ...surroundingLines].join(" ").toLowerCase();
136
- return SQL_CONTEXT_KEYWORDS.some(
137
- (keyword) => allContent.includes(keyword.toLowerCase())
138
- );
139
- }
140
- var VULNERABILITY_PATTERNS = [
141
- // ============================================
142
- // CRITICAL: Injection vulnerabilities
143
- // ============================================
144
- {
145
- pattern: "eval(",
146
- metadata: {
147
- type: "vulnerability",
148
- severity: "critical",
149
- category: "injection",
150
- description: "eval() can execute arbitrary code - potential RCE",
151
- cwe: "CWE-95",
152
- fix: "Use safer alternatives like JSON.parse() or a sandboxed interpreter"
153
- }
154
- },
155
- {
156
- pattern: "new Function(",
157
- metadata: {
158
- type: "vulnerability",
159
- severity: "critical",
160
- category: "injection",
161
- description: "new Function() can execute arbitrary code",
162
- cwe: "CWE-95",
163
- fix: "Avoid dynamic function creation from user input"
164
- }
165
- },
166
- {
167
- pattern: "exec(",
168
- metadata: {
169
- type: "vulnerability",
170
- severity: "critical",
171
- category: "injection",
172
- description: "Command execution - potential command injection",
173
- cwe: "CWE-78",
174
- fix: "Use parameterized commands and validate/sanitize all inputs"
175
- }
176
- },
177
- {
178
- pattern: "execSync(",
179
- metadata: {
180
- type: "vulnerability",
181
- severity: "critical",
182
- category: "injection",
183
- description: "Synchronous command execution - potential injection",
184
- cwe: "CWE-78",
185
- fix: "Use spawn with argument arrays instead of shell strings"
186
- }
187
- },
188
- {
189
- pattern: "spawn(",
190
- metadata: {
191
- type: "vulnerability",
192
- severity: "serious",
193
- category: "injection",
194
- description: "Process spawn - verify inputs are sanitized",
195
- cwe: "CWE-78",
196
- fix: "Use shell: false and pass arguments as array"
197
- }
198
- },
199
- {
200
- pattern: "child_process",
201
- metadata: {
202
- type: "vulnerability",
203
- severity: "serious",
204
- category: "injection",
205
- description: "Child process module - review for command injection",
206
- cwe: "CWE-78",
207
- fix: "Validate all inputs passed to child processes"
208
- }
209
- },
210
- // ============================================
211
- // CRITICAL: SQL Injection patterns
212
- // NOTE: ${} is NOT flagged here - we check SQL context in isFalsePositive
213
- // ============================================
214
- {
215
- pattern: "SELECT * FROM",
216
- metadata: {
217
- type: "vulnerability",
218
- severity: "moderate",
219
- category: "sql-injection",
220
- description: "Raw SQL query detected - verify parameterization",
221
- cwe: "CWE-89",
222
- fix: "Use ORM or parameterized queries"
223
- }
224
- },
225
- {
226
- pattern: "INSERT INTO",
227
- metadata: {
228
- type: "vulnerability",
229
- severity: "moderate",
230
- category: "sql-injection",
231
- description: "Raw SQL INSERT - verify parameterization",
232
- cwe: "CWE-89",
233
- fix: "Use parameterized queries"
234
- }
235
- },
236
- {
237
- pattern: "DELETE FROM",
238
- metadata: {
239
- type: "vulnerability",
240
- severity: "moderate",
241
- category: "sql-injection",
242
- description: "Raw SQL DELETE - verify parameterization",
243
- cwe: "CWE-89",
244
- fix: "Use parameterized queries"
245
- }
246
- },
247
- {
248
- pattern: ".raw(`",
249
- metadata: {
250
- type: "vulnerability",
251
- severity: "serious",
252
- category: "sql-injection",
253
- description: "Raw query with template literal - high injection risk",
254
- cwe: "CWE-89",
255
- fix: "Avoid raw queries with interpolation or use proper escaping"
256
- }
257
- },
258
- {
259
- pattern: ".raw('",
260
- metadata: {
261
- type: "vulnerability",
262
- severity: "moderate",
263
- category: "sql-injection",
264
- description: "Raw query method - verify for injection risk",
265
- cwe: "CWE-89",
266
- fix: "Use parameterized queries instead of raw SQL"
267
- }
268
- },
269
- {
270
- pattern: '.raw("',
271
- metadata: {
272
- type: "vulnerability",
273
- severity: "moderate",
274
- category: "sql-injection",
275
- description: "Raw query method - verify for injection risk",
276
- cwe: "CWE-89",
277
- fix: "Use parameterized queries instead of raw SQL"
278
- }
279
- },
280
- {
281
- pattern: "`SELECT",
282
- metadata: {
283
- type: "vulnerability",
284
- severity: "serious",
285
- category: "sql-injection",
286
- description: "SQL in template literal - check for injection",
287
- cwe: "CWE-89",
288
- fix: "Use parameterized queries with placeholders"
289
- }
290
- },
291
- {
292
- pattern: "`INSERT",
293
- metadata: {
294
- type: "vulnerability",
295
- severity: "serious",
296
- category: "sql-injection",
297
- description: "SQL INSERT in template literal - check for injection",
298
- cwe: "CWE-89",
299
- fix: "Use parameterized queries with placeholders"
300
- }
301
- },
302
- {
303
- pattern: "`UPDATE",
304
- metadata: {
305
- type: "vulnerability",
306
- severity: "serious",
307
- category: "sql-injection",
308
- description: "SQL UPDATE in template literal - check for injection",
309
- cwe: "CWE-89",
310
- fix: "Use parameterized queries with placeholders"
311
- }
312
- },
313
- {
314
- pattern: "`DELETE",
315
- metadata: {
316
- type: "vulnerability",
317
- severity: "serious",
318
- category: "sql-injection",
319
- description: "SQL DELETE in template literal - check for injection",
320
- cwe: "CWE-89",
321
- fix: "Use parameterized queries with placeholders"
322
- }
323
- },
324
- // ============================================
325
- // CRITICAL: XSS vulnerabilities
326
- // ============================================
327
- {
328
- pattern: "innerHTML",
329
- metadata: {
330
- type: "vulnerability",
331
- severity: "serious",
332
- category: "xss",
333
- description: "innerHTML can inject malicious scripts",
334
- cwe: "CWE-79",
335
- fix: "Use textContent or sanitize HTML with DOMPurify"
336
- }
337
- },
338
- {
339
- pattern: "outerHTML",
340
- metadata: {
341
- type: "vulnerability",
342
- severity: "serious",
343
- category: "xss",
344
- description: "outerHTML can inject malicious scripts",
345
- cwe: "CWE-79",
346
- fix: "Avoid outerHTML with user input"
347
- }
348
- },
349
- {
350
- pattern: "document.write",
351
- metadata: {
352
- type: "vulnerability",
353
- severity: "serious",
354
- category: "xss",
355
- description: "document.write can inject malicious content",
356
- cwe: "CWE-79",
357
- fix: "Use DOM methods like createElement instead"
358
- }
359
- },
360
- {
361
- pattern: "dangerouslySetInnerHTML",
362
- metadata: {
363
- type: "vulnerability",
364
- severity: "serious",
365
- category: "xss",
366
- description: "React dangerouslySetInnerHTML - XSS risk",
367
- cwe: "CWE-79",
368
- fix: "Sanitize with DOMPurify before using"
369
- }
370
- },
371
- {
372
- pattern: "v-html",
373
- metadata: {
374
- type: "vulnerability",
375
- severity: "serious",
376
- category: "xss",
377
- description: "Vue v-html directive - XSS risk",
378
- cwe: "CWE-79",
379
- fix: "Sanitize content or use v-text"
380
- }
381
- },
382
- {
383
- pattern: "[innerHTML]",
384
- metadata: {
385
- type: "vulnerability",
386
- severity: "serious",
387
- category: "xss",
388
- description: "Angular innerHTML binding - XSS risk",
389
- cwe: "CWE-79",
390
- fix: "Use Angular DomSanitizer"
391
- }
392
- },
393
- // ============================================
394
- // CRITICAL: Hardcoded secrets
395
- // More specific patterns to reduce false positives
396
- // ============================================
397
- {
398
- pattern: "password = '",
399
- metadata: {
400
- type: "vulnerability",
401
- severity: "critical",
402
- category: "secrets",
403
- description: "Hardcoded password in string",
404
- cwe: "CWE-798",
405
- fix: "Use environment variables or secret management"
406
- }
407
- },
408
- {
409
- pattern: 'password = "',
410
- metadata: {
411
- type: "vulnerability",
412
- severity: "critical",
413
- category: "secrets",
414
- description: "Hardcoded password in string",
415
- cwe: "CWE-798",
416
- fix: "Use environment variables or secret management"
417
- }
418
- },
419
- {
420
- pattern: "password: '",
421
- metadata: {
422
- type: "vulnerability",
423
- severity: "critical",
424
- category: "secrets",
425
- description: "Hardcoded password in config",
426
- cwe: "CWE-798",
427
- fix: "Use environment variables or secret management"
428
- }
429
- },
430
- {
431
- pattern: 'password: "',
432
- metadata: {
433
- type: "vulnerability",
434
- severity: "critical",
435
- category: "secrets",
436
- description: "Hardcoded password in config",
437
- cwe: "CWE-798",
438
- fix: "Use environment variables or secret management"
439
- }
440
- },
441
- {
442
- pattern: "api_key = '",
443
- metadata: {
444
- type: "vulnerability",
445
- severity: "critical",
446
- category: "secrets",
447
- description: "Hardcoded API key",
448
- cwe: "CWE-798",
449
- fix: "Use environment variables"
450
- }
451
- },
452
- {
453
- pattern: 'api_key = "',
454
- metadata: {
455
- type: "vulnerability",
456
- severity: "critical",
457
- category: "secrets",
458
- description: "Hardcoded API key",
459
- cwe: "CWE-798",
460
- fix: "Use environment variables"
461
- }
462
- },
463
- {
464
- pattern: "apiKey: '",
465
- metadata: {
466
- type: "vulnerability",
467
- severity: "critical",
468
- category: "secrets",
469
- description: "Hardcoded API key in config",
470
- cwe: "CWE-798",
471
- fix: "Use environment variables"
472
- }
473
- },
474
- {
475
- pattern: 'apiKey: "',
476
- metadata: {
477
- type: "vulnerability",
478
- severity: "critical",
479
- category: "secrets",
480
- description: "Hardcoded API key in config",
481
- cwe: "CWE-798",
482
- fix: "Use environment variables"
483
- }
484
- },
485
- {
486
- pattern: "secret = '",
487
- metadata: {
488
- type: "vulnerability",
489
- severity: "critical",
490
- category: "secrets",
491
- description: "Hardcoded secret",
492
- cwe: "CWE-798",
493
- fix: "Use environment variables or secret management"
494
- }
495
- },
496
- {
497
- pattern: 'secret = "',
498
- metadata: {
499
- type: "vulnerability",
500
- severity: "critical",
501
- category: "secrets",
502
- description: "Hardcoded secret",
503
- cwe: "CWE-798",
504
- fix: "Use environment variables or secret management"
505
- }
506
- },
507
- {
508
- pattern: "AWS_SECRET_ACCESS_KEY=",
509
- metadata: {
510
- type: "vulnerability",
511
- severity: "critical",
512
- category: "secrets",
513
- description: "AWS secret key assignment",
514
- cwe: "CWE-798",
515
- fix: "Use IAM roles or AWS Secrets Manager"
516
- }
517
- },
518
- {
519
- pattern: "'Bearer ",
520
- metadata: {
521
- type: "vulnerability",
522
- severity: "serious",
523
- category: "secrets",
524
- description: "Hardcoded bearer token in string",
525
- cwe: "CWE-798",
526
- fix: "Use environment variables for tokens"
527
- }
528
- },
529
- {
530
- pattern: '"Bearer ',
531
- metadata: {
532
- type: "vulnerability",
533
- severity: "serious",
534
- category: "secrets",
535
- description: "Hardcoded bearer token in string",
536
- cwe: "CWE-798",
537
- fix: "Use environment variables for tokens"
538
- }
539
- },
540
- // ============================================
541
- // SERIOUS: Authentication issues
542
- // ============================================
543
- {
544
- pattern: "password ==",
545
- metadata: {
546
- type: "vulnerability",
547
- severity: "critical",
548
- category: "auth",
549
- description: "Plain text password comparison",
550
- cwe: "CWE-256",
551
- fix: "Use bcrypt.compare() or similar secure comparison"
552
- }
553
- },
554
- {
555
- pattern: "password ===",
556
- metadata: {
557
- type: "vulnerability",
558
- severity: "critical",
559
- category: "auth",
560
- description: "Plain text password comparison",
561
- cwe: "CWE-256",
562
- fix: "Use bcrypt.compare() or similar secure comparison"
563
- }
564
- },
565
- {
566
- pattern: "MD5(",
567
- metadata: {
568
- type: "vulnerability",
569
- severity: "serious",
570
- category: "crypto",
571
- description: "MD5 is cryptographically broken",
572
- cwe: "CWE-328",
573
- fix: "Use SHA-256 or bcrypt for passwords"
574
- }
575
- },
576
- {
577
- pattern: "md5(",
578
- metadata: {
579
- type: "vulnerability",
580
- severity: "serious",
581
- category: "crypto",
582
- description: "MD5 is cryptographically broken",
583
- cwe: "CWE-328",
584
- fix: "Use SHA-256 or bcrypt for passwords"
585
- }
586
- },
587
- {
588
- pattern: "SHA1(",
589
- metadata: {
590
- type: "vulnerability",
591
- severity: "moderate",
592
- category: "crypto",
593
- description: "SHA1 is deprecated for security use",
594
- cwe: "CWE-328",
595
- fix: "Use SHA-256 or stronger"
596
- }
597
- },
598
- {
599
- pattern: "sha1(",
600
- metadata: {
601
- type: "vulnerability",
602
- severity: "moderate",
603
- category: "crypto",
604
- description: "SHA1 is deprecated for security use",
605
- cwe: "CWE-328",
606
- fix: "Use SHA-256 or stronger"
607
- }
608
- },
609
- {
610
- pattern: "Math.random()",
611
- metadata: {
612
- type: "vulnerability",
613
- severity: "serious",
614
- category: "crypto",
615
- description: "Math.random() is not cryptographically secure",
616
- cwe: "CWE-338",
617
- fix: "Use crypto.randomBytes() or crypto.getRandomValues()"
618
- }
619
- },
620
- // ============================================
621
- // SERIOUS: Insecure configurations
622
- // ============================================
623
- {
624
- pattern: "cors: true",
625
- metadata: {
626
- type: "vulnerability",
627
- severity: "moderate",
628
- category: "config",
629
- description: "CORS enabled - verify origin restrictions",
630
- cwe: "CWE-942",
631
- fix: "Specify allowed origins explicitly"
632
- }
633
- },
634
- {
635
- pattern: "origin: '*'",
636
- metadata: {
637
- type: "vulnerability",
638
- severity: "serious",
639
- category: "config",
640
- description: "CORS allows all origins",
641
- cwe: "CWE-942",
642
- fix: "Restrict to specific trusted origins"
643
- }
644
- },
645
- {
646
- pattern: 'origin: "*"',
647
- metadata: {
648
- type: "vulnerability",
649
- severity: "serious",
650
- category: "config",
651
- description: "CORS allows all origins",
652
- cwe: "CWE-942",
653
- fix: "Restrict to specific trusted origins"
654
- }
655
- },
656
- {
657
- pattern: "secure: false",
658
- metadata: {
659
- type: "vulnerability",
660
- severity: "serious",
661
- category: "config",
662
- description: "Insecure cookie/connection setting",
663
- cwe: "CWE-614",
664
- fix: "Set secure: true in production"
665
- }
666
- },
667
- {
668
- pattern: "httpOnly: false",
669
- metadata: {
670
- type: "vulnerability",
671
- severity: "serious",
672
- category: "config",
673
- description: "Cookie accessible to JavaScript",
674
- cwe: "CWE-1004",
675
- fix: "Set httpOnly: true to prevent XSS cookie theft"
676
- }
677
- },
678
- {
679
- pattern: "rejectUnauthorized: false",
680
- metadata: {
681
- type: "vulnerability",
682
- severity: "critical",
683
- category: "config",
684
- description: "TLS certificate validation disabled",
685
- cwe: "CWE-295",
686
- fix: "Enable certificate validation in production"
687
- }
688
- },
689
- {
690
- pattern: "NODE_TLS_REJECT_UNAUTHORIZED",
691
- metadata: {
692
- type: "vulnerability",
693
- severity: "critical",
694
- category: "config",
695
- description: "TLS validation may be disabled",
696
- cwe: "CWE-295",
697
- fix: "Never disable TLS validation in production"
698
- }
699
- },
700
- // ============================================
701
- // MODERATE: Common bugs and issues
702
- // ============================================
703
- {
704
- pattern: ".forEach(async",
705
- metadata: {
706
- type: "vulnerability",
707
- severity: "serious",
708
- category: "async",
709
- description: "async forEach does not await - unexpected behavior",
710
- cwe: "CWE-703",
711
- fix: "Use for...of loop or Promise.all(arr.map())"
712
- }
713
- },
714
- {
715
- pattern: "JSON.parse(",
716
- metadata: {
717
- type: "vulnerability",
718
- severity: "moderate",
719
- category: "error-handling",
720
- description: "JSON.parse can throw - needs try/catch",
721
- cwe: "CWE-755",
722
- fix: "Wrap in try/catch block"
723
- }
724
- },
725
- {
726
- pattern: "atob(",
727
- metadata: {
728
- type: "vulnerability",
729
- severity: "low",
730
- category: "encoding",
731
- description: "atob can throw on invalid input",
732
- cwe: "CWE-755",
733
- fix: "Wrap in try/catch and validate input"
734
- }
735
- },
736
- // ============================================
737
- // Privacy & Compliance patterns
738
- // ============================================
739
- {
740
- pattern: "console.log(",
741
- metadata: {
742
- type: "vulnerability",
743
- severity: "low",
744
- category: "logging",
745
- description: "Console logging - may leak sensitive data",
746
- cwe: "CWE-532",
747
- fix: "Remove or replace with proper logging in production"
748
- }
749
- },
750
- {
751
- pattern: "localStorage.setItem",
752
- metadata: {
753
- type: "vulnerability",
754
- severity: "moderate",
755
- category: "storage",
756
- description: "localStorage is accessible to XSS attacks",
757
- cwe: "CWE-922",
758
- fix: "Avoid storing sensitive data in localStorage"
759
- }
760
- },
761
- {
762
- pattern: "sessionStorage.setItem",
763
- metadata: {
764
- type: "vulnerability",
765
- severity: "moderate",
766
- category: "storage",
767
- description: "sessionStorage is accessible to XSS attacks",
768
- cwe: "CWE-922",
769
- fix: "Avoid storing sensitive data in sessionStorage"
770
- }
771
- }
772
- ];
773
- var vulnerabilityTrie = null;
774
- function getVulnerabilityTrie() {
775
- if (!vulnerabilityTrie) {
776
- vulnerabilityTrie = new AhoCorasick();
777
- for (const { pattern, metadata } of VULNERABILITY_PATTERNS) {
778
- vulnerabilityTrie.addPattern(pattern, metadata, metadata);
779
- }
780
- vulnerabilityTrie.build();
781
- if (!isInteractiveMode()) {
782
- console.error(` Loaded ${VULNERABILITY_PATTERNS.length} vulnerability signatures into trie`);
783
- }
784
- }
785
- return vulnerabilityTrie;
786
- }
787
- function scanForVulnerabilities(code, filePath) {
788
- if (shouldAlwaysExcludeFile(filePath)) {
789
- return [];
790
- }
791
- const trie = getVulnerabilityTrie();
792
- const rawMatches = trie.search(code);
793
- const lines = code.split("\n");
794
- const matches = [];
795
- const seen = /* @__PURE__ */ new Set();
796
- for (const match of rawMatches) {
797
- const key = `${match.line}:${match.pattern}`;
798
- if (seen.has(key)) continue;
799
- seen.add(key);
800
- const meta = match.metadata;
801
- if (shouldExcludeFile(filePath, meta.category || "")) continue;
802
- if (isFalsePositive(code, match, filePath, lines)) continue;
803
- const vulnMatch = {
804
- pattern: match.pattern,
805
- line: match.line,
806
- column: match.column,
807
- severity: meta.severity,
808
- category: meta.category || "unknown",
809
- description: meta.description || "",
810
- fix: meta.fix || ""
811
- };
812
- if (meta.cwe !== void 0) {
813
- vulnMatch.cwe = meta.cwe;
814
- }
815
- matches.push(vulnMatch);
816
- }
817
- return matches;
818
- }
819
- function getSurroundingLines(lines, lineNum, range = 3) {
820
- const start = Math.max(0, lineNum - range - 1);
821
- const end = Math.min(lines.length, lineNum + range);
822
- return lines.slice(start, end);
823
- }
824
- function isFalsePositive(_code, match, filePath, lines) {
825
- const line = lines[match.line - 1] || "";
826
- const trimmedLine = line.trim();
827
- const pattern = match.pattern;
828
- const category = match.metadata?.category || "";
829
- if (filePath.includes("signature") || filePath.includes("patterns") || filePath.includes("rules")) {
830
- if (/pattern\s*[:=]/.test(line)) {
831
- return true;
832
- }
833
- }
834
- if (/^\s*(pattern|regex|rule|signature)\s*[:=]/.test(trimmedLine)) {
835
- return true;
836
- }
837
- if (isTestFile(filePath)) {
838
- if (category === "secrets") {
839
- if (/test|mock|fake|dummy|example|fixture|sample|placeholder/i.test(line)) {
840
- return true;
841
- }
842
- if (/'[a-z_]*password[a-z_0-9]*'|"[a-z_]*password[a-z_0-9]*"|'[a-z_]*secret[a-z_0-9]*'|"[a-z_]*secret[a-z_0-9]*"/i.test(line)) {
843
- return true;
844
- }
845
- if (/sk-[a-z0-9]{10,20}"|'sk-[a-z0-9]{10,20}'|api[_-]?key.*['"][a-z0-9_-]{5,30}['"]/i.test(line)) {
846
- return true;
847
- }
848
- }
849
- return true;
850
- }
851
- if (trimmedLine.startsWith("//") || trimmedLine.startsWith("*") || trimmedLine.startsWith("/*") || trimmedLine.startsWith("#") || trimmedLine.startsWith("<!--")) {
852
- return true;
853
- }
854
- if (/^\s*\*\s/.test(line) || /@(param|returns|example|description|see|link)/i.test(line)) {
855
- return true;
856
- }
857
- if (/^\s*(description|fix|message|help|hint|reason|why)\s*[:=]/.test(trimmedLine)) {
858
- return true;
859
- }
860
- if (/^\s*(interface|type|export\s+interface|export\s+type)\s/.test(line)) {
861
- return true;
862
- }
863
- if (/:\s*(string|number|boolean|any|unknown|null|undefined|void)\s*(;|,|\)|$)/.test(line)) {
864
- return true;
865
- }
866
- if (/^\s*\w+\s*\??\s*:\s*(string|number|boolean|any)/.test(trimmedLine)) {
867
- return true;
868
- }
869
- if (/process\.env|import\.meta\.env|getenv|os\.environ|Deno\.env|\.env\.|config\.\w+|settings\.\w+/.test(line)) {
870
- return true;
871
- }
872
- if (filePath.endsWith("package-lock.json") || filePath.endsWith("yarn.lock") || filePath.endsWith("pnpm-lock.yaml") || filePath.includes("node_modules/")) {
873
- return true;
874
- }
875
- if (/^\s*(severity|category|type|level|priority|cwe|owasp)\s*:\s*['"]/.test(trimmedLine)) {
876
- return true;
877
- }
878
- if (category === "sql-injection") {
879
- const surroundingLines = getSurroundingLines(lines, match.line);
880
- if (!isInSQLContext(line, surroundingLines)) {
881
- return true;
882
- }
883
- }
884
- if (category === "secrets" || category === "auth") {
885
- if (/\(\s*[^)]*\w+\s*:\s*(string|any)/.test(line)) {
886
- return true;
887
- }
888
- if (/\{\s*\w*password\w*\s*(,|\}|:)/.test(line) && !/'|"|`/.test(line.split(/password/i)[1] || "")) {
889
- return true;
890
- }
891
- if (/=\s*(process\.env|config\.|options\.|settings\.|env\.)/.test(line)) {
892
- return true;
893
- }
894
- if (/password\s*[=:](?!\s*['"`])/.test(line)) {
895
- return true;
896
- }
897
- if (/password\s*=\s*\w+(\.|$)/.test(line) && !/'|"|`/.test(line)) {
898
- return true;
899
- }
900
- if (/error|message|log|warn|info|debug|throw|new Error/i.test(line)) {
901
- return true;
902
- }
903
- if (/regex|RegExp|\/.*password.*\//i.test(line)) {
904
- return true;
905
- }
906
- }
907
- if (category === "logging") {
908
- if (pattern === "console.error(" || pattern === "console.warn(") {
909
- return true;
910
- }
911
- if (/catch|error|err\b/.test(line)) {
912
- return true;
913
- }
914
- }
915
- if (category === "config") {
916
- if (/secure:\s*true/.test(line) || /httpOnly:\s*true/.test(line)) {
917
- return true;
918
- }
919
- if (/NODE_ENV|process\.env|production|development/.test(line)) {
920
- return true;
921
- }
922
- if (/if\s*\(|ternary|\?.*:/.test(line)) {
923
- return true;
924
- }
925
- }
926
- if (category === "crypto") {
927
- if (/checksum|hash.*file|etag|cache.*key|fingerprint|integrity|content.*hash/i.test(line)) {
928
- return true;
929
- }
930
- if (pattern === "Math.random()") {
931
- if (!/token|secret|password|key|auth|session|csrf|nonce/i.test(line)) {
932
- return true;
933
- }
934
- }
935
- }
936
- if (category === "async") {
937
- if (/\/\/.*intentional|\/\/.*fire.?and.?forget|\/\/.*parallel/i.test(line)) {
938
- return true;
939
- }
940
- }
941
- if (/password.*length|validate.*password|check.*password|verify.*password|is.*valid/i.test(line)) {
942
- return true;
943
- }
944
- if (/bcrypt|argon|scrypt|pbkdf|compare.*hash|hash.*compare|verify.*hash/i.test(line)) {
945
- return true;
946
- }
947
- if (/z\.|yup\.|joi\.|schema|validation|validator/i.test(line)) {
948
- return true;
949
- }
950
- if (/^\s*(import|require|from)\s/.test(trimmedLine)) {
951
- return true;
952
- }
953
- if (/example|demo|sample|tutorial|readme/i.test(filePath)) {
954
- return true;
955
- }
956
- return false;
957
- }
958
- function isTestFile(filePath) {
959
- return /\.(test|spec)\.[jt]sx?$/.test(filePath) || /__tests__\//.test(filePath) || /test\//.test(filePath) || /tests\//.test(filePath) || /\.stories\.[jt]sx?$/.test(filePath);
960
- }
961
- function getVulnerabilityStats() {
962
- const byCategory = {};
963
- const bySeverity = {};
964
- for (const { metadata } of VULNERABILITY_PATTERNS) {
965
- const cat = metadata.category || "unknown";
966
- const sev = metadata.severity || "unknown";
967
- byCategory[cat] = (byCategory[cat] || 0) + 1;
968
- bySeverity[sev] = (bySeverity[sev] || 0) + 1;
969
- }
970
- return {
971
- total: VULNERABILITY_PATTERNS.length,
972
- byCategory,
973
- bySeverity
974
- };
975
- }
976
- export {
977
- getVulnerabilityStats,
978
- getVulnerabilityTrie,
979
- scanForVulnerabilities,
980
- shouldAlwaysExcludeFile,
981
- shouldExcludeFile
982
- };
983
- //# sourceMappingURL=vulnerability-signatures-2URZSXAQ.js.map