@oculum/scanner 1.0.10 → 1.0.11

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 (365) hide show
  1. package/dist/baseline/diff.d.ts +32 -0
  2. package/dist/baseline/diff.d.ts.map +1 -0
  3. package/dist/baseline/diff.js +119 -0
  4. package/dist/baseline/diff.js.map +1 -0
  5. package/dist/baseline/index.d.ts +9 -0
  6. package/dist/baseline/index.d.ts.map +1 -0
  7. package/dist/baseline/index.js +19 -0
  8. package/dist/baseline/index.js.map +1 -0
  9. package/dist/baseline/manager.d.ts +67 -0
  10. package/dist/baseline/manager.d.ts.map +1 -0
  11. package/dist/baseline/manager.js +180 -0
  12. package/dist/baseline/manager.js.map +1 -0
  13. package/dist/baseline/types.d.ts +91 -0
  14. package/dist/baseline/types.d.ts.map +1 -0
  15. package/dist/baseline/types.js +12 -0
  16. package/dist/baseline/types.js.map +1 -0
  17. package/dist/formatters/cli-terminal.d.ts +38 -0
  18. package/dist/formatters/cli-terminal.d.ts.map +1 -1
  19. package/dist/formatters/cli-terminal.js +365 -42
  20. package/dist/formatters/cli-terminal.js.map +1 -1
  21. package/dist/formatters/github-comment.d.ts +1 -1
  22. package/dist/formatters/github-comment.d.ts.map +1 -1
  23. package/dist/formatters/github-comment.js +75 -11
  24. package/dist/formatters/github-comment.js.map +1 -1
  25. package/dist/formatters/index.d.ts +1 -1
  26. package/dist/formatters/index.d.ts.map +1 -1
  27. package/dist/formatters/index.js +4 -1
  28. package/dist/formatters/index.js.map +1 -1
  29. package/dist/index.d.ts +7 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +155 -16
  32. package/dist/index.js.map +1 -1
  33. package/dist/layer1/config-audit.d.ts.map +1 -1
  34. package/dist/layer1/config-audit.js +20 -3
  35. package/dist/layer1/config-audit.js.map +1 -1
  36. package/dist/layer1/config-mcp-audit.d.ts +20 -0
  37. package/dist/layer1/config-mcp-audit.d.ts.map +1 -0
  38. package/dist/layer1/config-mcp-audit.js +239 -0
  39. package/dist/layer1/config-mcp-audit.js.map +1 -0
  40. package/dist/layer1/index.d.ts +1 -0
  41. package/dist/layer1/index.d.ts.map +1 -1
  42. package/dist/layer1/index.js +9 -1
  43. package/dist/layer1/index.js.map +1 -1
  44. package/dist/layer2/ai-agent-tools.d.ts.map +1 -1
  45. package/dist/layer2/ai-agent-tools.js +303 -0
  46. package/dist/layer2/ai-agent-tools.js.map +1 -1
  47. package/dist/layer2/ai-endpoint-protection.d.ts.map +1 -1
  48. package/dist/layer2/ai-endpoint-protection.js +17 -3
  49. package/dist/layer2/ai-endpoint-protection.js.map +1 -1
  50. package/dist/layer2/ai-execution-sinks.d.ts.map +1 -1
  51. package/dist/layer2/ai-execution-sinks.js +462 -12
  52. package/dist/layer2/ai-execution-sinks.js.map +1 -1
  53. package/dist/layer2/ai-fingerprinting.d.ts.map +1 -1
  54. package/dist/layer2/ai-fingerprinting.js +3 -0
  55. package/dist/layer2/ai-fingerprinting.js.map +1 -1
  56. package/dist/layer2/ai-mcp-security.d.ts +17 -0
  57. package/dist/layer2/ai-mcp-security.d.ts.map +1 -0
  58. package/dist/layer2/ai-mcp-security.js +679 -0
  59. package/dist/layer2/ai-mcp-security.js.map +1 -0
  60. package/dist/layer2/ai-package-hallucination.d.ts +19 -0
  61. package/dist/layer2/ai-package-hallucination.d.ts.map +1 -0
  62. package/dist/layer2/ai-package-hallucination.js +696 -0
  63. package/dist/layer2/ai-package-hallucination.js.map +1 -0
  64. package/dist/layer2/ai-prompt-hygiene.d.ts.map +1 -1
  65. package/dist/layer2/ai-prompt-hygiene.js +495 -9
  66. package/dist/layer2/ai-prompt-hygiene.js.map +1 -1
  67. package/dist/layer2/ai-rag-safety.d.ts.map +1 -1
  68. package/dist/layer2/ai-rag-safety.js +372 -1
  69. package/dist/layer2/ai-rag-safety.js.map +1 -1
  70. package/dist/layer2/auth-antipatterns.d.ts.map +1 -1
  71. package/dist/layer2/auth-antipatterns.js +4 -0
  72. package/dist/layer2/auth-antipatterns.js.map +1 -1
  73. package/dist/layer2/byok-patterns.d.ts.map +1 -1
  74. package/dist/layer2/byok-patterns.js +3 -0
  75. package/dist/layer2/byok-patterns.js.map +1 -1
  76. package/dist/layer2/dangerous-functions/child-process.d.ts +16 -0
  77. package/dist/layer2/dangerous-functions/child-process.d.ts.map +1 -0
  78. package/dist/layer2/dangerous-functions/child-process.js +74 -0
  79. package/dist/layer2/dangerous-functions/child-process.js.map +1 -0
  80. package/dist/layer2/dangerous-functions/dom-xss.d.ts +29 -0
  81. package/dist/layer2/dangerous-functions/dom-xss.d.ts.map +1 -0
  82. package/dist/layer2/dangerous-functions/dom-xss.js +179 -0
  83. package/dist/layer2/dangerous-functions/dom-xss.js.map +1 -0
  84. package/dist/layer2/dangerous-functions/index.d.ts +13 -0
  85. package/dist/layer2/dangerous-functions/index.d.ts.map +1 -0
  86. package/dist/layer2/dangerous-functions/index.js +621 -0
  87. package/dist/layer2/dangerous-functions/index.js.map +1 -0
  88. package/dist/layer2/dangerous-functions/json-parse.d.ts +31 -0
  89. package/dist/layer2/dangerous-functions/json-parse.d.ts.map +1 -0
  90. package/dist/layer2/dangerous-functions/json-parse.js +319 -0
  91. package/dist/layer2/dangerous-functions/json-parse.js.map +1 -0
  92. package/dist/layer2/dangerous-functions/math-random.d.ts +61 -0
  93. package/dist/layer2/dangerous-functions/math-random.d.ts.map +1 -0
  94. package/dist/layer2/dangerous-functions/math-random.js +459 -0
  95. package/dist/layer2/dangerous-functions/math-random.js.map +1 -0
  96. package/dist/layer2/dangerous-functions/patterns.d.ts +21 -0
  97. package/dist/layer2/dangerous-functions/patterns.d.ts.map +1 -0
  98. package/dist/layer2/dangerous-functions/patterns.js +161 -0
  99. package/dist/layer2/dangerous-functions/patterns.js.map +1 -0
  100. package/dist/layer2/dangerous-functions/request-validation.d.ts +13 -0
  101. package/dist/layer2/dangerous-functions/request-validation.d.ts.map +1 -0
  102. package/dist/layer2/dangerous-functions/request-validation.js +119 -0
  103. package/dist/layer2/dangerous-functions/request-validation.js.map +1 -0
  104. package/dist/layer2/dangerous-functions/utils/control-flow.d.ts +23 -0
  105. package/dist/layer2/dangerous-functions/utils/control-flow.d.ts.map +1 -0
  106. package/dist/layer2/dangerous-functions/utils/control-flow.js +149 -0
  107. package/dist/layer2/dangerous-functions/utils/control-flow.js.map +1 -0
  108. package/dist/layer2/dangerous-functions/utils/helpers.d.ts +31 -0
  109. package/dist/layer2/dangerous-functions/utils/helpers.d.ts.map +1 -0
  110. package/dist/layer2/dangerous-functions/utils/helpers.js +124 -0
  111. package/dist/layer2/dangerous-functions/utils/helpers.js.map +1 -0
  112. package/dist/layer2/dangerous-functions/utils/index.d.ts +9 -0
  113. package/dist/layer2/dangerous-functions/utils/index.d.ts.map +1 -0
  114. package/dist/layer2/dangerous-functions/utils/index.js +23 -0
  115. package/dist/layer2/dangerous-functions/utils/index.js.map +1 -0
  116. package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts +22 -0
  117. package/dist/layer2/dangerous-functions/utils/schema-validation.d.ts.map +1 -0
  118. package/dist/layer2/dangerous-functions/utils/schema-validation.js +89 -0
  119. package/dist/layer2/dangerous-functions/utils/schema-validation.js.map +1 -0
  120. package/dist/layer2/data-exposure.d.ts.map +1 -1
  121. package/dist/layer2/data-exposure.js +3 -0
  122. package/dist/layer2/data-exposure.js.map +1 -1
  123. package/dist/layer2/framework-checks.d.ts.map +1 -1
  124. package/dist/layer2/framework-checks.js +3 -0
  125. package/dist/layer2/framework-checks.js.map +1 -1
  126. package/dist/layer2/index.d.ts +3 -0
  127. package/dist/layer2/index.d.ts.map +1 -1
  128. package/dist/layer2/index.js +61 -2
  129. package/dist/layer2/index.js.map +1 -1
  130. package/dist/layer2/logic-gates.d.ts.map +1 -1
  131. package/dist/layer2/logic-gates.js +4 -0
  132. package/dist/layer2/logic-gates.js.map +1 -1
  133. package/dist/layer2/model-supply-chain.d.ts +20 -0
  134. package/dist/layer2/model-supply-chain.d.ts.map +1 -0
  135. package/dist/layer2/model-supply-chain.js +376 -0
  136. package/dist/layer2/model-supply-chain.js.map +1 -0
  137. package/dist/layer2/risky-imports.d.ts.map +1 -1
  138. package/dist/layer2/risky-imports.js +4 -0
  139. package/dist/layer2/risky-imports.js.map +1 -1
  140. package/dist/layer2/variables.d.ts.map +1 -1
  141. package/dist/layer2/variables.js +4 -0
  142. package/dist/layer2/variables.js.map +1 -1
  143. package/dist/layer3/anthropic/auto-dismiss.d.ts +24 -0
  144. package/dist/layer3/anthropic/auto-dismiss.d.ts.map +1 -0
  145. package/dist/layer3/anthropic/auto-dismiss.js +188 -0
  146. package/dist/layer3/anthropic/auto-dismiss.js.map +1 -0
  147. package/dist/layer3/anthropic/clients.d.ts +44 -0
  148. package/dist/layer3/anthropic/clients.d.ts.map +1 -0
  149. package/dist/layer3/anthropic/clients.js +81 -0
  150. package/dist/layer3/anthropic/clients.js.map +1 -0
  151. package/dist/layer3/anthropic/index.d.ts +41 -0
  152. package/dist/layer3/anthropic/index.d.ts.map +1 -0
  153. package/dist/layer3/anthropic/index.js +141 -0
  154. package/dist/layer3/anthropic/index.js.map +1 -0
  155. package/dist/layer3/anthropic/prompts/index.d.ts +8 -0
  156. package/dist/layer3/anthropic/prompts/index.d.ts.map +1 -0
  157. package/dist/layer3/anthropic/prompts/index.js +14 -0
  158. package/dist/layer3/anthropic/prompts/index.js.map +1 -0
  159. package/dist/layer3/anthropic/prompts/semantic-analysis.d.ts +15 -0
  160. package/dist/layer3/anthropic/prompts/semantic-analysis.d.ts.map +1 -0
  161. package/dist/layer3/anthropic/prompts/semantic-analysis.js +169 -0
  162. package/dist/layer3/anthropic/prompts/semantic-analysis.js.map +1 -0
  163. package/dist/layer3/anthropic/prompts/validation.d.ts +12 -0
  164. package/dist/layer3/anthropic/prompts/validation.d.ts.map +1 -0
  165. package/dist/layer3/anthropic/prompts/validation.js +421 -0
  166. package/dist/layer3/anthropic/prompts/validation.js.map +1 -0
  167. package/dist/layer3/anthropic/providers/anthropic.d.ts +21 -0
  168. package/dist/layer3/anthropic/providers/anthropic.d.ts.map +1 -0
  169. package/dist/layer3/anthropic/providers/anthropic.js +266 -0
  170. package/dist/layer3/anthropic/providers/anthropic.js.map +1 -0
  171. package/dist/layer3/anthropic/providers/index.d.ts +8 -0
  172. package/dist/layer3/anthropic/providers/index.d.ts.map +1 -0
  173. package/dist/layer3/anthropic/providers/index.js +15 -0
  174. package/dist/layer3/anthropic/providers/index.js.map +1 -0
  175. package/dist/layer3/anthropic/providers/openai.d.ts +18 -0
  176. package/dist/layer3/anthropic/providers/openai.d.ts.map +1 -0
  177. package/dist/layer3/anthropic/providers/openai.js +340 -0
  178. package/dist/layer3/anthropic/providers/openai.js.map +1 -0
  179. package/dist/layer3/anthropic/request-builder.d.ts +20 -0
  180. package/dist/layer3/anthropic/request-builder.d.ts.map +1 -0
  181. package/dist/layer3/anthropic/request-builder.js +134 -0
  182. package/dist/layer3/anthropic/request-builder.js.map +1 -0
  183. package/dist/layer3/anthropic/types.d.ts +88 -0
  184. package/dist/layer3/anthropic/types.d.ts.map +1 -0
  185. package/dist/layer3/anthropic/types.js +38 -0
  186. package/dist/layer3/anthropic/types.js.map +1 -0
  187. package/dist/layer3/anthropic/utils/index.d.ts +9 -0
  188. package/dist/layer3/anthropic/utils/index.d.ts.map +1 -0
  189. package/dist/layer3/anthropic/utils/index.js +24 -0
  190. package/dist/layer3/anthropic/utils/index.js.map +1 -0
  191. package/dist/layer3/anthropic/utils/path-helpers.d.ts +21 -0
  192. package/dist/layer3/anthropic/utils/path-helpers.d.ts.map +1 -0
  193. package/dist/layer3/anthropic/utils/path-helpers.js +69 -0
  194. package/dist/layer3/anthropic/utils/path-helpers.js.map +1 -0
  195. package/dist/layer3/anthropic/utils/response-parser.d.ts +40 -0
  196. package/dist/layer3/anthropic/utils/response-parser.d.ts.map +1 -0
  197. package/dist/layer3/anthropic/utils/response-parser.js +285 -0
  198. package/dist/layer3/anthropic/utils/response-parser.js.map +1 -0
  199. package/dist/layer3/anthropic/utils/retry.d.ts +15 -0
  200. package/dist/layer3/anthropic/utils/retry.d.ts.map +1 -0
  201. package/dist/layer3/anthropic/utils/retry.js +62 -0
  202. package/dist/layer3/anthropic/utils/retry.js.map +1 -0
  203. package/dist/layer3/index.d.ts +1 -0
  204. package/dist/layer3/index.d.ts.map +1 -1
  205. package/dist/layer3/index.js +16 -6
  206. package/dist/layer3/index.js.map +1 -1
  207. package/dist/layer3/osv-check.d.ts +75 -0
  208. package/dist/layer3/osv-check.d.ts.map +1 -0
  209. package/dist/layer3/osv-check.js +308 -0
  210. package/dist/layer3/osv-check.js.map +1 -0
  211. package/dist/rules/framework-fixes.d.ts +48 -0
  212. package/dist/rules/framework-fixes.d.ts.map +1 -0
  213. package/dist/rules/framework-fixes.js +439 -0
  214. package/dist/rules/framework-fixes.js.map +1 -0
  215. package/dist/rules/index.d.ts +8 -0
  216. package/dist/rules/index.d.ts.map +1 -0
  217. package/dist/rules/index.js +18 -0
  218. package/dist/rules/index.js.map +1 -0
  219. package/dist/rules/metadata.d.ts +43 -0
  220. package/dist/rules/metadata.d.ts.map +1 -0
  221. package/dist/rules/metadata.js +734 -0
  222. package/dist/rules/metadata.js.map +1 -0
  223. package/dist/suppression/config-loader.d.ts +74 -0
  224. package/dist/suppression/config-loader.d.ts.map +1 -0
  225. package/dist/suppression/config-loader.js +424 -0
  226. package/dist/suppression/config-loader.js.map +1 -0
  227. package/dist/suppression/hash.d.ts +48 -0
  228. package/dist/suppression/hash.d.ts.map +1 -0
  229. package/dist/suppression/hash.js +88 -0
  230. package/dist/suppression/hash.js.map +1 -0
  231. package/dist/suppression/index.d.ts +11 -0
  232. package/dist/suppression/index.d.ts.map +1 -0
  233. package/dist/suppression/index.js +39 -0
  234. package/dist/suppression/index.js.map +1 -0
  235. package/dist/suppression/inline-parser.d.ts +39 -0
  236. package/dist/suppression/inline-parser.d.ts.map +1 -0
  237. package/dist/suppression/inline-parser.js +218 -0
  238. package/dist/suppression/inline-parser.js.map +1 -0
  239. package/dist/suppression/manager.d.ts +94 -0
  240. package/dist/suppression/manager.d.ts.map +1 -0
  241. package/dist/suppression/manager.js +292 -0
  242. package/dist/suppression/manager.js.map +1 -0
  243. package/dist/suppression/types.d.ts +151 -0
  244. package/dist/suppression/types.d.ts.map +1 -0
  245. package/dist/suppression/types.js +28 -0
  246. package/dist/suppression/types.js.map +1 -0
  247. package/dist/tiers.d.ts +1 -1
  248. package/dist/tiers.d.ts.map +1 -1
  249. package/dist/tiers.js +27 -0
  250. package/dist/tiers.js.map +1 -1
  251. package/dist/types.d.ts +62 -1
  252. package/dist/types.d.ts.map +1 -1
  253. package/dist/types.js.map +1 -1
  254. package/dist/utils/context-helpers.d.ts +4 -0
  255. package/dist/utils/context-helpers.d.ts.map +1 -1
  256. package/dist/utils/context-helpers.js +13 -9
  257. package/dist/utils/context-helpers.js.map +1 -1
  258. package/package.json +4 -2
  259. package/src/__tests__/benchmark/fixtures/layer1/mcp-config-audit.json +31 -0
  260. package/src/__tests__/benchmark/fixtures/layer2/ai-execution-sinks.ts +1489 -82
  261. package/src/__tests__/benchmark/fixtures/layer2/ai-mcp-security.ts +495 -0
  262. package/src/__tests__/benchmark/fixtures/layer2/ai-package-hallucination.ts +255 -0
  263. package/src/__tests__/benchmark/fixtures/layer2/ai-prompt-hygiene.ts +300 -1
  264. package/src/__tests__/benchmark/fixtures/layer2/ai-rag-safety.ts +139 -0
  265. package/src/__tests__/benchmark/fixtures/layer2/byok-patterns.ts +7 -0
  266. package/src/__tests__/benchmark/fixtures/layer2/data-exposure.ts +63 -0
  267. package/src/__tests__/benchmark/fixtures/layer2/excessive-agency.ts +221 -0
  268. package/src/__tests__/benchmark/fixtures/layer2/index.ts +18 -0
  269. package/src/__tests__/benchmark/fixtures/layer2/model-supply-chain.ts +204 -0
  270. package/src/__tests__/benchmark/fixtures/layer2/phase1-enhancements.ts +157 -0
  271. package/src/__tests__/snapshots/__snapshots__/anthropic-validation-refactor.test.ts.snap +758 -0
  272. package/src/__tests__/snapshots/__snapshots__/dangerous-functions-refactor.test.ts.snap +503 -0
  273. package/src/__tests__/snapshots/anthropic-validation-refactor.test.ts +321 -0
  274. package/src/__tests__/snapshots/dangerous-functions-refactor.test.ts +439 -0
  275. package/src/baseline/__tests__/diff.test.ts +261 -0
  276. package/src/baseline/__tests__/manager.test.ts +225 -0
  277. package/src/baseline/diff.ts +135 -0
  278. package/src/baseline/index.ts +29 -0
  279. package/src/baseline/manager.ts +230 -0
  280. package/src/baseline/types.ts +97 -0
  281. package/src/formatters/cli-terminal.ts +444 -41
  282. package/src/formatters/github-comment.ts +79 -11
  283. package/src/formatters/index.ts +4 -0
  284. package/src/index.ts +197 -14
  285. package/src/layer1/config-audit.ts +24 -3
  286. package/src/layer1/config-mcp-audit.ts +276 -0
  287. package/src/layer1/index.ts +16 -6
  288. package/src/layer2/ai-agent-tools.ts +336 -0
  289. package/src/layer2/ai-endpoint-protection.ts +16 -3
  290. package/src/layer2/ai-execution-sinks.ts +516 -12
  291. package/src/layer2/ai-fingerprinting.ts +5 -1
  292. package/src/layer2/ai-mcp-security.ts +730 -0
  293. package/src/layer2/ai-package-hallucination.ts +791 -0
  294. package/src/layer2/ai-prompt-hygiene.ts +547 -9
  295. package/src/layer2/ai-rag-safety.ts +382 -3
  296. package/src/layer2/auth-antipatterns.ts +5 -0
  297. package/src/layer2/byok-patterns.ts +5 -1
  298. package/src/layer2/dangerous-functions/child-process.ts +98 -0
  299. package/src/layer2/dangerous-functions/dom-xss.ts +220 -0
  300. package/src/layer2/dangerous-functions/index.ts +949 -0
  301. package/src/layer2/dangerous-functions/json-parse.ts +385 -0
  302. package/src/layer2/dangerous-functions/math-random.ts +537 -0
  303. package/src/layer2/dangerous-functions/patterns.ts +174 -0
  304. package/src/layer2/dangerous-functions/request-validation.ts +145 -0
  305. package/src/layer2/dangerous-functions/utils/control-flow.ts +162 -0
  306. package/src/layer2/dangerous-functions/utils/helpers.ts +170 -0
  307. package/src/layer2/dangerous-functions/utils/index.ts +25 -0
  308. package/src/layer2/dangerous-functions/utils/schema-validation.ts +91 -0
  309. package/src/layer2/data-exposure.ts +5 -1
  310. package/src/layer2/framework-checks.ts +5 -0
  311. package/src/layer2/index.ts +63 -1
  312. package/src/layer2/logic-gates.ts +5 -0
  313. package/src/layer2/model-supply-chain.ts +456 -0
  314. package/src/layer2/risky-imports.ts +5 -0
  315. package/src/layer2/variables.ts +5 -0
  316. package/src/layer3/__tests__/osv-check.test.ts +384 -0
  317. package/src/layer3/anthropic/auto-dismiss.ts +212 -0
  318. package/src/layer3/anthropic/clients.ts +84 -0
  319. package/src/layer3/anthropic/index.ts +170 -0
  320. package/src/layer3/anthropic/prompts/index.ts +14 -0
  321. package/src/layer3/anthropic/prompts/semantic-analysis.ts +173 -0
  322. package/src/layer3/anthropic/prompts/validation.ts +419 -0
  323. package/src/layer3/anthropic/providers/anthropic.ts +310 -0
  324. package/src/layer3/anthropic/providers/index.ts +8 -0
  325. package/src/layer3/anthropic/providers/openai.ts +384 -0
  326. package/src/layer3/anthropic/request-builder.ts +150 -0
  327. package/src/layer3/anthropic/types.ts +148 -0
  328. package/src/layer3/anthropic/utils/index.ts +26 -0
  329. package/src/layer3/anthropic/utils/path-helpers.ts +68 -0
  330. package/src/layer3/anthropic/utils/response-parser.ts +322 -0
  331. package/src/layer3/anthropic/utils/retry.ts +75 -0
  332. package/src/layer3/index.ts +18 -5
  333. package/src/layer3/osv-check.ts +420 -0
  334. package/src/rules/__tests__/framework-fixes.test.ts +689 -0
  335. package/src/rules/__tests__/metadata.test.ts +218 -0
  336. package/src/rules/framework-fixes.ts +470 -0
  337. package/src/rules/index.ts +21 -0
  338. package/src/rules/metadata.ts +831 -0
  339. package/src/suppression/__tests__/config-loader.test.ts +382 -0
  340. package/src/suppression/__tests__/hash.test.ts +166 -0
  341. package/src/suppression/__tests__/inline-parser.test.ts +212 -0
  342. package/src/suppression/__tests__/manager.test.ts +415 -0
  343. package/src/suppression/config-loader.ts +462 -0
  344. package/src/suppression/hash.ts +95 -0
  345. package/src/suppression/index.ts +51 -0
  346. package/src/suppression/inline-parser.ts +273 -0
  347. package/src/suppression/manager.ts +379 -0
  348. package/src/suppression/types.ts +174 -0
  349. package/src/tiers.ts +36 -0
  350. package/src/types.ts +90 -0
  351. package/src/utils/context-helpers.ts +13 -9
  352. package/dist/layer2/dangerous-functions.d.ts +0 -7
  353. package/dist/layer2/dangerous-functions.d.ts.map +0 -1
  354. package/dist/layer2/dangerous-functions.js +0 -1701
  355. package/dist/layer2/dangerous-functions.js.map +0 -1
  356. package/dist/layer3/anthropic.d.ts +0 -87
  357. package/dist/layer3/anthropic.d.ts.map +0 -1
  358. package/dist/layer3/anthropic.js +0 -1948
  359. package/dist/layer3/anthropic.js.map +0 -1
  360. package/dist/layer3/openai.d.ts +0 -25
  361. package/dist/layer3/openai.d.ts.map +0 -1
  362. package/dist/layer3/openai.js +0 -238
  363. package/dist/layer3/openai.js.map +0 -1
  364. package/src/layer2/dangerous-functions.ts +0 -1940
  365. package/src/layer3/anthropic.ts +0 -2257
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Baseline Diff Computation
3
+ * Computes the difference between current findings and a baseline
4
+ */
5
+ import type { Vulnerability } from '../types';
6
+ import type { BaselineData, DiffResult } from './types';
7
+ /**
8
+ * Compute the diff between current scan findings and a baseline
9
+ *
10
+ * Uses finding hashes for comparison, which are computed from:
11
+ * - Normalized file path
12
+ * - Normalized line content
13
+ * - Category
14
+ *
15
+ * This means findings are considered the same even if:
16
+ * - Line numbers changed (code moved)
17
+ * - Minor whitespace changes occurred
18
+ *
19
+ * @param currentFindings - Vulnerabilities from the current scan
20
+ * @param baseline - The baseline to compare against
21
+ * @returns DiffResult with new, fixed, and existing findings
22
+ */
23
+ export declare function computeDiff(currentFindings: Vulnerability[], baseline: BaselineData): DiffResult;
24
+ /**
25
+ * Check if a diff has any new blocking issues (critical or high severity)
26
+ */
27
+ export declare function hasNewBlockingIssues(diff: DiffResult): boolean;
28
+ /**
29
+ * Format a summary string for the diff
30
+ */
31
+ export declare function formatDiffSummary(diff: DiffResult): string;
32
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/baseline/diff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAyC,MAAM,UAAU,CAAA;AACpF,OAAO,KAAK,EAAE,YAAY,EAAmB,UAAU,EAAE,MAAM,SAAS,CAAA;AAkCxE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACzB,eAAe,EAAE,aAAa,EAAE,EAChC,QAAQ,EAAE,YAAY,GACrB,UAAU,CAiDZ;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAE9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAc1D"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ /**
3
+ * Baseline Diff Computation
4
+ * Computes the difference between current findings and a baseline
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.computeDiff = computeDiff;
8
+ exports.hasNewBlockingIssues = hasNewBlockingIssues;
9
+ exports.formatDiffSummary = formatDiffSummary;
10
+ const hash_1 = require("../suppression/hash");
11
+ /**
12
+ * Compute severity counts from baseline findings
13
+ */
14
+ function computeBaselineSeverityCounts(findings) {
15
+ const counts = { critical: 0, high: 0, medium: 0, low: 0, info: 0 };
16
+ for (const finding of findings) {
17
+ const severity = finding.severity;
18
+ if (severity in counts) {
19
+ counts[severity]++;
20
+ }
21
+ }
22
+ return counts;
23
+ }
24
+ /**
25
+ * Compute severity counts from vulnerabilities
26
+ */
27
+ function computeVulnerabilitySeverityCounts(vulnerabilities) {
28
+ const counts = { critical: 0, high: 0, medium: 0, low: 0, info: 0 };
29
+ for (const vuln of vulnerabilities) {
30
+ if (vuln.severity in counts) {
31
+ counts[vuln.severity]++;
32
+ }
33
+ }
34
+ return counts;
35
+ }
36
+ /**
37
+ * Compute the diff between current scan findings and a baseline
38
+ *
39
+ * Uses finding hashes for comparison, which are computed from:
40
+ * - Normalized file path
41
+ * - Normalized line content
42
+ * - Category
43
+ *
44
+ * This means findings are considered the same even if:
45
+ * - Line numbers changed (code moved)
46
+ * - Minor whitespace changes occurred
47
+ *
48
+ * @param currentFindings - Vulnerabilities from the current scan
49
+ * @param baseline - The baseline to compare against
50
+ * @returns DiffResult with new, fixed, and existing findings
51
+ */
52
+ function computeDiff(currentFindings, baseline) {
53
+ // Build hash set from baseline for O(1) lookup
54
+ const baselineHashes = new Set(baseline.findings.map(f => f.hash));
55
+ // Build hash map from current findings
56
+ const currentHashMap = new Map();
57
+ for (const finding of currentFindings) {
58
+ const hash = (0, hash_1.computeFindingHash)(finding);
59
+ currentHashMap.set(hash, finding);
60
+ }
61
+ // Compute new findings (in current, not in baseline)
62
+ const newFindings = [];
63
+ for (const finding of currentFindings) {
64
+ const hash = (0, hash_1.computeFindingHash)(finding);
65
+ if (!baselineHashes.has(hash)) {
66
+ newFindings.push(finding);
67
+ }
68
+ }
69
+ // Compute fixed findings (in baseline, not in current)
70
+ const fixedFindings = [];
71
+ for (const baselineFinding of baseline.findings) {
72
+ if (!currentHashMap.has(baselineFinding.hash)) {
73
+ fixedFindings.push(baselineFinding);
74
+ }
75
+ }
76
+ // Compute existing findings (in both)
77
+ const existingFindings = [];
78
+ for (const finding of currentFindings) {
79
+ const hash = (0, hash_1.computeFindingHash)(finding);
80
+ if (baselineHashes.has(hash)) {
81
+ existingFindings.push(finding);
82
+ }
83
+ }
84
+ return {
85
+ new: newFindings,
86
+ fixed: fixedFindings,
87
+ existing: existingFindings,
88
+ stats: {
89
+ newCount: newFindings.length,
90
+ fixedCount: fixedFindings.length,
91
+ existingCount: existingFindings.length,
92
+ newBySeverity: computeVulnerabilitySeverityCounts(newFindings),
93
+ fixedBySeverity: computeBaselineSeverityCounts(fixedFindings),
94
+ },
95
+ };
96
+ }
97
+ /**
98
+ * Check if a diff has any new blocking issues (critical or high severity)
99
+ */
100
+ function hasNewBlockingIssues(diff) {
101
+ return diff.stats.newBySeverity.critical > 0 || diff.stats.newBySeverity.high > 0;
102
+ }
103
+ /**
104
+ * Format a summary string for the diff
105
+ */
106
+ function formatDiffSummary(diff) {
107
+ const parts = [];
108
+ if (diff.stats.newCount > 0) {
109
+ parts.push(`${diff.stats.newCount} new`);
110
+ }
111
+ if (diff.stats.fixedCount > 0) {
112
+ parts.push(`${diff.stats.fixedCount} fixed`);
113
+ }
114
+ if (diff.stats.existingCount > 0) {
115
+ parts.push(`${diff.stats.existingCount} existing`);
116
+ }
117
+ return parts.join(', ');
118
+ }
119
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/baseline/diff.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAqDH,kCAoDC;AAKD,oDAEC;AAKD,8CAcC;AA/HD,8CAAwD;AAExD;;GAEG;AACH,SAAS,6BAA6B,CAAC,QAA2B;IAChE,MAAM,MAAM,GAAmB,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;IAEnF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAiC,CAAA;QAC1D,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;YACvB,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;QACpB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,SAAS,kCAAkC,CAAC,eAAgC;IAC1E,MAAM,MAAM,GAAmB,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM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AAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,QAAQ,CAAC,CAAA;IAC9C,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,WAAW,CAAC,CAAA;IACpD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Baseline Module
3
+ * Provides baseline/diff mode functionality for tracking security improvements
4
+ */
5
+ export type { BaselineFinding, BaselineData, DiffResult, BaselineDiff, } from './types';
6
+ export { BASELINE_FILE_PATH, OCULUM_DIR } from './types';
7
+ export { BaselineManager, type BaselineManagerOptions, type LoadBaselineResult, type SaveBaselineResult, type ClearBaselineResult, } from './manager';
8
+ export { computeDiff, hasNewBlockingIssues, formatDiffSummary, } from './diff';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/baseline/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAA;AAGlB,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,QAAQ,CAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Baseline Module
4
+ * Provides baseline/diff mode functionality for tracking security improvements
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.formatDiffSummary = exports.hasNewBlockingIssues = exports.computeDiff = exports.BaselineManager = exports.OCULUM_DIR = exports.BASELINE_FILE_PATH = void 0;
8
+ var types_1 = require("./types");
9
+ Object.defineProperty(exports, "BASELINE_FILE_PATH", { enumerable: true, get: function () { return types_1.BASELINE_FILE_PATH; } });
10
+ Object.defineProperty(exports, "OCULUM_DIR", { enumerable: true, get: function () { return types_1.OCULUM_DIR; } });
11
+ // Manager
12
+ var manager_1 = require("./manager");
13
+ Object.defineProperty(exports, "BaselineManager", { enumerable: true, get: function () { return manager_1.BaselineManager; } });
14
+ // Diff computation
15
+ var diff_1 = require("./diff");
16
+ Object.defineProperty(exports, "computeDiff", { enumerable: true, get: function () { return diff_1.computeDiff; } });
17
+ Object.defineProperty(exports, "hasNewBlockingIssues", { enumerable: true, get: function () { return diff_1.hasNewBlockingIssues; } });
18
+ Object.defineProperty(exports, "formatDiffSummary", { enumerable: true, get: function () { return diff_1.formatDiffSummary; } });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/baseline/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,iCAAwD;AAA/C,2GAAA,kBAAkB,OAAA;AAAE,mGAAA,UAAU,OAAA;AAEvC,UAAU;AACV,qCAMkB;AALhB,0GAAA,eAAe,OAAA;AAOjB,mBAAmB;AACnB,+BAIe;AAHb,mGAAA,WAAW,OAAA;AACX,4GAAA,oBAAoB,OAAA;AACpB,yGAAA,iBAAiB,OAAA"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Baseline Manager
3
+ * Handles loading, saving, and clearing baseline files
4
+ */
5
+ import type { ScanResult, ScanDepth } from '../types';
6
+ import type { BaselineData } from './types';
7
+ export interface BaselineManagerOptions {
8
+ /** Project root path */
9
+ projectPath: string;
10
+ }
11
+ export interface LoadBaselineResult {
12
+ /** Whether a baseline was found */
13
+ found: boolean;
14
+ /** The baseline data (if found) */
15
+ baseline?: BaselineData;
16
+ /** Error message (if failed to load) */
17
+ error?: string;
18
+ }
19
+ export interface SaveBaselineResult {
20
+ /** Whether the save was successful */
21
+ success: boolean;
22
+ /** Path where baseline was saved */
23
+ path: string;
24
+ /** Error message (if failed) */
25
+ error?: string;
26
+ }
27
+ export interface ClearBaselineResult {
28
+ /** Whether the clear was successful */
29
+ success: boolean;
30
+ /** Whether a baseline existed before clearing */
31
+ existed: boolean;
32
+ /** Error message (if failed) */
33
+ error?: string;
34
+ }
35
+ /**
36
+ * Manages baseline files for diff mode
37
+ */
38
+ export declare class BaselineManager {
39
+ private projectPath;
40
+ private baselinePath;
41
+ constructor(options: BaselineManagerOptions | string);
42
+ /**
43
+ * Get the full path to the baseline file
44
+ */
45
+ getBaselinePath(): string;
46
+ /**
47
+ * Load baseline from .oculum/baseline.json
48
+ */
49
+ loadBaseline(): LoadBaselineResult;
50
+ /**
51
+ * Save current scan result as baseline
52
+ */
53
+ saveBaseline(scanResult: ScanResult, options?: {
54
+ commit?: string;
55
+ branch?: string;
56
+ scanDepth?: ScanDepth;
57
+ }): SaveBaselineResult;
58
+ /**
59
+ * Clear (delete) the baseline file
60
+ */
61
+ clearBaseline(): ClearBaselineResult;
62
+ /**
63
+ * Check if a baseline exists
64
+ */
65
+ hasBaseline(): boolean;
66
+ }
67
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/baseline/manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAiB,MAAM,UAAU,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,SAAS,CAAA;AAI5D,MAAM,WAAW,sBAAsB;IACrC,wBAAwB;IACxB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAA;IACd,mCAAmC;IACnC,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAA;IAChB,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAA;IAChB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AA8CD;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,YAAY,CAAQ;gBAEhB,OAAO,EAAE,sBAAsB,GAAG,MAAM;IAUpD;;OAEG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,YAAY,IAAI,kBAAkB;IAiClC;;OAEG;IACH,YAAY,CACV,UAAU,EAAE,UAAU,EACtB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,SAAS,CAAA;KAAE,GACpE,kBAAkB;IA8CrB;;OAEG;IACH,aAAa,IAAI,mBAAmB;IAmBpC;;OAEG;IACH,WAAW,IAAI,OAAO;CAGvB"}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ /**
3
+ * Baseline Manager
4
+ * Handles loading, saving, and clearing baseline files
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.BaselineManager = void 0;
8
+ const fs_1 = require("fs");
9
+ const path_1 = require("path");
10
+ const child_process_1 = require("child_process");
11
+ const types_1 = require("./types");
12
+ const hash_1 = require("../suppression/hash");
13
+ /**
14
+ * Get current git commit SHA (short form)
15
+ */
16
+ function getGitCommit(projectPath) {
17
+ try {
18
+ const result = (0, child_process_1.execFileSync)('git', ['rev-parse', '--short', 'HEAD'], {
19
+ cwd: projectPath,
20
+ stdio: ['ignore', 'pipe', 'ignore'],
21
+ });
22
+ return result.toString().trim();
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ }
28
+ /**
29
+ * Get current git branch name
30
+ */
31
+ function getGitBranch(projectPath) {
32
+ try {
33
+ const result = (0, child_process_1.execFileSync)('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
34
+ cwd: projectPath,
35
+ stdio: ['ignore', 'pipe', 'ignore'],
36
+ });
37
+ return result.toString().trim();
38
+ }
39
+ catch {
40
+ return undefined;
41
+ }
42
+ }
43
+ /**
44
+ * Convert a Vulnerability to a BaselineFinding
45
+ */
46
+ function toBaselineFinding(vuln) {
47
+ return {
48
+ hash: (0, hash_1.computeFindingHash)(vuln),
49
+ filePath: vuln.filePath,
50
+ lineNumber: vuln.lineNumber,
51
+ category: vuln.category,
52
+ severity: vuln.severity,
53
+ title: vuln.title,
54
+ };
55
+ }
56
+ /**
57
+ * Manages baseline files for diff mode
58
+ */
59
+ class BaselineManager {
60
+ constructor(options) {
61
+ // Support both old string arg and new options object
62
+ if (typeof options === 'string') {
63
+ this.projectPath = options;
64
+ }
65
+ else {
66
+ this.projectPath = options.projectPath;
67
+ }
68
+ this.baselinePath = (0, path_1.join)(this.projectPath, types_1.BASELINE_FILE_PATH);
69
+ }
70
+ /**
71
+ * Get the full path to the baseline file
72
+ */
73
+ getBaselinePath() {
74
+ return this.baselinePath;
75
+ }
76
+ /**
77
+ * Load baseline from .oculum/baseline.json
78
+ */
79
+ loadBaseline() {
80
+ if (!(0, fs_1.existsSync)(this.baselinePath)) {
81
+ return { found: false };
82
+ }
83
+ try {
84
+ const content = (0, fs_1.readFileSync)(this.baselinePath, 'utf-8');
85
+ const baseline = JSON.parse(content);
86
+ // Basic validation
87
+ if (baseline.version !== 1) {
88
+ return {
89
+ found: false,
90
+ error: `Unsupported baseline version: ${baseline.version}. Expected version 1.`,
91
+ };
92
+ }
93
+ if (!Array.isArray(baseline.findings)) {
94
+ return {
95
+ found: false,
96
+ error: 'Invalid baseline: missing findings array',
97
+ };
98
+ }
99
+ return { found: true, baseline };
100
+ }
101
+ catch (err) {
102
+ return {
103
+ found: false,
104
+ error: `Failed to parse baseline: ${err instanceof Error ? err.message : 'Unknown error'}`,
105
+ };
106
+ }
107
+ }
108
+ /**
109
+ * Save current scan result as baseline
110
+ */
111
+ saveBaseline(scanResult, options) {
112
+ try {
113
+ // Ensure .oculum directory exists
114
+ const oculumDir = (0, path_1.join)(this.projectPath, types_1.OCULUM_DIR);
115
+ if (!(0, fs_1.existsSync)(oculumDir)) {
116
+ (0, fs_1.mkdirSync)(oculumDir, { recursive: true });
117
+ }
118
+ // Get git info if not provided
119
+ const commit = options?.commit ?? getGitCommit(this.projectPath);
120
+ const branch = options?.branch ?? getGitBranch(this.projectPath);
121
+ // Convert vulnerabilities to baseline findings
122
+ const findings = scanResult.vulnerabilities.map(toBaselineFinding);
123
+ // Build baseline data
124
+ const baseline = {
125
+ version: 1,
126
+ createdAt: new Date().toISOString(),
127
+ commit,
128
+ branch,
129
+ scanDepth: options?.scanDepth,
130
+ findings,
131
+ stats: {
132
+ total: findings.length,
133
+ critical: scanResult.severityCounts.critical,
134
+ high: scanResult.severityCounts.high,
135
+ medium: scanResult.severityCounts.medium,
136
+ low: scanResult.severityCounts.low,
137
+ info: scanResult.severityCounts.info,
138
+ },
139
+ };
140
+ // Write to file
141
+ (0, fs_1.writeFileSync)(this.baselinePath, JSON.stringify(baseline, null, 2));
142
+ return { success: true, path: this.baselinePath };
143
+ }
144
+ catch (err) {
145
+ return {
146
+ success: false,
147
+ path: this.baselinePath,
148
+ error: `Failed to save baseline: ${err instanceof Error ? err.message : 'Unknown error'}`,
149
+ };
150
+ }
151
+ }
152
+ /**
153
+ * Clear (delete) the baseline file
154
+ */
155
+ clearBaseline() {
156
+ const existed = (0, fs_1.existsSync)(this.baselinePath);
157
+ if (!existed) {
158
+ return { success: true, existed: false };
159
+ }
160
+ try {
161
+ (0, fs_1.unlinkSync)(this.baselinePath);
162
+ return { success: true, existed: true };
163
+ }
164
+ catch (err) {
165
+ return {
166
+ success: false,
167
+ existed: true,
168
+ error: `Failed to clear baseline: ${err instanceof Error ? err.message : 'Unknown error'}`,
169
+ };
170
+ }
171
+ }
172
+ /**
173
+ * Check if a baseline exists
174
+ */
175
+ hasBaseline() {
176
+ return (0, fs_1.existsSync)(this.baselinePath);
177
+ }
178
+ }
179
+ exports.BaselineManager = BaselineManager;
180
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/baseline/manager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2BAAmF;AACnF,+BAAoC;AACpC,iDAA4C;AAG5C,mCAAwD;AACxD,8CAAwD;AAkCxD;;GAEG;AACH,SAAS,YAAY,CAAC,WAAmB;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,4BAAY,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE;YACnE,GAAG,EAAE,WAAW;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAA;QACF,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAA;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,WAAmB;IACvC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,4BAAY,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE;YACxE,GAAG,EAAE,WAAW;YAChB,KAAK,EAAE,CAAC,QAAQ,EA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AE,CAAA;QAC1C,CAAC;QAED,IAAI,CAAC;YACH,IAAA,eAAU,EAAC,IAAI,CAAC,YAAY,CAAC,CAAA;YAC7B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,6BAA6B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE;aAC3F,CAAA;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAA,eAAU,EAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACtC,CAAC;CACF;AAzID,0CAyIC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Baseline Types
3
+ * Types for baseline/diff mode functionality
4
+ */
5
+ import type { VulnerabilityCategory, VulnerabilitySeverity, SeverityCounts, ScanDepth } from '../types';
6
+ /**
7
+ * A finding stored in the baseline
8
+ * Contains enough information to identify and display the finding
9
+ */
10
+ export interface BaselineFinding {
11
+ /** Finding hash (from computeFindingHash) */
12
+ hash: string;
13
+ /** File path relative to project root */
14
+ filePath: string;
15
+ /** Line number in the file */
16
+ lineNumber: number;
17
+ /** Vulnerability category */
18
+ category: VulnerabilityCategory;
19
+ /** Severity level */
20
+ severity: VulnerabilitySeverity;
21
+ /** Finding title */
22
+ title: string;
23
+ }
24
+ /**
25
+ * Baseline data stored in .oculum/baseline.json
26
+ */
27
+ export interface BaselineData {
28
+ /** Schema version for forward compatibility */
29
+ version: 1;
30
+ /** ISO 8601 timestamp when baseline was created */
31
+ createdAt: string;
32
+ /** Git commit SHA when baseline was created (optional) */
33
+ commit?: string;
34
+ /** Git branch name when baseline was created (optional) */
35
+ branch?: string;
36
+ /** Scan depth used when creating baseline */
37
+ scanDepth?: ScanDepth;
38
+ /** List of findings in the baseline */
39
+ findings: BaselineFinding[];
40
+ /** Summary statistics */
41
+ stats: {
42
+ total: number;
43
+ critical: number;
44
+ high: number;
45
+ medium: number;
46
+ low: number;
47
+ info: number;
48
+ };
49
+ }
50
+ /**
51
+ * Result of comparing current findings against baseline
52
+ */
53
+ export interface DiffResult {
54
+ /** Findings in current scan but NOT in baseline (new issues) */
55
+ new: import('../types').Vulnerability[];
56
+ /** Findings in baseline but NOT in current scan (fixed issues) */
57
+ fixed: BaselineFinding[];
58
+ /** Findings in both current scan AND baseline (existing issues) */
59
+ existing: import('../types').Vulnerability[];
60
+ /** Summary statistics */
61
+ stats: {
62
+ newCount: number;
63
+ fixedCount: number;
64
+ existingCount: number;
65
+ newBySeverity: SeverityCounts;
66
+ fixedBySeverity: SeverityCounts;
67
+ };
68
+ }
69
+ /**
70
+ * Baseline diff metadata attached to ScanResult
71
+ * Only present when --new flag is used
72
+ */
73
+ export interface BaselineDiff {
74
+ /** When the baseline was created */
75
+ baselineCreatedAt: string;
76
+ /** Git commit of the baseline (if available) */
77
+ baselineCommit?: string;
78
+ /** Number of new findings (not in baseline) */
79
+ newCount: number;
80
+ /** Number of fixed findings (in baseline, not in current) */
81
+ fixedCount: number;
82
+ /** Number of existing findings (in both) */
83
+ existingCount: number;
84
+ /** Details of fixed findings for display */
85
+ fixedFindings: BaselineFinding[];
86
+ }
87
+ /** Default baseline file path relative to project root */
88
+ export declare const BASELINE_FILE_PATH = ".oculum/baseline.json";
89
+ /** Directory for oculum files */
90
+ export declare const OCULUM_DIR = ".oculum";
91
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/baseline/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEvG;;;GAGG;AACH,MAAM,WAAW,eAAe;I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,EAAE,cAAc,CAAA;KAChC,CAAA;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,iBAAiB,EAAE,MAAM,CAAA;IACzB,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAA;IACrB,4CAA4C;IAC5C,aAAa,EAAE,eAAe,EAAE,CAAA;CACjC;AAED,0DAA0D;AAC1D,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AAEzD,iCAAiC;AACjC,eAAO,MAAM,UAAU,YAAY,CAAA"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Baseline Types
4
+ * Types for baseline/diff mode functionality
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.OCULUM_DIR = exports.BASELINE_FILE_PATH = void 0;
8
+ /** Default baseline file path relative to project root */
9
+ exports.BASELINE_FILE_PATH = '.oculum/baseline.json';
10
+ /** Directory for oculum files */
11
+ exports.OCULUM_DIR = '.oculum';
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/baseline/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAyFH,0DAA0D;AAC7C,QAAA,kBAAkB,GAAG,uBAAuB,CAAA;AAEzD,iCAAiC;AACpB,QAAA,UAAU,GAAG,SAAS,CAAA"}
@@ -10,6 +10,44 @@ export declare function formatTerminalOutput(result: ScanResult, options?: {
10
10
  maxFindingsPerGroup?: number;
11
11
  showAllFindings?: boolean;
12
12
  noColor?: boolean;
13
+ compact?: boolean;
14
+ verbose?: boolean;
15
+ }): string;
16
+ /**
17
+ * Compact summary options
18
+ */
19
+ export interface CompactSummaryOptions {
20
+ /** Number findings for reference with show command */
21
+ showNumbers?: boolean;
22
+ /** Limit shown per severity (default: 5) */
23
+ maxPerSeverity?: number;
24
+ /** Show "Run oculum show..." hint */
25
+ showHint?: boolean;
26
+ /** Disable colors */
27
+ noColor?: boolean;
28
+ }
29
+ /**
30
+ * Format compact summary grouped by severity
31
+ * Output format:
32
+ * HIGH (2)
33
+ * 1. SQL injection in src/api/users.ts:42
34
+ * 2. Missing auth in src/api/admin.ts:15
35
+ */
36
+ export declare function formatCompactSummary(vulnerabilities: Vulnerability[], options?: CompactSummaryOptions): string;
37
+ /**
38
+ * Format a numbered finding list for the show command
39
+ * Returns findings with their numbers for reference
40
+ */
41
+ export declare function getNumberedFindings(vulnerabilities: Vulnerability[]): Array<{
42
+ number: number;
43
+ finding: Vulnerability;
44
+ }>;
45
+ /**
46
+ * Format a single finding detail view for the show command
47
+ */
48
+ export declare function formatFindingDetail(finding: Vulnerability, number: number, options?: {
49
+ verbose?: boolean;
50
+ noColor?: boolean;
13
51
  }): string;
14
52
  /**
15
53
  * Format as simple list (no grouping, no colors)
@@ -1 +1 @@
1
- {"version":3,"file":"cli-terminal.d.ts","sourceRoot":"","sources":["../../src/formatters/cli-terminal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAyB,MAAM,UAAU,CAAA;AAwGhF;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE;IAChE,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;CACb,GAAG,MAAM,CA4Ed;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,aAAa,EAAE,GAAG,MAAM,CASzE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,GAAE,OAAe,GAAG,MAAM,CAK9E;AAkGD;;;GAGG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