agentic-qe 3.3.0 → 3.3.1

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 (367) hide show
  1. package/README.md +6 -2
  2. package/package.json +6 -1
  3. package/v3/CHANGELOG.md +88 -0
  4. package/v3/dist/cli/bundle.js +18794 -15534
  5. package/v3/dist/cli/command-registry.d.ts +55 -0
  6. package/v3/dist/cli/command-registry.d.ts.map +1 -0
  7. package/v3/dist/cli/command-registry.js +103 -0
  8. package/v3/dist/cli/command-registry.js.map +1 -0
  9. package/v3/dist/cli/commands/code.d.ts +9 -0
  10. package/v3/dist/cli/commands/code.d.ts.map +1 -0
  11. package/v3/dist/cli/commands/code.js +254 -0
  12. package/v3/dist/cli/commands/code.js.map +1 -0
  13. package/v3/dist/cli/commands/completions.d.ts +8 -0
  14. package/v3/dist/cli/commands/completions.d.ts.map +1 -0
  15. package/v3/dist/cli/commands/completions.js +99 -0
  16. package/v3/dist/cli/commands/completions.js.map +1 -0
  17. package/v3/dist/cli/commands/coverage.d.ts +9 -0
  18. package/v3/dist/cli/commands/coverage.d.ts.map +1 -0
  19. package/v3/dist/cli/commands/coverage.js +208 -0
  20. package/v3/dist/cli/commands/coverage.js.map +1 -0
  21. package/v3/dist/cli/commands/fleet.d.ts +11 -0
  22. package/v3/dist/cli/commands/fleet.d.ts.map +1 -0
  23. package/v3/dist/cli/commands/fleet.js +338 -0
  24. package/v3/dist/cli/commands/fleet.js.map +1 -0
  25. package/v3/dist/cli/commands/migrate.d.ts +9 -0
  26. package/v3/dist/cli/commands/migrate.d.ts.map +1 -0
  27. package/v3/dist/cli/commands/migrate.js +566 -0
  28. package/v3/dist/cli/commands/migrate.js.map +1 -0
  29. package/v3/dist/cli/commands/quality.d.ts +9 -0
  30. package/v3/dist/cli/commands/quality.d.ts.map +1 -0
  31. package/v3/dist/cli/commands/quality.js +40 -0
  32. package/v3/dist/cli/commands/quality.js.map +1 -0
  33. package/v3/dist/cli/commands/security.d.ts +9 -0
  34. package/v3/dist/cli/commands/security.d.ts.map +1 -0
  35. package/v3/dist/cli/commands/security.js +124 -0
  36. package/v3/dist/cli/commands/security.js.map +1 -0
  37. package/v3/dist/cli/commands/sync.d.ts +19 -0
  38. package/v3/dist/cli/commands/sync.d.ts.map +1 -0
  39. package/v3/dist/cli/commands/sync.js +283 -0
  40. package/v3/dist/cli/commands/sync.js.map +1 -0
  41. package/v3/dist/cli/commands/test.d.ts +9 -0
  42. package/v3/dist/cli/commands/test.d.ts.map +1 -0
  43. package/v3/dist/cli/commands/test.js +166 -0
  44. package/v3/dist/cli/commands/test.js.map +1 -0
  45. package/v3/dist/cli/handlers/agent-handler.d.ts +20 -0
  46. package/v3/dist/cli/handlers/agent-handler.d.ts.map +1 -0
  47. package/v3/dist/cli/handlers/agent-handler.js +158 -0
  48. package/v3/dist/cli/handlers/agent-handler.js.map +1 -0
  49. package/v3/dist/cli/handlers/domain-handler.d.ts +20 -0
  50. package/v3/dist/cli/handlers/domain-handler.d.ts.map +1 -0
  51. package/v3/dist/cli/handlers/domain-handler.js +115 -0
  52. package/v3/dist/cli/handlers/domain-handler.js.map +1 -0
  53. package/v3/dist/cli/handlers/index.d.ts +13 -0
  54. package/v3/dist/cli/handlers/index.d.ts.map +1 -0
  55. package/v3/dist/cli/handlers/index.js +15 -0
  56. package/v3/dist/cli/handlers/index.js.map +1 -0
  57. package/v3/dist/cli/handlers/init-handler.d.ts +38 -0
  58. package/v3/dist/cli/handlers/init-handler.d.ts.map +1 -0
  59. package/v3/dist/cli/handlers/init-handler.js +288 -0
  60. package/v3/dist/cli/handlers/init-handler.js.map +1 -0
  61. package/v3/dist/cli/handlers/interfaces.d.ts +104 -0
  62. package/v3/dist/cli/handlers/interfaces.d.ts.map +1 -0
  63. package/v3/dist/cli/handlers/interfaces.js +109 -0
  64. package/v3/dist/cli/handlers/interfaces.js.map +1 -0
  65. package/v3/dist/cli/handlers/protocol-handler.d.ts +19 -0
  66. package/v3/dist/cli/handlers/protocol-handler.d.ts.map +1 -0
  67. package/v3/dist/cli/handlers/protocol-handler.js +79 -0
  68. package/v3/dist/cli/handlers/protocol-handler.js.map +1 -0
  69. package/v3/dist/cli/handlers/status-handler.d.ts +30 -0
  70. package/v3/dist/cli/handlers/status-handler.d.ts.map +1 -0
  71. package/v3/dist/cli/handlers/status-handler.js +218 -0
  72. package/v3/dist/cli/handlers/status-handler.js.map +1 -0
  73. package/v3/dist/cli/handlers/task-handler.d.ts +22 -0
  74. package/v3/dist/cli/handlers/task-handler.d.ts.map +1 -0
  75. package/v3/dist/cli/handlers/task-handler.js +271 -0
  76. package/v3/dist/cli/handlers/task-handler.js.map +1 -0
  77. package/v3/dist/cli/index.d.ts +4 -0
  78. package/v3/dist/cli/index.d.ts.map +1 -1
  79. package/v3/dist/cli/index.js +48 -2677
  80. package/v3/dist/cli/index.js.map +1 -1
  81. package/v3/dist/cli/wizards/core/index.d.ts +11 -0
  82. package/v3/dist/cli/wizards/core/index.d.ts.map +1 -0
  83. package/v3/dist/cli/wizards/core/index.js +15 -0
  84. package/v3/dist/cli/wizards/core/index.js.map +1 -0
  85. package/v3/dist/cli/wizards/core/wizard-base.d.ts +87 -0
  86. package/v3/dist/cli/wizards/core/wizard-base.d.ts.map +1 -0
  87. package/v3/dist/cli/wizards/core/wizard-base.js +120 -0
  88. package/v3/dist/cli/wizards/core/wizard-base.js.map +1 -0
  89. package/v3/dist/cli/wizards/core/wizard-command.d.ts +182 -0
  90. package/v3/dist/cli/wizards/core/wizard-command.d.ts.map +1 -0
  91. package/v3/dist/cli/wizards/core/wizard-command.js +45 -0
  92. package/v3/dist/cli/wizards/core/wizard-command.js.map +1 -0
  93. package/v3/dist/cli/wizards/core/wizard-step.d.ts +109 -0
  94. package/v3/dist/cli/wizards/core/wizard-step.d.ts.map +1 -0
  95. package/v3/dist/cli/wizards/core/wizard-step.js +384 -0
  96. package/v3/dist/cli/wizards/core/wizard-step.js.map +1 -0
  97. package/v3/dist/cli/wizards/core/wizard-utils.d.ts +117 -0
  98. package/v3/dist/cli/wizards/core/wizard-utils.d.ts.map +1 -0
  99. package/v3/dist/cli/wizards/core/wizard-utils.js +291 -0
  100. package/v3/dist/cli/wizards/core/wizard-utils.js.map +1 -0
  101. package/v3/dist/cli/wizards/coverage-wizard.d.ts +13 -68
  102. package/v3/dist/cli/wizards/coverage-wizard.d.ts.map +1 -1
  103. package/v3/dist/cli/wizards/coverage-wizard.js +127 -391
  104. package/v3/dist/cli/wizards/coverage-wizard.js.map +1 -1
  105. package/v3/dist/cli/wizards/fleet-wizard.d.ts +13 -64
  106. package/v3/dist/cli/wizards/fleet-wizard.d.ts.map +1 -1
  107. package/v3/dist/cli/wizards/fleet-wizard.js +150 -363
  108. package/v3/dist/cli/wizards/fleet-wizard.js.map +1 -1
  109. package/v3/dist/cli/wizards/index.d.ts +2 -0
  110. package/v3/dist/cli/wizards/index.d.ts.map +1 -1
  111. package/v3/dist/cli/wizards/index.js +3 -0
  112. package/v3/dist/cli/wizards/index.js.map +1 -1
  113. package/v3/dist/cli/wizards/security-wizard.d.ts +13 -64
  114. package/v3/dist/cli/wizards/security-wizard.d.ts.map +1 -1
  115. package/v3/dist/cli/wizards/security-wizard.js +152 -395
  116. package/v3/dist/cli/wizards/security-wizard.js.map +1 -1
  117. package/v3/dist/cli/wizards/test-wizard.d.ts +13 -77
  118. package/v3/dist/cli/wizards/test-wizard.d.ts.map +1 -1
  119. package/v3/dist/cli/wizards/test-wizard.js +196 -328
  120. package/v3/dist/cli/wizards/test-wizard.js.map +1 -1
  121. package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts +3 -0
  122. package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts.map +1 -1
  123. package/v3/dist/coordination/mincut/mincut-health-monitor.js +6 -2
  124. package/v3/dist/coordination/mincut/mincut-health-monitor.js.map +1 -1
  125. package/v3/dist/coordination/mincut/queen-integration.d.ts +3 -0
  126. package/v3/dist/coordination/mincut/queen-integration.d.ts.map +1 -1
  127. package/v3/dist/coordination/mincut/queen-integration.js +6 -1
  128. package/v3/dist/coordination/mincut/queen-integration.js.map +1 -1
  129. package/v3/dist/coordination/task-executor.js +2 -2
  130. package/v3/dist/coordination/task-executor.js.map +1 -1
  131. package/v3/dist/domains/chaos-resilience/plugin.js +2 -2
  132. package/v3/dist/domains/chaos-resilience/plugin.js.map +1 -1
  133. package/v3/dist/domains/code-intelligence/plugin.js +2 -2
  134. package/v3/dist/domains/code-intelligence/plugin.js.map +1 -1
  135. package/v3/dist/domains/contract-testing/plugin.js +2 -2
  136. package/v3/dist/domains/contract-testing/plugin.js.map +1 -1
  137. package/v3/dist/domains/coverage-analysis/plugin.d.ts.map +1 -1
  138. package/v3/dist/domains/coverage-analysis/plugin.js +2 -1
  139. package/v3/dist/domains/coverage-analysis/plugin.js.map +1 -1
  140. package/v3/dist/domains/defect-intelligence/plugin.js +2 -2
  141. package/v3/dist/domains/defect-intelligence/plugin.js.map +1 -1
  142. package/v3/dist/domains/domain-interface.d.ts.map +1 -1
  143. package/v3/dist/domains/domain-interface.js +3 -1
  144. package/v3/dist/domains/domain-interface.js.map +1 -1
  145. package/v3/dist/domains/learning-optimization/plugin.js +2 -2
  146. package/v3/dist/domains/learning-optimization/plugin.js.map +1 -1
  147. package/v3/dist/domains/quality-assessment/plugin.js +2 -2
  148. package/v3/dist/domains/quality-assessment/plugin.js.map +1 -1
  149. package/v3/dist/domains/requirements-validation/plugin.js +2 -2
  150. package/v3/dist/domains/requirements-validation/plugin.js.map +1 -1
  151. package/v3/dist/domains/security-compliance/plugin.js +2 -2
  152. package/v3/dist/domains/security-compliance/plugin.js.map +1 -1
  153. package/v3/dist/domains/test-execution/index.d.ts +2 -1
  154. package/v3/dist/domains/test-execution/index.d.ts.map +1 -1
  155. package/v3/dist/domains/test-execution/index.js +0 -2
  156. package/v3/dist/domains/test-execution/index.js.map +1 -1
  157. package/v3/dist/domains/test-execution/interfaces.d.ts +222 -25
  158. package/v3/dist/domains/test-execution/interfaces.d.ts.map +1 -1
  159. package/v3/dist/domains/test-execution/interfaces.js +130 -3
  160. package/v3/dist/domains/test-execution/interfaces.js.map +1 -1
  161. package/v3/dist/domains/test-execution/plugin.d.ts.map +1 -1
  162. package/v3/dist/domains/test-execution/plugin.js +2 -1
  163. package/v3/dist/domains/test-execution/plugin.js.map +1 -1
  164. package/v3/dist/domains/test-execution/test-prioritization-types.d.ts +5 -172
  165. package/v3/dist/domains/test-execution/test-prioritization-types.d.ts.map +1 -1
  166. package/v3/dist/domains/test-execution/test-prioritization-types.js +6 -129
  167. package/v3/dist/domains/test-execution/test-prioritization-types.js.map +1 -1
  168. package/v3/dist/domains/test-execution/types/index.d.ts +7 -3
  169. package/v3/dist/domains/test-execution/types/index.d.ts.map +1 -1
  170. package/v3/dist/domains/test-execution/types/index.js +7 -17
  171. package/v3/dist/domains/test-execution/types/index.js.map +1 -1
  172. package/v3/dist/domains/test-generation/coordinator.d.ts +1 -1
  173. package/v3/dist/domains/test-generation/coordinator.d.ts.map +1 -1
  174. package/v3/dist/domains/test-generation/coordinator.js +3 -3
  175. package/v3/dist/domains/test-generation/coordinator.js.map +1 -1
  176. package/v3/dist/domains/test-generation/factories/index.d.ts +8 -0
  177. package/v3/dist/domains/test-generation/factories/index.d.ts.map +1 -0
  178. package/v3/dist/domains/test-generation/factories/index.js +8 -0
  179. package/v3/dist/domains/test-generation/factories/index.js.map +1 -0
  180. package/v3/dist/domains/test-generation/factories/test-generator-factory.d.ts +108 -0
  181. package/v3/dist/domains/test-generation/factories/test-generator-factory.d.ts.map +1 -0
  182. package/v3/dist/domains/test-generation/factories/test-generator-factory.js +158 -0
  183. package/v3/dist/domains/test-generation/factories/test-generator-factory.js.map +1 -0
  184. package/v3/dist/domains/test-generation/generators/base-test-generator.d.ts +79 -0
  185. package/v3/dist/domains/test-generation/generators/base-test-generator.d.ts.map +1 -0
  186. package/v3/dist/domains/test-generation/generators/base-test-generator.js +252 -0
  187. package/v3/dist/domains/test-generation/generators/base-test-generator.js.map +1 -0
  188. package/v3/dist/domains/test-generation/generators/index.d.ts +11 -0
  189. package/v3/dist/domains/test-generation/generators/index.d.ts.map +1 -0
  190. package/v3/dist/domains/test-generation/generators/index.js +13 -0
  191. package/v3/dist/domains/test-generation/generators/index.js.map +1 -0
  192. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.d.ts +77 -0
  193. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.d.ts.map +1 -0
  194. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.js +365 -0
  195. package/v3/dist/domains/test-generation/generators/jest-vitest-generator.js.map +1 -0
  196. package/v3/dist/domains/test-generation/generators/mocha-generator.d.ts +56 -0
  197. package/v3/dist/domains/test-generation/generators/mocha-generator.d.ts.map +1 -0
  198. package/v3/dist/domains/test-generation/generators/mocha-generator.js +197 -0
  199. package/v3/dist/domains/test-generation/generators/mocha-generator.js.map +1 -0
  200. package/v3/dist/domains/test-generation/generators/pytest-generator.d.ts +66 -0
  201. package/v3/dist/domains/test-generation/generators/pytest-generator.d.ts.map +1 -0
  202. package/v3/dist/domains/test-generation/generators/pytest-generator.js +240 -0
  203. package/v3/dist/domains/test-generation/generators/pytest-generator.js.map +1 -0
  204. package/v3/dist/domains/test-generation/index.d.ts +2 -2
  205. package/v3/dist/domains/test-generation/index.d.ts.map +1 -1
  206. package/v3/dist/domains/test-generation/index.js +3 -3
  207. package/v3/dist/domains/test-generation/index.js.map +1 -1
  208. package/v3/dist/domains/test-generation/interfaces/index.d.ts +9 -0
  209. package/v3/dist/domains/test-generation/interfaces/index.d.ts.map +1 -0
  210. package/v3/dist/domains/test-generation/interfaces/index.js +9 -0
  211. package/v3/dist/domains/test-generation/interfaces/index.js.map +1 -0
  212. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.d.ts +166 -0
  213. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.d.ts.map +1 -0
  214. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.js +8 -0
  215. package/v3/dist/domains/test-generation/interfaces/test-generator.interface.js.map +1 -0
  216. package/v3/dist/domains/test-generation/interfaces.d.ts +163 -24
  217. package/v3/dist/domains/test-generation/interfaces.d.ts.map +1 -1
  218. package/v3/dist/domains/test-generation/interfaces.js +2 -2
  219. package/v3/dist/domains/test-generation/plugin.d.ts.map +1 -1
  220. package/v3/dist/domains/test-generation/plugin.js +6 -5
  221. package/v3/dist/domains/test-generation/plugin.js.map +1 -1
  222. package/v3/dist/domains/test-generation/{coherence-gate.d.ts → services/coherence-gate-service.d.ts} +4 -4
  223. package/v3/dist/domains/test-generation/services/coherence-gate-service.d.ts.map +1 -0
  224. package/v3/dist/domains/test-generation/{coherence-gate.js → services/coherence-gate-service.js} +2 -2
  225. package/v3/dist/domains/test-generation/services/coherence-gate-service.js.map +1 -0
  226. package/v3/dist/domains/test-generation/services/index.d.ts +8 -2
  227. package/v3/dist/domains/test-generation/services/index.d.ts.map +1 -1
  228. package/v3/dist/domains/test-generation/services/index.js +10 -3
  229. package/v3/dist/domains/test-generation/services/index.js.map +1 -1
  230. package/v3/dist/domains/test-generation/services/property-test-generator.d.ts +34 -0
  231. package/v3/dist/domains/test-generation/services/property-test-generator.d.ts.map +1 -0
  232. package/v3/dist/domains/test-generation/services/property-test-generator.js +306 -0
  233. package/v3/dist/domains/test-generation/services/property-test-generator.js.map +1 -0
  234. package/v3/dist/domains/test-generation/services/tdd-generator.d.ts +33 -0
  235. package/v3/dist/domains/test-generation/services/tdd-generator.d.ts.map +1 -0
  236. package/v3/dist/domains/test-generation/services/tdd-generator.js +342 -0
  237. package/v3/dist/domains/test-generation/services/tdd-generator.js.map +1 -0
  238. package/v3/dist/domains/test-generation/services/test-data-generator.d.ts +34 -0
  239. package/v3/dist/domains/test-generation/services/test-data-generator.d.ts.map +1 -0
  240. package/v3/dist/domains/test-generation/services/test-data-generator.js +245 -0
  241. package/v3/dist/domains/test-generation/services/test-data-generator.js.map +1 -0
  242. package/v3/dist/domains/test-generation/services/test-generator.d.ts +51 -160
  243. package/v3/dist/domains/test-generation/services/test-generator.d.ts.map +1 -1
  244. package/v3/dist/domains/test-generation/services/test-generator.js +101 -1858
  245. package/v3/dist/domains/test-generation/services/test-generator.js.map +1 -1
  246. package/v3/dist/domains/visual-accessibility/plugin.js +2 -2
  247. package/v3/dist/domains/visual-accessibility/plugin.js.map +1 -1
  248. package/v3/dist/init/phases/12-verification.d.ts +23 -0
  249. package/v3/dist/init/phases/12-verification.d.ts.map +1 -1
  250. package/v3/dist/init/phases/12-verification.js +185 -2
  251. package/v3/dist/init/phases/12-verification.js.map +1 -1
  252. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.d.ts +24 -62
  253. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.d.ts.map +1 -1
  254. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.js +45 -497
  255. package/v3/dist/integrations/agentic-flow/model-router/complexity-analyzer.js.map +1 -1
  256. package/v3/dist/integrations/agentic-flow/model-router/router.js +2 -2
  257. package/v3/dist/integrations/agentic-flow/model-router/router.js.map +1 -1
  258. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.d.ts +98 -0
  259. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.d.ts.map +1 -0
  260. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.js +197 -0
  261. package/v3/dist/integrations/agentic-flow/model-router/score-calculator.js.map +1 -0
  262. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.d.ts +102 -0
  263. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.d.ts.map +1 -0
  264. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js +372 -0
  265. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js.map +1 -0
  266. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.d.ts +64 -0
  267. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.d.ts.map +1 -0
  268. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.js +120 -0
  269. package/v3/dist/integrations/agentic-flow/model-router/tier-recommender.js.map +1 -0
  270. package/v3/dist/integrations/coherence/coherence-service.d.ts.map +1 -1
  271. package/v3/dist/integrations/coherence/coherence-service.js +87 -30
  272. package/v3/dist/integrations/coherence/coherence-service.js.map +1 -1
  273. package/v3/dist/integrations/coherence/engines/spectral-adapter.d.ts.map +1 -1
  274. package/v3/dist/integrations/coherence/engines/spectral-adapter.js +124 -35
  275. package/v3/dist/integrations/coherence/engines/spectral-adapter.js.map +1 -1
  276. package/v3/dist/learning/memory-auditor.d.ts.map +1 -1
  277. package/v3/dist/learning/memory-auditor.js +3 -1
  278. package/v3/dist/learning/memory-auditor.js.map +1 -1
  279. package/v3/dist/mcp/bundle.js +2475 -1463
  280. package/v3/dist/mcp/security/cve-prevention.d.ts +31 -134
  281. package/v3/dist/mcp/security/cve-prevention.d.ts.map +1 -1
  282. package/v3/dist/mcp/security/cve-prevention.js +37 -562
  283. package/v3/dist/mcp/security/cve-prevention.js.map +1 -1
  284. package/v3/dist/mcp/security/index.d.ts +5 -1
  285. package/v3/dist/mcp/security/index.d.ts.map +1 -1
  286. package/v3/dist/mcp/security/validators/command-validator.d.ts +41 -0
  287. package/v3/dist/mcp/security/validators/command-validator.d.ts.map +1 -0
  288. package/v3/dist/mcp/security/validators/command-validator.js +123 -0
  289. package/v3/dist/mcp/security/validators/command-validator.js.map +1 -0
  290. package/v3/dist/mcp/security/validators/crypto-validator.d.ts +40 -0
  291. package/v3/dist/mcp/security/validators/crypto-validator.d.ts.map +1 -0
  292. package/v3/dist/mcp/security/validators/crypto-validator.js +72 -0
  293. package/v3/dist/mcp/security/validators/crypto-validator.js.map +1 -0
  294. package/v3/dist/mcp/security/validators/index.d.ts +12 -0
  295. package/v3/dist/mcp/security/validators/index.d.ts.map +1 -0
  296. package/v3/dist/mcp/security/validators/index.js +22 -0
  297. package/v3/dist/mcp/security/validators/index.js.map +1 -0
  298. package/v3/dist/mcp/security/validators/input-sanitizer.d.ts +56 -0
  299. package/v3/dist/mcp/security/validators/input-sanitizer.d.ts.map +1 -0
  300. package/v3/dist/mcp/security/validators/input-sanitizer.js +157 -0
  301. package/v3/dist/mcp/security/validators/input-sanitizer.js.map +1 -0
  302. package/v3/dist/mcp/security/validators/interfaces.d.ts +164 -0
  303. package/v3/dist/mcp/security/validators/interfaces.d.ts.map +1 -0
  304. package/v3/dist/mcp/security/validators/interfaces.js +6 -0
  305. package/v3/dist/mcp/security/validators/interfaces.js.map +1 -0
  306. package/v3/dist/mcp/security/validators/path-traversal-validator.d.ts +50 -0
  307. package/v3/dist/mcp/security/validators/path-traversal-validator.d.ts.map +1 -0
  308. package/v3/dist/mcp/security/validators/path-traversal-validator.js +242 -0
  309. package/v3/dist/mcp/security/validators/path-traversal-validator.js.map +1 -0
  310. package/v3/dist/mcp/security/validators/regex-safety-validator.d.ts +50 -0
  311. package/v3/dist/mcp/security/validators/regex-safety-validator.d.ts.map +1 -0
  312. package/v3/dist/mcp/security/validators/regex-safety-validator.js +183 -0
  313. package/v3/dist/mcp/security/validators/regex-safety-validator.js.map +1 -0
  314. package/v3/dist/mcp/security/validators/validation-orchestrator.d.ts +66 -0
  315. package/v3/dist/mcp/security/validators/validation-orchestrator.d.ts.map +1 -0
  316. package/v3/dist/mcp/security/validators/validation-orchestrator.js +146 -0
  317. package/v3/dist/mcp/security/validators/validation-orchestrator.js.map +1 -0
  318. package/v3/dist/mcp/server.d.ts.map +1 -1
  319. package/v3/dist/mcp/server.js +1 -0
  320. package/v3/dist/mcp/server.js.map +1 -1
  321. package/v3/dist/mcp/tool-registry.d.ts +3 -1
  322. package/v3/dist/mcp/tool-registry.d.ts.map +1 -1
  323. package/v3/dist/mcp/tool-registry.js +155 -2
  324. package/v3/dist/mcp/tool-registry.js.map +1 -1
  325. package/v3/dist/mcp/tools/test-generation/generate.d.ts +1 -0
  326. package/v3/dist/mcp/tools/test-generation/generate.d.ts.map +1 -1
  327. package/v3/dist/mcp/tools/test-generation/generate.js +3 -2
  328. package/v3/dist/mcp/tools/test-generation/generate.js.map +1 -1
  329. package/v3/dist/sync/cloud/index.d.ts +8 -0
  330. package/v3/dist/sync/cloud/index.d.ts.map +1 -0
  331. package/v3/dist/sync/cloud/index.js +8 -0
  332. package/v3/dist/sync/cloud/index.js.map +1 -0
  333. package/v3/dist/sync/cloud/postgres-writer.d.ts +88 -0
  334. package/v3/dist/sync/cloud/postgres-writer.d.ts.map +1 -0
  335. package/v3/dist/sync/cloud/postgres-writer.js +319 -0
  336. package/v3/dist/sync/cloud/postgres-writer.js.map +1 -0
  337. package/v3/dist/sync/cloud/tunnel-manager.d.ts +75 -0
  338. package/v3/dist/sync/cloud/tunnel-manager.d.ts.map +1 -0
  339. package/v3/dist/sync/cloud/tunnel-manager.js +221 -0
  340. package/v3/dist/sync/cloud/tunnel-manager.js.map +1 -0
  341. package/v3/dist/sync/index.d.ts +35 -0
  342. package/v3/dist/sync/index.d.ts.map +1 -0
  343. package/v3/dist/sync/index.js +35 -0
  344. package/v3/dist/sync/index.js.map +1 -0
  345. package/v3/dist/sync/interfaces.d.ts +245 -0
  346. package/v3/dist/sync/interfaces.d.ts.map +1 -0
  347. package/v3/dist/sync/interfaces.js +160 -0
  348. package/v3/dist/sync/interfaces.js.map +1 -0
  349. package/v3/dist/sync/readers/index.d.ts +8 -0
  350. package/v3/dist/sync/readers/index.d.ts.map +1 -0
  351. package/v3/dist/sync/readers/index.js +8 -0
  352. package/v3/dist/sync/readers/index.js.map +1 -0
  353. package/v3/dist/sync/readers/json-reader.d.ts +95 -0
  354. package/v3/dist/sync/readers/json-reader.d.ts.map +1 -0
  355. package/v3/dist/sync/readers/json-reader.js +306 -0
  356. package/v3/dist/sync/readers/json-reader.js.map +1 -0
  357. package/v3/dist/sync/readers/sqlite-reader.d.ts +88 -0
  358. package/v3/dist/sync/readers/sqlite-reader.d.ts.map +1 -0
  359. package/v3/dist/sync/readers/sqlite-reader.js +255 -0
  360. package/v3/dist/sync/readers/sqlite-reader.js.map +1 -0
  361. package/v3/dist/sync/sync-agent.d.ts +116 -0
  362. package/v3/dist/sync/sync-agent.d.ts.map +1 -0
  363. package/v3/dist/sync/sync-agent.js +416 -0
  364. package/v3/dist/sync/sync-agent.js.map +1 -0
  365. package/v3/package.json +13 -2
  366. package/v3/dist/domains/test-generation/coherence-gate.d.ts.map +0 -1
  367. package/v3/dist/domains/test-generation/coherence-gate.js.map +0 -1
@@ -2,6 +2,10 @@
2
2
  * Agentic QE v3 - MCP Security: CVE Prevention Utilities
3
3
  * Security utilities for preventing common vulnerabilities (ADR-012)
4
4
  *
5
+ * This file serves as a facade that maintains backward compatibility
6
+ * while the actual implementations are organized using the Strategy Pattern
7
+ * in the validators/ directory.
8
+ *
5
9
  * Features:
6
10
  * - Path traversal protection (no ../ in paths)
7
11
  * - ReDoS prevention with regex escaping
@@ -9,579 +13,50 @@
9
13
  * - Input sanitization utilities
10
14
  * - Command injection prevention
11
15
  */
12
- import { createHash, timingSafeEqual, randomBytes } from 'crypto';
13
- // ============================================================================
14
- // Path Traversal Protection
15
16
  // ============================================================================
16
- /**
17
- * Path traversal patterns to detect
18
- */
19
- const PATH_TRAVERSAL_PATTERNS = [
20
- /\.\./, // Basic traversal
21
- /%2e%2e/i, // URL encoded ..
22
- /%252e%252e/i, // Double URL encoded
23
- /\.\.%2f/i, // Mixed encoding
24
- /%2f\.\./i, // Forward slash + ..
25
- /\.\.%5c/i, // Backslash + ..
26
- /\.\.\\/, // Windows backslash traversal
27
- /%c0%ae/i, // UTF-8 overlong encoding
28
- /%c0%2f/i, // UTF-8 overlong /
29
- /%c1%9c/i, // UTF-8 overlong \
30
- /\0/, // Null byte injection
31
- /%00/i, // URL encoded null
32
- ];
33
- /**
34
- * Dangerous path components
35
- */
36
- const DANGEROUS_PATH_COMPONENTS = [
37
- /^\/etc\//i,
38
- /^\/proc\//i,
39
- /^\/sys\//i,
40
- /^\/dev\//i,
41
- /^\/root\//i,
42
- /^\/home\/.+\/\./i,
43
- /^[A-Z]:\\Windows/i,
44
- /^[A-Z]:\\System/i,
45
- /^[A-Z]:\\Users\\.+\\AppData/i,
46
- ];
47
- /**
48
- * Validate and sanitize a file path to prevent traversal attacks
49
- */
50
- export function validatePath(path, options = {}) {
51
- const { basePath = '', allowAbsolute = false, allowedExtensions = [], deniedExtensions = ['.exe', '.bat', '.cmd', '.sh', '.ps1', '.dll', '.so'], maxDepth = 10, maxLength = 4096, } = options;
52
- // Check length
53
- if (path.length > maxLength) {
54
- return {
55
- valid: false,
56
- error: `Path exceeds maximum length of ${maxLength}`,
57
- riskLevel: 'medium',
58
- };
59
- }
60
- // Check for traversal patterns
61
- for (const pattern of PATH_TRAVERSAL_PATTERNS) {
62
- if (pattern.test(path)) {
63
- return {
64
- valid: false,
65
- error: 'Path traversal attempt detected',
66
- riskLevel: 'critical',
67
- };
68
- }
69
- }
70
- // Check for absolute paths
71
- if (!allowAbsolute && (path.startsWith('/') || /^[A-Z]:/i.test(path))) {
72
- return {
73
- valid: false,
74
- error: 'Absolute paths are not allowed',
75
- riskLevel: 'high',
76
- };
77
- }
78
- // Check for dangerous path components
79
- for (const pattern of DANGEROUS_PATH_COMPONENTS) {
80
- if (pattern.test(path)) {
81
- return {
82
- valid: false,
83
- error: 'Access to system paths is not allowed',
84
- riskLevel: 'critical',
85
- };
86
- }
87
- }
88
- // Normalize the path
89
- const normalizedPath = normalizePath(path);
90
- // Re-check for traversal after normalization
91
- if (normalizedPath.includes('..')) {
92
- return {
93
- valid: false,
94
- error: 'Path traversal detected after normalization',
95
- riskLevel: 'critical',
96
- };
97
- }
98
- // Check depth
99
- const depth = normalizedPath.split('/').filter(Boolean).length;
100
- if (depth > maxDepth) {
101
- return {
102
- valid: false,
103
- error: `Path depth exceeds maximum of ${maxDepth}`,
104
- riskLevel: 'low',
105
- };
106
- }
107
- // Check extension
108
- const ext = getExtension(normalizedPath);
109
- if (ext) {
110
- const extWithDot = `.${ext.toLowerCase()}`;
111
- const extWithoutDot = ext.toLowerCase();
112
- // Check denied extensions (support both .exe and exe formats)
113
- if (deniedExtensions.length > 0) {
114
- const isDenied = deniedExtensions.some(denied => denied.toLowerCase() === extWithDot || denied.toLowerCase() === extWithoutDot);
115
- if (isDenied) {
116
- return {
117
- valid: false,
118
- error: `File extension '${ext}' is not allowed`,
119
- riskLevel: 'high',
120
- };
121
- }
122
- }
123
- // Check allowed extensions (support both .ts and ts formats)
124
- if (allowedExtensions.length > 0) {
125
- const isAllowed = allowedExtensions.some(allowed => allowed.toLowerCase() === extWithDot || allowed.toLowerCase() === extWithoutDot);
126
- if (!isAllowed) {
127
- return {
128
- valid: false,
129
- error: `File extension '${ext}' is not in allowed list`,
130
- riskLevel: 'medium',
131
- };
132
- }
133
- }
134
- }
135
- // Combine with base path if provided
136
- const finalPath = basePath
137
- ? joinPathsAbsolute(basePath, normalizedPath)
138
- : normalizedPath;
139
- // Verify final path doesn't escape base (use normalized base for comparison)
140
- const normalizedBase = basePath.startsWith('/')
141
- ? `/${normalizePath(basePath)}`
142
- : normalizePath(basePath);
143
- if (basePath && !finalPath.startsWith(normalizedBase)) {
144
- return {
145
- valid: false,
146
- error: 'Path escapes base directory',
147
- riskLevel: 'critical',
148
- };
149
- }
150
- return {
151
- valid: true,
152
- normalizedPath: finalPath,
153
- riskLevel: 'none',
154
- };
155
- }
156
- /**
157
- * Normalize a path by resolving . and .. components
158
- */
159
- export function normalizePath(path) {
160
- // Replace backslashes with forward slashes
161
- let normalized = path.replace(/\\/g, '/');
162
- // Remove multiple consecutive slashes
163
- normalized = normalized.replace(/\/+/g, '/');
164
- // Split and resolve
165
- const parts = normalized.split('/');
166
- const result = [];
167
- for (const part of parts) {
168
- if (part === '.' || part === '') {
169
- continue;
170
- }
171
- if (part === '..') {
172
- // Don't allow going above root
173
- if (result.length > 0 && result[result.length - 1] !== '..') {
174
- result.pop();
175
- }
176
- }
177
- else {
178
- result.push(part);
179
- }
180
- }
181
- return result.join('/');
182
- }
183
- /**
184
- * Safely join path components (strips leading/trailing slashes from all parts)
185
- */
186
- export function joinPaths(...paths) {
187
- if (paths.length === 0)
188
- return '';
189
- return paths
190
- .map(p => p.replace(/^\/+|\/+$/g, ''))
191
- .filter(Boolean)
192
- .join('/');
193
- }
194
- /**
195
- * Join paths preserving absolute path from first component
196
- */
197
- export function joinPathsAbsolute(...paths) {
198
- if (paths.length === 0)
199
- return '';
200
- // Check if the first path is absolute
201
- const isAbsolute = paths[0].startsWith('/');
202
- const result = paths
203
- // Use non-backtracking patterns with possessive-like behavior via split/join
204
- .map(p => {
205
- // Remove leading slashes by splitting and rejoining
206
- while (p.startsWith('/'))
207
- p = p.slice(1);
208
- // Remove trailing slashes
209
- while (p.endsWith('/'))
210
- p = p.slice(0, -1);
211
- return p;
212
- })
213
- .filter(Boolean)
214
- .join('/');
215
- // Preserve leading slash for absolute paths
216
- return isAbsolute ? `/${result}` : result;
217
- }
218
- /**
219
- * Get file extension
220
- */
221
- export function getExtension(path) {
222
- const match = path.match(/\.([^./\\]+)$/);
223
- return match ? match[1] : null;
224
- }
17
+ // Re-export Validators and Functions
225
18
  // ============================================================================
19
+ // Path Traversal Protection
20
+ export { validatePath, normalizePath, joinPaths, joinPathsAbsolute, getExtension, PathTraversalValidator, PATH_TRAVERSAL_PATTERNS, DANGEROUS_PATH_COMPONENTS, } from './validators/path-traversal-validator';
226
21
  // ReDoS Prevention
227
- // ============================================================================
228
- /**
229
- * Patterns that can cause ReDoS
230
- */
231
- const REDOS_PATTERNS = [
232
- /\(\.\*\)\+/, // (.*)+
233
- /\(\.\+\)\+/, // (.+)+
234
- /\([^)]*\?\)\+/, // (...?)+
235
- /\([^)]*\*\)\+/, // (...*)+
236
- /\([^)]*\+\)\+/, // (...+)+
237
- /\(\[.*?\]\+\)\+/, // ([...]+)+
238
- /\(\[.*?\]\*\)\+/, // ([...]*)+
239
- /\(\[.*?\]\?\)\+/, // ([...]?)+
240
- /\(\[.*?\]\*\)\*/, // ([...]*)*
241
- /\.\*\.\*/, // .*.*
242
- /\.\+\.\+/, // .+.+
243
- /\(\.\|\.\)/, // (.|.)
244
- ];
245
- /**
246
- * Maximum allowed regex complexity (nested quantifiers)
247
- */
248
- const MAX_REGEX_COMPLEXITY = 3;
249
- /**
250
- * Check if a regex pattern is safe from ReDoS
251
- */
252
- export function isRegexSafe(pattern) {
253
- const riskyPatterns = [];
254
- // Check for known ReDoS patterns
255
- for (const redosPattern of REDOS_PATTERNS) {
256
- if (redosPattern.test(pattern)) {
257
- riskyPatterns.push(redosPattern.source);
258
- }
259
- }
260
- // Check nesting depth of quantifiers
261
- const quantifierDepth = countQuantifierNesting(pattern);
262
- if (quantifierDepth > MAX_REGEX_COMPLEXITY) {
263
- riskyPatterns.push(`Quantifier nesting depth: ${quantifierDepth} (max: ${MAX_REGEX_COMPLEXITY})`);
264
- }
265
- // Check for exponential backtracking potential
266
- if (hasExponentialBacktracking(pattern)) {
267
- riskyPatterns.push('Exponential backtracking potential detected');
268
- }
269
- return {
270
- safe: riskyPatterns.length === 0,
271
- pattern,
272
- escapedPattern: escapeRegex(pattern),
273
- riskyPatterns,
274
- error: riskyPatterns.length > 0 ? 'Pattern may cause ReDoS' : undefined,
275
- };
276
- }
277
- /**
278
- * Count nested quantifier depth
279
- */
280
- function countQuantifierNesting(pattern) {
281
- let maxDepth = 0;
282
- let currentDepth = 0;
283
- let inGroup = false;
284
- let escaped = false;
285
- for (let i = 0; i < pattern.length; i++) {
286
- const char = pattern[i];
287
- if (escaped) {
288
- escaped = false;
289
- continue;
290
- }
291
- if (char === '\\') {
292
- escaped = true;
293
- continue;
294
- }
295
- if (char === '(') {
296
- inGroup = true;
297
- continue;
298
- }
299
- if (char === ')') {
300
- inGroup = false;
301
- // Check if followed by quantifier
302
- const next = pattern[i + 1];
303
- if (next === '*' || next === '+' || next === '?' || next === '{') {
304
- currentDepth++;
305
- maxDepth = Math.max(maxDepth, currentDepth);
306
- }
307
- continue;
308
- }
309
- if ((char === '*' || char === '+' || char === '?') && !inGroup) {
310
- currentDepth = 1;
311
- maxDepth = Math.max(maxDepth, currentDepth);
312
- }
313
- }
314
- return maxDepth;
315
- }
316
- /**
317
- * Check for exponential backtracking potential
318
- */
319
- function hasExponentialBacktracking(pattern) {
320
- // Simplified check for common exponential patterns
321
- const dangerous = [
322
- /\(\[^\\]*\]\+\)\+/, // ([...]+)+
323
- /\(\[^\\]*\]\*\)\*/, // ([...]*)*
324
- /\([^)]+\|[^)]+\)\+/, // (a|b)+
325
- /\(\.\*\)[*+]/, // (.*)+, (.*)*
326
- /\(\.\+\)[*+]/, // (.+)+, (.+)*
327
- ];
328
- return dangerous.some(d => d.test(pattern));
329
- }
330
- /**
331
- * Escape special regex characters in a string
332
- */
333
- export function escapeRegex(str) {
334
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
335
- }
336
- /**
337
- * Create a safe regex with timeout
338
- */
339
- export function createSafeRegex(pattern, flags, maxLength = 10000) {
340
- const safety = isRegexSafe(pattern);
341
- if (!safety.safe) {
342
- return null;
343
- }
344
- if (pattern.length > maxLength) {
345
- return null;
346
- }
347
- try {
348
- return new RegExp(pattern, flags);
349
- }
350
- catch {
351
- return null;
352
- }
353
- }
354
- // ============================================================================
22
+ export { isRegexSafe, escapeRegex, createSafeRegex, RegexSafetyValidator, REDOS_PATTERNS, countQuantifierNesting, hasExponentialBacktracking, } from './validators/regex-safety-validator';
355
23
  // Timing-Safe Comparison
24
+ export { timingSafeCompare, timingSafeHashCompare, generateSecureToken, secureHash, CryptoValidator, } from './validators/crypto-validator';
25
+ // Input Sanitization
26
+ export { sanitizeInput, escapeHtml, stripHtmlTags, InputSanitizer, HTML_ESCAPE_MAP, SQL_INJECTION_PATTERNS, SHELL_METACHARACTERS, DANGEROUS_CONTROL_CHARS, } from './validators/input-sanitizer';
27
+ // Command Injection Prevention
28
+ export { validateCommand, escapeShellArg, CommandValidator, DEFAULT_ALLOWED_COMMANDS, BLOCKED_COMMAND_PATTERNS, } from './validators/command-validator';
356
29
  // ============================================================================
357
- /**
358
- * Perform a timing-safe string comparison
359
- */
360
- export function timingSafeCompare(a, b) {
361
- // Pad shorter string to prevent length-based timing attacks
362
- const maxLen = Math.max(a.length, b.length);
363
- const paddedA = a.padEnd(maxLen, '\0');
364
- const paddedB = b.padEnd(maxLen, '\0');
365
- try {
366
- return timingSafeEqual(Buffer.from(paddedA), Buffer.from(paddedB));
367
- }
368
- catch {
369
- return false;
370
- }
371
- }
372
- /**
373
- * Timing-safe comparison for hashed values
374
- */
375
- export function timingSafeHashCompare(value, expectedHash) {
376
- const hash = createHash('sha256').update(value).digest('hex');
377
- return timingSafeCompare(hash, expectedHash);
378
- }
379
- /**
380
- * Generate a secure random token
381
- */
382
- export function generateSecureToken(length = 32) {
383
- return randomBytes(length)
384
- .toString('base64')
385
- .replace(/\+/g, '-')
386
- .replace(/\//g, '_')
387
- .replace(/=/g, '');
388
- }
389
- /**
390
- * Hash a value securely
391
- */
392
- export function secureHash(value, salt) {
393
- const data = salt ? `${salt}:${value}` : value;
394
- return createHash('sha256').update(data).digest('hex');
395
- }
30
+ // Re-export Orchestrator
396
31
  // ============================================================================
397
- // Input Sanitization
32
+ export { ValidationOrchestrator, getOrchestrator, createOrchestrator, } from './validators/validation-orchestrator';
398
33
  // ============================================================================
399
- /**
400
- * HTML escape characters
401
- */
402
- const HTML_ESCAPE_MAP = {
403
- '&': '&amp;',
404
- '<': '&lt;',
405
- '>': '&gt;',
406
- '"': '&quot;',
407
- "'": '&#x27;',
408
- '/': '&#x2F;',
409
- '`': '&#x60;',
410
- '=': '&#x3D;',
411
- };
412
- /**
413
- * SQL injection patterns
414
- */
415
- const SQL_INJECTION_PATTERNS = [
416
- /('|")\s*;\s*--/i,
417
- /'\s*OR\s+'1'\s*=\s*'1/i,
418
- /"\s*OR\s+"1"\s*=\s*"1/i,
419
- /UNION\s+SELECT/i,
420
- /INSERT\s+INTO/i,
421
- /DROP\s+TABLE/i,
422
- /DELETE\s+FROM/i,
423
- /UPDATE\s+.*\s+SET/i,
424
- /EXEC(\s+|\()sp_/i,
425
- /xp_cmdshell/i,
426
- ];
427
- /**
428
- * Shell metacharacters (excludes parentheses which are common in normal text)
429
- */
430
- const SHELL_METACHARACTERS = /[|;&$`<>{}[\]!#*?~]/g;
431
- /**
432
- * Sanitize input string
433
- */
434
- export function sanitizeInput(input, options = {}) {
435
- const { maxLength = 10000, allowedChars, stripHtml = true, stripSql = true, escapeShell = true, trim = true, } = options;
436
- let result = input;
437
- // Trim
438
- if (trim) {
439
- result = result.trim();
440
- }
441
- // Max length
442
- if (result.length > maxLength) {
443
- result = result.substring(0, maxLength);
444
- }
445
- // Strip HTML
446
- if (stripHtml) {
447
- result = stripHtmlTags(result);
448
- }
449
- // Strip SQL injection attempts
450
- if (stripSql) {
451
- for (const pattern of SQL_INJECTION_PATTERNS) {
452
- result = result.replace(pattern, '');
453
- }
454
- }
455
- // Escape shell metacharacters
456
- if (escapeShell) {
457
- result = result.replace(SHELL_METACHARACTERS, '');
458
- }
459
- // Filter to allowed characters
460
- if (allowedChars) {
461
- // Filter character by character to respect the provided regex
462
- result = result.split('').filter(char => allowedChars.test(char)).join('');
463
- }
464
- return result;
465
- }
466
- /**
467
- * Escape HTML special characters
468
- */
469
- export function escapeHtml(str) {
470
- return str.replace(/[&<>"'`=/]/g, char => HTML_ESCAPE_MAP[char] || char);
471
- }
472
- /**
473
- * Strip HTML tags from a string
474
- * Handles both complete tags and incomplete/malformed tags to prevent XSS
475
- */
476
- export function stripHtmlTags(str) {
477
- // Limit input length to prevent ReDoS
478
- const MAX_LENGTH = 100000;
479
- if (str.length > MAX_LENGTH) {
480
- str = str.slice(0, MAX_LENGTH);
481
- }
482
- let result = str;
483
- let prevLength;
484
- // Loop until no more changes (handles nested/malformed tags like <script<script>>)
485
- do {
486
- prevLength = result.length;
487
- // Remove complete HTML tags using a non-backtracking approach
488
- // Process character by character to avoid regex backtracking
489
- let cleaned = '';
490
- let inTag = false;
491
- for (let i = 0; i < result.length; i++) {
492
- const char = result[i];
493
- if (char === '<') {
494
- inTag = true;
495
- }
496
- else if (char === '>' && inTag) {
497
- inTag = false;
498
- }
499
- else if (!inTag) {
500
- cleaned += char;
501
- }
502
- }
503
- result = cleaned;
504
- } while (result.length < prevLength && result.length > 0);
505
- // Encode any remaining angle brackets
506
- result = result.replace(/</g, '&lt;').replace(/>/g, '&gt;');
507
- return result;
508
- }
34
+ // Import for CVEPrevention Object
509
35
  // ============================================================================
510
- // Command Injection Prevention
36
+ import { validatePath } from './validators/path-traversal-validator';
37
+ import { normalizePath } from './validators/path-traversal-validator';
38
+ import { joinPaths } from './validators/path-traversal-validator';
39
+ import { joinPathsAbsolute } from './validators/path-traversal-validator';
40
+ import { getExtension } from './validators/path-traversal-validator';
41
+ import { isRegexSafe } from './validators/regex-safety-validator';
42
+ import { escapeRegex } from './validators/regex-safety-validator';
43
+ import { createSafeRegex } from './validators/regex-safety-validator';
44
+ import { timingSafeCompare } from './validators/crypto-validator';
45
+ import { timingSafeHashCompare } from './validators/crypto-validator';
46
+ import { generateSecureToken } from './validators/crypto-validator';
47
+ import { secureHash } from './validators/crypto-validator';
48
+ import { sanitizeInput } from './validators/input-sanitizer';
49
+ import { escapeHtml } from './validators/input-sanitizer';
50
+ import { stripHtmlTags } from './validators/input-sanitizer';
51
+ import { validateCommand } from './validators/command-validator';
52
+ import { escapeShellArg } from './validators/command-validator';
53
+ // ============================================================================
54
+ // Export Utilities Object (Backward Compatibility)
511
55
  // ============================================================================
512
56
  /**
513
- * Allowed commands whitelist
514
- */
515
- const DEFAULT_ALLOWED_COMMANDS = [
516
- 'ls', 'cat', 'echo', 'grep', 'find', 'head', 'tail', 'wc',
517
- 'npm', 'node', 'yarn', 'pnpm',
518
- 'git', 'jest', 'vitest', 'playwright',
519
- ];
520
- /**
521
- * Blocked command patterns
522
- */
523
- const BLOCKED_COMMAND_PATTERNS = [
524
- /;/, // Command chaining with semicolon
525
- /&&/, // Command chaining with AND
526
- /\|\|/, // Command chaining with OR
527
- /\|/, // Piping
528
- /`.*`/, // Backtick command substitution
529
- /\$\(.*\)/, // $() command substitution
530
- />\s*\/dev\/sd/i, // Writing to block devices
531
- />\s*\/etc\//i, // Writing to /etc
532
- ];
533
- /**
534
- * Validate and sanitize a command
535
- */
536
- export function validateCommand(command, allowedCommands = DEFAULT_ALLOWED_COMMANDS) {
537
- const blockedPatterns = [];
538
- // Check for blocked patterns
539
- for (const pattern of BLOCKED_COMMAND_PATTERNS) {
540
- if (pattern.test(command)) {
541
- blockedPatterns.push(pattern.source);
542
- }
543
- }
544
- if (blockedPatterns.length > 0) {
545
- return {
546
- valid: false,
547
- error: 'Command contains blocked patterns',
548
- blockedPatterns,
549
- };
550
- }
551
- // Extract base command
552
- const parts = command.trim().split(/\s+/);
553
- const baseCommand = parts[0].split('/').pop() || '';
554
- // Check against whitelist
555
- if (!allowedCommands.includes(baseCommand)) {
556
- return {
557
- valid: false,
558
- error: `Command '${baseCommand}' is not in the allowed list`,
559
- blockedPatterns: [],
560
- };
561
- }
562
- // Sanitize arguments
563
- const sanitizedParts = parts.map((part, i) => {
564
- if (i === 0)
565
- return part;
566
- // Remove shell metacharacters from arguments
567
- return part.replace(SHELL_METACHARACTERS, '');
568
- });
569
- return {
570
- valid: true,
571
- sanitizedCommand: sanitizedParts.join(' '),
572
- blockedPatterns: [],
573
- };
574
- }
575
- /**
576
- * Escape a string for safe shell usage
57
+ * CVEPrevention - Main security utilities object
58
+ * Provides backward-compatible access to all security functions
577
59
  */
578
- export function escapeShellArg(arg) {
579
- // Wrap in single quotes and escape any internal single quotes
580
- return `'${arg.replace(/'/g, "'\\''")}'`;
581
- }
582
- // ============================================================================
583
- // Export Utilities Object
584
- // ============================================================================
585
60
  export const CVEPrevention = {
586
61
  // Path traversal
587
62
  validatePath,
@@ -1 +1 @@
1
- {"version":3,"file":"cve-prevention.js","sourceRoot":"","sources":["../../../src/mcp/security/cve-prevention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AA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C,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,IAAI;QACX,gBAAgB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC;QAC1C,eAAe,EAAE,EAAE;KACpB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,8DAA8D;IAC9D,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC3C,CAAC;AAED,+EAA+E;AAC/E,0BAA0B;AAC1B,+EAA+E;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,iBAAiB;IACjB,YAAY;IACZ,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,YAAY;IAEZ,QAAQ;IACR,WAAW;IACX,WAAW;IACX,eAAe;IAEf,cAAc;IACd,iBAAiB;IACjB,qBAAqB;IACrB,mBAAmB;IACnB,UAAU;IAEV,qBAAqB;IACrB,aAAa;IACb,UAAU;IACV,aAAa;IAEb,oBAAoB;IACpB,eAAe;IACf,cAAc;CACf,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"cve-prevention.js","sourceRoot":"","sources":["../../../src/mcp/security/cve-prevention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoBH,+EAA+E;AAC/E,qCAAqC;AACrC,+EAA+E;AAE/E,4BAA4B;AAC5B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,uCAAuC,CAAC;AAE/C,mBAAmB;AACnB,OAAO,EACL,WAAW,EACX,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,qCAAqC,CAAC;AAE7C,yBAAyB;AAC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U,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,+EAA+E;AAC/E,mDAAmD;AACnD,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,iBAAiB;IACjB,YAAY;IACZ,aAAa;IACb,SAAS;IACT,iBAAiB;IACjB,YAAY;IAEZ,QAAQ;IACR,WAAW;IACX,WAAW;IACX,eAAe;IAEf,cAAc;IACd,iBAAiB;IACjB,qBAAqB;IACrB,mBAAmB;IACnB,UAAU;IAEV,qBAAqB;IACrB,aAAa;IACb,UAAU;IACV,aAAa;IAEb,oBAAoB;IACpB,eAAe;IACf,cAAc;CACf,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -99,7 +99,11 @@ export declare function createSecurityMiddleware(config?: SecurityMiddlewareConf
99
99
  /**
100
100
  * Validate command for execution
101
101
  */
102
- validateShellCommand(command: string, allowedCommands?: string[]): import("./cve-prevention").CommandValidationResult;
102
+ validateShellCommand(command: string, allowedCommands?: string[]): import("./cve-prevention").CommandValidationResult | {
103
+ valid: boolean;
104
+ sanitizedCommand: string;
105
+ blockedPatterns: never[];
106
+ };
103
107
  /**
104
108
  * Run all security checks
105
109
  */