@cdxgen/cdxgen 13.3.0 → 13.4.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 (255) hide show
  1. package/README.md +9 -6
  2. package/bin/cdxgen.js +90 -26
  3. package/bin/evinse.js +18 -1
  4. package/bin/repl.js +86 -0
  5. package/bin/sign.js +45 -15
  6. package/bin/tracebom.js +5 -1
  7. package/bin/validate.js +84 -18
  8. package/bin/verify.js +155 -86
  9. package/data/helpers/init.gradle +46 -21
  10. package/data/remediations.json +61 -0
  11. package/data/rules/dependency-sources.yaml +67 -0
  12. package/data/rules/scala-evidence.yaml +115 -0
  13. package/lib/audit/index.js +38 -6
  14. package/lib/cli/index.js +113 -54
  15. package/lib/cli/jsBom.js +50 -29
  16. package/lib/cli/jvmBom.js +665 -138
  17. package/lib/cli/managedBom.js +320 -200
  18. package/lib/cli/nativeBom.js +139 -30
  19. package/lib/core/activity.js +12 -0
  20. package/lib/core/env.js +17 -9
  21. package/lib/core/fs.js +3 -2
  22. package/lib/core/httpClient.js +159 -24
  23. package/lib/core/pluginRun.js +184 -0
  24. package/lib/core/processTree.js +100 -0
  25. package/lib/core/runState.js +39 -0
  26. package/lib/core/toml.js +72 -0
  27. package/lib/ecosystems/asarutils.js +4 -2
  28. package/lib/ecosystems/bunutils.js +5 -7
  29. package/lib/ecosystems/cargoCache.js +231 -8
  30. package/lib/ecosystems/cmakeResolver.js +10 -21
  31. package/lib/ecosystems/cppBuildContext.js +631 -0
  32. package/lib/ecosystems/cppEvidence.js +337 -22
  33. package/lib/ecosystems/cppIncludeResolver.js +294 -0
  34. package/lib/ecosystems/denoutils.js +93 -66
  35. package/lib/ecosystems/ecosystems.js +1967 -788
  36. package/lib/ecosystems/golem.js +28 -12
  37. package/lib/ecosystems/gradleutils.js +314 -30
  38. package/lib/ecosystems/jsEvidence.js +85 -24
  39. package/lib/ecosystems/kosi.js +21 -4
  40. package/lib/ecosystems/npmutils.js +64 -0
  41. package/lib/ecosystems/parsers-dotnet.js +567 -151
  42. package/lib/ecosystems/parsers-elm.js +46 -28
  43. package/lib/ecosystems/parsers-gleam.js +3 -4
  44. package/lib/ecosystems/parsers-go.js +324 -61
  45. package/lib/ecosystems/parsers-js.js +92 -26
  46. package/lib/ecosystems/parsers-julia.js +2 -3
  47. package/lib/ecosystems/parsers-jvm.js +204 -12
  48. package/lib/ecosystems/parsers-misc.js +182 -55
  49. package/lib/ecosystems/parsers-python.js +141 -10
  50. package/lib/ecosystems/parsers-rust.js +4 -4
  51. package/lib/ecosystems/parsers-terraform.js +1573 -19
  52. package/lib/ecosystems/pythonutils.js +102 -6
  53. package/lib/ecosystems/remote/huggingface.js +3 -0
  54. package/lib/ecosystems/rubyutils.js +67 -17
  55. package/lib/ecosystems/rusi.js +22 -9
  56. package/lib/ecosystems/sbtutils.js +243 -187
  57. package/lib/ecosystems/scalacliutils.js +342 -0
  58. package/lib/ecosystems/scalasem.js +2618 -0
  59. package/lib/ecosystems/terraformRegistry.js +288 -0
  60. package/lib/ecosystems/utils.js +2 -0
  61. package/lib/ecosystems/vendoredCode.js +156 -0
  62. package/lib/evinser/evinser.js +578 -69
  63. package/lib/helpers/agenticToolutils.js +2 -2
  64. package/lib/helpers/bomSigner.js +576 -128
  65. package/lib/inventory/aiCollector.js +4 -1
  66. package/lib/inventory/analyzer.js +110 -127
  67. package/lib/inventory/atomUtils.js +171 -48
  68. package/lib/inventory/auditCategories.js +7 -0
  69. package/lib/inventory/buildToolRateLimit.js +144 -0
  70. package/lib/inventory/cacheCommands.js +2 -1
  71. package/lib/inventory/cmakeBuildDirs.js +254 -0
  72. package/lib/inventory/deps.js +501 -124
  73. package/lib/inventory/dosai.js +248 -44
  74. package/lib/inventory/dosaiParsers.js +310 -15
  75. package/lib/inventory/dynamic.js +52 -6
  76. package/lib/inventory/evidenceUtils.js +154 -109
  77. package/lib/inventory/fetchBatch.js +574 -38
  78. package/lib/inventory/fetchDiskCache.js +597 -0
  79. package/lib/inventory/forgeEnricher.js +14 -5
  80. package/lib/inventory/jvmLocalRepos.js +917 -0
  81. package/lib/inventory/mcpConfigParser.js +2 -3
  82. package/lib/inventory/parentSelection.js +146 -0
  83. package/lib/inventory/rustFormulationParser.js +3 -4
  84. package/lib/inventory/scalaCoords.js +153 -0
  85. package/lib/inventory/source.js +8 -8
  86. package/lib/inventory/spdx.js +101 -0
  87. package/lib/inventory/traceRunner.js +88 -7
  88. package/lib/inventory/tracedCrypto.js +294 -0
  89. package/lib/managers/docker.js +33 -32
  90. package/lib/managers/oci.js +24 -2
  91. package/lib/parsers/cmakeCache.js +69 -0
  92. package/lib/parsers/cmakeLists.js +16 -2
  93. package/lib/parsers/cmakePresets.js +400 -0
  94. package/lib/parsers/compileCommands.js +557 -0
  95. package/lib/parsers/strictJson.js +322 -0
  96. package/lib/parsers/terraformConfig.js +1073 -0
  97. package/lib/parsers/terraformSource.js +652 -0
  98. package/lib/server/server.js +23 -0
  99. package/lib/stages/postgen/introspection/markers.js +1 -1
  100. package/lib/stages/postgen/postgen.js +15 -1
  101. package/lib/stages/postgen/specVersionCompat.js +32 -0
  102. package/lib/validator/index.js +25 -10
  103. package/lib/validator/reporters/json.js +1 -0
  104. package/package.json +21 -21
  105. package/types/lib/audit/index.d.ts.map +1 -1
  106. package/types/lib/cli/index.d.ts.map +1 -1
  107. package/types/lib/cli/jsBom.d.ts.map +1 -1
  108. package/types/lib/cli/jvmBom.d.ts +24 -1
  109. package/types/lib/cli/jvmBom.d.ts.map +1 -1
  110. package/types/lib/cli/managedBom.d.ts +7 -4
  111. package/types/lib/cli/managedBom.d.ts.map +1 -1
  112. package/types/lib/cli/nativeBom.d.ts +3 -1
  113. package/types/lib/cli/nativeBom.d.ts.map +1 -1
  114. package/types/lib/core/activity.d.ts.map +1 -1
  115. package/types/lib/core/env.d.ts +9 -0
  116. package/types/lib/core/env.d.ts.map +1 -1
  117. package/types/lib/core/fs.d.ts.map +1 -1
  118. package/types/lib/core/httpClient.d.ts +13 -8
  119. package/types/lib/core/httpClient.d.ts.map +1 -1
  120. package/types/lib/core/pluginRun.d.ts +97 -0
  121. package/types/lib/core/pluginRun.d.ts.map +1 -0
  122. package/types/lib/core/processTree.d.ts +36 -0
  123. package/types/lib/core/processTree.d.ts.map +1 -0
  124. package/types/lib/core/runState.d.ts +29 -0
  125. package/types/lib/core/runState.d.ts.map +1 -0
  126. package/types/lib/core/toml.d.ts +20 -0
  127. package/types/lib/core/toml.d.ts.map +1 -0
  128. package/types/lib/ecosystems/asarutils.d.ts.map +1 -1
  129. package/types/lib/ecosystems/bunutils.d.ts.map +1 -1
  130. package/types/lib/ecosystems/cargoCache.d.ts +12 -0
  131. package/types/lib/ecosystems/cargoCache.d.ts.map +1 -1
  132. package/types/lib/ecosystems/cmakeResolver.d.ts +5 -3
  133. package/types/lib/ecosystems/cmakeResolver.d.ts.map +1 -1
  134. package/types/lib/ecosystems/cppBuildContext.d.ts +55 -0
  135. package/types/lib/ecosystems/cppBuildContext.d.ts.map +1 -0
  136. package/types/lib/ecosystems/cppEvidence.d.ts +18 -2
  137. package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
  138. package/types/lib/ecosystems/cppIncludeResolver.d.ts +92 -0
  139. package/types/lib/ecosystems/cppIncludeResolver.d.ts.map +1 -0
  140. package/types/lib/ecosystems/denoutils.d.ts +9 -3
  141. package/types/lib/ecosystems/denoutils.d.ts.map +1 -1
  142. package/types/lib/ecosystems/ecosystems.d.ts +62 -13
  143. package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
  144. package/types/lib/ecosystems/golem.d.ts.map +1 -1
  145. package/types/lib/ecosystems/gradleutils.d.ts +50 -0
  146. package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
  147. package/types/lib/ecosystems/jsEvidence.d.ts.map +1 -1
  148. package/types/lib/ecosystems/kosi.d.ts.map +1 -1
  149. package/types/lib/ecosystems/npmutils.d.ts +15 -0
  150. package/types/lib/ecosystems/npmutils.d.ts.map +1 -1
  151. package/types/lib/ecosystems/parsers-dotnet.d.ts +118 -4
  152. package/types/lib/ecosystems/parsers-dotnet.d.ts.map +1 -1
  153. package/types/lib/ecosystems/parsers-elm.d.ts.map +1 -1
  154. package/types/lib/ecosystems/parsers-gleam.d.ts.map +1 -1
  155. package/types/lib/ecosystems/parsers-go.d.ts +44 -2
  156. package/types/lib/ecosystems/parsers-go.d.ts.map +1 -1
  157. package/types/lib/ecosystems/parsers-js.d.ts +6 -1
  158. package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
  159. package/types/lib/ecosystems/parsers-julia.d.ts.map +1 -1
  160. package/types/lib/ecosystems/parsers-jvm.d.ts +46 -1
  161. package/types/lib/ecosystems/parsers-jvm.d.ts.map +1 -1
  162. package/types/lib/ecosystems/parsers-misc.d.ts +3 -1
  163. package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
  164. package/types/lib/ecosystems/parsers-python.d.ts +53 -3
  165. package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
  166. package/types/lib/ecosystems/parsers-terraform.d.ts +38 -21
  167. package/types/lib/ecosystems/parsers-terraform.d.ts.map +1 -1
  168. package/types/lib/ecosystems/pythonutils.d.ts +27 -2
  169. package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
  170. package/types/lib/ecosystems/remote/huggingface.d.ts.map +1 -1
  171. package/types/lib/ecosystems/rubyutils.d.ts +21 -1
  172. package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
  173. package/types/lib/ecosystems/rusi.d.ts.map +1 -1
  174. package/types/lib/ecosystems/sbtutils.d.ts +88 -2
  175. package/types/lib/ecosystems/sbtutils.d.ts.map +1 -1
  176. package/types/lib/ecosystems/scalacliutils.d.ts +56 -0
  177. package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -0
  178. package/types/lib/ecosystems/scalasem.d.ts +311 -0
  179. package/types/lib/ecosystems/scalasem.d.ts.map +1 -0
  180. package/types/lib/ecosystems/terraformRegistry.d.ts +9 -0
  181. package/types/lib/ecosystems/terraformRegistry.d.ts.map +1 -0
  182. package/types/lib/ecosystems/utils.d.ts +2 -2
  183. package/types/lib/ecosystems/utils.d.ts.map +1 -1
  184. package/types/lib/ecosystems/vendoredCode.d.ts +32 -0
  185. package/types/lib/ecosystems/vendoredCode.d.ts.map +1 -0
  186. package/types/lib/evinser/evinser.d.ts +75 -8
  187. package/types/lib/evinser/evinser.d.ts.map +1 -1
  188. package/types/lib/helpers/bomSigner.d.ts +80 -4
  189. package/types/lib/helpers/bomSigner.d.ts.map +1 -1
  190. package/types/lib/inventory/aiCollector.d.ts.map +1 -1
  191. package/types/lib/inventory/analyzer.d.ts.map +1 -1
  192. package/types/lib/inventory/atomUtils.d.ts +82 -10
  193. package/types/lib/inventory/atomUtils.d.ts.map +1 -1
  194. package/types/lib/inventory/auditCategories.d.ts +3 -0
  195. package/types/lib/inventory/auditCategories.d.ts.map +1 -1
  196. package/types/lib/inventory/buildToolRateLimit.d.ts +38 -0
  197. package/types/lib/inventory/buildToolRateLimit.d.ts.map +1 -0
  198. package/types/lib/inventory/cacheCommands.d.ts +2 -1
  199. package/types/lib/inventory/cacheCommands.d.ts.map +1 -1
  200. package/types/lib/inventory/cmakeBuildDirs.d.ts +58 -0
  201. package/types/lib/inventory/cmakeBuildDirs.d.ts.map +1 -0
  202. package/types/lib/inventory/deps.d.ts +59 -1
  203. package/types/lib/inventory/deps.d.ts.map +1 -1
  204. package/types/lib/inventory/dosai.d.ts +57 -8
  205. package/types/lib/inventory/dosai.d.ts.map +1 -1
  206. package/types/lib/inventory/dosaiParsers.d.ts +53 -7
  207. package/types/lib/inventory/dosaiParsers.d.ts.map +1 -1
  208. package/types/lib/inventory/dynamic.d.ts +10 -0
  209. package/types/lib/inventory/dynamic.d.ts.map +1 -1
  210. package/types/lib/inventory/evidenceUtils.d.ts +19 -4
  211. package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
  212. package/types/lib/inventory/fetchBatch.d.ts +83 -14
  213. package/types/lib/inventory/fetchBatch.d.ts.map +1 -1
  214. package/types/lib/inventory/fetchDiskCache.d.ts +169 -0
  215. package/types/lib/inventory/fetchDiskCache.d.ts.map +1 -0
  216. package/types/lib/inventory/forgeEnricher.d.ts.map +1 -1
  217. package/types/lib/inventory/jvmLocalRepos.d.ts +178 -0
  218. package/types/lib/inventory/jvmLocalRepos.d.ts.map +1 -0
  219. package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
  220. package/types/lib/inventory/parentSelection.d.ts +34 -0
  221. package/types/lib/inventory/parentSelection.d.ts.map +1 -0
  222. package/types/lib/inventory/rustFormulationParser.d.ts.map +1 -1
  223. package/types/lib/inventory/scalaCoords.d.ts +80 -0
  224. package/types/lib/inventory/scalaCoords.d.ts.map +1 -0
  225. package/types/lib/inventory/source.d.ts.map +1 -1
  226. package/types/lib/inventory/spdx.d.ts +9 -0
  227. package/types/lib/inventory/spdx.d.ts.map +1 -1
  228. package/types/lib/inventory/traceRunner.d.ts +12 -0
  229. package/types/lib/inventory/traceRunner.d.ts.map +1 -1
  230. package/types/lib/inventory/tracedCrypto.d.ts +42 -0
  231. package/types/lib/inventory/tracedCrypto.d.ts.map +1 -0
  232. package/types/lib/managers/docker.d.ts.map +1 -1
  233. package/types/lib/managers/oci.d.ts +3 -1
  234. package/types/lib/managers/oci.d.ts.map +1 -1
  235. package/types/lib/parsers/cmakeCache.d.ts +16 -0
  236. package/types/lib/parsers/cmakeCache.d.ts.map +1 -1
  237. package/types/lib/parsers/cmakeLists.d.ts +2 -1
  238. package/types/lib/parsers/cmakeLists.d.ts.map +1 -1
  239. package/types/lib/parsers/cmakePresets.d.ts +78 -0
  240. package/types/lib/parsers/cmakePresets.d.ts.map +1 -0
  241. package/types/lib/parsers/compileCommands.d.ts +115 -0
  242. package/types/lib/parsers/compileCommands.d.ts.map +1 -0
  243. package/types/lib/parsers/strictJson.d.ts +46 -0
  244. package/types/lib/parsers/strictJson.d.ts.map +1 -0
  245. package/types/lib/parsers/terraformConfig.d.ts +70 -0
  246. package/types/lib/parsers/terraformConfig.d.ts.map +1 -0
  247. package/types/lib/parsers/terraformSource.d.ts +66 -0
  248. package/types/lib/parsers/terraformSource.d.ts.map +1 -0
  249. package/types/lib/server/server.d.ts.map +1 -1
  250. package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
  251. package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
  252. package/types/lib/validator/index.d.ts +8 -0
  253. package/types/lib/validator/index.d.ts.map +1 -1
  254. package/types/lib/validator/reporters/json.d.ts.map +1 -1
  255. package/lib/third-party/arborist/snapshots/calc-dep-flags.test.cjs +0 -462
@@ -75,6 +75,36 @@ export declare function readDosaiMethodsReport(reportFile: string, options?: {
75
75
  export declare function readDosaiDataFlowReport(reportFile: string, options?: {
76
76
  maxTextBytes?: number;
77
77
  }): Object | undefined;
78
+ /**
79
+ * Whether a dosai run ended because it ran out of time.
80
+ *
81
+ * dosai has no limit of its own: cdxgen's spawn timeout
82
+ * (CDXGEN_TIMEOUT_MS) stops the process, which reaches the caller only as an
83
+ * ETIMEDOUT error looking like any other failure (issue 4438).
84
+ *
85
+ * @param {Object} result spawnSync result
86
+ * @returns {boolean} true when the run was stopped by the spawn timeout
87
+ */
88
+ export declare function dosaiRunTimedOut(result: Object): boolean;
89
+ /**
90
+ * How a dosai run was stopped before it could finish, if it was.
91
+ *
92
+ * Besides the spawn timeout, a run is stopped when its console output outgrows
93
+ * CDXGEN_MAX_BUFFER (ENOBUFS) or a signal ends it, such as the kernel's
94
+ * out-of-memory killer. A stopped run can leave its slice half written.
95
+ *
96
+ * @param {Object} result spawnSync result
97
+ * @returns {"timeout"|"buffer"|"signal"|undefined} Why the run was stopped, or undefined when it ended by itself
98
+ */
99
+ export declare function dosaiRunStopReason(result: Object): "timeout" | "buffer" | "signal" | undefined;
100
+ /**
101
+ * Whether the dosai run that should have written a file was stopped (by the
102
+ * time limit, the output buffer limit, or a signal) and already reported so.
103
+ *
104
+ * @param {string} outputFile Output file passed to the dosai run
105
+ * @returns {boolean} true when the run was stopped
106
+ */
107
+ export declare function dosaiRunWasStopped(outputFile: string): boolean;
78
108
  /**
79
109
  * Run a dosai subcommand ("methods", "dataflows", or "crypto") against a source
80
110
  * tree and write its JSON output to the given file.
@@ -138,17 +168,21 @@ export declare function persistDosaiSemanticsReport(options: any, methodsSlice:
138
168
  * Build a purl alias map for a list of components.
139
169
  *
140
170
  * @param {Object[]} [components] Component objects with purl fields
141
- * @returns {Map<string, string>} Map of exact purls and normalized type/namespace/name keys to canonical purls
171
+ * @param {Object} [options] Options passed to {@link buildDosaiPurlAliasMap} (`srcPath`)
172
+ * @returns {Map<string, string>} Map of component purls, carrying the version-free identity index
142
173
  */
143
- export declare function buildPurlAliasMap(components?: Object[]): Map<string, string>;
174
+ export declare function buildPurlAliasMap(components?: Object[], options?: Object): Map<string, string>;
144
175
  /**
145
- * Resolve a possibly-aliased purl to the canonical component purl.
176
+ * Resolve a dosai purl to the canonical component purl, by version, and for a
177
+ * package the BOM holds in several versions by the record's location.
146
178
  *
147
179
  * @param {string} purl Purl from a dosai report
148
180
  * @param {Map<string, string>} purlAliasMap Alias map built by buildPurlAliasMap
149
- * @returns {string|undefined} Canonical component purl, the input purl when unaliased, or undefined when empty
181
+ * @param {string} [location] Source location of the dosai record
182
+ * @returns {string|undefined} Canonical component purl, the input purl when the BOM has no such package,
183
+ * or undefined when empty or ambiguous
150
184
  */
151
- export declare function resolveComponentPurl(purl: string, purlAliasMap: Map<string, string>): string | undefined;
185
+ export declare function resolveComponentPurl(purl: string, purlAliasMap: Map<string, string>, location?: string): string | undefined;
152
186
  /**
153
187
  * Copy one dosai PackageReachability fact onto a component as properties.
154
188
  *
@@ -169,9 +203,14 @@ export declare function addDosaiReachabilityProperties(component: Object, reacha
169
203
  *
170
204
  * @param {Object} methodsSlice Parsed dosai methods slice JSON
171
205
  * @param {Object[]} [components] BOM components used to resolve purl aliases and mutate
206
+ * @param {Object} [options] Options
207
+ * @param {string} [options.srcPath] Directory dosai analyzed; a package the BOM holds in several
208
+ * versions is matched by the project of the record's file
172
209
  * @returns {number} Number of distinct components enriched
173
210
  */
174
- export declare function applyDosaiReachabilityEvidence(methodsSlice: Object, components?: Object[]): number;
211
+ export declare function applyDosaiReachabilityEvidence(methodsSlice: Object, components?: Object[], options?: {
212
+ srcPath?: string;
213
+ }): number;
175
214
  /**
176
215
  * Map a dosai methods slice to per-purl occurrence evidence.
177
216
  *
@@ -180,9 +219,14 @@ export declare function applyDosaiReachabilityEvidence(methodsSlice: Object, com
180
219
  *
181
220
  * @param {Object} methodsSlice Parsed dosai methods slice JSON
182
221
  * @param {Object[]} [components] BOM components used to resolve purl aliases
222
+ * @param {Object} [options] Options
223
+ * @param {string} [options.srcPath] Directory dosai analyzed; a package the BOM holds in several
224
+ * versions is matched by the project of the record's file
183
225
  * @returns {Object} Object with purlLocationMap, purlModulesMap, and purlMethodsMap keyed by purl
184
226
  */
185
- export declare function collectDosaiPurlEvidence(methodsSlice: Object, components?: Object[]): Object;
227
+ export declare function collectDosaiPurlEvidence(methodsSlice: Object, components?: Object[], options?: {
228
+ srcPath?: string;
229
+ }): Object;
186
230
  /**
187
231
  * Extract data-flow call frames per component purl from a dosai data-flow result.
188
232
  *
@@ -191,9 +235,14 @@ export declare function collectDosaiPurlEvidence(methodsSlice: Object, component
191
235
  *
192
236
  * @param {Object} dataFlowResult Parsed dosai data-flow slice JSON
193
237
  * @param {Object[]} [components] BOM components used to resolve purl aliases
238
+ * @param {Object} [options] Options
239
+ * @param {string} [options.srcPath] Directory dosai analyzed; a package the BOM holds in several
240
+ * versions is matched by the project of the record's file
194
241
  * @returns {Object} Map of canonical purl to arrays of call-stack frame objects
195
242
  */
196
- export declare function collectDosaiDataFlowFrames(dataFlowResult: Object, components?: Object[]): Object;
243
+ export declare function collectDosaiDataFlowFrames(dataFlowResult: Object, components?: Object[], options?: {
244
+ srcPath?: string;
245
+ }): Object;
197
246
  /**
198
247
  * Consume dosai's AiComponents[] inventory (schema 4.0.0): model identifiers,
199
248
  * on-disk model artifacts with hashes, MCP tools, prompts (redacted), and agents
@@ -1 +1 @@
1
- {"version":3,"file":"dosai.d.ts","sourceRoot":"","sources":["../../../lib/inventory/dosai.js"],"names":[],"mappings":"AA6WA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAJpC,MAAM,EAI8B,EAAE,OAAO,EAH7C,MAG6C,GAF3C;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAC,CAyFtE;AAoCD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAHnC,MAGmC,GAFjC,OAAO,CAInB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAH/B,MAG+B,GAF7B,MAAM,GAAC,SAAS,CAW5B;AA2ED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAPtC,MAOsC,EAAE,OAAO,AANvD,CAIA,EAHA;IAA2B,QAAQ,AAAnC,CACA,EADQ,MAAM,EAAE,CAChB;IAA2B,cAAc,AAAzC,CACA,WAAA;IAAyB,YAAY,AAArC,CACA,EADQ,MAAM,CACd;CAE4D,GAFlD,MAAM,GAAC,SAAS,CA0B5B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EALvC,MAKuC,EAAE,OAAO,AAJxD,CAEA,EADA;IAAyB,YAAY,AAArC,CACA,EADQ,MAAM,CACd;CAE6D,GAFnD,MAAM,GAAC,SAAS,CAa5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAN5B,MAM4B,EAAE,GAAG,EALjC,MAKiC,EAAE,UAAU,EAJ7C,MAI6C,EAAE,OAAO,AAH9D,CACA,EADQ,MAG2D,GAFzD,OAAO,CAoFnB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAu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;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EARL,MAQK,EACd,UAAU,AART,CACA,EADQ,MAAM,EAQA,EACf,OAAO,AARN,CAGA,EAFA;IAAyB,OAAO,AAAhC,CAEA,EAFQ,MAAM,CAEd;CAKW,GALD,MAAM,CAwDlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAJ1C,MAI0C,EAAE,UAAU,AAH9D,CACA,OAEmE,SA6FrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAJ/C,MAI+C,EAAE,WAAW,AAHpE,CACA,EADQ,MAGiE,GAF/D,MAAM,CAyKlB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,CAC7C,YAAY,EALH,MAKG,EACZ,WAAW,AALV,CACA,EADQ,MAKO,GAJL,MAAM,CA+GlB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,AAHjD,CACA,EADQ,MAG8C,GAF5C,MAAM,EAAE,CA6CpB"}
@@ -24,6 +24,25 @@ export declare function addDosaiSetValue(map: Object, key: string, value: string
24
24
  * @returns {string|undefined} Location string with a `#line` suffix when available, or undefined when no file is known
25
25
  */
26
26
  export declare function dosaiLocation(item: Object): string | undefined;
27
+ /**
28
+ * Format the `file#line` location of a dosai MethodCalls row, relative to the
29
+ * scanned directory like dosai's source rows.
30
+ *
31
+ * A call site found in assembly IL names its file through the PDB. dosai 5
32
+ * writes it relative to the scan root and leaves Path out when the file has
33
+ * no place in the tree; dosai 4 writes the PDB path as it is: absolute for a
34
+ * local build, `/_/` for a deterministic one (owasp-dep-scan/dosai#79). An
35
+ * absolute path under the scanned directory is made relative to it, and any
36
+ * other build path, or a missing one, gives way to the file name, as for call
37
+ * graph edges, so both versions list a call site found in source and in IL
38
+ * once. Where no sequence point covers a call, the row names the assembly and
39
+ * its line is an IL offset, which is no source location.
40
+ *
41
+ * @param {Object} methodCall Dosai MethodCalls row
42
+ * @param {string} [srcPath] Directory dosai analyzed
43
+ * @returns {string|undefined} Location string, or undefined when the row names no source file
44
+ */
45
+ export declare function dosaiCallSiteLocation(methodCall: Object, srcPath?: string): string | undefined;
27
46
  /**
28
47
  * Return a validated source location for .NET source extensions, from a call graph node.
29
48
  *
@@ -41,19 +60,46 @@ export declare function dosaiSourceLocation(location: Object): string | undefine
41
60
  /**
42
61
  * Build a purl alias map from BOM components.
43
62
  *
44
- * Maps both exact component purls and normalized type/namespace/name keys to
45
- * the canonical component purl so dosai-reported purls can be reconciled.
63
+ * Maps each component purl to itself, and indexes the components by their
64
+ * version-free identity, so a dosai-reported purl can be reconciled by version
65
+ * (see {@link resolveDosaiComponentPurl}). Two versions of one package are two
66
+ * components, and nothing here picks one of them on a name alone.
46
67
  *
47
68
  * @param {Object[]} [components] Component objects with purl fields
48
- * @returns {Map<string, string>} Map of purl or normalized key to canonical component purl
69
+ * @param {Object} [options] Options
70
+ * @param {string} [options.srcPath] Directory dosai analyzed, which its relative locations
71
+ * and the BOM's relative manifest paths are relative to
72
+ * @returns {Map<string, string>} Map of purl to canonical component purl, carrying the identity index
49
73
  */
50
- export declare function buildDosaiPurlAliasMap(components?: Object[]): Map<string, string>;
74
+ export declare function buildDosaiPurlAliasMap(components?: Object[], options?: {
75
+ srcPath?: string;
76
+ }): Map<string, string>;
51
77
  /**
52
- * Resolve a purl to the canonical component purl via the alias map.
78
+ * Choose among the components that share a file name (two versions of a
79
+ * package ship the same DLLs): the only one, else the one whose project
80
+ * directory is nearest the record's location.
81
+ *
82
+ * @param {Iterable<string>} purls Candidate component purls
83
+ * @param {Map<string, string>} purlAliasMap Alias map built by buildDosaiPurlAliasMap
84
+ * @param {string} [location] Source location of the dosai record (`path` or `path#line`)
85
+ * @returns {string|undefined} The component purl, or undefined when it cannot be told
86
+ */
87
+ export declare function pickDosaiComponentByLocation(purls: Iterable<string>, purlAliasMap: Map<string, string>, location?: string): string | undefined;
88
+ /**
89
+ * Resolve a dosai-reported purl to a BOM component purl.
90
+ *
91
+ * The exact purl wins, then the same package at the same version (ids compare
92
+ * case-insensitively). A versionless purl, or a version the BOM does not hold,
93
+ * maps to the package's only component when it has one. When the BOM holds
94
+ * several versions, the record's location picks the version of the project
95
+ * that file belongs to; without a location that settles it the purl maps to
96
+ * nothing rather than to an arbitrary version (issue dosai#72).
53
97
  *
54
98
  * @param {string} purl Purl reported by dosai
55
99
  * @param {Map<string, string>} purlAliasMap Alias map built by buildDosaiPurlAliasMap
56
- * @returns {string|undefined} Canonical component purl, the input purl when unaliased, or undefined when empty
100
+ * @param {string} [location] Source location of the dosai record (`path` or `path#line`)
101
+ * @returns {string|undefined} Canonical component purl, the input purl when the BOM has no
102
+ * component of that package, or undefined when empty or ambiguous
57
103
  */
58
- export declare function resolveDosaiComponentPurl(purl: string, purlAliasMap: Map<string, string>): string | undefined;
104
+ export declare function resolveDosaiComponentPurl(purl: string, purlAliasMap: Map<string, string>, location?: string): string | undefined;
59
105
  //# sourceMappingURL=dosaiParsers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dosaiParsers.d.ts","sourceRoot":"","sources":["../../../lib/inventory/dosaiParsers.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAH/B,MAG+B,GAF7B,MAAM,GAAC,SAAS,CAgB5B;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EALzB,MAKyB,EAAE,GAAG,EAJ9B,MAI8B,EAAE,KAAK,EAHrC,MAGqC,GAFnC,IAAI,CAQhB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAHvB,MAGuB,GAFrB,MAAM,GAAC,SAAS,CAc5B;AAcD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAHrC,MAGqC,GAFnC,MAAM,GAAC,SAAS,CAa5B;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAHjC,MAGiC,GA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,CAEA,EAFQ,MAAM,CAEd;CAEiE,GAFvD,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAqC/B;AAsCD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EALvC,QAAQ,CAAC,MAAM,CAKwB,EAAE,YAAY,EAJrD,GAAG,CAAC,MAAM,EAAE,MAAM,CAImC,EAAE,QAAQ,AAHvE,CACA,EADQ,MAG+D,GAF7D,MAAM,GAAC,SAAS,CAgB5B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EANnC,MAMmC,EAAE,YAAY,EALjD,GAAG,CAAC,MAAM,EAAE,MAAM,CAK+B,EAAE,QAAQ,AAJnE,CACA,EADQ,MAI2D,GAHzD,MAAM,GAAC,SAAS,CA6B5B"}
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Converts a traced library path into a purl subpath. Windows paths
3
+ * ("C:\Windows\System32\bcrypt.dll", "\\server\share\x.dll") use forward
4
+ * slashes and drop the drive or UNC prefix, which a purl subpath cannot carry;
5
+ * the full path stays in the cdx:dynamic:filePath property.
6
+ *
7
+ * @param {string} libPath - Absolute path of the loaded library
8
+ * @returns {string|null} Subpath without leading separators, or null
9
+ */
10
+ export declare function librarySubpath(libPath: string): string | null;
1
11
  /**
2
12
  * Builds a flat list of CycloneDX component objects and services by executing
3
13
  * the given command and inspecting which shared libraries it loads at runtime
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic.d.ts","sourceRoot":"","sources":["../../../lib/inventory/dynamic.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAND,MAMC,EACV,UAAU,EAND,MAMC,EACV,YAAY,AANX,CACA,EADQ,MAMQ,GALN,OAAO,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAC,CAAC,CA4JzE"}
1
+ {"version":3,"file":"dynamic.d.ts","sourceRoot":"","sources":["../../../lib/inventory/dynamic.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAH3B,MAG2B,GAFzB,MAAM,GAAC,IAAI,CAevB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAND,MAMC,EACV,UAAU,EAND,MAMC,EACV,YAAY,AANX,CACA,EADQ,MAMQ,GALN,OAAO,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAC,CAAC,CA8KzE"}
@@ -44,15 +44,30 @@ export declare function attachIdentityTools(subjects: Object | Object[], toolRef
44
44
  * Enrich .NET package components with occurrence evidence and imported module/method
45
45
  * information from a dosai dependency slices file.
46
46
  *
47
- * Builds a mapping of DLL filenames to purls using the `internal:PackageFiles` property of each
48
- * package, then reads the slices file to add occurrence locations, imported modules,
49
- * called methods, and assembly version information where available.
47
+ * Each dosai record names its package by purl, resolved in the project of the
48
+ * record's file, and is attached to the component of that version (see
49
+ * {@link resolveDosaiComponentPurl}). The DLL files of each package
50
+ * (`internal:PackageFiles`) only fill in for a record whose purl names no
51
+ * component, and only when the DLL belongs to one component or the record's
52
+ * location says which: two versions of a package ship the same DLL names.
53
+ *
54
+ * The fallback is needed because dosai names a `System.*` assembly it cannot
55
+ * map to a package with a framework purl (`pkg:nuget/System.Runtime`), as it
56
+ * does whenever the tree has lock files but no restore output: the DLL of
57
+ * System.Data.SQLite.Core is still the package's. A DLL that only a package's
58
+ * build-time folders carry is not listed in `internal:PackageFiles`, so it
59
+ * credits no package with the project's framework calls (issue 4441).
50
60
  *
51
61
  * @param {Object[]} pkgList Array of .NET package component objects to enrich
52
62
  * @param {string} slicesFile Path to the dosai dependency slices JSON file
63
+ * @param {Object} [options] Options
64
+ * @param {string} [options.srcPath] Directory dosai analyzed, which its relative locations
65
+ * and the components' relative manifest paths are relative to
53
66
  * @returns {Object[]} The enriched package list (same array, mutated in place)
54
67
  */
55
- export declare function addEvidenceForDotnet(pkgList: Object[], slicesFile: string): Object[];
68
+ export declare function addEvidenceForDotnet(pkgList: Object[], slicesFile: string, options?: {
69
+ srcPath?: string;
70
+ }): Object[];
56
71
  /**
57
72
  * Convert OS query results
58
73
  *
@@ -1 +1 @@
1
- {"version":3,"file":"evidenceUtils.d.ts","sourceRoot":"","sources":["../../../lib/inventory/evidenceUtils.js"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAJtC,MAIsC,EAAE,OAAO,AAHvD,CACA,EADQ,MAGoD,GAFlD,MAAM,GAAC,SAAS,CAgB5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAJ7C,MAI6C,EAAE,OAAO,AAH9D,CACA,EADQ,MAG2D,GAFzD,MAAM,GAAC,SAAS,CA8B5B;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAHxC,MAGwC,GAFtC,MAAM,CAalB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAJ1B,MAAM,EAAE,GAAC,MAIiB,EAAE,SAAS,UAAA,GAFnC,MAAM,EAAE,CAmDpB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAJjC,MAAM,GAAC,MAAM,EAIoB,EAAE,QAAQ,EAH3C,MAAM,EAGqC,GAFzC,MAAM,GAAC,MAAM,EAAE,CAwB3B;AAsCD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAJjC,MAAM,EAI2B,EAAE,UAAU,EAH7C,MAG6C,GAF3C,MAAM,EAAE,CAwOpB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EANJ,MAMI,EACb,QAAQ,EANC,MAM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  * read instead of the network.
11
11
  *
12
12
  * There is one policy layer (`fetchRate.js`, mirrored by the Rust `rate.rs`)
13
- * and two transports. When the `cdxrs` binary is available it is preferred,
14
- * because it brings an on-disk conditional cache (D26) the JS pool does not
15
- * have. When it is absent, disabled, or unusable, the JS pool runs every
16
- * request through `cdxgenAgent` so the secure-mode host allowlist, the
17
- * activity recorder and the test cassette interceptor all still apply.
13
+ * and two transports. When the `cdxrs` binary is available it is preferred for
14
+ * the JSON it can carry. When it is absent, disabled, or unusable, and whenever
15
+ * a dry run, secure mode or a host allowlist is in force, the JS pool runs
16
+ * every request through `cdxgenAgent` so those policies, the activity recorder
17
+ * and the test cassette interceptor all still apply. The JS pool keeps the same
18
+ * on-disk conditional cache as cdxrs (`fetchDiskCache.js`), in the same
19
+ * directory and layout.
18
20
  *
19
21
  * Two properties are deliberate and load-bearing:
20
22
  *
@@ -27,11 +29,43 @@
27
29
  * JS on all three registries it covered.
28
30
  *
29
31
  * 2. **Fallback is per URL, not per run.** A URL that the batch could not
30
- * resolve for a transport reason is simply absent from the map, and the
31
- * caller's own `cdxgenAgent.get` runs for it exactly as before. A URL that
32
- * resolved to a definite HTTP error is recorded as such, so the caller does
33
- * not re-request it only to get the same 404.
32
+ * resolve for a transport reason is left to the caller, whose own request
33
+ * goes through {@link gatedGet} and the same per-host gate. A URL the server
34
+ * answered with an error status, after the batch's retries, is recorded as
35
+ * such, so the caller does not ask again only to get the same answer, and a
36
+ * 404 or 410 is remembered for the rest of the run.
34
37
  */
38
+ /**
39
+ * Whether requests to a host are paused.
40
+ *
41
+ * @param {string|null} host Hostname.
42
+ * @returns {boolean}
43
+ */
44
+ export declare function isHostCircuitOpen(host: string | null): boolean;
45
+ /**
46
+ * Pause requests to a host, for at least {@link DEFAULT_CIRCUIT_OPEN_MS} or for
47
+ * as long as the server asked. Warns once per pause.
48
+ *
49
+ * @param {string} host Hostname.
50
+ * @param {{delayMs?: number|null, cause?: string, quiet?: boolean, minimumMs?: number}} [details]
51
+ * Server-supplied delay, a short description of what happened, whether to
52
+ * pause without a warning or a degradation record (for failures that are not
53
+ * the host's doing, such as a dry run or an allowlist block), and the
54
+ * shortest pause, which a host that says exactly when it recovers sets to 0.
55
+ * @returns {void}
56
+ */
57
+ export declare function openHostCircuit(host: string, { delayMs, cause, quiet, minimumMs }?: {
58
+ delayMs?: number | null;
59
+ cause?: string;
60
+ quiet?: boolean;
61
+ minimumMs?: number;
62
+ }): void;
63
+ /**
64
+ * Clear every paused host. Tests only.
65
+ *
66
+ * @returns {void}
67
+ */
68
+ export declare function resetHostCircuits(): void;
35
69
  /**
36
70
  * @returns {Object|null} Stats from the last batch (requests, unique, ok,
37
71
  * failures, cacheHits, elapsedMs, peakConcurrency), or null.
@@ -69,6 +103,11 @@ export type BatchEntry = {
69
103
  * other than 429) and re-requesting it in JS would be pointless.
70
104
  */
71
105
  definite?: boolean;
106
+ /**
107
+ * Response headers of a failed request, when the
108
+ * JS pool made it. cdxrs reports no headers.
109
+ */
110
+ headers?: Object;
72
111
  };
73
112
  /**
74
113
  * Fetch a batch of registry URLs concurrently.
@@ -132,12 +171,40 @@ export declare function recordPolicyDegradationFromError(err: Error): void;
132
171
  * The per-host semaphore and limiter are module state, so this shares one gate
133
172
  * per host for the life of the process.
134
173
  *
174
+ * A host paused by its circuit breaker fails at once with a 429-shaped error,
175
+ * and a 429 from a breaker host pauses it.
176
+ *
177
+ * With `deferGate`, `issue` receives request options carrying a
178
+ * `beforeNetwork` hook and must pass them to `cdxgenAgent`. The rate limiter
179
+ * then runs only when the request misses the response cache, so a cached
180
+ * answer does not wait for a slot. Without it, the limiter runs before
181
+ * `issue`, as before.
182
+ *
135
183
  * @template T
136
184
  * @param {string} url The URL about to be requested.
137
- * @param {() => Promise<T>} issue Issues the request and resolves its result.
185
+ * @param {(gate: Object) => Promise<T>} issue Issues the request and resolves its result.
186
+ * @param {{deferGate?: boolean}} [opts]
138
187
  * @returns {Promise<T>} Whatever `issue` resolves to.
139
188
  */
140
- export declare function withHostRateLimit<T>(url: string, issue: () => Promise<T>): Promise<T>;
189
+ export declare function withHostRateLimit<T>(url: string, issue: (gate: Object) => Promise<T>, { deferGate }?: {
190
+ deferGate?: boolean;
191
+ }): Promise<T>;
192
+ /**
193
+ * Request a URL the batch did not answer, the way the pool would have: behind
194
+ * the per-host gate, failing at once for a document that already answered 404
195
+ * or 410 this run, and remembering such an answer for the next pass.
196
+ *
197
+ * This is the fallback every metadata function uses after a prefetch. Without
198
+ * it, a URL the batch left open went straight to the network with no rate gate,
199
+ * and the same miss was asked again on every pass.
200
+ *
201
+ * @param {string} url URL to request.
202
+ * @param {Object} [options] `cdxgenAgent.get` options.
203
+ * @returns {Promise<Object>} The response.
204
+ * @throws {Error} The request's own error, or a 404-shaped error for a
205
+ * remembered miss, so the caller's `catch` runs as it would for the network.
206
+ */
207
+ export declare function gatedGet(url: string, options?: Object): Promise<Object>;
141
208
  /**
142
209
  * Read a prefetched response, or signal that the caller should fetch it itself.
143
210
  *
@@ -145,9 +212,11 @@ export declare function withHostRateLimit<T>(url: string, issue: () => Promise<T
145
212
  * @param {string} url The URL the caller is about to request.
146
213
  * @returns {{body: *}|undefined} A response-shaped object when the body is
147
214
  * available, or `undefined` when the caller should issue its own request.
148
- * @throws {Error} When the batch established a definite HTTP error for this
149
- * URL, so that the caller's existing `catch` treats it exactly as it treats a
150
- * failed `cdxgenAgent.get`.
215
+ * @throws {Error} When the server answered with an error status, so that the
216
+ * caller's existing `catch` treats it exactly as it treats a failed
217
+ * `cdxgenAgent.get`. A 5xx or a 429 is the answer after the batch's own
218
+ * retries, and asking once more at once would only add to the load. Only a
219
+ * transport failure, with no status, is left to the caller to retry.
151
220
  */
152
221
  export declare function prefetchedResponse(prefetched: Map<string, BatchEntry>, url: string): {
153
222
  body: any;
@@ -1 +1 @@
1
- {"version":3,"file":"fetchBatch.d.ts","sourceRoot":"","sources":["../../../lib/inventory/fetchBatch.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;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;;;;;;GAcG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EANvB,MAMuB,EAAE,OAAO,AALxC,CACA,EADQ,MAKqC,GAJnC,OAAO,CAAC,MAAM,CAAC,CA8B3B;AA6GD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAVlC,GAAG,CAAC,MAAM,EAAE,UAAU,CAUY,EAAE,GAAG,EATvC,MASuC,GARrC;IAAC,IAAI,EAAE,GAAC,CAAA;CAAC,GAAC,SAAS,CAoB/B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,IAFlB,OAAO,CAOnB"}
@@ -0,0 +1,169 @@
1
+ /**
2
+ * The on-disk response cache of the JS batch pool.
3
+ *
4
+ * cdxrs keeps registry JSON on disk between runs. The requests it cannot carry
5
+ * run on the JS pool instead: crates.io and package.elm-lang.org, which have
6
+ * one rate gate in JS; the GitHub API, whose quota headers cdxrs does not
7
+ * report; HTML pages such as pkg.go.dev and podspecs; and POMs. Without a disk
8
+ * cache of their own, the most tightly limited hosts were asked again on every
9
+ * run. All of them are kept here, in the cdxrs layout and under the same rules:
10
+ *
11
+ * - `<cacheDir>/cdxrs-fetch/<host>/<hash>.json`, written atomically, mode 0600,
12
+ * with the URL redacted;
13
+ * - keyed by URL, method, `Accept` and the auth realm, hashed as cdxrs hashes
14
+ * them, so a JSON entry either side writes serves the other. A text body adds
15
+ * its type to the key, so cdxrs never reads it as JSON;
16
+ * - fresh for `CDXGEN_CACHE_TTL` seconds (24 hours by default, 0 for never);
17
+ * a stale entry with an ETag or Last-Modified is revalidated, and is served
18
+ * when the server fails;
19
+ * - loopback hosts are not cached unless `CDXGEN_CACHE_LOOPBACK=1`;
20
+ * - least recently used entries are removed past 256 MB.
21
+ *
22
+ * Two rules are the JS pool's own. A release POM never changes once published,
23
+ * so it does not expire. A 404 or 410 is kept for the same TTL, or for 24
24
+ * hours when the TTL is 0, under a key of its own that cdxrs never reads.
25
+ *
26
+ * Requests that carry their own headers, such as a registry token, are never
27
+ * cached here, and nothing is read or written during a dry run, for a host
28
+ * outside `CDXGEN_ALLOWED_HOSTS`, or over plain HTTP in secure mode, so the
29
+ * cache never answers a request the policy would have refused. The directory
30
+ * is cdxgen's own, and its files are written as cdxrs writes them, without an
31
+ * activity record per entry.
32
+ */
33
+ export type DiskCacheKey = {
34
+ /**
35
+ * Request URL.
36
+ */
37
+ url: string;
38
+ /**
39
+ * `Accept` header.
40
+ */
41
+ accept?: string;
42
+ /**
43
+ * Identity of the credential, never itself.
44
+ */
45
+ authRealm?: string;
46
+ /**
47
+ * `json`, `text` or `buffer`.
48
+ */
49
+ responseType?: string;
50
+ };
51
+ export type DiskCacheEntry = {
52
+ /**
53
+ * Schema version.
54
+ */
55
+ v: number;
56
+ /**
57
+ * Redacted URL.
58
+ */
59
+ url: string;
60
+ /**
61
+ * Always `GET`.
62
+ */
63
+ method: string;
64
+ /**
65
+ * HTTP status.
66
+ */
67
+ status: number;
68
+ /**
69
+ * ETag validator.
70
+ */
71
+ etag: string | null;
72
+ /**
73
+ * Last-Modified validator.
74
+ */
75
+ last_modified: string | null;
76
+ /**
77
+ * Unix seconds when fetched or revalidated.
78
+ */
79
+ fetched_at: number;
80
+ /**
81
+ * Response body.
82
+ */
83
+ body: any;
84
+ /**
85
+ * Never expires.
86
+ */
87
+ immutable?: boolean;
88
+ };
89
+ /**
90
+ * Hash of a cache key, as cdxrs computes it for a JSON response.
91
+ *
92
+ * @param {DiskCacheKey} key Cache key.
93
+ * @param {{miss?: boolean}} [opts] Whether this is the key of a recorded miss.
94
+ * @returns {string}
95
+ */
96
+ export declare function diskCacheKeyHash(key: DiskCacheKey, { miss }?: {
97
+ miss?: boolean;
98
+ }): string;
99
+ /**
100
+ * Whether the disk cache may serve or store a request.
101
+ *
102
+ * @param {{url: string, headers?: Object, responseType?: string}} request
103
+ * @returns {boolean}
104
+ */
105
+ export declare function diskCacheable(request: {
106
+ url: string;
107
+ headers?: Object;
108
+ responseType?: string;
109
+ }): boolean;
110
+ export type DiskCacheLookup = {
111
+ /**
112
+ * `fresh` and `miss` are
113
+ * answers; `stale` needs revalidation; `none` means nothing is stored.
114
+ */
115
+ state: "fresh" | "stale" | "miss" | "none";
116
+ /**
117
+ * The stored entry.
118
+ */
119
+ entry?: DiskCacheEntry;
120
+ };
121
+ /**
122
+ * @typedef {Object} DiskCacheLookup
123
+ * @property {"fresh"|"stale"|"miss"|"none"} state `fresh` and `miss` are
124
+ * answers; `stale` needs revalidation; `none` means nothing is stored.
125
+ * @property {DiskCacheEntry} [entry] The stored entry.
126
+ */
127
+ /**
128
+ * Look a request up.
129
+ *
130
+ * @param {DiskCacheKey} key Cache key.
131
+ * @returns {DiskCacheLookup}
132
+ */
133
+ export declare function diskCacheGet(key: DiskCacheKey): DiskCacheLookup;
134
+ /**
135
+ * Store a successful response.
136
+ *
137
+ * @param {DiskCacheKey} key Cache key.
138
+ * @param {{statusCode: number, headers?: Object, body: *}} response Response.
139
+ * @returns {void}
140
+ */
141
+ export declare function diskCachePut(key: DiskCacheKey, response: {
142
+ statusCode: number;
143
+ headers?: Object;
144
+ body: any;
145
+ }): void;
146
+ /**
147
+ * Record that a request answered 404 or 410, and forget any body stored for it.
148
+ *
149
+ * @param {DiskCacheKey} key Cache key.
150
+ * @param {number} status HTTP status.
151
+ * @returns {void}
152
+ */
153
+ export declare function diskCachePutMiss(key: DiskCacheKey, status: number): void;
154
+ /**
155
+ * Mark a stale entry fresh again after a 304.
156
+ *
157
+ * @param {DiskCacheKey} key Cache key.
158
+ * @param {DiskCacheEntry} entry The stale entry.
159
+ * @param {Object} [headers] Headers of the 304, which may carry new validators.
160
+ * @returns {void}
161
+ */
162
+ export declare function diskCacheRefresh(key: DiskCacheKey, entry: DiskCacheEntry, headers?: Object): void;
163
+ /**
164
+ * Forget which host directories were swept. Tests only.
165
+ *
166
+ * @returns {void}
167
+ */
168
+ export declare function resetDiskCacheState(): void;
169
+ //# sourceMappingURL=fetchDiskCache.d.ts.map
@@ -0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CACF,EADa,cAAc,CAC3B;CAAA,CAAA;AALD;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAHrB,YAGqB,GAFnB,eAAe,CAwB3B;AAkCD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAJrB,YAIqB,EAAE,QAAQ,EAH/B;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAC,CAAA;CAGf,GAF7B,IAAI,CAwBhB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAJzB,YAIyB,EAAE,MAAM,EAHjC,MAGiC,GAF/B,IAAI,CAqBhB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EALzB,YAKyB,EAAE,KAAK,EAJhC,cAIgC,EAAE,OAAO,AAHjD,CACA,EADQ,MAG8C,GAF5C,IAAI,CAahB;AAyGD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAFtB,IAAI,CAKhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"forgeEnricher.d.ts","sourceRoot":"","sources":["../../../lib/inventory/forgeEnricher.js"],"names":[],"mappings":"AAkDA;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAHvB,MAGuB,GAFrB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAC,IAAI,CAa9C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAHvB,MAGuB,GAFrB,MAAM,GAAC,IAAI,CAWvB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAL9B,MAK8B,EAAE,SAAS,EAJzC,KAAK,CAAC,MAAM,CAI6B,EAAE,OAAO,GAHlD,MAGuD,GAFrD,OAAO,CAAC,MAAM,CAAC,CA4M3B"}
1
+ {"version":3,"file":"forgeEnricher.d.ts","sourceRoot":"","sources":["../../../lib/inventory/forgeEnricher.js"],"names":[],"mappings":"AA2DA;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAHvB,MAGuB,GAFrB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAC,IAAI,CAa9C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAHvB,MAGuB,GAFrB,MAAM,GAAC,IAAI,CAWvB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAL9B,MAK8B,EAAE,SAAS,EAJzC,KAAK,CAAC,MAAM,CAI6B,EAAE,OAAO,GAHlD,MAGuD,GAFrD,OAAO,CAAC,MAAM,CAAC,CA4M3B"}