@ai-primitives-hub/core 0.2.0 → 0.2.2-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (336) hide show
  1. package/dist/domain/bundle/version.d.ts +13 -0
  2. package/dist/domain/bundle/version.d.ts.map +1 -1
  3. package/dist/domain/bundle/version.js +27 -0
  4. package/dist/domain/bundle/version.js.map +1 -1
  5. package/dist/domain/collection/apm-release-plan.d.ts +39 -0
  6. package/dist/domain/collection/apm-release-plan.d.ts.map +1 -0
  7. package/dist/domain/collection/apm-release-plan.js +185 -0
  8. package/dist/domain/collection/apm-release-plan.js.map +1 -0
  9. package/dist/domain/collection/contribution.d.ts +126 -0
  10. package/dist/domain/collection/contribution.d.ts.map +1 -0
  11. package/dist/domain/collection/contribution.js +462 -0
  12. package/dist/domain/collection/contribution.js.map +1 -0
  13. package/dist/domain/collection/diagnostics.d.ts +166 -0
  14. package/dist/domain/collection/diagnostics.d.ts.map +1 -0
  15. package/dist/domain/collection/diagnostics.js +3 -0
  16. package/dist/domain/collection/diagnostics.js.map +1 -0
  17. package/dist/domain/collection/manifest-validator.d.ts +3 -2
  18. package/dist/domain/collection/manifest-validator.d.ts.map +1 -1
  19. package/dist/domain/collection/manifest-validator.js +99 -17
  20. package/dist/domain/collection/manifest-validator.js.map +1 -1
  21. package/dist/domain/collection/release-manifest-plan.d.ts +9 -0
  22. package/dist/domain/collection/release-manifest-plan.d.ts.map +1 -1
  23. package/dist/domain/collection/release-manifest-plan.js +45 -14
  24. package/dist/domain/collection/release-manifest-plan.js.map +1 -1
  25. package/dist/domain/collection/validate.d.ts +5 -0
  26. package/dist/domain/collection/validate.d.ts.map +1 -1
  27. package/dist/domain/collection/validate.js +7 -2
  28. package/dist/domain/collection/validate.js.map +1 -1
  29. package/dist/domain/diagnostics/primitives/catalogue.d.ts +40 -0
  30. package/dist/domain/diagnostics/primitives/catalogue.d.ts.map +1 -0
  31. package/dist/domain/diagnostics/primitives/catalogue.js +78 -0
  32. package/dist/domain/diagnostics/primitives/catalogue.js.map +1 -0
  33. package/dist/domain/diagnostics/primitives/classifier.d.ts +81 -0
  34. package/dist/domain/diagnostics/primitives/classifier.d.ts.map +1 -0
  35. package/dist/domain/diagnostics/primitives/classifier.js +138 -0
  36. package/dist/domain/diagnostics/primitives/classifier.js.map +1 -0
  37. package/dist/domain/diagnostics/primitives/evaluators.d.ts +138 -0
  38. package/dist/domain/diagnostics/primitives/evaluators.d.ts.map +1 -0
  39. package/dist/domain/diagnostics/primitives/evaluators.js +485 -0
  40. package/dist/domain/diagnostics/primitives/evaluators.js.map +1 -0
  41. package/dist/domain/diagnostics/primitives/fixture.d.ts +97 -0
  42. package/dist/domain/diagnostics/primitives/fixture.d.ts.map +1 -0
  43. package/dist/domain/diagnostics/primitives/fixture.js +265 -0
  44. package/dist/domain/diagnostics/primitives/fixture.js.map +1 -0
  45. package/dist/domain/diagnostics/primitives/index.d.ts +18 -0
  46. package/dist/domain/diagnostics/primitives/index.d.ts.map +1 -0
  47. package/dist/domain/diagnostics/primitives/index.js +34 -0
  48. package/dist/domain/diagnostics/primitives/index.js.map +1 -0
  49. package/dist/domain/diagnostics/primitives/known-gaps.d.ts +50 -0
  50. package/dist/domain/diagnostics/primitives/known-gaps.d.ts.map +1 -0
  51. package/dist/domain/diagnostics/primitives/known-gaps.js +148 -0
  52. package/dist/domain/diagnostics/primitives/known-gaps.js.map +1 -0
  53. package/dist/domain/diagnostics/primitives/manifest-view.d.ts +28 -0
  54. package/dist/domain/diagnostics/primitives/manifest-view.d.ts.map +1 -0
  55. package/dist/domain/diagnostics/primitives/manifest-view.js +50 -0
  56. package/dist/domain/diagnostics/primitives/manifest-view.js.map +1 -0
  57. package/dist/domain/diagnostics/primitives/placements.d.ts +51 -0
  58. package/dist/domain/diagnostics/primitives/placements.d.ts.map +1 -0
  59. package/dist/domain/diagnostics/primitives/placements.js +76 -0
  60. package/dist/domain/diagnostics/primitives/placements.js.map +1 -0
  61. package/dist/domain/diagnostics/primitives/planner.d.ts +60 -0
  62. package/dist/domain/diagnostics/primitives/planner.d.ts.map +1 -0
  63. package/dist/domain/diagnostics/primitives/planner.js +60 -0
  64. package/dist/domain/diagnostics/primitives/planner.js.map +1 -0
  65. package/dist/domain/diagnostics/primitives/plugin-projection.d.ts +38 -0
  66. package/dist/domain/diagnostics/primitives/plugin-projection.d.ts.map +1 -0
  67. package/dist/domain/diagnostics/primitives/plugin-projection.js +173 -0
  68. package/dist/domain/diagnostics/primitives/plugin-projection.js.map +1 -0
  69. package/dist/domain/diagnostics/primitives/report.d.ts +122 -0
  70. package/dist/domain/diagnostics/primitives/report.d.ts.map +1 -0
  71. package/dist/domain/diagnostics/primitives/report.js +85 -0
  72. package/dist/domain/diagnostics/primitives/report.js.map +1 -0
  73. package/dist/domain/diagnostics/primitives/sandbox.d.ts +59 -0
  74. package/dist/domain/diagnostics/primitives/sandbox.d.ts.map +1 -0
  75. package/dist/domain/diagnostics/primitives/sandbox.js +193 -0
  76. package/dist/domain/diagnostics/primitives/sandbox.js.map +1 -0
  77. package/dist/domain/diagnostics/primitives/support-matrix.d.ts +36 -0
  78. package/dist/domain/diagnostics/primitives/support-matrix.d.ts.map +1 -0
  79. package/dist/domain/diagnostics/primitives/support-matrix.js +69 -0
  80. package/dist/domain/diagnostics/primitives/support-matrix.js.map +1 -0
  81. package/dist/domain/diagnostics/primitives/types.d.ts +117 -0
  82. package/dist/domain/diagnostics/primitives/types.d.ts.map +1 -0
  83. package/dist/domain/diagnostics/primitives/types.js +62 -0
  84. package/dist/domain/diagnostics/primitives/types.js.map +1 -0
  85. package/dist/domain/governance/catalogue.d.ts +11 -0
  86. package/dist/domain/governance/catalogue.d.ts.map +1 -0
  87. package/dist/domain/governance/catalogue.js +45 -0
  88. package/dist/domain/governance/catalogue.js.map +1 -0
  89. package/dist/domain/governance/effective-rules.d.ts +19 -0
  90. package/dist/domain/governance/effective-rules.d.ts.map +1 -0
  91. package/dist/domain/governance/effective-rules.js +49 -0
  92. package/dist/domain/governance/effective-rules.js.map +1 -0
  93. package/dist/domain/governance/evaluate.d.ts +16 -0
  94. package/dist/domain/governance/evaluate.d.ts.map +1 -0
  95. package/dist/domain/governance/evaluate.js +34 -0
  96. package/dist/domain/governance/evaluate.js.map +1 -0
  97. package/dist/domain/governance/hub-scope.d.ts +74 -0
  98. package/dist/domain/governance/hub-scope.d.ts.map +1 -0
  99. package/dist/domain/governance/hub-scope.js +202 -0
  100. package/dist/domain/governance/hub-scope.js.map +1 -0
  101. package/dist/domain/governance/hub-scoped-inventory.d.ts +22 -0
  102. package/dist/domain/governance/hub-scoped-inventory.d.ts.map +1 -0
  103. package/dist/domain/governance/hub-scoped-inventory.js +59 -0
  104. package/dist/domain/governance/hub-scoped-inventory.js.map +1 -0
  105. package/dist/domain/governance/index.d.ts +15 -0
  106. package/dist/domain/governance/index.d.ts.map +1 -0
  107. package/dist/domain/governance/index.js +31 -0
  108. package/dist/domain/governance/index.js.map +1 -0
  109. package/dist/domain/governance/rule-registry.d.ts +20 -0
  110. package/dist/domain/governance/rule-registry.d.ts.map +1 -0
  111. package/dist/domain/governance/rule-registry.js +40 -0
  112. package/dist/domain/governance/rule-registry.js.map +1 -0
  113. package/dist/domain/governance/rules/collection.d.ts +32 -0
  114. package/dist/domain/governance/rules/collection.d.ts.map +1 -0
  115. package/dist/domain/governance/rules/collection.js +153 -0
  116. package/dist/domain/governance/rules/collection.js.map +1 -0
  117. package/dist/domain/governance/rules/config.d.ts +15 -0
  118. package/dist/domain/governance/rules/config.d.ts.map +1 -0
  119. package/dist/domain/governance/rules/config.js +38 -0
  120. package/dist/domain/governance/rules/config.js.map +1 -0
  121. package/dist/domain/governance/rules/hub.d.ts +7 -0
  122. package/dist/domain/governance/rules/hub.d.ts.map +1 -0
  123. package/dist/domain/governance/rules/hub.js +10 -0
  124. package/dist/domain/governance/rules/hub.js.map +1 -0
  125. package/dist/domain/governance/types.d.ts +70 -0
  126. package/dist/domain/governance/types.d.ts.map +1 -0
  127. package/dist/domain/governance/types.js +7 -0
  128. package/dist/domain/governance/types.js.map +1 -0
  129. package/dist/domain/hub/diagnostics.d.ts +92 -0
  130. package/dist/domain/hub/diagnostics.d.ts.map +1 -0
  131. package/dist/domain/hub/diagnostics.js +11 -0
  132. package/dist/domain/hub/diagnostics.js.map +1 -0
  133. package/dist/domain/hub/profile-requirements.d.ts +16 -0
  134. package/dist/domain/hub/profile-requirements.d.ts.map +1 -0
  135. package/dist/domain/hub/profile-requirements.js +16 -0
  136. package/dist/domain/hub/profile-requirements.js.map +1 -0
  137. package/dist/domain/hub/replicate.d.ts +23 -0
  138. package/dist/domain/hub/replicate.d.ts.map +1 -1
  139. package/dist/domain/hub/replicate.js +13 -0
  140. package/dist/domain/hub/replicate.js.map +1 -1
  141. package/dist/domain/hub/types.d.ts +2 -0
  142. package/dist/domain/hub/types.d.ts.map +1 -1
  143. package/dist/domain/hub/validate.d.ts +150 -2
  144. package/dist/domain/hub/validate.d.ts.map +1 -1
  145. package/dist/domain/hub/validate.js +421 -37
  146. package/dist/domain/hub/validate.js.map +1 -1
  147. package/dist/domain/index.d.ts +17 -0
  148. package/dist/domain/index.d.ts.map +1 -1
  149. package/dist/domain/index.js +17 -0
  150. package/dist/domain/index.js.map +1 -1
  151. package/dist/domain/install/category.d.ts +31 -0
  152. package/dist/domain/install/category.d.ts.map +1 -0
  153. package/dist/domain/install/category.js +33 -0
  154. package/dist/domain/install/category.js.map +1 -0
  155. package/dist/domain/install/file-mode.d.ts +49 -0
  156. package/dist/domain/install/file-mode.d.ts.map +1 -0
  157. package/dist/domain/install/file-mode.js +54 -0
  158. package/dist/domain/install/file-mode.js.map +1 -0
  159. package/dist/domain/install/git-exclude.d.ts +22 -0
  160. package/dist/domain/install/git-exclude.d.ts.map +1 -0
  161. package/dist/domain/install/git-exclude.js +56 -0
  162. package/dist/domain/install/git-exclude.js.map +1 -0
  163. package/dist/domain/install/installable.d.ts +2 -0
  164. package/dist/domain/install/installable.d.ts.map +1 -1
  165. package/dist/domain/install/kind-route.d.ts +80 -0
  166. package/dist/domain/install/kind-route.d.ts.map +1 -0
  167. package/dist/domain/install/kind-route.js +135 -0
  168. package/dist/domain/install/kind-route.js.map +1 -0
  169. package/dist/domain/install/record-errors.d.ts +53 -0
  170. package/dist/domain/install/record-errors.d.ts.map +1 -0
  171. package/dist/domain/install/record-errors.js +104 -0
  172. package/dist/domain/install/record-errors.js.map +1 -0
  173. package/dist/domain/install/record-object.d.ts +21 -0
  174. package/dist/domain/install/record-object.d.ts.map +1 -0
  175. package/dist/domain/install/record-object.js +38 -0
  176. package/dist/domain/install/record-object.js.map +1 -0
  177. package/dist/domain/install/record-parse.d.ts +23 -0
  178. package/dist/domain/install/record-parse.d.ts.map +1 -0
  179. package/dist/domain/install/record-parse.js +73 -0
  180. package/dist/domain/install/record-parse.js.map +1 -0
  181. package/dist/domain/install/record-path.d.ts +26 -0
  182. package/dist/domain/install/record-path.d.ts.map +1 -0
  183. package/dist/domain/install/record-path.js +130 -0
  184. package/dist/domain/install/record-path.js.map +1 -0
  185. package/dist/domain/install/record-types.d.ts +183 -0
  186. package/dist/domain/install/record-types.d.ts.map +1 -0
  187. package/dist/domain/install/record-types.js +92 -0
  188. package/dist/domain/install/record-types.js.map +1 -0
  189. package/dist/domain/install/types.d.ts +2 -0
  190. package/dist/domain/install/types.d.ts.map +1 -1
  191. package/dist/domain/mcp/index.d.ts +1 -0
  192. package/dist/domain/mcp/index.d.ts.map +1 -1
  193. package/dist/domain/mcp/index.js +1 -0
  194. package/dist/domain/mcp/index.js.map +1 -1
  195. package/dist/domain/mcp/server-key.d.ts +35 -0
  196. package/dist/domain/mcp/server-key.d.ts.map +1 -0
  197. package/dist/domain/mcp/server-key.js +44 -0
  198. package/dist/domain/mcp/server-key.js.map +1 -0
  199. package/dist/domain/plugin/agent-plugin-spec.d.ts +8 -0
  200. package/dist/domain/plugin/agent-plugin-spec.d.ts.map +1 -1
  201. package/dist/domain/plugin/agent-plugin-spec.js +22 -8
  202. package/dist/domain/plugin/agent-plugin-spec.js.map +1 -1
  203. package/dist/domain/registry-error.d.ts +1 -1
  204. package/dist/domain/registry-error.d.ts.map +1 -1
  205. package/dist/domain/registry-error.js +2 -1
  206. package/dist/domain/registry-error.js.map +1 -1
  207. package/dist/domain/security/fingerprint.d.ts +18 -0
  208. package/dist/domain/security/fingerprint.d.ts.map +1 -0
  209. package/dist/domain/security/fingerprint.js +34 -0
  210. package/dist/domain/security/fingerprint.js.map +1 -0
  211. package/dist/domain/security/high-impact-rules.d.ts +30 -0
  212. package/dist/domain/security/high-impact-rules.d.ts.map +1 -0
  213. package/dist/domain/security/high-impact-rules.js +160 -0
  214. package/dist/domain/security/high-impact-rules.js.map +1 -0
  215. package/dist/domain/security/index.d.ts +10 -0
  216. package/dist/domain/security/index.d.ts.map +1 -0
  217. package/dist/domain/security/index.js +26 -0
  218. package/dist/domain/security/index.js.map +1 -0
  219. package/dist/domain/security/markdown-context.d.ts +17 -0
  220. package/dist/domain/security/markdown-context.d.ts.map +1 -0
  221. package/dist/domain/security/markdown-context.js +74 -0
  222. package/dist/domain/security/markdown-context.js.map +1 -0
  223. package/dist/domain/security/policy.d.ts +17 -0
  224. package/dist/domain/security/policy.d.ts.map +1 -0
  225. package/dist/domain/security/policy.js +31 -0
  226. package/dist/domain/security/policy.js.map +1 -0
  227. package/dist/domain/security/rating/findings-document.d.ts +22 -0
  228. package/dist/domain/security/rating/findings-document.d.ts.map +1 -0
  229. package/dist/domain/security/rating/findings-document.js +57 -0
  230. package/dist/domain/security/rating/findings-document.js.map +1 -0
  231. package/dist/domain/security/rating/index.d.ts +5 -0
  232. package/dist/domain/security/rating/index.d.ts.map +1 -0
  233. package/dist/domain/security/rating/index.js +21 -0
  234. package/dist/domain/security/rating/index.js.map +1 -0
  235. package/dist/domain/security/rating/scoring.d.ts +83 -0
  236. package/dist/domain/security/rating/scoring.d.ts.map +1 -0
  237. package/dist/domain/security/rating/scoring.js +115 -0
  238. package/dist/domain/security/rating/scoring.js.map +1 -0
  239. package/dist/domain/security/rating/security-rating-report.d.ts +111 -0
  240. package/dist/domain/security/rating/security-rating-report.d.ts.map +1 -0
  241. package/dist/domain/security/rating/security-rating-report.js +152 -0
  242. package/dist/domain/security/rating/security-rating-report.js.map +1 -0
  243. package/dist/domain/security/rating/types.d.ts +22 -0
  244. package/dist/domain/security/rating/types.d.ts.map +1 -0
  245. package/dist/domain/security/rating/types.js +11 -0
  246. package/dist/domain/security/rating/types.js.map +1 -0
  247. package/dist/domain/security/remediations.d.ts +17 -0
  248. package/dist/domain/security/remediations.d.ts.map +1 -0
  249. package/dist/domain/security/remediations.js +61 -0
  250. package/dist/domain/security/remediations.js.map +1 -0
  251. package/dist/domain/security/rule-engine.d.ts +8 -0
  252. package/dist/domain/security/rule-engine.d.ts.map +1 -0
  253. package/dist/domain/security/rule-engine.js +875 -0
  254. package/dist/domain/security/rule-engine.js.map +1 -0
  255. package/dist/domain/security/suppression.d.ts +19 -0
  256. package/dist/domain/security/suppression.d.ts.map +1 -0
  257. package/dist/domain/security/suppression.js +78 -0
  258. package/dist/domain/security/suppression.js.map +1 -0
  259. package/dist/domain/security/types.d.ts +91 -0
  260. package/dist/domain/security/types.d.ts.map +1 -0
  261. package/dist/domain/security/types.js +10 -0
  262. package/dist/domain/security/types.js.map +1 -0
  263. package/dist/index.d.ts +8 -0
  264. package/dist/index.d.ts.map +1 -1
  265. package/dist/index.js +12 -1
  266. package/dist/index.js.map +1 -1
  267. package/dist/ports/app-storage.d.ts +11 -15
  268. package/dist/ports/app-storage.d.ts.map +1 -1
  269. package/dist/ports/app-storage.js +8 -8
  270. package/dist/ports/argv-process-runner.d.ts +6 -0
  271. package/dist/ports/argv-process-runner.d.ts.map +1 -0
  272. package/dist/ports/argv-process-runner.js +3 -0
  273. package/dist/ports/argv-process-runner.js.map +1 -0
  274. package/dist/ports/bundle-extractor.d.ts +16 -3
  275. package/dist/ports/bundle-extractor.d.ts.map +1 -1
  276. package/dist/ports/collection-contribution.d.ts +36 -0
  277. package/dist/ports/collection-contribution.d.ts.map +1 -0
  278. package/dist/ports/collection-contribution.js +3 -0
  279. package/dist/ports/collection-contribution.js.map +1 -0
  280. package/dist/ports/filesystem.d.ts +12 -0
  281. package/dist/ports/filesystem.d.ts.map +1 -1
  282. package/dist/ports/hub-collection-index.d.ts +27 -0
  283. package/dist/ports/hub-collection-index.d.ts.map +1 -0
  284. package/dist/ports/hub-collection-index.js +3 -0
  285. package/dist/ports/hub-collection-index.js.map +1 -0
  286. package/dist/ports/hub-contribution.d.ts +158 -0
  287. package/dist/ports/hub-contribution.d.ts.map +1 -0
  288. package/dist/ports/hub-contribution.js +3 -0
  289. package/dist/ports/hub-contribution.js.map +1 -0
  290. package/dist/ports/index.d.ts +12 -0
  291. package/dist/ports/index.d.ts.map +1 -1
  292. package/dist/ports/index.js +12 -0
  293. package/dist/ports/index.js.map +1 -1
  294. package/dist/ports/primitive-diagnostics-driver.d.ts +96 -0
  295. package/dist/ports/primitive-diagnostics-driver.d.ts.map +1 -0
  296. package/dist/ports/primitive-diagnostics-driver.js +3 -0
  297. package/dist/ports/primitive-diagnostics-driver.js.map +1 -0
  298. package/dist/ports/record-fs.d.ts +46 -0
  299. package/dist/ports/record-fs.d.ts.map +1 -0
  300. package/dist/ports/record-fs.js +9 -0
  301. package/dist/ports/record-fs.js.map +1 -0
  302. package/dist/ports/registry-operations.d.ts +3 -2
  303. package/dist/ports/registry-operations.d.ts.map +1 -1
  304. package/dist/ports/release-lookup.d.ts +24 -0
  305. package/dist/ports/release-lookup.d.ts.map +1 -0
  306. package/dist/ports/release-lookup.js +7 -0
  307. package/dist/ports/release-lookup.js.map +1 -0
  308. package/dist/ports/release-source.d.ts +17 -3
  309. package/dist/ports/release-source.d.ts.map +1 -1
  310. package/dist/ports/repository-exclusion.d.ts +30 -0
  311. package/dist/ports/repository-exclusion.d.ts.map +1 -0
  312. package/dist/ports/repository-exclusion.js +3 -0
  313. package/dist/ports/repository-exclusion.js.map +1 -0
  314. package/dist/ports/schema-validator.d.ts +25 -0
  315. package/dist/ports/schema-validator.d.ts.map +1 -0
  316. package/dist/ports/schema-validator.js +7 -0
  317. package/dist/ports/schema-validator.js.map +1 -0
  318. package/dist/ports/security-report-store.d.ts +9 -0
  319. package/dist/ports/security-report-store.d.ts.map +1 -0
  320. package/dist/ports/security-report-store.js +4 -0
  321. package/dist/ports/security-report-store.js.map +1 -0
  322. package/dist/ports/security-scan-engine.d.ts +32 -0
  323. package/dist/ports/security-scan-engine.d.ts.map +1 -0
  324. package/dist/ports/security-scan-engine.js +6 -0
  325. package/dist/ports/security-scan-engine.js.map +1 -0
  326. package/dist/ports/security-scan-input.d.ts +63 -0
  327. package/dist/ports/security-scan-input.d.ts.map +1 -0
  328. package/dist/ports/security-scan-input.js +3 -0
  329. package/dist/ports/security-scan-input.js.map +1 -0
  330. package/dist/ports/source-adapter.d.ts +11 -0
  331. package/dist/ports/source-adapter.d.ts.map +1 -1
  332. package/dist/public/schemas/collection.schema.json +0 -1
  333. package/dist/public/schemas/hub-governance.schema.json +21 -0
  334. package/dist/public/schemas/install-record.schema.json +343 -0
  335. package/dist/public/schemas/security-rating-report.schema.json +113 -0
  336. package/package.json +2 -2
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Weighted security rating of scanner findings.
3
+ *
4
+ * Every finding costs points; none is ignored:
5
+ *
6
+ * points = severityPoints x confidenceFactor x contextFactor x ruleFactor x repeatFactor
7
+ * penalty = sum of points
8
+ * score = round(100 x exp(-penalty / curveScale))
9
+ * risk = band of the score (higher score, lower risk)
10
+ *
11
+ * The weights, curve and bands are chosen together so that one full-strength finding of each
12
+ * severity lands in its own band (LOW 93 low, MEDIUM 82 medium, HIGH 61 high, CRITICAL 37
13
+ * critical).
14
+ * @module domain/security/rating/scoring
15
+ */
16
+ import type { SecurityRatingConfidence, SecurityRatingFinding, SecurityRatingSeverity } from './types';
17
+ export type PathContext = 'primitive' | 'doc' | 'vendored';
18
+ /** Risk label of a score; `unknown` when there is no score. */
19
+ export type SecurityRatingRisk = 'low' | 'medium' | 'high' | 'critical' | 'unknown';
20
+ /** Gate level: a bundle fails when its score is below the limit of this level. */
21
+ export type SecurityRatingFailOn = 'none' | 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
22
+ export interface ScoringWeights {
23
+ readonly severityPoints: Readonly<Record<SecurityRatingSeverity, number>>;
24
+ readonly confidenceFactor: Readonly<Record<SecurityRatingConfidence, number>>;
25
+ readonly contextFactor: Readonly<Record<PathContext, number>>;
26
+ readonly ruleFactor: Readonly<Record<string, number>>;
27
+ /** Factor for the 1st, 2nd, 3rd and later finding of one rule in one file. */
28
+ readonly repeatFactor: readonly number[];
29
+ readonly curveScale: number;
30
+ /** A score at or above `low` is low risk, at or above `medium` medium, at or above `high` high. */
31
+ readonly riskBands: {
32
+ readonly low: number;
33
+ readonly medium: number;
34
+ readonly high: number;
35
+ };
36
+ readonly docBasenames: readonly string[];
37
+ readonly docPathParts: readonly string[];
38
+ readonly vendoredPathParts: readonly string[];
39
+ readonly vendoredSuffixes: readonly string[];
40
+ }
41
+ export declare const DEFAULT_SCORING_WEIGHTS: ScoringWeights;
42
+ export type ScoredFinding = Pick<SecurityRatingFinding, 'ruleId' | 'severity' | 'confidence' | 'file' | 'line'>;
43
+ export interface ScoredFindings {
44
+ score: number;
45
+ risk: SecurityRatingRisk;
46
+ penalty: number;
47
+ /** Points of each input finding, in input order. */
48
+ points: number[];
49
+ }
50
+ /**
51
+ * Where a finding is: vendored code and docs cost less than real primitives.
52
+ * @param file - Finding file path, any separator and case
53
+ * @param weights - Scoring weights
54
+ */
55
+ export declare const classifyPath: (file: string, weights?: ScoringWeights) => PathContext;
56
+ /**
57
+ * Risk label of a score.
58
+ * @param score - 0-100, or null when unscored
59
+ * @param weights - Scoring weights
60
+ */
61
+ export declare const riskFromScore: (score: number | null, weights?: ScoringWeights) => SecurityRatingRisk;
62
+ export declare const scoreFromPenalty: (penalty: number, weights?: ScoringWeights) => number;
63
+ /**
64
+ * Score a list of findings.
65
+ * @param findings - Findings with severity, confidence, rule and location
66
+ * @param weights - Scoring weights
67
+ */
68
+ export declare const scoreFindings: (findings: readonly ScoredFinding[], weights?: ScoringWeights) => ScoredFindings;
69
+ /**
70
+ * Score below which the gate fails a bundle: CRITICAL fails the critical band, HIGH the high and
71
+ * critical bands, MEDIUM everything below the low band, LOW any score under 100.
72
+ * @param failOn - Gate level other than `none`
73
+ * @param weights - Scoring weights
74
+ */
75
+ export declare const gateScoreLimit: (failOn: Exclude<SecurityRatingFailOn, "none">, weights?: ScoringWeights) => number;
76
+ /**
77
+ * Whether a score trips the gate.
78
+ * @param score - 0-100, or null when unscored
79
+ * @param failOn - Gate level
80
+ * @param weights - Scoring weights
81
+ */
82
+ export declare const gateFailed: (score: number | null, failOn: SecurityRatingFailOn, weights?: ScoringWeights) => boolean;
83
+ //# sourceMappingURL=scoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../../../src/domain/security/rating/scoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,KAAK,GAAG,UAAU,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAEpF,kFAAkF;AAClF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEnF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1E,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAA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ACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,GAAG,IAAI,EAAE,UAAS,cAAwC,KAAG,kBAYvG,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,SAAS,MAAM,EAAE,UAAS,cAAwC,KAAG,MACnC,CAAC;AASpE;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,SAAS,aAAa,EAAE,EAClC,UAAS,cAAwC,KAChD,cAwBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,EAC7C,UAAS,cAAwC,KAChD,MAGF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,MAAM,GAAG,IAAI,EACpB,QAAQ,oBAAoB,EAC5B,UAAS,cAAwC,KAChD,OAAyF,CAAC"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gateFailed = exports.gateScoreLimit = exports.scoreFindings = exports.scoreFromPenalty = exports.riskFromScore = exports.classifyPath = exports.DEFAULT_SCORING_WEIGHTS = void 0;
4
+ exports.DEFAULT_SCORING_WEIGHTS = {
5
+ severityPoints: { CRITICAL: 40, HIGH: 20, MEDIUM: 8, LOW: 3, INFO: 0 },
6
+ confidenceFactor: { HIGH: 1, MEDIUM: 0.5, LOW: 0.25 },
7
+ contextFactor: { primitive: 1, doc: 0.25, vendored: 0.1 },
8
+ ruleFactor: { 'INJ-002': 0.25, 'HKS-008': 0.25, 'MD-001': 0.25 },
9
+ repeatFactor: [1, 0.5, 0.25],
10
+ curveScale: 40,
11
+ riskBands: { low: 90, medium: 70, high: 40 },
12
+ docBasenames: [
13
+ 'readme.md', 'agents.md', 'claude.md', 'contributing.md', 'code_of_conduct.md',
14
+ 'security.md', 'communication.md', 'changelog.md', 'release_notes.md'
15
+ ],
16
+ docPathParts: ['/docs/', '/references/', '/change-logs/', '/changelogs/'],
17
+ vendoredPathParts: ['/node_modules/', '/vendor/', '/third_party/', '/.yarn/', '/dist/', '/build/'],
18
+ vendoredSuffixes: ['.min.js', '.min.css', '.map']
19
+ };
20
+ /**
21
+ * Where a finding is: vendored code and docs cost less than real primitives.
22
+ * @param file - Finding file path, any separator and case
23
+ * @param weights - Scoring weights
24
+ */
25
+ const classifyPath = (file, weights = exports.DEFAULT_SCORING_WEIGHTS) => {
26
+ const normalized = `/${file.replaceAll('\\', '/').toLowerCase().replaceAll(/^\/+|\/+$/g, '')}`;
27
+ const folders = `${normalized}/`;
28
+ if (weights.vendoredPathParts.some((part) => folders.includes(part))
29
+ || weights.vendoredSuffixes.some((suffix) => normalized.endsWith(suffix))) {
30
+ return 'vendored';
31
+ }
32
+ const basename = normalized.slice(normalized.lastIndexOf('/') + 1);
33
+ if (weights.docPathParts.some((part) => folders.includes(part)) || weights.docBasenames.includes(basename)) {
34
+ return 'doc';
35
+ }
36
+ return 'primitive';
37
+ };
38
+ exports.classifyPath = classifyPath;
39
+ /**
40
+ * Risk label of a score.
41
+ * @param score - 0-100, or null when unscored
42
+ * @param weights - Scoring weights
43
+ */
44
+ const riskFromScore = (score, weights = exports.DEFAULT_SCORING_WEIGHTS) => {
45
+ if (score === null) {
46
+ return 'unknown';
47
+ }
48
+ const { low, medium, high } = weights.riskBands;
49
+ if (score >= low) {
50
+ return 'low';
51
+ }
52
+ if (score >= medium) {
53
+ return 'medium';
54
+ }
55
+ return score >= high ? 'high' : 'critical';
56
+ };
57
+ exports.riskFromScore = riskFromScore;
58
+ const scoreFromPenalty = (penalty, weights = exports.DEFAULT_SCORING_WEIGHTS) => Math.floor((100 * Math.exp(-penalty / weights.curveScale)) + 0.5);
59
+ exports.scoreFromPenalty = scoreFromPenalty;
60
+ /**
61
+ * Code point order, so repeats are counted the same way on every platform and locale.
62
+ * @param a
63
+ * @param b
64
+ */
65
+ const compare = (a, b) => (a < b ? -1 : (a > b ? 1 : 0));
66
+ /**
67
+ * Score a list of findings.
68
+ * @param findings - Findings with severity, confidence, rule and location
69
+ * @param weights - Scoring weights
70
+ */
71
+ const scoreFindings = (findings, weights = exports.DEFAULT_SCORING_WEIGHTS) => {
72
+ const points = Array.from({ length: findings.length }).fill(0);
73
+ const seen = new Map();
74
+ const order = findings.map((_, index) => index).toSorted((a, b) => compare(findings[a].file, findings[b].file)
75
+ || compare(findings[a].line ?? 0, findings[b].line ?? 0)
76
+ || compare(findings[a].ruleId, findings[b].ruleId)
77
+ || compare(weights.severityPoints[findings[b].severity], weights.severityPoints[findings[a].severity])
78
+ || compare(weights.confidenceFactor[findings[b].confidence] ?? 1, weights.confidenceFactor[findings[a].confidence] ?? 1));
79
+ const lastRepeat = weights.repeatFactor.length - 1;
80
+ for (const index of order) {
81
+ const item = findings[index];
82
+ const key = `${item.ruleId}\u0000${item.file}`;
83
+ const occurrence = seen.get(key) ?? 0;
84
+ seen.set(key, occurrence + 1);
85
+ points[index] = weights.severityPoints[item.severity]
86
+ * (weights.confidenceFactor[item.confidence] ?? 1)
87
+ * weights.contextFactor[(0, exports.classifyPath)(item.file, weights)]
88
+ * (Object.hasOwn(weights.ruleFactor, item.ruleId) ? weights.ruleFactor[item.ruleId] : 1)
89
+ * weights.repeatFactor[Math.min(occurrence, lastRepeat)];
90
+ }
91
+ const penalty = points.reduce((sum, value) => sum + value, 0);
92
+ const score = (0, exports.scoreFromPenalty)(penalty, weights);
93
+ return { score, risk: (0, exports.riskFromScore)(score, weights), penalty, points };
94
+ };
95
+ exports.scoreFindings = scoreFindings;
96
+ /**
97
+ * Score below which the gate fails a bundle: CRITICAL fails the critical band, HIGH the high and
98
+ * critical bands, MEDIUM everything below the low band, LOW any score under 100.
99
+ * @param failOn - Gate level other than `none`
100
+ * @param weights - Scoring weights
101
+ */
102
+ const gateScoreLimit = (failOn, weights = exports.DEFAULT_SCORING_WEIGHTS) => {
103
+ const limits = { CRITICAL: weights.riskBands.high, HIGH: weights.riskBands.medium, MEDIUM: weights.riskBands.low, LOW: 100 };
104
+ return limits[failOn];
105
+ };
106
+ exports.gateScoreLimit = gateScoreLimit;
107
+ /**
108
+ * Whether a score trips the gate.
109
+ * @param score - 0-100, or null when unscored
110
+ * @param failOn - Gate level
111
+ * @param weights - Scoring weights
112
+ */
113
+ const gateFailed = (score, failOn, weights = exports.DEFAULT_SCORING_WEIGHTS) => failOn !== 'none' && score !== null && score < (0, exports.gateScoreLimit)(failOn, weights);
114
+ exports.gateFailed = gateFailed;
115
+ //# sourceMappingURL=scoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoring.js","sourceRoot":"","sources":["../../../../src/domain/security/rating/scoring.ts"],"names":[],"mappings":";;;AA6Ca,QAAA,uBAAuB,GAAmB;IACrD,cAAc,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;IACtE,gBAAgB,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE;IACrD,aAAa,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE;IACzD,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IAChE,YAAY,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC;IAC5B,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;IAC5C,YAAY,EAAE;QACZ,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,oBAAoB;QAC9E,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB;KACtE;IACD,YAAY,EAAE,CAAC,QAA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,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAC7H,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEF;;;;;GAKG;AACI,MAAM,UAAU,GAAG,CACxB,KAAoB,EACpB,MAA4B,EAC5B,UAA0B,+BAAuB,EACxC,EAAE,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,GAAG,IAAA,sBAAc,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAJhF,QAAA,UAAU,cAIsE"}
@@ -0,0 +1,111 @@
1
+ import { type ScoringWeights, type SecurityRatingFailOn, type SecurityRatingRisk } from './scoring';
2
+ import type { SecurityRatingFinding, SecurityRatingSeverity } from './types';
3
+ export type SecurityRatingReportMode = 'release-archives' | 'collections' | 'skills' | 'repository';
4
+ export interface SecurityRatingFindingEntry {
5
+ ruleId: string;
6
+ severity: SecurityRatingSeverity;
7
+ /** Points this finding costs. */
8
+ points: number;
9
+ file: string;
10
+ line: number;
11
+ title: string;
12
+ /** How to fix it. */
13
+ fix: string;
14
+ }
15
+ export interface SecurityRatingBlock {
16
+ score: number | null;
17
+ risk: SecurityRatingRisk;
18
+ penalty: number;
19
+ counts: Record<SecurityRatingSeverity, number>;
20
+ /** The costliest findings; counts cover all of them. */
21
+ findings: SecurityRatingFindingEntry[];
22
+ }
23
+ export interface SecurityRatingBundleMetadata {
24
+ author: string | null;
25
+ kind: Record<string, number>;
26
+ labels: string[];
27
+ }
28
+ export interface SecurityRatingBundle extends SecurityRatingBlock {
29
+ id: string;
30
+ version: string;
31
+ metadata?: SecurityRatingBundleMetadata;
32
+ }
33
+ export interface SecurityRatingSourceBlock extends SecurityRatingBlock {
34
+ /** `bundles-average`, or `repository` when no bundles were found and the whole checkout was rated. */
35
+ basis: 'bundles-average' | 'repository';
36
+ }
37
+ export interface SecurityRatingReport {
38
+ schemaVersion: 1;
39
+ generatedAt: string;
40
+ scanner: {
41
+ name: string;
42
+ };
43
+ source: {
44
+ repository: string;
45
+ tag: string;
46
+ commit: string;
47
+ mode: SecurityRatingReportMode;
48
+ };
49
+ repo: SecurityRatingSourceBlock;
50
+ bundles: SecurityRatingBundle[];
51
+ gate: {
52
+ failOn: Uppercase<SecurityRatingFailOn>;
53
+ passed: boolean;
54
+ };
55
+ }
56
+ /** A bundle and the repository-relative files it ships. */
57
+ export interface BundleFiles {
58
+ id: string;
59
+ version: string;
60
+ files: readonly string[];
61
+ metadata?: SecurityRatingBundleMetadata;
62
+ }
63
+ export interface RateOptions {
64
+ weights?: ScoringWeights;
65
+ /** How many of the costliest findings to list. */
66
+ maxFindings?: number;
67
+ }
68
+ export declare const DEFAULT_MAX_LISTED_FINDINGS = 20;
69
+ /**
70
+ * Normalise a path for matching: forward slashes, no leading `./`.
71
+ * @param file - Path as reported by the scanner or a collection
72
+ */
73
+ export declare const normalizeReportPath: (file: string) => string;
74
+ /**
75
+ * Rate a list of findings.
76
+ * @param findings - Findings of one bundle, or of the whole repository
77
+ * @param options - Weights and list size
78
+ */
79
+ export declare const rateFindings: (findings: readonly SecurityRatingFinding[], options?: RateOptions) => SecurityRatingBlock;
80
+ /**
81
+ * Average of the scored blocks (halves rounded up), the risk band of that average, and the summed
82
+ * penalty and counts. Unscored blocks are left out.
83
+ * @param blocks - Bundle blocks
84
+ * @param maxFindings - How many of the costliest findings to list
85
+ * @param weights - Scoring weights
86
+ */
87
+ export declare const aggregateSecurityRatingBlocks: (blocks: readonly SecurityRatingBlock[], maxFindings?: number, weights?: ScoringWeights) => SecurityRatingBlock;
88
+ export interface BuildSecurityRatingReportInput {
89
+ findings: readonly SecurityRatingFinding[];
90
+ /** Bundles to rate; empty rates the whole repository as one unit. */
91
+ bundles: readonly BundleFiles[];
92
+ mode: SecurityRatingReportMode;
93
+ failOn: SecurityRatingFailOn;
94
+ generatedAt: string;
95
+ scanner: {
96
+ name: string;
97
+ };
98
+ source: {
99
+ repository: string;
100
+ tag: string;
101
+ commit: string;
102
+ };
103
+ weights?: ScoringWeights;
104
+ maxFindings?: number;
105
+ }
106
+ /**
107
+ * Build the security rating report of a scan.
108
+ * @param input - Scan findings, the bundles with their files, and report metadata
109
+ */
110
+ export declare const buildSecurityRatingReport: (input: BuildSecurityRatingReportInput) => SecurityRatingReport;
111
+ //# sourceMappingURL=security-rating-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-rating-report.d.ts","sourceRoot":"","sources":["../../../../src/domain/security/rating/security-rating-report.ts"],"names":[],"mappings":"AAWA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACxB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAKjB,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,aAAa,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEpG,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,sBAAsB,CAAC;IACjC,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;IAC/C,wDAAwD;IACxD,QAAQ,EAAE,0BAA0B,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MA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A0D,CAAC;AAE9G;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,qBAAqB,EAAE,EAAE,UAAS,WAAgB,KAAG,mBA0BpG,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GACxC,QAAQ,SAAS,mBAAmB,EAAE,EACtC,cAAa,MAAoC,EACjD,UAAS,cAAwC,KAChD,mBAkBF,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC3C,qEAAqE;IACrE,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAAI,OAAO,8BAA8B,KAAG,oBA6BjF,CAAC"}
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.buildSecurityRatingReport = exports.aggregateSecurityRatingBlocks = exports.rateFindings = exports.normalizeReportPath = exports.DEFAULT_MAX_LISTED_FINDINGS = void 0;
37
+ /**
38
+ * Security rating report: rates each bundle (collection) on its own and the source as the average of its
39
+ * bundles, from the findings of a scan.
40
+ *
41
+ * The JSON shape is `security-rating-report.schema.json` (schemaVersion 1).
42
+ * @module domain/security/rating/security-rating-report
43
+ */
44
+ const path = __importStar(require("node:path"));
45
+ const remediations_1 = require("../remediations");
46
+ const scoring_1 = require("./scoring");
47
+ const types_1 = require("./types");
48
+ exports.DEFAULT_MAX_LISTED_FINDINGS = 20;
49
+ const emptyCounts = () => Object.fromEntries(types_1.SECURITY_RATING_SEVERITIES.map((severity) => [severity, 0]));
50
+ const round1 = (value) => Math.round(value * 10) / 10;
51
+ /**
52
+ * Normalise a path for matching: forward slashes, no leading `./`.
53
+ * @param file - Path as reported by the scanner or a collection
54
+ */
55
+ const normalizeReportPath = (file) => path.posix.normalize(file.replaceAll('\\', '/'));
56
+ exports.normalizeReportPath = normalizeReportPath;
57
+ /**
58
+ * Rate a list of findings.
59
+ * @param findings - Findings of one bundle, or of the whole repository
60
+ * @param options - Weights and list size
61
+ */
62
+ const rateFindings = (findings, options = {}) => {
63
+ const weights = options.weights ?? scoring_1.DEFAULT_SCORING_WEIGHTS;
64
+ const scored = (0, scoring_1.scoreFindings)(findings, weights);
65
+ const counts = emptyCounts();
66
+ for (const item of findings) {
67
+ counts[item.severity] += 1;
68
+ }
69
+ const ranked = findings.map((_, index) => index)
70
+ .filter((index) => scored.points[index] > 0)
71
+ .toSorted((a, b) => scored.points[b] - scored.points[a]
72
+ || findings[a].file.localeCompare(findings[b].file) || (findings[a].line ?? 0) - (findings[b].line ?? 0));
73
+ return {
74
+ score: scored.score,
75
+ risk: scored.risk,
76
+ penalty: round1(scored.penalty),
77
+ counts,
78
+ findings: ranked.slice(0, options.maxFindings ?? exports.DEFAULT_MAX_LISTED_FINDINGS).map((index) => ({
79
+ ruleId: findings[index].ruleId,
80
+ severity: findings[index].severity,
81
+ points: round1(scored.points[index]),
82
+ file: (0, exports.normalizeReportPath)(findings[index].file),
83
+ line: findings[index].line ?? 0,
84
+ title: findings[index].title,
85
+ fix: findings[index].recommendedFix ?? (0, remediations_1.recommendedFixFor)(findings[index].ruleId)
86
+ }))
87
+ };
88
+ };
89
+ exports.rateFindings = rateFindings;
90
+ /**
91
+ * Average of the scored blocks (halves rounded up), the risk band of that average, and the summed
92
+ * penalty and counts. Unscored blocks are left out.
93
+ * @param blocks - Bundle blocks
94
+ * @param maxFindings - How many of the costliest findings to list
95
+ * @param weights - Scoring weights
96
+ */
97
+ const aggregateSecurityRatingBlocks = (blocks, maxFindings = exports.DEFAULT_MAX_LISTED_FINDINGS, weights = scoring_1.DEFAULT_SCORING_WEIGHTS) => {
98
+ const scores = blocks.flatMap((block) => (block.score === null ? [] : [block.score]));
99
+ const score = scores.length === 0 ? null : Math.floor((2 * scores.reduce((sum, value) => sum + value, 0) + scores.length) / (2 * scores.length));
100
+ const counts = emptyCounts();
101
+ for (const block of blocks) {
102
+ for (const severity of types_1.SECURITY_RATING_SEVERITIES) {
103
+ counts[severity] += block.counts[severity];
104
+ }
105
+ }
106
+ return {
107
+ score,
108
+ risk: (0, scoring_1.riskFromScore)(score, weights),
109
+ penalty: round1(blocks.reduce((sum, block) => sum + block.penalty, 0)),
110
+ counts,
111
+ findings: blocks.flatMap((block) => block.findings)
112
+ .toSorted((a, b) => b.points - a.points || a.file.localeCompare(b.file) || a.line - b.line)
113
+ .slice(0, maxFindings)
114
+ };
115
+ };
116
+ exports.aggregateSecurityRatingBlocks = aggregateSecurityRatingBlocks;
117
+ /**
118
+ * Build the security rating report of a scan.
119
+ * @param input - Scan findings, the bundles with their files, and report metadata
120
+ */
121
+ const buildSecurityRatingReport = (input) => {
122
+ const weights = input.weights ?? scoring_1.DEFAULT_SCORING_WEIGHTS;
123
+ const options = { weights, maxFindings: input.maxFindings };
124
+ const limit = input.maxFindings ?? exports.DEFAULT_MAX_LISTED_FINDINGS;
125
+ const bundles = input.bundles.map((bundle) => {
126
+ const files = new Set(bundle.files.map((file) => (0, exports.normalizeReportPath)(file)));
127
+ const own = input.findings.filter((item) => files.has((0, exports.normalizeReportPath)(item.file)));
128
+ return {
129
+ id: bundle.id,
130
+ version: bundle.version,
131
+ ...(0, exports.rateFindings)(own, options),
132
+ ...(bundle.metadata === undefined ? {} : { metadata: bundle.metadata })
133
+ };
134
+ });
135
+ const repo = bundles.length > 0
136
+ ? { ...(0, exports.aggregateSecurityRatingBlocks)(bundles, limit, weights), basis: 'bundles-average' }
137
+ : { ...(0, exports.rateFindings)(input.findings, options), basis: 'repository' };
138
+ const failed = bundles.length > 0
139
+ ? bundles.some((bundle) => (0, scoring_1.gateFailed)(bundle.score, input.failOn, weights))
140
+ : (0, scoring_1.gateFailed)(repo.score, input.failOn, weights);
141
+ return {
142
+ schemaVersion: 1,
143
+ generatedAt: input.generatedAt,
144
+ scanner: input.scanner,
145
+ source: { ...input.source, mode: bundles.length > 0 ? input.mode : 'repository' },
146
+ repo,
147
+ bundles,
148
+ gate: { failOn: input.failOn.toUpperCase(), passed: !failed }
149
+ };
150
+ };
151
+ exports.buildSecurityRatingReport = buildSecurityRatingReport;
152
+ //# sourceMappingURL=security-rating-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-rating-report.js","sourceRoot":"","sources":["../../../../src/domain/security/rating/security-rating-report.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,gDAAkC;AAClC,kDAEyB;AACzB,uCAQmB;AAKnB,mCAEiB;AAkEJ,QAAA,2BAA2B,GAAG,EAAE,CAAC;AAE9C,MAAM,WAAW,GAAG,GAA2C,EAAE,CAC/D,MAAM,CAAC,WAAW,CAAC,kCAA0B,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAA2C,CAAC;AAE5H,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;AAEtE;;;GAGG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;AAAjG,QAAA,mBAAmB,uBAA8E;AAE9G;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,QAA0C,EAAE,UAAuB,EAAE,EAAuB,EAAE;IACzH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,iCAAuB,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAA,uBAAa,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,M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I,CAAC,CAAC,CAAC,YAAY,EAAE;QACjF,IAAI;QACJ,OAAO;QACP,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW,EAAqC,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE;KACjG,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,yBAAyB,6BA6BpC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Types of a finding as the security rating reads it. Deliberately small: any scanner that writes
3
+ * these fields as JSON can feed the rating.
4
+ * @module domain/security/rating/types
5
+ */
6
+ export declare const SECURITY_RATING_SEVERITIES: readonly ["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"];
7
+ export type SecurityRatingSeverity = typeof SECURITY_RATING_SEVERITIES[number];
8
+ export declare const SECURITY_RATING_CONFIDENCES: readonly ["HIGH", "MEDIUM", "LOW"];
9
+ export type SecurityRatingConfidence = typeof SECURITY_RATING_CONFIDENCES[number];
10
+ /** One scanner finding. */
11
+ export interface SecurityRatingFinding {
12
+ ruleId: string;
13
+ title: string;
14
+ severity: SecurityRatingSeverity;
15
+ confidence: SecurityRatingConfidence;
16
+ /** Path of the file, relative to the rated checkout when possible. */
17
+ file: string;
18
+ line?: number;
19
+ /** How to fix it; a suggestion for the rule family is used when the scanner gives none. */
20
+ recommendedFix?: string;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/domain/security/rating/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,0BAA0B,wDAAyD,CAAC;AACjG,MAAM,MAAM,sBAAsB,GAAG,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAE/E,eAAO,MAAM,2BAA2B,oCAAqC,CAAC;AAC9E,MAAM,MAAM,wBAAwB,GAAG,OAAO,2BAA2B,CAAC,MAAM,CAAC,CAAC;AAElF,2BAA2B;AAC3B,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,sBAAsB,CAAC;IACjC,UAAU,EAAE,wBAAwB,CAAC;IACrC,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2FAA2F;IAC3F,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Types of a finding as the security rating reads it. Deliberately small: any scanner that writes
4
+ * these fields as JSON can feed the rating.
5
+ * @module domain/security/rating/types
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.SECURITY_RATING_CONFIDENCES = exports.SECURITY_RATING_SEVERITIES = void 0;
9
+ exports.SECURITY_RATING_SEVERITIES = ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW', 'INFO'];
10
+ exports.SECURITY_RATING_CONFIDENCES = ['HIGH', 'MEDIUM', 'LOW'];
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/domain/security/rating/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEU,QAAA,0BAA0B,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC;AAGpF,QAAA,2BAA2B,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Remediation text of the scanner rules, looked up by exact rule id first and then by rule family
3
+ * prefix. The rule engine gives it to the findings it reports; the security rating uses it for
4
+ * findings from a scan report that carry no fix.
5
+ * @module domain/security/remediations
6
+ */
7
+ /**
8
+ * Remediation text written for a rule, if there is one.
9
+ * @param ruleId - Scanner rule id, e.g. `HKS-001`
10
+ */
11
+ export declare const remediationForRule: (ruleId: string) => string | undefined;
12
+ /**
13
+ * Suggested fix for a rule, or a generic hint for a rule without remediation text.
14
+ * @param ruleId - Scanner rule id, e.g. `HKS-001`
15
+ */
16
+ export declare const recommendedFixFor: (ruleId: string) => string;
17
+ //# sourceMappingURL=remediations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remediations.d.ts","sourceRoot":"","sources":["../../../src/domain/security/remediations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2CH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAEI,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,KAAG,MAA+C,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * Remediation text of the scanner rules, looked up by exact rule id first and then by rule family
4
+ * prefix. The rule engine gives it to the findings it reports; the security rating uses it for
5
+ * findings from a scan report that carry no fix.
6
+ * @module domain/security/remediations
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.recommendedFixFor = exports.remediationForRule = void 0;
10
+ const GENERIC = 'Review the finding in context. If it is documentation that only quotes the pattern, move it into a fenced '
11
+ + 'code block or an example section; otherwise rewrite it.';
12
+ const BY_RULE = {
13
+ 'HKS-001': 'Do not pipe a download into a shell. Download a pinned version, verify its checksum, then run it.',
14
+ 'SKL-001': 'Do not pipe a download into a shell, write into agent loader directories, or read CLI credentials. Ship the files explicitly and verify downloads by checksum.',
15
+ 'MCP-012': 'Do not pipe a remote script into a shell. Pin the package version or vendor the script.',
16
+ 'MCP-005': 'Pin the package: `npx -y <package>@<exact-version>` instead of the floating latest.',
17
+ 'SKL-007': 'Pin dependencies to exact versions instead of ranges (`~`, `^`, `>=`).',
18
+ 'LLM-005': 'Pin installs to an exact version, e.g. `pip install pkg==1.2.3`, `npm install pkg@1.2.3`.',
19
+ 'HKS-007': 'Avoid global package installs in hooks or scripts; use a pinned, project-local dependency.',
20
+ 'AGT-001': 'Replace wildcard permissions with the specific tools and paths the agent needs.',
21
+ 'AGT-004': 'Remove allow-all wording; list the exact tools or commands the agent may use.',
22
+ 'AGT-005': 'Narrow the tool allowlist; remove `Bash(*)` and `sudo`.',
23
+ 'AGT-003': 'Add an explicit human-approval step before destructive actions (delete, deploy, publish).',
24
+ 'LLM-008': 'Require human approval before destructive actions and say so in the instructions.',
25
+ 'SKL-008': 'Remove wording that asks to disable or evade security scanning.',
26
+ 'INJ-004': 'Remove instructions hidden in HTML comments; keep all instructions visible.',
27
+ 'INJ-006': 'Remove base64-encoded instructions; ship the instruction as plain text.',
28
+ 'MD-003': 'Remove `javascript:` links; use normal https links.',
29
+ 'MD-033': 'Remove obfuscated `javascript:` links; use normal https links.',
30
+ 'MD-001': 'Remove raw executable HTML (script, iframe, object, embed, form); use Markdown.',
31
+ 'MD-002': 'Remove HTML event handlers such as `onclick=`.',
32
+ 'SEC-014': 'Remove the exfiltration or out-of-band URL, or replace it with a documented, trusted endpoint.',
33
+ 'SEC-022': 'Do not echo secrets or sensitive environment variables to output or logs.',
34
+ 'SEC-027': 'Do not reference credential files from instructions; pass credentials through the environment\'s secret store.'
35
+ };
36
+ const BY_PREFIX = [
37
+ ['SEC-', 'Treat the secret as exposed: revoke or rotate it now, remove it from the file, and load it from a secret store or environment variable. Rewriting history alone is not enough.'],
38
+ ['INJ-', 'Remove or rewrite text that overrides the agent\'s rules or hides instructions. Keep user data separate from instructions.'],
39
+ ['MD-', 'Remove raw HTML, script-like links and unsafe renderer settings from the Markdown; use plain Markdown.'],
40
+ ['HKS-', 'Remove the dangerous shell behaviour from the hook or script, or replace it with a narrow, pinned and documented command.'],
41
+ ['AGT-', 'Grant the narrowest permissions the agent needs and require human approval for destructive actions.'],
42
+ ['MCP-', 'Check the MCP server definition: pin package versions, avoid shell metacharacters, and do not hide instructions in tool descriptions.'],
43
+ ['SKL-', 'Fix the skill definition: no credential extraction, no approval bypass, pinned dependencies, and no hidden or look-alike characters.'],
44
+ ['LLM-', 'Handle model output as untrusted, avoid unbounded loops, and pin package installs.'],
45
+ ['ASI-', 'Do not let the agent load unverified tools, persist untrusted memory, or delegate without limits.'],
46
+ ['CTL-', 'Informational: consider adding the missing safeguard to the instructions.']
47
+ ];
48
+ /**
49
+ * Remediation text written for a rule, if there is one.
50
+ * @param ruleId - Scanner rule id, e.g. `HKS-001`
51
+ */
52
+ const remediationForRule = (ruleId) => (Object.hasOwn(BY_RULE, ruleId) ? BY_RULE[ruleId] : undefined)
53
+ ?? BY_PREFIX.find(([prefix]) => ruleId.startsWith(prefix))?.[1];
54
+ exports.remediationForRule = remediationForRule;
55
+ /**
56
+ * Suggested fix for a rule, or a generic hint for a rule without remediation text.
57
+ * @param ruleId - Scanner rule id, e.g. `HKS-001`
58
+ */
59
+ const recommendedFixFor = (ruleId) => (0, exports.remediationForRule)(ruleId) ?? GENERIC;
60
+ exports.recommendedFixFor = recommendedFixFor;
61
+ //# sourceMappingURL=remediations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remediations.js","sourceRoot":"","sources":["../../../src/domain/security/remediations.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,MAAM,OAAO,GAAG,4GAA4G;MACxH,yDAAyD,CAAC;AAE9D,MAAM,OAAO,GAAqC;IAChD,SAAS,EAAE,mGAAmG;IAC9G,SAAS,EAAE,gKAAgK;IAC3K,SAAS,EAAE,yFAAyF;IACpG,SAAS,EAAE,qFAAqF;IAChG,SAAS,EAAE,wEAAwE;IACnF,SAAS,EAAE,2FAA2F;IACtG,SAAS,EAAE,4FAA4F;IACvG,SAAS,EAAE,iFAAiF;IAC5F,SAAS,EAAE,+EAA+E;IAC1F,SAAS,EAAE,yDAAyD;IACpE,SAAS,EAAE,2FAA2F;IACtG,SAAS,EAAE,mFAAmF;IAC9F,SAAS,EAAE,iEAAiE;IAC5E,SAAS,EAAE,6EAA6E;IACxF,SAAS,EAAE,yEAAyE;IACpF,QAAQ,EAAE,qDAAqD;IAC/D,QA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-scan-engine';
2
+ import type { SecurityDocument, SecurityFinding } from './types';
3
+ export declare class RuleBasedSecurityScanEngine implements SecurityScanEngine {
4
+ readonly descriptor: SecurityEngineDescriptor;
5
+ readonly capabilities: SecurityEngineCapabilities;
6
+ scanDocument(document: SecurityDocument, options: SecurityEngineOptions, cancellation: SecurityCancellation): Promise<readonly SecurityFinding[]>;
7
+ }
8
+ //# sourceMappingURL=rule-engine.d.ts.map