vaspera 2.5.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.
Files changed (712) hide show
  1. package/CHANGELOG.md +184 -0
  2. package/LICENSE +21 -0
  3. package/README.md +809 -0
  4. package/dist/__tests__/integration/certification-flow.test.d.ts +5 -0
  5. package/dist/__tests__/integration/certification-flow.test.d.ts.map +1 -0
  6. package/dist/__tests__/integration/certification-flow.test.js +245 -0
  7. package/dist/__tests__/integration/certification-flow.test.js.map +1 -0
  8. package/dist/__tests__/integration/commands.test.d.ts +5 -0
  9. package/dist/__tests__/integration/commands.test.d.ts.map +1 -0
  10. package/dist/__tests__/integration/commands.test.js +93 -0
  11. package/dist/__tests__/integration/commands.test.js.map +1 -0
  12. package/dist/action/diff-mode.d.ts +34 -0
  13. package/dist/action/diff-mode.d.ts.map +1 -0
  14. package/dist/action/diff-mode.js +201 -0
  15. package/dist/action/diff-mode.js.map +1 -0
  16. package/dist/action/diff-mode.test.d.ts +5 -0
  17. package/dist/action/diff-mode.test.d.ts.map +1 -0
  18. package/dist/action/diff-mode.test.js +162 -0
  19. package/dist/action/diff-mode.test.js.map +1 -0
  20. package/dist/action/index.d.ts +10 -0
  21. package/dist/action/index.d.ts.map +1 -0
  22. package/dist/action/index.js +231 -0
  23. package/dist/action/index.js.map +1 -0
  24. package/dist/action/pr-comment.d.ts +30 -0
  25. package/dist/action/pr-comment.d.ts.map +1 -0
  26. package/dist/action/pr-comment.js +301 -0
  27. package/dist/action/pr-comment.js.map +1 -0
  28. package/dist/action/pr-comment.test.d.ts +5 -0
  29. package/dist/action/pr-comment.test.d.ts.map +1 -0
  30. package/dist/action/pr-comment.test.js +189 -0
  31. package/dist/action/pr-comment.test.js.map +1 -0
  32. package/dist/action/sarif-upload.d.ts +104 -0
  33. package/dist/action/sarif-upload.d.ts.map +1 -0
  34. package/dist/action/sarif-upload.js +188 -0
  35. package/dist/action/sarif-upload.js.map +1 -0
  36. package/dist/action/sarif-upload.test.d.ts +5 -0
  37. package/dist/action/sarif-upload.test.d.ts.map +1 -0
  38. package/dist/action/sarif-upload.test.js +206 -0
  39. package/dist/action/sarif-upload.test.js.map +1 -0
  40. package/dist/action/types.d.ts +104 -0
  41. package/dist/action/types.d.ts.map +1 -0
  42. package/dist/action/types.js +33 -0
  43. package/dist/action/types.js.map +1 -0
  44. package/dist/action/types.test.d.ts +5 -0
  45. package/dist/action/types.test.d.ts.map +1 -0
  46. package/dist/action/types.test.js +79 -0
  47. package/dist/action/types.test.js.map +1 -0
  48. package/dist/agents/agent-integrity.d.ts +111 -0
  49. package/dist/agents/agent-integrity.d.ts.map +1 -0
  50. package/dist/agents/agent-integrity.js +308 -0
  51. package/dist/agents/agent-integrity.js.map +1 -0
  52. package/dist/agents/agent-privacy.d.ts +68 -0
  53. package/dist/agents/agent-privacy.d.ts.map +1 -0
  54. package/dist/agents/agent-privacy.js +345 -0
  55. package/dist/agents/agent-privacy.js.map +1 -0
  56. package/dist/agents/exploit-chain.d.ts +64 -0
  57. package/dist/agents/exploit-chain.d.ts.map +1 -0
  58. package/dist/agents/exploit-chain.js +477 -0
  59. package/dist/agents/exploit-chain.js.map +1 -0
  60. package/dist/agents/exploit-chain.test.d.ts +5 -0
  61. package/dist/agents/exploit-chain.test.d.ts.map +1 -0
  62. package/dist/agents/exploit-chain.test.js +455 -0
  63. package/dist/agents/exploit-chain.test.js.map +1 -0
  64. package/dist/agents/index.d.ts +14 -0
  65. package/dist/agents/index.d.ts.map +1 -0
  66. package/dist/agents/index.js +19 -0
  67. package/dist/agents/index.js.map +1 -0
  68. package/dist/agents/logic-flaw-detector.d.ts +55 -0
  69. package/dist/agents/logic-flaw-detector.d.ts.map +1 -0
  70. package/dist/agents/logic-flaw-detector.js +454 -0
  71. package/dist/agents/logic-flaw-detector.js.map +1 -0
  72. package/dist/agents/zero-day-hunter.d.ts +69 -0
  73. package/dist/agents/zero-day-hunter.d.ts.map +1 -0
  74. package/dist/agents/zero-day-hunter.js +591 -0
  75. package/dist/agents/zero-day-hunter.js.map +1 -0
  76. package/dist/certification/artifacts.d.ts +21 -0
  77. package/dist/certification/artifacts.d.ts.map +1 -0
  78. package/dist/certification/artifacts.js +275 -0
  79. package/dist/certification/artifacts.js.map +1 -0
  80. package/dist/certification/autofix.d.ts +122 -0
  81. package/dist/certification/autofix.d.ts.map +1 -0
  82. package/dist/certification/autofix.js +476 -0
  83. package/dist/certification/autofix.js.map +1 -0
  84. package/dist/certification/badge.d.ts +56 -0
  85. package/dist/certification/badge.d.ts.map +1 -0
  86. package/dist/certification/badge.js +155 -0
  87. package/dist/certification/badge.js.map +1 -0
  88. package/dist/certification/cache.d.ts +121 -0
  89. package/dist/certification/cache.d.ts.map +1 -0
  90. package/dist/certification/cache.js +275 -0
  91. package/dist/certification/cache.js.map +1 -0
  92. package/dist/certification/cache.test.d.ts +5 -0
  93. package/dist/certification/cache.test.d.ts.map +1 -0
  94. package/dist/certification/cache.test.js +270 -0
  95. package/dist/certification/cache.test.js.map +1 -0
  96. package/dist/certification/consensus.d.ts +105 -0
  97. package/dist/certification/consensus.d.ts.map +1 -0
  98. package/dist/certification/consensus.js +353 -0
  99. package/dist/certification/consensus.js.map +1 -0
  100. package/dist/certification/consensus.test.d.ts +5 -0
  101. package/dist/certification/consensus.test.d.ts.map +1 -0
  102. package/dist/certification/consensus.test.js +342 -0
  103. package/dist/certification/consensus.test.js.map +1 -0
  104. package/dist/certification/index.d.ts +14 -0
  105. package/dist/certification/index.d.ts.map +1 -0
  106. package/dist/certification/index.js +14 -0
  107. package/dist/certification/index.js.map +1 -0
  108. package/dist/certification/rules.d.ts +89 -0
  109. package/dist/certification/rules.d.ts.map +1 -0
  110. package/dist/certification/rules.js +317 -0
  111. package/dist/certification/rules.js.map +1 -0
  112. package/dist/certification/sarif.d.ts +107 -0
  113. package/dist/certification/sarif.d.ts.map +1 -0
  114. package/dist/certification/sarif.js +191 -0
  115. package/dist/certification/sarif.js.map +1 -0
  116. package/dist/certification/store.d.ts +255 -0
  117. package/dist/certification/store.d.ts.map +1 -0
  118. package/dist/certification/store.js +835 -0
  119. package/dist/certification/store.js.map +1 -0
  120. package/dist/certification/store.test.d.ts +5 -0
  121. package/dist/certification/store.test.d.ts.map +1 -0
  122. package/dist/certification/store.test.js +468 -0
  123. package/dist/certification/store.test.js.map +1 -0
  124. package/dist/certification/summary.d.ts +72 -0
  125. package/dist/certification/summary.d.ts.map +1 -0
  126. package/dist/certification/summary.js +296 -0
  127. package/dist/certification/summary.js.map +1 -0
  128. package/dist/certification/types.d.ts +138 -0
  129. package/dist/certification/types.d.ts.map +1 -0
  130. package/dist/certification/types.js +34 -0
  131. package/dist/certification/types.js.map +1 -0
  132. package/dist/commands/audits/api-check.d.ts +3 -0
  133. package/dist/commands/audits/api-check.d.ts.map +1 -0
  134. package/dist/commands/audits/api-check.js +71 -0
  135. package/dist/commands/audits/api-check.js.map +1 -0
  136. package/dist/commands/audits/deadcode.d.ts +3 -0
  137. package/dist/commands/audits/deadcode.d.ts.map +1 -0
  138. package/dist/commands/audits/deadcode.js +63 -0
  139. package/dist/commands/audits/deadcode.js.map +1 -0
  140. package/dist/commands/audits/deps.d.ts +3 -0
  141. package/dist/commands/audits/deps.d.ts.map +1 -0
  142. package/dist/commands/audits/deps.js +56 -0
  143. package/dist/commands/audits/deps.js.map +1 -0
  144. package/dist/commands/audits/errors.d.ts +3 -0
  145. package/dist/commands/audits/errors.d.ts.map +1 -0
  146. package/dist/commands/audits/errors.js +65 -0
  147. package/dist/commands/audits/errors.js.map +1 -0
  148. package/dist/commands/audits/index.d.ts +3 -0
  149. package/dist/commands/audits/index.d.ts.map +1 -0
  150. package/dist/commands/audits/index.js +15 -0
  151. package/dist/commands/audits/index.js.map +1 -0
  152. package/dist/commands/audits/perf.d.ts +3 -0
  153. package/dist/commands/audits/perf.d.ts.map +1 -0
  154. package/dist/commands/audits/perf.js +85 -0
  155. package/dist/commands/audits/perf.js.map +1 -0
  156. package/dist/commands/audits/secrets.d.ts +3 -0
  157. package/dist/commands/audits/secrets.d.ts.map +1 -0
  158. package/dist/commands/audits/secrets.js +71 -0
  159. package/dist/commands/audits/secrets.js.map +1 -0
  160. package/dist/commands/certification/certify.d.ts +3 -0
  161. package/dist/commands/certification/certify.d.ts.map +1 -0
  162. package/dist/commands/certification/certify.js +108 -0
  163. package/dist/commands/certification/certify.js.map +1 -0
  164. package/dist/commands/certification/index.d.ts +3 -0
  165. package/dist/commands/certification/index.d.ts.map +1 -0
  166. package/dist/commands/certification/index.js +17 -0
  167. package/dist/commands/certification/index.js.map +1 -0
  168. package/dist/commands/certification/performance.d.ts +3 -0
  169. package/dist/commands/certification/performance.d.ts.map +1 -0
  170. package/dist/commands/certification/performance.js +89 -0
  171. package/dist/commands/certification/performance.js.map +1 -0
  172. package/dist/commands/certification/quality.d.ts +3 -0
  173. package/dist/commands/certification/quality.d.ts.map +1 -0
  174. package/dist/commands/certification/quality.js +92 -0
  175. package/dist/commands/certification/quality.js.map +1 -0
  176. package/dist/commands/certification/redteam.d.ts +3 -0
  177. package/dist/commands/certification/redteam.d.ts.map +1 -0
  178. package/dist/commands/certification/redteam.js +114 -0
  179. package/dist/commands/certification/redteam.js.map +1 -0
  180. package/dist/commands/certification/reliability.d.ts +3 -0
  181. package/dist/commands/certification/reliability.d.ts.map +1 -0
  182. package/dist/commands/certification/reliability.js +93 -0
  183. package/dist/commands/certification/reliability.js.map +1 -0
  184. package/dist/commands/certification/security.d.ts +3 -0
  185. package/dist/commands/certification/security.d.ts.map +1 -0
  186. package/dist/commands/certification/security.js +90 -0
  187. package/dist/commands/certification/security.js.map +1 -0
  188. package/dist/commands/certification/typesafety.d.ts +3 -0
  189. package/dist/commands/certification/typesafety.d.ts.map +1 -0
  190. package/dist/commands/certification/typesafety.js +87 -0
  191. package/dist/commands/certification/typesafety.js.map +1 -0
  192. package/dist/commands/core/add-tests.d.ts +3 -0
  193. package/dist/commands/core/add-tests.d.ts.map +1 -0
  194. package/dist/commands/core/add-tests.js +29 -0
  195. package/dist/commands/core/add-tests.js.map +1 -0
  196. package/dist/commands/core/audit.d.ts +3 -0
  197. package/dist/commands/core/audit.d.ts.map +1 -0
  198. package/dist/commands/core/audit.js +64 -0
  199. package/dist/commands/core/audit.js.map +1 -0
  200. package/dist/commands/core/fix-critical.d.ts +3 -0
  201. package/dist/commands/core/fix-critical.d.ts.map +1 -0
  202. package/dist/commands/core/fix-critical.js +22 -0
  203. package/dist/commands/core/fix-critical.js.map +1 -0
  204. package/dist/commands/core/fix-high.d.ts +3 -0
  205. package/dist/commands/core/fix-high.d.ts.map +1 -0
  206. package/dist/commands/core/fix-high.js +32 -0
  207. package/dist/commands/core/fix-high.js.map +1 -0
  208. package/dist/commands/core/fix-medium.d.ts +3 -0
  209. package/dist/commands/core/fix-medium.d.ts.map +1 -0
  210. package/dist/commands/core/fix-medium.js +29 -0
  211. package/dist/commands/core/fix-medium.js.map +1 -0
  212. package/dist/commands/core/fix-rls.d.ts +3 -0
  213. package/dist/commands/core/fix-rls.d.ts.map +1 -0
  214. package/dist/commands/core/fix-rls.js +17 -0
  215. package/dist/commands/core/fix-rls.js.map +1 -0
  216. package/dist/commands/core/harden.d.ts +3 -0
  217. package/dist/commands/core/harden.d.ts.map +1 -0
  218. package/dist/commands/core/harden.js +19 -0
  219. package/dist/commands/core/harden.js.map +1 -0
  220. package/dist/commands/core/index.d.ts +3 -0
  221. package/dist/commands/core/index.d.ts.map +1 -0
  222. package/dist/commands/core/index.js +21 -0
  223. package/dist/commands/core/index.js.map +1 -0
  224. package/dist/commands/core/preflight.d.ts +3 -0
  225. package/dist/commands/core/preflight.d.ts.map +1 -0
  226. package/dist/commands/core/preflight.js +50 -0
  227. package/dist/commands/core/preflight.js.map +1 -0
  228. package/dist/commands/core/verify.d.ts +3 -0
  229. package/dist/commands/core/verify.d.ts.map +1 -0
  230. package/dist/commands/core/verify.js +32 -0
  231. package/dist/commands/core/verify.js.map +1 -0
  232. package/dist/commands/index.d.ts +28 -0
  233. package/dist/commands/index.d.ts.map +1 -0
  234. package/dist/commands/index.js +37 -0
  235. package/dist/commands/index.js.map +1 -0
  236. package/dist/commands/types.d.ts +9 -0
  237. package/dist/commands/types.d.ts.map +1 -0
  238. package/dist/commands/types.js +5 -0
  239. package/dist/commands/types.js.map +1 -0
  240. package/dist/compliance/cis.d.ts +29 -0
  241. package/dist/compliance/cis.d.ts.map +1 -0
  242. package/dist/compliance/cis.js +316 -0
  243. package/dist/compliance/cis.js.map +1 -0
  244. package/dist/compliance/frameworks/eu-ai-act.d.ts +55 -0
  245. package/dist/compliance/frameworks/eu-ai-act.d.ts.map +1 -0
  246. package/dist/compliance/frameworks/eu-ai-act.js +621 -0
  247. package/dist/compliance/frameworks/eu-ai-act.js.map +1 -0
  248. package/dist/compliance/frameworks/index.d.ts +67 -0
  249. package/dist/compliance/frameworks/index.d.ts.map +1 -0
  250. package/dist/compliance/frameworks/index.js +97 -0
  251. package/dist/compliance/frameworks/index.js.map +1 -0
  252. package/dist/compliance/frameworks/iso-42001.d.ts +59 -0
  253. package/dist/compliance/frameworks/iso-42001.d.ts.map +1 -0
  254. package/dist/compliance/frameworks/iso-42001.js +719 -0
  255. package/dist/compliance/frameworks/iso-42001.js.map +1 -0
  256. package/dist/compliance/frameworks/mitre-atlas.d.ts +58 -0
  257. package/dist/compliance/frameworks/mitre-atlas.d.ts.map +1 -0
  258. package/dist/compliance/frameworks/mitre-atlas.js +686 -0
  259. package/dist/compliance/frameworks/mitre-atlas.js.map +1 -0
  260. package/dist/compliance/frameworks/nist-ai-rmf.d.ts +51 -0
  261. package/dist/compliance/frameworks/nist-ai-rmf.d.ts.map +1 -0
  262. package/dist/compliance/frameworks/nist-ai-rmf.js +677 -0
  263. package/dist/compliance/frameworks/nist-ai-rmf.js.map +1 -0
  264. package/dist/compliance/frameworks/owasp-llm.d.ts +58 -0
  265. package/dist/compliance/frameworks/owasp-llm.d.ts.map +1 -0
  266. package/dist/compliance/frameworks/owasp-llm.js +399 -0
  267. package/dist/compliance/frameworks/owasp-llm.js.map +1 -0
  268. package/dist/compliance/gdpr.d.ts +34 -0
  269. package/dist/compliance/gdpr.d.ts.map +1 -0
  270. package/dist/compliance/gdpr.js +319 -0
  271. package/dist/compliance/gdpr.js.map +1 -0
  272. package/dist/compliance/hipaa.d.ts +29 -0
  273. package/dist/compliance/hipaa.d.ts.map +1 -0
  274. package/dist/compliance/hipaa.js +205 -0
  275. package/dist/compliance/hipaa.js.map +1 -0
  276. package/dist/compliance/index.d.ts +18 -0
  277. package/dist/compliance/index.d.ts.map +1 -0
  278. package/dist/compliance/index.js +26 -0
  279. package/dist/compliance/index.js.map +1 -0
  280. package/dist/compliance/iso27001.d.ts +30 -0
  281. package/dist/compliance/iso27001.d.ts.map +1 -0
  282. package/dist/compliance/iso27001.js +332 -0
  283. package/dist/compliance/iso27001.js.map +1 -0
  284. package/dist/compliance/mapper.d.ts +42 -0
  285. package/dist/compliance/mapper.d.ts.map +1 -0
  286. package/dist/compliance/mapper.js +269 -0
  287. package/dist/compliance/mapper.js.map +1 -0
  288. package/dist/compliance/mapper.test.d.ts +5 -0
  289. package/dist/compliance/mapper.test.d.ts.map +1 -0
  290. package/dist/compliance/mapper.test.js +360 -0
  291. package/dist/compliance/mapper.test.js.map +1 -0
  292. package/dist/compliance/pci-dss.d.ts +29 -0
  293. package/dist/compliance/pci-dss.d.ts.map +1 -0
  294. package/dist/compliance/pci-dss.js +247 -0
  295. package/dist/compliance/pci-dss.js.map +1 -0
  296. package/dist/compliance/report.d.ts +25 -0
  297. package/dist/compliance/report.d.ts.map +1 -0
  298. package/dist/compliance/report.js +254 -0
  299. package/dist/compliance/report.js.map +1 -0
  300. package/dist/compliance/report.test.d.ts +5 -0
  301. package/dist/compliance/report.test.d.ts.map +1 -0
  302. package/dist/compliance/report.test.js +128 -0
  303. package/dist/compliance/report.test.js.map +1 -0
  304. package/dist/compliance/soc2.d.ts +30 -0
  305. package/dist/compliance/soc2.d.ts.map +1 -0
  306. package/dist/compliance/soc2.js +262 -0
  307. package/dist/compliance/soc2.js.map +1 -0
  308. package/dist/compliance/soc2.test.d.ts +5 -0
  309. package/dist/compliance/soc2.test.d.ts.map +1 -0
  310. package/dist/compliance/soc2.test.js +86 -0
  311. package/dist/compliance/soc2.test.js.map +1 -0
  312. package/dist/compliance/types.d.ts +125 -0
  313. package/dist/compliance/types.d.ts.map +1 -0
  314. package/dist/compliance/types.js +10 -0
  315. package/dist/compliance/types.js.map +1 -0
  316. package/dist/config/flags.d.ts +456 -0
  317. package/dist/config/flags.d.ts.map +1 -0
  318. package/dist/config/flags.js +464 -0
  319. package/dist/config/flags.js.map +1 -0
  320. package/dist/config/index.d.ts +10 -0
  321. package/dist/config/index.d.ts.map +1 -0
  322. package/dist/config/index.js +10 -0
  323. package/dist/config/index.js.map +1 -0
  324. package/dist/config/severity-overrides.d.ts +209 -0
  325. package/dist/config/severity-overrides.d.ts.map +1 -0
  326. package/dist/config/severity-overrides.js +380 -0
  327. package/dist/config/severity-overrides.js.map +1 -0
  328. package/dist/cost/index.d.ts +11 -0
  329. package/dist/cost/index.d.ts.map +1 -0
  330. package/dist/cost/index.js +12 -0
  331. package/dist/cost/index.js.map +1 -0
  332. package/dist/cost/pricing.d.ts +57 -0
  333. package/dist/cost/pricing.d.ts.map +1 -0
  334. package/dist/cost/pricing.js +196 -0
  335. package/dist/cost/pricing.js.map +1 -0
  336. package/dist/cost/pricing.test.d.ts +5 -0
  337. package/dist/cost/pricing.test.d.ts.map +1 -0
  338. package/dist/cost/pricing.test.js +195 -0
  339. package/dist/cost/pricing.test.js.map +1 -0
  340. package/dist/cost/tracker.d.ts +100 -0
  341. package/dist/cost/tracker.d.ts.map +1 -0
  342. package/dist/cost/tracker.js +366 -0
  343. package/dist/cost/tracker.js.map +1 -0
  344. package/dist/cost/tracker.test.d.ts +5 -0
  345. package/dist/cost/tracker.test.d.ts.map +1 -0
  346. package/dist/cost/tracker.test.js +360 -0
  347. package/dist/cost/tracker.test.js.map +1 -0
  348. package/dist/cost/types.d.ts +135 -0
  349. package/dist/cost/types.d.ts.map +1 -0
  350. package/dist/cost/types.js +9 -0
  351. package/dist/cost/types.js.map +1 -0
  352. package/dist/enterprise/auth/oidc.d.ts +231 -0
  353. package/dist/enterprise/auth/oidc.d.ts.map +1 -0
  354. package/dist/enterprise/auth/oidc.js +372 -0
  355. package/dist/enterprise/auth/oidc.js.map +1 -0
  356. package/dist/enterprise/auth/oidc.test.d.ts +5 -0
  357. package/dist/enterprise/auth/oidc.test.d.ts.map +1 -0
  358. package/dist/enterprise/auth/oidc.test.js +435 -0
  359. package/dist/enterprise/auth/oidc.test.js.map +1 -0
  360. package/dist/enterprise/index.d.ts +14 -0
  361. package/dist/enterprise/index.d.ts.map +1 -0
  362. package/dist/enterprise/index.js +19 -0
  363. package/dist/enterprise/index.js.map +1 -0
  364. package/dist/enterprise/integrations/chat.d.ts +205 -0
  365. package/dist/enterprise/integrations/chat.d.ts.map +1 -0
  366. package/dist/enterprise/integrations/chat.js +624 -0
  367. package/dist/enterprise/integrations/chat.js.map +1 -0
  368. package/dist/enterprise/integrations/chat.test.d.ts +5 -0
  369. package/dist/enterprise/integrations/chat.test.d.ts.map +1 -0
  370. package/dist/enterprise/integrations/chat.test.js +557 -0
  371. package/dist/enterprise/integrations/chat.test.js.map +1 -0
  372. package/dist/enterprise/integrations/ticketing.d.ts +257 -0
  373. package/dist/enterprise/integrations/ticketing.d.ts.map +1 -0
  374. package/dist/enterprise/integrations/ticketing.js +548 -0
  375. package/dist/enterprise/integrations/ticketing.js.map +1 -0
  376. package/dist/enterprise/integrations/ticketing.test.d.ts +5 -0
  377. package/dist/enterprise/integrations/ticketing.test.d.ts.map +1 -0
  378. package/dist/enterprise/integrations/ticketing.test.js +693 -0
  379. package/dist/enterprise/integrations/ticketing.test.js.map +1 -0
  380. package/dist/enterprise/policy/opa.d.ts +194 -0
  381. package/dist/enterprise/policy/opa.d.ts.map +1 -0
  382. package/dist/enterprise/policy/opa.js +385 -0
  383. package/dist/enterprise/policy/opa.js.map +1 -0
  384. package/dist/enterprise/policy/opa.test.d.ts +5 -0
  385. package/dist/enterprise/policy/opa.test.d.ts.map +1 -0
  386. package/dist/enterprise/policy/opa.test.js +702 -0
  387. package/dist/enterprise/policy/opa.test.js.map +1 -0
  388. package/dist/enterprise/signing/kms.d.ts +211 -0
  389. package/dist/enterprise/signing/kms.d.ts.map +1 -0
  390. package/dist/enterprise/signing/kms.js +480 -0
  391. package/dist/enterprise/signing/kms.js.map +1 -0
  392. package/dist/enterprise/signing/kms.test.d.ts +5 -0
  393. package/dist/enterprise/signing/kms.test.d.ts.map +1 -0
  394. package/dist/enterprise/signing/kms.test.js +511 -0
  395. package/dist/enterprise/signing/kms.test.js.map +1 -0
  396. package/dist/eval/fixtures.d.ts +58 -0
  397. package/dist/eval/fixtures.d.ts.map +1 -0
  398. package/dist/eval/fixtures.js +571 -0
  399. package/dist/eval/fixtures.js.map +1 -0
  400. package/dist/eval/fixtures.test.d.ts +5 -0
  401. package/dist/eval/fixtures.test.d.ts.map +1 -0
  402. package/dist/eval/fixtures.test.js +193 -0
  403. package/dist/eval/fixtures.test.js.map +1 -0
  404. package/dist/eval/harness.d.ts +30 -0
  405. package/dist/eval/harness.d.ts.map +1 -0
  406. package/dist/eval/harness.js +221 -0
  407. package/dist/eval/harness.js.map +1 -0
  408. package/dist/eval/harness.test.d.ts +5 -0
  409. package/dist/eval/harness.test.d.ts.map +1 -0
  410. package/dist/eval/harness.test.js +314 -0
  411. package/dist/eval/harness.test.js.map +1 -0
  412. package/dist/eval/index.d.ts +15 -0
  413. package/dist/eval/index.d.ts.map +1 -0
  414. package/dist/eval/index.js +18 -0
  415. package/dist/eval/index.js.map +1 -0
  416. package/dist/eval/metrics.d.ts +56 -0
  417. package/dist/eval/metrics.d.ts.map +1 -0
  418. package/dist/eval/metrics.js +298 -0
  419. package/dist/eval/metrics.js.map +1 -0
  420. package/dist/eval/metrics.test.d.ts +5 -0
  421. package/dist/eval/metrics.test.d.ts.map +1 -0
  422. package/dist/eval/metrics.test.js +426 -0
  423. package/dist/eval/metrics.test.js.map +1 -0
  424. package/dist/eval/report.d.ts +30 -0
  425. package/dist/eval/report.d.ts.map +1 -0
  426. package/dist/eval/report.js +333 -0
  427. package/dist/eval/report.js.map +1 -0
  428. package/dist/eval/report.test.d.ts +5 -0
  429. package/dist/eval/report.test.d.ts.map +1 -0
  430. package/dist/eval/report.test.js +275 -0
  431. package/dist/eval/report.test.js.map +1 -0
  432. package/dist/eval/types.d.ts +234 -0
  433. package/dist/eval/types.d.ts.map +1 -0
  434. package/dist/eval/types.js +27 -0
  435. package/dist/eval/types.js.map +1 -0
  436. package/dist/http-server.d.ts +3 -0
  437. package/dist/http-server.d.ts.map +1 -0
  438. package/dist/http-server.js +127 -0
  439. package/dist/http-server.js.map +1 -0
  440. package/dist/index.d.ts +33 -0
  441. package/dist/index.d.ts.map +1 -0
  442. package/dist/index.js +4120 -0
  443. package/dist/index.js.map +1 -0
  444. package/dist/logger.d.ts +46 -0
  445. package/dist/logger.d.ts.map +1 -0
  446. package/dist/logger.js +131 -0
  447. package/dist/logger.js.map +1 -0
  448. package/dist/multimodel/consensus.d.ts +49 -0
  449. package/dist/multimodel/consensus.d.ts.map +1 -0
  450. package/dist/multimodel/consensus.js +454 -0
  451. package/dist/multimodel/consensus.js.map +1 -0
  452. package/dist/multimodel/consensus.test.d.ts +5 -0
  453. package/dist/multimodel/consensus.test.d.ts.map +1 -0
  454. package/dist/multimodel/consensus.test.js +415 -0
  455. package/dist/multimodel/consensus.test.js.map +1 -0
  456. package/dist/multimodel/index.d.ts +13 -0
  457. package/dist/multimodel/index.d.ts.map +1 -0
  458. package/dist/multimodel/index.js +14 -0
  459. package/dist/multimodel/index.js.map +1 -0
  460. package/dist/multimodel/runner.d.ts +95 -0
  461. package/dist/multimodel/runner.d.ts.map +1 -0
  462. package/dist/multimodel/runner.js +312 -0
  463. package/dist/multimodel/runner.js.map +1 -0
  464. package/dist/multimodel/runner.test.d.ts +5 -0
  465. package/dist/multimodel/runner.test.d.ts.map +1 -0
  466. package/dist/multimodel/runner.test.js +224 -0
  467. package/dist/multimodel/runner.test.js.map +1 -0
  468. package/dist/multimodel/types.d.ts +202 -0
  469. package/dist/multimodel/types.d.ts.map +1 -0
  470. package/dist/multimodel/types.js +10 -0
  471. package/dist/multimodel/types.js.map +1 -0
  472. package/dist/observability/index.d.ts +9 -0
  473. package/dist/observability/index.d.ts.map +1 -0
  474. package/dist/observability/index.js +9 -0
  475. package/dist/observability/index.js.map +1 -0
  476. package/dist/observability/otel.d.ts +102 -0
  477. package/dist/observability/otel.d.ts.map +1 -0
  478. package/dist/observability/otel.js +284 -0
  479. package/dist/observability/otel.js.map +1 -0
  480. package/dist/plugins/index.d.ts +10 -0
  481. package/dist/plugins/index.d.ts.map +1 -0
  482. package/dist/plugins/index.js +10 -0
  483. package/dist/plugins/index.js.map +1 -0
  484. package/dist/plugins/loader.d.ts +78 -0
  485. package/dist/plugins/loader.d.ts.map +1 -0
  486. package/dist/plugins/loader.js +470 -0
  487. package/dist/plugins/loader.js.map +1 -0
  488. package/dist/plugins/types.d.ts +304 -0
  489. package/dist/plugins/types.d.ts.map +1 -0
  490. package/dist/plugins/types.js +100 -0
  491. package/dist/plugins/types.js.map +1 -0
  492. package/dist/sbom/cyclonedx.d.ts +30 -0
  493. package/dist/sbom/cyclonedx.d.ts.map +1 -0
  494. package/dist/sbom/cyclonedx.js +392 -0
  495. package/dist/sbom/cyclonedx.js.map +1 -0
  496. package/dist/sbom/cyclonedx.test.d.ts +5 -0
  497. package/dist/sbom/cyclonedx.test.d.ts.map +1 -0
  498. package/dist/sbom/cyclonedx.test.js +244 -0
  499. package/dist/sbom/cyclonedx.test.js.map +1 -0
  500. package/dist/sbom/index.d.ts +13 -0
  501. package/dist/sbom/index.d.ts.map +1 -0
  502. package/dist/sbom/index.js +15 -0
  503. package/dist/sbom/index.js.map +1 -0
  504. package/dist/sbom/provenance.d.ts +37 -0
  505. package/dist/sbom/provenance.d.ts.map +1 -0
  506. package/dist/sbom/provenance.js +268 -0
  507. package/dist/sbom/provenance.js.map +1 -0
  508. package/dist/sbom/provenance.test.d.ts +5 -0
  509. package/dist/sbom/provenance.test.d.ts.map +1 -0
  510. package/dist/sbom/provenance.test.js +189 -0
  511. package/dist/sbom/provenance.test.js.map +1 -0
  512. package/dist/sbom/signing.d.ts +87 -0
  513. package/dist/sbom/signing.d.ts.map +1 -0
  514. package/dist/sbom/signing.js +354 -0
  515. package/dist/sbom/signing.js.map +1 -0
  516. package/dist/sbom/signing.test.d.ts +5 -0
  517. package/dist/sbom/signing.test.d.ts.map +1 -0
  518. package/dist/sbom/signing.test.js +170 -0
  519. package/dist/sbom/signing.test.js.map +1 -0
  520. package/dist/sbom/types.d.ts +384 -0
  521. package/dist/sbom/types.d.ts.map +1 -0
  522. package/dist/sbom/types.js +17 -0
  523. package/dist/sbom/types.js.map +1 -0
  524. package/dist/scanners/agent/credential-scope-audit.d.ts +40 -0
  525. package/dist/scanners/agent/credential-scope-audit.d.ts.map +1 -0
  526. package/dist/scanners/agent/credential-scope-audit.js +404 -0
  527. package/dist/scanners/agent/credential-scope-audit.js.map +1 -0
  528. package/dist/scanners/agent/exfil-path-graph.d.ts +50 -0
  529. package/dist/scanners/agent/exfil-path-graph.d.ts.map +1 -0
  530. package/dist/scanners/agent/exfil-path-graph.js +764 -0
  531. package/dist/scanners/agent/exfil-path-graph.js.map +1 -0
  532. package/dist/scanners/agent/index.d.ts +43 -0
  533. package/dist/scanners/agent/index.d.ts.map +1 -0
  534. package/dist/scanners/agent/index.js +616 -0
  535. package/dist/scanners/agent/index.js.map +1 -0
  536. package/dist/scanners/agent/manifest-audit.d.ts +43 -0
  537. package/dist/scanners/agent/manifest-audit.d.ts.map +1 -0
  538. package/dist/scanners/agent/manifest-audit.js +403 -0
  539. package/dist/scanners/agent/manifest-audit.js.map +1 -0
  540. package/dist/scanners/agent/payloads/index.d.ts +44 -0
  541. package/dist/scanners/agent/payloads/index.d.ts.map +1 -0
  542. package/dist/scanners/agent/payloads/index.js +184 -0
  543. package/dist/scanners/agent/payloads/index.js.map +1 -0
  544. package/dist/scanners/agent/permission-minimiser.d.ts +48 -0
  545. package/dist/scanners/agent/permission-minimiser.d.ts.map +1 -0
  546. package/dist/scanners/agent/permission-minimiser.js +551 -0
  547. package/dist/scanners/agent/permission-minimiser.js.map +1 -0
  548. package/dist/scanners/agent/prompt-injection-fuzzer.d.ts +39 -0
  549. package/dist/scanners/agent/prompt-injection-fuzzer.d.ts.map +1 -0
  550. package/dist/scanners/agent/prompt-injection-fuzzer.js +720 -0
  551. package/dist/scanners/agent/prompt-injection-fuzzer.js.map +1 -0
  552. package/dist/scanners/agent/sandbox-audit.d.ts +44 -0
  553. package/dist/scanners/agent/sandbox-audit.d.ts.map +1 -0
  554. package/dist/scanners/agent/sandbox-audit.js +425 -0
  555. package/dist/scanners/agent/sandbox-audit.js.map +1 -0
  556. package/dist/scanners/agent/supply-chain-mcp.d.ts +53 -0
  557. package/dist/scanners/agent/supply-chain-mcp.d.ts.map +1 -0
  558. package/dist/scanners/agent/supply-chain-mcp.js +479 -0
  559. package/dist/scanners/agent/supply-chain-mcp.js.map +1 -0
  560. package/dist/scanners/agent/tool-description-drift.d.ts +62 -0
  561. package/dist/scanners/agent/tool-description-drift.d.ts.map +1 -0
  562. package/dist/scanners/agent/tool-description-drift.js +365 -0
  563. package/dist/scanners/agent/tool-description-drift.js.map +1 -0
  564. package/dist/scanners/agent/types.d.ts +840 -0
  565. package/dist/scanners/agent/types.d.ts.map +1 -0
  566. package/dist/scanners/agent/types.js +149 -0
  567. package/dist/scanners/agent/types.js.map +1 -0
  568. package/dist/scanners/bandit.d.ts +25 -0
  569. package/dist/scanners/bandit.d.ts.map +1 -0
  570. package/dist/scanners/bandit.js +129 -0
  571. package/dist/scanners/bandit.js.map +1 -0
  572. package/dist/scanners/binary-analysis.d.ts +41 -0
  573. package/dist/scanners/binary-analysis.d.ts.map +1 -0
  574. package/dist/scanners/binary-analysis.js +587 -0
  575. package/dist/scanners/binary-analysis.js.map +1 -0
  576. package/dist/scanners/binary-analysis.test.d.ts +5 -0
  577. package/dist/scanners/binary-analysis.test.d.ts.map +1 -0
  578. package/dist/scanners/binary-analysis.test.js +291 -0
  579. package/dist/scanners/binary-analysis.test.js.map +1 -0
  580. package/dist/scanners/brakeman.d.ts +30 -0
  581. package/dist/scanners/brakeman.d.ts.map +1 -0
  582. package/dist/scanners/brakeman.js +271 -0
  583. package/dist/scanners/brakeman.js.map +1 -0
  584. package/dist/scanners/dependencies.d.ts +22 -0
  585. package/dist/scanners/dependencies.d.ts.map +1 -0
  586. package/dist/scanners/dependencies.js +202 -0
  587. package/dist/scanners/dependencies.js.map +1 -0
  588. package/dist/scanners/dependencies.test.d.ts +5 -0
  589. package/dist/scanners/dependencies.test.d.ts.map +1 -0
  590. package/dist/scanners/dependencies.test.js +185 -0
  591. package/dist/scanners/dependencies.test.js.map +1 -0
  592. package/dist/scanners/eslint.d.ts +25 -0
  593. package/dist/scanners/eslint.d.ts.map +1 -0
  594. package/dist/scanners/eslint.js +220 -0
  595. package/dist/scanners/eslint.js.map +1 -0
  596. package/dist/scanners/gosec.d.ts +25 -0
  597. package/dist/scanners/gosec.d.ts.map +1 -0
  598. package/dist/scanners/gosec.js +128 -0
  599. package/dist/scanners/gosec.js.map +1 -0
  600. package/dist/scanners/index.d.ts +128 -0
  601. package/dist/scanners/index.d.ts.map +1 -0
  602. package/dist/scanners/index.js +811 -0
  603. package/dist/scanners/index.js.map +1 -0
  604. package/dist/scanners/index.test.d.ts +5 -0
  605. package/dist/scanners/index.test.d.ts.map +1 -0
  606. package/dist/scanners/index.test.js +424 -0
  607. package/dist/scanners/index.test.js.map +1 -0
  608. package/dist/scanners/memory-safety.d.ts +44 -0
  609. package/dist/scanners/memory-safety.d.ts.map +1 -0
  610. package/dist/scanners/memory-safety.js +571 -0
  611. package/dist/scanners/memory-safety.js.map +1 -0
  612. package/dist/scanners/memory-safety.test.d.ts +5 -0
  613. package/dist/scanners/memory-safety.test.d.ts.map +1 -0
  614. package/dist/scanners/memory-safety.test.js +321 -0
  615. package/dist/scanners/memory-safety.test.js.map +1 -0
  616. package/dist/scanners/race-condition.d.ts +25 -0
  617. package/dist/scanners/race-condition.d.ts.map +1 -0
  618. package/dist/scanners/race-condition.js +443 -0
  619. package/dist/scanners/race-condition.js.map +1 -0
  620. package/dist/scanners/race-condition.test.d.ts +5 -0
  621. package/dist/scanners/race-condition.test.d.ts.map +1 -0
  622. package/dist/scanners/race-condition.test.js +428 -0
  623. package/dist/scanners/race-condition.test.js.map +1 -0
  624. package/dist/scanners/secrets.d.ts +25 -0
  625. package/dist/scanners/secrets.d.ts.map +1 -0
  626. package/dist/scanners/secrets.js +367 -0
  627. package/dist/scanners/secrets.js.map +1 -0
  628. package/dist/scanners/secrets.test.d.ts +5 -0
  629. package/dist/scanners/secrets.test.d.ts.map +1 -0
  630. package/dist/scanners/secrets.test.js +160 -0
  631. package/dist/scanners/secrets.test.js.map +1 -0
  632. package/dist/scanners/semgrep.d.ts +33 -0
  633. package/dist/scanners/semgrep.d.ts.map +1 -0
  634. package/dist/scanners/semgrep.js +350 -0
  635. package/dist/scanners/semgrep.js.map +1 -0
  636. package/dist/scanners/semgrep.test.d.ts +8 -0
  637. package/dist/scanners/semgrep.test.d.ts.map +1 -0
  638. package/dist/scanners/semgrep.test.js +254 -0
  639. package/dist/scanners/semgrep.test.js.map +1 -0
  640. package/dist/scanners/trivy.d.ts +26 -0
  641. package/dist/scanners/trivy.d.ts.map +1 -0
  642. package/dist/scanners/trivy.js +187 -0
  643. package/dist/scanners/trivy.js.map +1 -0
  644. package/dist/scanners/types.d.ts +210 -0
  645. package/dist/scanners/types.d.ts.map +1 -0
  646. package/dist/scanners/types.js +106 -0
  647. package/dist/scanners/types.js.map +1 -0
  648. package/dist/scanners/types.test.d.ts +5 -0
  649. package/dist/scanners/types.test.d.ts.map +1 -0
  650. package/dist/scanners/types.test.js +103 -0
  651. package/dist/scanners/types.test.js.map +1 -0
  652. package/dist/scanners/typescript.d.ts +32 -0
  653. package/dist/scanners/typescript.d.ts.map +1 -0
  654. package/dist/scanners/typescript.js +300 -0
  655. package/dist/scanners/typescript.js.map +1 -0
  656. package/dist/scanners/typescript.test.d.ts +5 -0
  657. package/dist/scanners/typescript.test.d.ts.map +1 -0
  658. package/dist/scanners/typescript.test.js +296 -0
  659. package/dist/scanners/typescript.test.js.map +1 -0
  660. package/dist/transcripts/index.d.ts +13 -0
  661. package/dist/transcripts/index.d.ts.map +1 -0
  662. package/dist/transcripts/index.js +17 -0
  663. package/dist/transcripts/index.js.map +1 -0
  664. package/dist/transcripts/logger.d.ts +190 -0
  665. package/dist/transcripts/logger.d.ts.map +1 -0
  666. package/dist/transcripts/logger.js +385 -0
  667. package/dist/transcripts/logger.js.map +1 -0
  668. package/dist/transcripts/logger.test.d.ts +5 -0
  669. package/dist/transcripts/logger.test.d.ts.map +1 -0
  670. package/dist/transcripts/logger.test.js +227 -0
  671. package/dist/transcripts/logger.test.js.map +1 -0
  672. package/dist/transcripts/redaction.d.ts +125 -0
  673. package/dist/transcripts/redaction.d.ts.map +1 -0
  674. package/dist/transcripts/redaction.js +416 -0
  675. package/dist/transcripts/redaction.js.map +1 -0
  676. package/dist/transcripts/redaction.test.d.ts +5 -0
  677. package/dist/transcripts/redaction.test.d.ts.map +1 -0
  678. package/dist/transcripts/redaction.test.js +267 -0
  679. package/dist/transcripts/redaction.test.js.map +1 -0
  680. package/dist/transcripts/signing.d.ts +108 -0
  681. package/dist/transcripts/signing.d.ts.map +1 -0
  682. package/dist/transcripts/signing.js +173 -0
  683. package/dist/transcripts/signing.js.map +1 -0
  684. package/dist/transcripts/verifier.d.ts +133 -0
  685. package/dist/transcripts/verifier.d.ts.map +1 -0
  686. package/dist/transcripts/verifier.js +489 -0
  687. package/dist/transcripts/verifier.js.map +1 -0
  688. package/dist/transcripts/verifier.test.d.ts +5 -0
  689. package/dist/transcripts/verifier.test.d.ts.map +1 -0
  690. package/dist/transcripts/verifier.test.js +330 -0
  691. package/dist/transcripts/verifier.test.js.map +1 -0
  692. package/dist/util/concurrency.d.ts +221 -0
  693. package/dist/util/concurrency.d.ts.map +1 -0
  694. package/dist/util/concurrency.js +339 -0
  695. package/dist/util/concurrency.js.map +1 -0
  696. package/dist/util/index.d.ts +12 -0
  697. package/dist/util/index.d.ts.map +1 -0
  698. package/dist/util/index.js +12 -0
  699. package/dist/util/index.js.map +1 -0
  700. package/dist/util/json.d.ts +63 -0
  701. package/dist/util/json.d.ts.map +1 -0
  702. package/dist/util/json.js +134 -0
  703. package/dist/util/json.js.map +1 -0
  704. package/dist/util/paths.d.ts +56 -0
  705. package/dist/util/paths.d.ts.map +1 -0
  706. package/dist/util/paths.js +128 -0
  707. package/dist/util/paths.js.map +1 -0
  708. package/dist/util/retry.d.ts +185 -0
  709. package/dist/util/retry.d.ts.map +1 -0
  710. package/dist/util/retry.js +338 -0
  711. package/dist/util/retry.js.map +1 -0
  712. package/package.json +79 -0
@@ -0,0 +1,764 @@
1
+ /**
2
+ * Exfiltration Path Graph Scanner
3
+ *
4
+ * Builds a directed graph of MCP tools based on their capabilities,
5
+ * then finds potential data exfiltration paths from secret sources
6
+ * (tools that read sensitive data) to network sinks (tools that can
7
+ * send data externally).
8
+ *
9
+ * Key features:
10
+ * - Tool capability classification (reads_secrets, network_access, etc.)
11
+ * - Path finding from sources to sinks
12
+ * - Minimal cut-set computation (tools to sandbox)
13
+ * - Mermaid diagram generation for visualization
14
+ *
15
+ * @module scanners/agent/exfil-path-graph
16
+ */
17
+ import { createHash } from "crypto";
18
+ // ============================================================================
19
+ // Tool Classification Patterns
20
+ // ============================================================================
21
+ /**
22
+ * Patterns indicating a tool reads secrets/credentials
23
+ */
24
+ const READS_SECRETS_PATTERNS = [
25
+ /secret/i,
26
+ /credential/i,
27
+ /password/i,
28
+ /api[_\s-]?key/i,
29
+ /token/i,
30
+ /auth/i,
31
+ /private[_\s-]?key/i,
32
+ /access[_\s-]?key/i,
33
+ /env(ironment)?/i,
34
+ /config(uration)?/i,
35
+ /\.env/i,
36
+ /keychain/i,
37
+ /vault/i,
38
+ /1password/i,
39
+ /lastpass/i,
40
+ /bitwarden/i,
41
+ ];
42
+ /**
43
+ * Patterns indicating a tool reads files
44
+ */
45
+ const READS_FILES_PATTERNS = [
46
+ /read[_\s-]?file/i,
47
+ /get[_\s-]?file/i,
48
+ /load[_\s-]?file/i,
49
+ /open[_\s-]?file/i,
50
+ /file[_\s-]?content/i,
51
+ /cat\s/i,
52
+ /less\s/i,
53
+ /head\s/i,
54
+ /tail\s/i,
55
+ /grep/i,
56
+ /search[_\s-]?file/i,
57
+ /glob/i,
58
+ /directory/i,
59
+ /folder/i,
60
+ /path/i,
61
+ /fs\./i,
62
+ /filesystem/i,
63
+ ];
64
+ /**
65
+ * Patterns indicating a tool reads environment variables
66
+ */
67
+ const READS_ENV_PATTERNS = [
68
+ /env(ironment)?/i,
69
+ /process\.env/i,
70
+ /getenv/i,
71
+ /environ/i,
72
+ /variable/i,
73
+ /dotenv/i,
74
+ ];
75
+ /**
76
+ * Patterns indicating a tool reads from database
77
+ */
78
+ const READS_DATABASE_PATTERNS = [
79
+ /database/i,
80
+ /db/i,
81
+ /sql/i,
82
+ /query/i,
83
+ /select/i,
84
+ /table/i,
85
+ /postgres/i,
86
+ /mysql/i,
87
+ /mongo/i,
88
+ /redis/i,
89
+ /supabase/i,
90
+ /prisma/i,
91
+ /drizzle/i,
92
+ ];
93
+ /**
94
+ * Patterns indicating a tool has network access
95
+ */
96
+ const NETWORK_ACCESS_PATTERNS = [
97
+ /http/i,
98
+ /https/i,
99
+ /url/i,
100
+ /fetch/i,
101
+ /request/i,
102
+ /api/i,
103
+ /webhook/i,
104
+ /socket/i,
105
+ /connect/i,
106
+ /download/i,
107
+ /upload/i,
108
+ /stream/i,
109
+ /remote/i,
110
+ /external/i,
111
+ /endpoint/i,
112
+ /curl/i,
113
+ /axios/i,
114
+ /got\s/i,
115
+ /node-fetch/i,
116
+ ];
117
+ /**
118
+ * Patterns indicating a tool sends email
119
+ */
120
+ const SENDS_EMAIL_PATTERNS = [
121
+ /email/i,
122
+ /mail/i,
123
+ /smtp/i,
124
+ /sendgrid/i,
125
+ /mailgun/i,
126
+ /postmark/i,
127
+ /ses\s/i,
128
+ /newsletter/i,
129
+ ];
130
+ /**
131
+ * Patterns indicating a tool sends to webhooks
132
+ */
133
+ const SENDS_WEBHOOK_PATTERNS = [
134
+ /webhook/i,
135
+ /callback/i,
136
+ /notify/i,
137
+ /slack/i,
138
+ /discord/i,
139
+ /teams/i,
140
+ /trigger/i,
141
+ /zapier/i,
142
+ /ifttt/i,
143
+ ];
144
+ /**
145
+ * Patterns indicating a tool executes code
146
+ */
147
+ const EXECUTES_CODE_PATTERNS = [
148
+ /exec/i,
149
+ /execute/i,
150
+ /run/i,
151
+ /eval/i,
152
+ /shell/i,
153
+ /bash/i,
154
+ /command/i,
155
+ /script/i,
156
+ /spawn/i,
157
+ /process/i,
158
+ /terminal/i,
159
+ /repl/i,
160
+ /interpret/i,
161
+ /compile/i,
162
+ ];
163
+ /**
164
+ * Patterns indicating a tool writes files
165
+ */
166
+ const WRITES_FILES_PATTERNS = [
167
+ /write[_\s-]?file/i,
168
+ /save[_\s-]?file/i,
169
+ /create[_\s-]?file/i,
170
+ /update[_\s-]?file/i,
171
+ /edit[_\s-]?file/i,
172
+ /modify[_\s-]?file/i,
173
+ /append/i,
174
+ /overwrite/i,
175
+ /delete[_\s-]?file/i,
176
+ /remove[_\s-]?file/i,
177
+ ];
178
+ /**
179
+ * Patterns indicating a tool writes to database
180
+ */
181
+ const WRITES_DATABASE_PATTERNS = [
182
+ /insert/i,
183
+ /update/i,
184
+ /delete/i,
185
+ /upsert/i,
186
+ /create.*record/i,
187
+ /modify.*record/i,
188
+ /write.*db/i,
189
+ /write.*database/i,
190
+ ];
191
+ // ============================================================================
192
+ // Tool Classification Functions
193
+ // ============================================================================
194
+ /**
195
+ * Classify a tool's capabilities based on name and description
196
+ */
197
+ function classifyTool(tool) {
198
+ const capabilities = [];
199
+ const text = `${tool.name} ${tool.description || ""}`.toLowerCase();
200
+ // Check each capability type
201
+ if (READS_SECRETS_PATTERNS.some((p) => p.test(text))) {
202
+ capabilities.push("reads_secrets");
203
+ }
204
+ if (READS_FILES_PATTERNS.some((p) => p.test(text))) {
205
+ capabilities.push("reads_files");
206
+ }
207
+ if (READS_ENV_PATTERNS.some((p) => p.test(text))) {
208
+ capabilities.push("reads_env");
209
+ }
210
+ if (READS_DATABASE_PATTERNS.some((p) => p.test(text))) {
211
+ capabilities.push("reads_database");
212
+ }
213
+ if (WRITES_FILES_PATTERNS.some((p) => p.test(text))) {
214
+ capabilities.push("writes_files");
215
+ }
216
+ if (WRITES_DATABASE_PATTERNS.some((p) => p.test(text))) {
217
+ capabilities.push("writes_database");
218
+ }
219
+ if (NETWORK_ACCESS_PATTERNS.some((p) => p.test(text)) || tool.networkAccess) {
220
+ capabilities.push("network_access");
221
+ }
222
+ if (EXECUTES_CODE_PATTERNS.some((p) => p.test(text)) || tool.codeExecution) {
223
+ capabilities.push("executes_code");
224
+ }
225
+ if (tool.destructiveHint) {
226
+ capabilities.push("modifies_state");
227
+ }
228
+ if (SENDS_EMAIL_PATTERNS.some((p) => p.test(text))) {
229
+ capabilities.push("sends_email");
230
+ }
231
+ if (SENDS_WEBHOOK_PATTERNS.some((p) => p.test(text))) {
232
+ capabilities.push("sends_webhook");
233
+ }
234
+ if (NETWORK_ACCESS_PATTERNS.some((p) => p.test(text)) && !capabilities.includes("network_access")) {
235
+ capabilities.push("accesses_external_api");
236
+ }
237
+ return capabilities;
238
+ }
239
+ /**
240
+ * Calculate risk score for a tool based on capabilities
241
+ */
242
+ function calculateToolRiskScore(capabilities) {
243
+ const riskWeights = {
244
+ reads_secrets: 30,
245
+ reads_files: 15,
246
+ reads_env: 25,
247
+ reads_database: 20,
248
+ writes_files: 20,
249
+ writes_database: 25,
250
+ network_access: 35,
251
+ executes_code: 40,
252
+ modifies_state: 15,
253
+ sends_email: 25,
254
+ sends_webhook: 30,
255
+ accesses_external_api: 25,
256
+ };
257
+ let score = 0;
258
+ for (const cap of capabilities) {
259
+ score += riskWeights[cap] || 0;
260
+ }
261
+ return Math.min(100, score);
262
+ }
263
+ /**
264
+ * Check if a tool is a potential secret source
265
+ */
266
+ function isSecretSource(capabilities) {
267
+ const secretSourceCaps = [
268
+ "reads_secrets",
269
+ "reads_env",
270
+ "reads_files",
271
+ "reads_database",
272
+ "executes_code", // Can access anything
273
+ ];
274
+ return capabilities.some((c) => secretSourceCaps.includes(c));
275
+ }
276
+ /**
277
+ * Check if a tool is a potential network sink
278
+ */
279
+ function isNetworkSink(capabilities) {
280
+ const networkCaps = [
281
+ "network_access",
282
+ "sends_email",
283
+ "sends_webhook",
284
+ "accesses_external_api",
285
+ "executes_code", // Can make network calls
286
+ ];
287
+ return capabilities.some((c) => networkCaps.includes(c));
288
+ }
289
+ // ============================================================================
290
+ // Graph Building
291
+ // ============================================================================
292
+ /**
293
+ * Build tool nodes from manifest
294
+ */
295
+ function buildNodes(manifest) {
296
+ const nodes = new Map();
297
+ for (const tool of manifest.tools) {
298
+ const capabilities = classifyTool(tool);
299
+ const riskScore = calculateToolRiskScore(capabilities);
300
+ nodes.set(tool.name, {
301
+ name: tool.name,
302
+ description: tool.description,
303
+ capabilities,
304
+ riskScore,
305
+ isSecretSource: isSecretSource(capabilities),
306
+ isNetworkSink: isNetworkSink(capabilities),
307
+ });
308
+ }
309
+ return nodes;
310
+ }
311
+ /**
312
+ * Build edges representing potential data flows
313
+ *
314
+ * In MCP, tools can be chained by the AI agent, so we model
315
+ * potential data flows between any source and any sink.
316
+ */
317
+ function buildEdges(nodes) {
318
+ const edges = [];
319
+ const nodeArray = Array.from(nodes.values());
320
+ // Create implicit edges from sources to sinks
321
+ // (data can flow through AI orchestration)
322
+ for (const source of nodeArray) {
323
+ if (!source.isSecretSource)
324
+ continue;
325
+ for (const target of nodeArray) {
326
+ if (source.name === target.name)
327
+ continue;
328
+ if (!target.isNetworkSink)
329
+ continue;
330
+ edges.push({
331
+ source: source.name,
332
+ target: target.name,
333
+ dataFlow: "implicit",
334
+ description: `Data can flow from ${source.name} to ${target.name} via AI orchestration`,
335
+ });
336
+ }
337
+ }
338
+ // Add chained edges for code execution tools
339
+ // (they can invoke any other tool)
340
+ for (const tool of nodeArray) {
341
+ if (tool.capabilities.includes("executes_code")) {
342
+ for (const other of nodeArray) {
343
+ if (tool.name === other.name)
344
+ continue;
345
+ // Execution tools can read from anything
346
+ if (other.isSecretSource && !tool.isSecretSource) {
347
+ edges.push({
348
+ source: other.name,
349
+ target: tool.name,
350
+ dataFlow: "chained",
351
+ description: `${tool.name} can execute code that reads from ${other.name}`,
352
+ });
353
+ }
354
+ // Execution tools can write to anything
355
+ if (other.isNetworkSink && !tool.isNetworkSink) {
356
+ edges.push({
357
+ source: tool.name,
358
+ target: other.name,
359
+ dataFlow: "chained",
360
+ description: `${tool.name} can execute code that sends data via ${other.name}`,
361
+ });
362
+ }
363
+ }
364
+ }
365
+ }
366
+ return edges;
367
+ }
368
+ // ============================================================================
369
+ // Path Finding
370
+ // ============================================================================
371
+ /**
372
+ * Find all exfiltration paths from sources to sinks
373
+ */
374
+ function findExfilPaths(nodes, edges) {
375
+ const paths = [];
376
+ // Build adjacency list
377
+ const adjacency = new Map();
378
+ for (const edge of edges) {
379
+ if (!adjacency.has(edge.source)) {
380
+ adjacency.set(edge.source, []);
381
+ }
382
+ adjacency.get(edge.source).push(edge.target);
383
+ }
384
+ // Find all sources and sinks
385
+ const sources = Array.from(nodes.values()).filter((n) => n.isSecretSource);
386
+ const sinks = Array.from(nodes.values()).filter((n) => n.isNetworkSink);
387
+ // BFS to find paths from each source to each sink
388
+ for (const source of sources) {
389
+ for (const sink of sinks) {
390
+ if (source.name === sink.name) {
391
+ // Direct exfil - tool both reads secrets AND has network access
392
+ paths.push({
393
+ source: source.name,
394
+ sink: sink.name,
395
+ path: [],
396
+ fullPath: [source.name],
397
+ riskLevel: "critical",
398
+ description: `Tool "${source.name}" can both read sensitive data and send it externally`,
399
+ mitigations: [
400
+ "Split into separate tools for reading and sending",
401
+ "Add explicit approval step before network operations",
402
+ "Implement data loss prevention (DLP) checks",
403
+ ],
404
+ });
405
+ continue;
406
+ }
407
+ // Find path using BFS
408
+ const pathFound = bfsPath(source.name, sink.name, adjacency);
409
+ if (pathFound) {
410
+ const riskLevel = calculatePathRisk(pathFound, nodes);
411
+ paths.push({
412
+ source: source.name,
413
+ sink: sink.name,
414
+ path: pathFound.slice(1, -1),
415
+ fullPath: pathFound,
416
+ riskLevel,
417
+ description: `Data can flow from "${source.name}" to "${sink.name}" via ${pathFound.length === 2 ? "direct connection" : `${pathFound.length - 2} intermediate tool(s)`}`,
418
+ mitigations: getMitigations(pathFound, nodes),
419
+ });
420
+ }
421
+ }
422
+ }
423
+ return paths;
424
+ }
425
+ /**
426
+ * BFS to find shortest path between two nodes
427
+ */
428
+ function bfsPath(start, end, adjacency) {
429
+ const visited = new Set();
430
+ const queue = [
431
+ { node: start, path: [start] },
432
+ ];
433
+ while (queue.length > 0) {
434
+ const { node, path } = queue.shift();
435
+ if (node === end) {
436
+ return path;
437
+ }
438
+ if (visited.has(node))
439
+ continue;
440
+ visited.add(node);
441
+ const neighbors = adjacency.get(node) || [];
442
+ for (const neighbor of neighbors) {
443
+ if (!visited.has(neighbor)) {
444
+ queue.push({ node: neighbor, path: [...path, neighbor] });
445
+ }
446
+ }
447
+ }
448
+ return null;
449
+ }
450
+ /**
451
+ * Calculate risk level for a path
452
+ */
453
+ function calculatePathRisk(path, nodes) {
454
+ if (path.length === 1) {
455
+ return "critical"; // Single tool with both capabilities
456
+ }
457
+ let maxRisk = 0;
458
+ for (const nodeName of path) {
459
+ const node = nodes.get(nodeName);
460
+ if (node) {
461
+ maxRisk = Math.max(maxRisk, node.riskScore);
462
+ }
463
+ }
464
+ if (maxRisk >= 60)
465
+ return "critical";
466
+ if (maxRisk >= 40)
467
+ return "high";
468
+ if (maxRisk >= 20)
469
+ return "medium";
470
+ return "low";
471
+ }
472
+ /**
473
+ * Generate mitigations for a path
474
+ */
475
+ function getMitigations(path, nodes) {
476
+ const mitigations = [];
477
+ if (path.length === 2) {
478
+ mitigations.push("Add intermediate approval step before network operations");
479
+ mitigations.push("Implement rate limiting on data transfer");
480
+ }
481
+ for (const nodeName of path) {
482
+ const node = nodes.get(nodeName);
483
+ if (node?.capabilities.includes("executes_code")) {
484
+ mitigations.push(`Sandbox code execution in "${nodeName}" with restricted network access`);
485
+ }
486
+ if (node?.capabilities.includes("reads_secrets")) {
487
+ mitigations.push(`Restrict "${nodeName}" to only necessary secrets using RBAC`);
488
+ }
489
+ if (node?.capabilities.includes("network_access")) {
490
+ mitigations.push(`Add allowlist for "${nodeName}" network destinations`);
491
+ }
492
+ }
493
+ // Add generic mitigations
494
+ mitigations.push("Enable comprehensive audit logging");
495
+ mitigations.push("Implement data classification and DLP policies");
496
+ // Deduplicate
497
+ return [...new Set(mitigations)];
498
+ }
499
+ // ============================================================================
500
+ // Cut Set Computation
501
+ // ============================================================================
502
+ /**
503
+ * Find minimal cut set to break all exfiltration paths
504
+ *
505
+ * Uses a greedy approximation: repeatedly select the node that
506
+ * appears in the most paths until all paths are cut.
507
+ */
508
+ function findMinimalCutSet(paths, nodes) {
509
+ if (paths.length === 0)
510
+ return [];
511
+ const cutSet = [];
512
+ const remainingPaths = [...paths];
513
+ while (remainingPaths.length > 0) {
514
+ // Count node occurrences across all remaining paths
515
+ const nodeCounts = new Map();
516
+ for (const path of remainingPaths) {
517
+ for (const node of path.fullPath) {
518
+ nodeCounts.set(node, (nodeCounts.get(node) || 0) + 1);
519
+ }
520
+ }
521
+ // Find node with highest count
522
+ let maxNode = "";
523
+ let maxCount = 0;
524
+ for (const [node, count] of nodeCounts) {
525
+ // Weight by risk score for tie-breaking
526
+ const nodeData = nodes.get(node);
527
+ const weightedCount = count + (nodeData ? nodeData.riskScore / 100 : 0);
528
+ if (weightedCount > maxCount) {
529
+ maxCount = weightedCount;
530
+ maxNode = node;
531
+ }
532
+ }
533
+ if (!maxNode)
534
+ break;
535
+ // Add to cut set
536
+ cutSet.push(maxNode);
537
+ // Remove paths containing this node
538
+ for (let i = remainingPaths.length - 1; i >= 0; i--) {
539
+ if (remainingPaths[i].fullPath.includes(maxNode)) {
540
+ remainingPaths.splice(i, 1);
541
+ }
542
+ }
543
+ }
544
+ return cutSet;
545
+ }
546
+ // ============================================================================
547
+ // Mermaid Diagram Generation
548
+ // ============================================================================
549
+ /**
550
+ * Generate Mermaid diagram of the tool graph
551
+ */
552
+ function generateMermaidDiagram(graph) {
553
+ const lines = ["graph LR"];
554
+ // Add styling
555
+ lines.push(" classDef source fill:#ff6b6b,stroke:#333,color:#fff");
556
+ lines.push(" classDef sink fill:#4ecdc4,stroke:#333,color:#fff");
557
+ lines.push(" classDef both fill:#ffe66d,stroke:#333,color:#000");
558
+ lines.push(" classDef normal fill:#95e1d3,stroke:#333");
559
+ lines.push(" classDef cutset fill:#ff9999,stroke:#f00,stroke-width:3px");
560
+ // Add nodes
561
+ for (const [name, node] of graph.nodes) {
562
+ const sanitized = name.replace(/[^a-zA-Z0-9]/g, "_");
563
+ const label = name.length > 20 ? name.slice(0, 17) + "..." : name;
564
+ if (node.isSecretSource && node.isNetworkSink) {
565
+ lines.push(` ${sanitized}["${label}"]:::both`);
566
+ }
567
+ else if (node.isSecretSource) {
568
+ lines.push(` ${sanitized}["${label}"]:::source`);
569
+ }
570
+ else if (node.isNetworkSink) {
571
+ lines.push(` ${sanitized}["${label}"]:::sink`);
572
+ }
573
+ else {
574
+ lines.push(` ${sanitized}["${label}"]:::normal`);
575
+ }
576
+ }
577
+ // Add edges for exfil paths only (to avoid clutter)
578
+ const addedEdges = new Set();
579
+ for (const path of graph.exfilPaths) {
580
+ for (let i = 0; i < path.fullPath.length - 1; i++) {
581
+ const from = path.fullPath[i].replace(/[^a-zA-Z0-9]/g, "_");
582
+ const to = path.fullPath[i + 1].replace(/[^a-zA-Z0-9]/g, "_");
583
+ const edgeKey = `${from}-${to}`;
584
+ if (!addedEdges.has(edgeKey)) {
585
+ addedEdges.add(edgeKey);
586
+ const style = path.riskLevel === "critical" ? "==>" : "-->";
587
+ lines.push(` ${from} ${style} ${to}`);
588
+ }
589
+ }
590
+ }
591
+ // Mark cut set nodes
592
+ for (const node of graph.cutSet) {
593
+ const sanitized = node.replace(/[^a-zA-Z0-9]/g, "_");
594
+ lines.push(` ${sanitized}:::cutset`);
595
+ }
596
+ // Add legend
597
+ lines.push("");
598
+ lines.push(" subgraph Legend");
599
+ lines.push(" source_leg[Secret Source]:::source");
600
+ lines.push(" sink_leg[Network Sink]:::sink");
601
+ lines.push(" both_leg[Source + Sink]:::both");
602
+ lines.push(" cut_leg[Cut Set]:::cutset");
603
+ lines.push(" end");
604
+ return lines.join("\n");
605
+ }
606
+ // ============================================================================
607
+ // Main Scanner Function
608
+ // ============================================================================
609
+ /**
610
+ * Run exfiltration path graph scanner
611
+ */
612
+ export async function runExfilPathScanner(manifest, _options) {
613
+ const startTime = Date.now();
614
+ // Build graph
615
+ const nodes = buildNodes(manifest);
616
+ const edges = buildEdges(nodes);
617
+ const exfilPaths = findExfilPaths(nodes, edges);
618
+ const cutSet = findMinimalCutSet(exfilPaths, nodes);
619
+ const graph = {
620
+ nodes,
621
+ edges,
622
+ exfilPaths,
623
+ cutSet,
624
+ mermaidDiagram: "",
625
+ };
626
+ // Generate diagram
627
+ graph.mermaidDiagram = generateMermaidDiagram(graph);
628
+ // Convert to findings
629
+ const findings = [];
630
+ // Add finding for each critical/high path
631
+ for (const path of exfilPaths) {
632
+ if (path.riskLevel === "critical" || path.riskLevel === "high") {
633
+ findings.push({
634
+ scanner: "semgrep",
635
+ ruleId: `exfil-path:${path.riskLevel}`,
636
+ file: "mcp-manifest",
637
+ line: 0,
638
+ message: path.description,
639
+ severity: path.riskLevel,
640
+ confidence: 100,
641
+ evidence: [
642
+ `Path: ${path.fullPath.join(" → ")}`,
643
+ `Mitigations:`,
644
+ ...path.mitigations.map((m) => ` - ${m}`),
645
+ ].join("\n"),
646
+ metadata: {
647
+ agentScanner: "exfil-path-graph",
648
+ source: path.source,
649
+ sink: path.sink,
650
+ pathLength: path.fullPath.length,
651
+ mitigations: path.mitigations,
652
+ },
653
+ });
654
+ }
655
+ }
656
+ // Add summary finding
657
+ if (exfilPaths.length > 0) {
658
+ const criticalPaths = exfilPaths.filter((p) => p.riskLevel === "critical");
659
+ const highPaths = exfilPaths.filter((p) => p.riskLevel === "high");
660
+ findings.push({
661
+ scanner: "semgrep",
662
+ ruleId: "exfil-path:summary",
663
+ file: "mcp-manifest",
664
+ line: 0,
665
+ message: `Found ${exfilPaths.length} potential exfiltration path(s): ${criticalPaths.length} critical, ${highPaths.length} high`,
666
+ severity: criticalPaths.length > 0 ? "critical" : highPaths.length > 0 ? "high" : "medium",
667
+ confidence: 100,
668
+ evidence: [
669
+ `Total paths: ${exfilPaths.length}`,
670
+ `Secret sources: ${Array.from(nodes.values()).filter((n) => n.isSecretSource).length}`,
671
+ `Network sinks: ${Array.from(nodes.values()).filter((n) => n.isNetworkSink).length}`,
672
+ `Recommended cut set: ${cutSet.join(", ") || "None needed"}`,
673
+ "",
674
+ "Mermaid diagram:",
675
+ "```mermaid",
676
+ graph.mermaidDiagram,
677
+ "```",
678
+ ].join("\n"),
679
+ metadata: {
680
+ agentScanner: "exfil-path-graph",
681
+ totalPaths: exfilPaths.length,
682
+ criticalPaths: criticalPaths.length,
683
+ highPaths: highPaths.length,
684
+ cutSet,
685
+ sources: Array.from(nodes.values())
686
+ .filter((n) => n.isSecretSource)
687
+ .map((n) => n.name),
688
+ sinks: Array.from(nodes.values())
689
+ .filter((n) => n.isNetworkSink)
690
+ .map((n) => n.name),
691
+ },
692
+ });
693
+ }
694
+ // Calculate manifest hash
695
+ const manifestHash = createHash("sha256")
696
+ .update(JSON.stringify(manifest))
697
+ .digest("hex");
698
+ return {
699
+ scanner: "exfil-path-graph",
700
+ findings,
701
+ duration: Date.now() - startTime,
702
+ success: true,
703
+ mcpServerName: manifest.name,
704
+ mcpServerVersion: manifest.version,
705
+ manifestHash,
706
+ version: "1.0.0",
707
+ rulesUsed: ["path-analysis"],
708
+ };
709
+ }
710
+ /**
711
+ * Check if exfil path scanner is available (always true - no external deps)
712
+ */
713
+ export async function checkExfilPathAvailable() {
714
+ return {
715
+ scanner: "exfil-path-graph",
716
+ available: true,
717
+ version: "1.0.0",
718
+ };
719
+ }
720
+ /**
721
+ * Get exfil graph from scanner result
722
+ */
723
+ export function getExfilGraph(result) {
724
+ const summaryFinding = result.findings.find((f) => f.ruleId === "exfil-path:summary");
725
+ if (!summaryFinding?.metadata) {
726
+ return null;
727
+ }
728
+ const meta = summaryFinding.metadata;
729
+ // Return partial graph info from metadata
730
+ // (full graph requires re-running scanner)
731
+ return {
732
+ nodes: new Map(),
733
+ edges: [],
734
+ exfilPaths: [],
735
+ cutSet: meta.cutSet || [],
736
+ mermaidDiagram: extractMermaidDiagram(summaryFinding.evidence || ""),
737
+ };
738
+ }
739
+ /**
740
+ * Extract Mermaid diagram from evidence
741
+ */
742
+ function extractMermaidDiagram(evidence) {
743
+ const match = evidence.match(/```mermaid\n([\s\S]*?)\n```/);
744
+ return match ? match[1] : "";
745
+ }
746
+ /**
747
+ * Get exfil path summary
748
+ */
749
+ export function getExfilSummary(result) {
750
+ const summaryFinding = result.findings.find((f) => f.ruleId === "exfil-path:summary");
751
+ if (!summaryFinding?.metadata) {
752
+ return null;
753
+ }
754
+ const meta = summaryFinding.metadata;
755
+ return {
756
+ totalPaths: meta.totalPaths || 0,
757
+ criticalPaths: meta.criticalPaths || 0,
758
+ highPaths: meta.highPaths || 0,
759
+ sources: meta.sources || [],
760
+ sinks: meta.sinks || [],
761
+ cutSet: meta.cutSet || [],
762
+ };
763
+ }
764
+ //# sourceMappingURL=exfil-path-graph.js.map