@trustify-da/trustify-da-javascript-client 0.3.0-ea.f2d5d72 → 0.3.0-ea.fa16f06

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 (77) hide show
  1. package/README.md +2 -2
  2. package/dist/package.json +26 -23
  3. package/dist/src/analysis.d.ts +14 -7
  4. package/dist/src/analysis.js +32 -15
  5. package/dist/src/cli.js +156 -3
  6. package/dist/src/cyclone_dx_sbom.d.ts +7 -1
  7. package/dist/src/cyclone_dx_sbom.js +29 -8
  8. package/dist/src/index.d.ts +84 -11
  9. package/dist/src/index.js +95 -8
  10. package/dist/src/license/index.d.ts +3 -3
  11. package/dist/src/license/index.js +4 -1
  12. package/dist/src/license/license_utils.js +4 -1
  13. package/dist/src/license/licenses_api.d.ts +2 -2
  14. package/dist/src/oci_image/images.d.ts +1 -1
  15. package/dist/src/oci_image/images.js +15 -1
  16. package/dist/src/oci_image/utils.d.ts +5 -5
  17. package/dist/src/oci_image/utils.js +11 -2
  18. package/dist/src/provider.d.ts +4 -3
  19. package/dist/src/provider.js +8 -2
  20. package/dist/src/providers/base_java.d.ts +14 -12
  21. package/dist/src/providers/base_java.js +18 -44
  22. package/dist/src/providers/base_javascript.d.ts +20 -9
  23. package/dist/src/providers/base_javascript.js +10 -3
  24. package/dist/src/providers/base_pyproject.d.ts +42 -31
  25. package/dist/src/providers/base_pyproject.js +121 -78
  26. package/dist/src/providers/containerfile_parser.d.ts +5 -0
  27. package/dist/src/providers/containerfile_parser.js +20 -0
  28. package/dist/src/providers/golang_gomodules.d.ts +11 -1
  29. package/dist/src/providers/golang_gomodules.js +65 -8
  30. package/dist/src/providers/java_gradle.d.ts +19 -0
  31. package/dist/src/providers/java_gradle.js +116 -2
  32. package/dist/src/providers/java_gradle_groovy.d.ts +1 -1
  33. package/dist/src/providers/java_gradle_kotlin.d.ts +1 -1
  34. package/dist/src/providers/java_maven.d.ts +10 -2
  35. package/dist/src/providers/java_maven.js +165 -1
  36. package/dist/src/providers/javascript_bun.d.ts +10 -0
  37. package/dist/src/providers/javascript_bun.js +100 -0
  38. package/dist/src/providers/javascript_npm.d.ts +6 -0
  39. package/dist/src/providers/javascript_npm.js +21 -0
  40. package/dist/src/providers/javascript_pnpm.js +6 -2
  41. package/dist/src/providers/marker_evaluator.d.ts +14 -0
  42. package/dist/src/providers/marker_evaluator.js +191 -0
  43. package/dist/src/providers/oci_dockerfile.d.ts +51 -0
  44. package/dist/src/providers/oci_dockerfile.js +177 -0
  45. package/dist/src/providers/processors/yarn_berry_processor.d.ts +2 -2
  46. package/dist/src/providers/processors/yarn_berry_processor.js +6 -2
  47. package/dist/src/providers/processors/yarn_classic_processor.d.ts +2 -2
  48. package/dist/src/providers/python_controller.d.ts +5 -1
  49. package/dist/src/providers/python_controller.js +69 -8
  50. package/dist/src/providers/python_pip.d.ts +5 -0
  51. package/dist/src/providers/python_pip.js +5 -5
  52. package/dist/src/providers/python_pip_pyproject.d.ts +61 -0
  53. package/dist/src/providers/python_pip_pyproject.js +146 -0
  54. package/dist/src/providers/python_poetry.d.ts +64 -8
  55. package/dist/src/providers/python_poetry.js +165 -25
  56. package/dist/src/providers/python_uv.d.ts +22 -2
  57. package/dist/src/providers/python_uv.js +157 -6
  58. package/dist/src/providers/rust_cargo.d.ts +6 -2
  59. package/dist/src/providers/rust_cargo.js +105 -19
  60. package/dist/src/providers/tree-sitter-containerfile.wasm +0 -0
  61. package/dist/src/remediate.d.ts +21 -0
  62. package/dist/src/remediate.js +149 -0
  63. package/dist/src/remediation.d.ts +57 -0
  64. package/dist/src/remediation.js +436 -0
  65. package/dist/src/remediation_report.d.ts +40 -0
  66. package/dist/src/remediation_report.js +159 -0
  67. package/dist/src/sbom.d.ts +7 -1
  68. package/dist/src/sbom.js +4 -2
  69. package/dist/src/tools.d.ts +28 -2
  70. package/dist/src/tools.js +58 -0
  71. package/dist/src/updaters/maven_updater.d.ts +26 -0
  72. package/dist/src/updaters/maven_updater.js +322 -0
  73. package/dist/src/updaters/toml_updater.d.ts +33 -0
  74. package/dist/src/updaters/toml_updater.js +244 -0
  75. package/dist/src/workspace.d.ts +9 -0
  76. package/dist/src/workspace.js +1 -1
  77. package/package.json +27 -24
@@ -13,14 +13,25 @@ export function selectTrustifyDABackend(opts?: {
13
13
  TRUSTIFY_DA_DEBUG?: string | undefined;
14
14
  TRUSTIFY_DA_BACKEND_URL?: string | undefined;
15
15
  }): string;
16
+ /**
17
+ * Generate a CycloneDX SBOM from a manifest file. No backend HTTP request is made.
18
+ *
19
+ * @param {string} manifestPath - path to the manifest file (e.g. pom.xml, package.json)
20
+ * @param {Options} [opts={}] - optional options (e.g. workspace dir, tool paths)
21
+ * @returns {Promise<object>} parsed CycloneDX SBOM JSON object
22
+ * @throws {Error} if the manifest is unsupported or SBOM generation fails
23
+ */
24
+ export function generateSbom(manifestPath: string, opts?: Options): Promise<object>;
16
25
  export { parseImageRef } from "./oci_image/utils.js";
17
26
  export { ImageRef } from "./oci_image/images.js";
27
+ export { extractRemediations } from "./remediation.js";
18
28
  declare namespace _default {
19
29
  export { componentAnalysis };
20
30
  export { stackAnalysis };
21
31
  export { stackAnalysisBatch };
22
32
  export { imageAnalysis };
23
33
  export { validateToken };
34
+ export { generateSbom };
24
35
  }
25
36
  export default _default;
26
37
  export type Options = {
@@ -43,7 +54,9 @@ export type Options = {
43
54
  TRUSTIFY_DA_PYTHON_PATH?: string | undefined;
44
55
  TRUSTIFY_DA_PYTHON_VIRTUAL_ENV?: string | undefined;
45
56
  TRUSTIFY_DA_PYTHON3_PATH?: string | undefined;
46
- TRUSTIFY_DA_RECOMMENDATIONS_ENABLED?: string | undefined;
57
+ TRUSTIFY_DA_PROVIDERS?: string | undefined;
58
+ TRUSTIFY_DA_RECOMMEND?: string | undefined;
59
+ TRUSTIFY_DA_SOURCES?: string | undefined;
47
60
  TRUSTIFY_DA_SKOPEO_CONFIG_PATH?: string | undefined;
48
61
  TRUSTIFY_DA_SKOPEO_PATH?: string | undefined;
49
62
  TRUSTIFY_DA_SYFT_CONFIG_PATH?: string | undefined;
@@ -70,7 +83,7 @@ export type Options = {
70
83
  };
71
84
  export type BatchAnalysisMetadata = {
72
85
  workspaceRoot: string;
73
- ecosystem: "javascript" | "cargo" | "unknown";
86
+ ecosystem: "javascript" | "cargo" | "pyproject" | "unknown";
74
87
  total: number;
75
88
  successful: number;
76
89
  failed: number;
@@ -96,7 +109,7 @@ export type SbomResult = {
96
109
  * @returns {Promise<import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>}
97
110
  * @throws {Error} if no matching provider, failed to get create content, or backend request failed
98
111
  */
99
- declare function componentAnalysis(manifest: string, opts?: Options): Promise<import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport>;
112
+ declare function componentAnalysis(manifest: string, opts?: Options): Promise<any>;
100
113
  /**
101
114
  * @overload
102
115
  * @param {string} manifest
@@ -114,7 +127,7 @@ declare function stackAnalysis(manifest: string, html: true, opts?: Options | un
114
127
  * @returns {Promise<import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>}
115
128
  * @throws {Error}
116
129
  */
117
- declare function stackAnalysis(manifest: string, html: false, opts?: Options | undefined): Promise<import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport>;
130
+ declare function stackAnalysis(manifest: string, html: false, opts?: Options | undefined): Promise<any>;
118
131
  /**
119
132
  * Get stack analysis report for a manifest file.
120
133
  * @overload
@@ -125,24 +138,79 @@ declare function stackAnalysis(manifest: string, html: false, opts?: Options | u
125
138
  * @throws {Error} if manifest inaccessible, no matching provider, failed to get create content,
126
139
  * or backend request failed
127
140
  */
128
- declare function stackAnalysis(manifest: string, html?: boolean | undefined, opts?: Options | undefined): Promise<string | import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport>;
141
+ declare function stackAnalysis(manifest: string, html?: boolean | undefined, opts?: Options | undefined): Promise<string | any>;
142
+ /**
143
+ * @overload
144
+ * @param {string} workspaceRoot
145
+ * @param {true} html
146
+ * @param {Options & { batchMetadata: true }} opts
147
+ * @returns {Promise<{ analysis: string, metadata: BatchAnalysisMetadata }>}
148
+ * @throws {Error}
149
+ */
150
+ declare function stackAnalysisBatch(workspaceRoot: string, html: true, opts: Options & {
151
+ batchMetadata: true;
152
+ }): Promise<{
153
+ analysis: string;
154
+ metadata: BatchAnalysisMetadata;
155
+ }>;
156
+ /**
157
+ * @overload
158
+ * @param {string} workspaceRoot
159
+ * @param {true} html
160
+ * @param {Options & { batchMetadata?: false }} [opts={}]
161
+ * @returns {Promise<string>}
162
+ * @throws {Error}
163
+ */
164
+ declare function stackAnalysisBatch(workspaceRoot: string, html: true, opts?: (Options & {
165
+ batchMetadata?: false;
166
+ }) | undefined): Promise<string>;
167
+ /**
168
+ * @overload
169
+ * @param {string} workspaceRoot
170
+ * @param {false} html
171
+ * @param {Options & { batchMetadata: true }} opts
172
+ * @returns {Promise<{ analysis: Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>, metadata: BatchAnalysisMetadata }>}
173
+ * @throws {Error}
174
+ */
175
+ declare function stackAnalysisBatch(workspaceRoot: string, html: false, opts: Options & {
176
+ batchMetadata: true;
177
+ }): Promise<{
178
+ analysis: {
179
+ [x: string]: any;
180
+ };
181
+ metadata: BatchAnalysisMetadata;
182
+ }>;
183
+ /**
184
+ * @overload
185
+ * @param {string} workspaceRoot
186
+ * @param {false} html
187
+ * @param {Options & { batchMetadata?: false }} [opts={}]
188
+ * @returns {Promise<Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>>}
189
+ * @throws {Error}
190
+ */
191
+ declare function stackAnalysisBatch(workspaceRoot: string, html: false, opts?: (Options & {
192
+ batchMetadata?: false;
193
+ }) | undefined): Promise<{
194
+ [x: string]: any;
195
+ }>;
129
196
  /**
130
197
  * Get stack analysis for all workspace packages/crates (batch).
131
198
  * Detects ecosystem from workspace root: Cargo (Cargo.toml + Cargo.lock) or JS/TS (package.json + lock file).
132
199
  * SBOMs are generated in parallel (see `batchConcurrency`) unless `continueOnError: false` (fail-fast sequential).
133
200
  * With `opts.batchMetadata` / `TRUSTIFY_DA_BATCH_METADATA`, returns `{ analysis, metadata }` including validation and SBOM errors.
134
201
  *
202
+ * @overload
135
203
  * @param {string} workspaceRoot - Path to workspace root (containing lock file and workspace config)
136
204
  * @param {boolean} [html=false] - true returns HTML, false returns JSON report
137
205
  * @param {Options} [opts={}] - `batchConcurrency`, discovery ignores, `continueOnError` (default true), `batchMetadata` (default false)
138
206
  * @returns {Promise<string|Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>|{ analysis: string|Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>, metadata: BatchAnalysisMetadata }>}
139
207
  * @throws {Error} if workspace root invalid, no manifests found, no packages pass validation, no SBOMs produced, or backend request failed. When `opts.batchMetadata` is set, `error.batchMetadata` may be set on thrown errors.
140
208
  */
141
- declare function stackAnalysisBatch(workspaceRoot: string, html?: boolean, opts?: Options): Promise<string | {
142
- [x: string]: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport;
209
+ declare function stackAnalysisBatch(workspaceRoot: string, html?: boolean | undefined, opts?: Options | undefined): Promise<string | {
210
+ [x: string]: any;
143
211
  } | {
144
212
  analysis: string | {
145
- [x: string]: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport;
213
+ [x: string]: any;
146
214
  };
147
215
  metadata: BatchAnalysisMetadata;
148
216
  }>;
@@ -164,7 +232,7 @@ declare function imageAnalysis(imageRefs: Array<string>, html: true, opts?: Opti
164
232
  * @throws {Error}
165
233
  */
166
234
  declare function imageAnalysis(imageRefs: Array<string>, html: false, opts?: Options | undefined): Promise<{
167
- [x: string]: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport;
235
+ [x: string]: any;
168
236
  }>;
169
237
  /**
170
238
  * Get image analysis report for a set of OCI image references.
@@ -177,7 +245,7 @@ declare function imageAnalysis(imageRefs: Array<string>, html: false, opts?: Opt
177
245
  * or backend request failed
178
246
  */
179
247
  declare function imageAnalysis(imageRefs: Array<string>, html?: boolean | undefined, opts?: Options | undefined): Promise<string | {
180
- [x: string]: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport;
248
+ [x: string]: any;
181
249
  }>;
182
250
  /**
183
251
  * Validates the Exhort token.
@@ -186,6 +254,10 @@ declare function imageAnalysis(imageRefs: Array<string>, html?: boolean | undefi
186
254
  * @throws {Error} if the backend request failed.
187
255
  */
188
256
  declare function validateToken(opts?: Options): Promise<object>;
257
+ import { discoverMavenModules } from './providers/java_maven.js';
258
+ import { discoverGradleSubprojects } from './providers/java_gradle.js';
259
+ import { discoverGoWorkspaceModules } from './providers/golang_gomodules.js';
260
+ import { discoverUvWorkspaceMembers } from './providers/python_uv.js';
189
261
  import { discoverWorkspacePackages } from './workspace.js';
190
262
  import { discoverWorkspaceCrates } from './workspace.js';
191
263
  import { validatePackageJson } from './workspace.js';
@@ -193,5 +265,6 @@ import { resolveWorkspaceDiscoveryIgnore } from './workspace.js';
193
265
  import { filterManifestPathsByDiscoveryIgnore } from './workspace.js';
194
266
  import { resolveContinueOnError } from './batch_opts.js';
195
267
  import { resolveBatchMetadata } from './batch_opts.js';
196
- export { discoverWorkspacePackages, discoverWorkspaceCrates, validatePackageJson, resolveWorkspaceDiscoveryIgnore, filterManifestPathsByDiscoveryIgnore, resolveContinueOnError, resolveBatchMetadata };
268
+ export { discoverMavenModules, discoverGradleSubprojects, discoverGoWorkspaceModules, discoverUvWorkspaceMembers, discoverWorkspacePackages, discoverWorkspaceCrates, validatePackageJson, resolveWorkspaceDiscoveryIgnore, filterManifestPathsByDiscoveryIgnore, resolveContinueOnError, resolveBatchMetadata };
197
269
  export { getProjectLicense, findLicenseFilePath, identifyLicense, getLicenseDetails, licensesFromReport, normalizeLicensesResponse, runLicenseCheck, getCompatibility } from "./license/index.js";
270
+ export { generateReport, generateDeduplicationKey } from "./remediation_report.js";
package/dist/src/index.js CHANGED
@@ -6,14 +6,20 @@ import analysis from './analysis.js';
6
6
  import fs from 'node:fs';
7
7
  import { getCustom } from "./tools.js";
8
8
  import { resolveBatchMetadata, resolveContinueOnError } from './batch_opts.js';
9
+ import { discoverMavenModules } from './providers/java_maven.js';
10
+ import { discoverGradleSubprojects } from './providers/java_gradle.js';
11
+ import { discoverGoWorkspaceModules } from './providers/golang_gomodules.js';
12
+ import { discoverUvWorkspaceMembers } from './providers/python_uv.js';
9
13
  import { discoverWorkspaceCrates, discoverWorkspacePackages, filterManifestPathsByDiscoveryIgnore, resolveWorkspaceDiscoveryIgnore, validatePackageJson, } from './workspace.js';
10
14
  import.meta.dirname;
11
15
  import * as url from 'url';
12
16
  export { parseImageRef } from "./oci_image/utils.js";
13
17
  export { ImageRef } from "./oci_image/images.js";
14
18
  export { getProjectLicense, findLicenseFilePath, identifyLicense, getLicenseDetails, licensesFromReport, normalizeLicensesResponse, runLicenseCheck, getCompatibility } from "./license/index.js";
15
- export default { componentAnalysis, stackAnalysis, stackAnalysisBatch, imageAnalysis, validateToken };
16
- export { discoverWorkspacePackages, discoverWorkspaceCrates, validatePackageJson, resolveWorkspaceDiscoveryIgnore, filterManifestPathsByDiscoveryIgnore, resolveContinueOnError, resolveBatchMetadata, };
19
+ export { extractRemediations } from "./remediation.js";
20
+ export { generateReport, generateDeduplicationKey } from './remediation_report.js';
21
+ export default { componentAnalysis, stackAnalysis, stackAnalysisBatch, imageAnalysis, validateToken, generateSbom };
22
+ export { discoverMavenModules, discoverGradleSubprojects, discoverGoWorkspaceModules, discoverUvWorkspaceMembers, discoverWorkspacePackages, discoverWorkspaceCrates, validatePackageJson, resolveWorkspaceDiscoveryIgnore, filterManifestPathsByDiscoveryIgnore, resolveContinueOnError, resolveBatchMetadata, };
17
23
  /**
18
24
  * @typedef {{
19
25
  * TRUSTIFY_DA_CARGO_PATH?: string | undefined,
@@ -35,7 +41,9 @@ export { discoverWorkspacePackages, discoverWorkspaceCrates, validatePackageJson
35
41
  * TRUSTIFY_DA_PYTHON_PATH?: string | undefined,
36
42
  * TRUSTIFY_DA_PYTHON_VIRTUAL_ENV?: string | undefined,
37
43
  * TRUSTIFY_DA_PYTHON3_PATH?: string | undefined,
38
- * TRUSTIFY_DA_RECOMMENDATIONS_ENABLED?: string | undefined,
44
+ * TRUSTIFY_DA_PROVIDERS?: string | undefined,
45
+ * TRUSTIFY_DA_RECOMMEND?: string | undefined,
46
+ * TRUSTIFY_DA_SOURCES?: string | undefined,
39
47
  * TRUSTIFY_DA_SKOPEO_CONFIG_PATH?: string | undefined,
40
48
  * TRUSTIFY_DA_SKOPEO_PATH?: string | undefined,
41
49
  * TRUSTIFY_DA_SYFT_CONFIG_PATH?: string | undefined,
@@ -64,7 +72,7 @@ export { discoverWorkspacePackages, discoverWorkspaceCrates, validatePackageJson
64
72
  /**
65
73
  * @typedef {{
66
74
  * workspaceRoot: string,
67
- * ecosystem: 'javascript' | 'cargo' | 'unknown',
75
+ * ecosystem: 'javascript' | 'cargo' | 'pyproject' | 'unknown',
68
76
  * total: number,
69
77
  * successful: number,
70
78
  * failed: number,
@@ -171,7 +179,9 @@ async function componentAnalysis(manifest, opts = {}) {
171
179
  fs.accessSync(manifest, fs.constants.R_OK);
172
180
  opts["manifest-type"] = path.basename(manifest);
173
181
  let provider = match(manifest, availableProviders, opts); // throws error if no matching provider
174
- return await analysis.requestComponent(provider, manifest, theUrl, opts); // throws error request sending failed
182
+ const result = await analysis.requestComponent(provider, manifest, theUrl, opts); // throws error request sending failed
183
+ result.packageManager = provider.packageManagerName();
184
+ return result;
175
185
  }
176
186
  /**
177
187
  * @overload
@@ -237,6 +247,22 @@ function buildBatchAnalysisMetadata(root, ecosystem, totalSbomAttempts, successf
237
247
  errors: [...errors],
238
248
  };
239
249
  }
250
+ /**
251
+ * Generate a CycloneDX SBOM from a manifest file. No backend HTTP request is made.
252
+ *
253
+ * @param {string} manifestPath - path to the manifest file (e.g. pom.xml, package.json)
254
+ * @param {Options} [opts={}] - optional options (e.g. workspace dir, tool paths)
255
+ * @returns {Promise<object>} parsed CycloneDX SBOM JSON object
256
+ * @throws {Error} if the manifest is unsupported or SBOM generation fails
257
+ */
258
+ export async function generateSbom(manifestPath, opts = {}) {
259
+ fs.accessSync(manifestPath, fs.constants.R_OK);
260
+ const result = await generateOneSbom(manifestPath, opts);
261
+ if (!result.ok) {
262
+ throw new Error(`Failed to generate SBOM for ${result.manifestPath}: ${result.reason}`);
263
+ }
264
+ return result.sbom;
265
+ }
240
266
  /**
241
267
  * @typedef {{ ok: true, purl: string, sbom: object } | { ok: false, manifestPath: string, reason: string }} SbomResult
242
268
  */
@@ -263,17 +289,45 @@ async function generateOneSbom(manifestPath, workspaceOpts) {
263
289
  *
264
290
  * @param {string} root - Resolved workspace root
265
291
  * @param {Options} opts
266
- * @returns {Promise<{ ecosystem: 'javascript' | 'cargo' | 'unknown', manifestPaths: string[] }>}
292
+ * @returns {Promise<{ ecosystem: 'javascript' | 'cargo' | 'maven' | 'gradle' | 'gomodules' | 'pyproject' | 'unknown', manifestPaths: string[] }>}
267
293
  * @private
268
294
  */
269
295
  async function detectWorkspaceManifests(root, opts) {
270
296
  const cargoToml = path.join(root, 'Cargo.toml');
271
297
  const cargoLock = path.join(root, 'Cargo.lock');
272
298
  const packageJson = path.join(root, 'package.json');
299
+ const pomXml = path.join(root, 'pom.xml');
273
300
  if (fs.existsSync(cargoToml) && fs.existsSync(cargoLock)) {
274
301
  return { ecosystem: 'cargo', manifestPaths: await discoverWorkspaceCrates(root, opts) };
275
302
  }
276
- const hasJsLock = fs.existsSync(path.join(root, 'pnpm-lock.yaml'))
303
+ if (fs.existsSync(pomXml)) {
304
+ const manifestPaths = await discoverMavenModules(root, opts);
305
+ if (manifestPaths.length > 0) {
306
+ return { ecosystem: 'maven', manifestPaths };
307
+ }
308
+ }
309
+ const hasGradleSettings = fs.existsSync(path.join(root, 'settings.gradle'))
310
+ || fs.existsSync(path.join(root, 'settings.gradle.kts'));
311
+ if (hasGradleSettings) {
312
+ const manifestPaths = await discoverGradleSubprojects(root, opts);
313
+ if (manifestPaths.length > 0) {
314
+ return { ecosystem: 'gradle', manifestPaths };
315
+ }
316
+ }
317
+ if (fs.existsSync(path.join(root, 'go.work'))) {
318
+ const manifestPaths = await discoverGoWorkspaceModules(root, opts);
319
+ if (manifestPaths.length > 0) {
320
+ return { ecosystem: 'gomodules', manifestPaths };
321
+ }
322
+ }
323
+ if (fs.existsSync(path.join(root, 'pyproject.toml')) && fs.existsSync(path.join(root, 'uv.lock'))) {
324
+ const manifestPaths = await discoverUvWorkspaceMembers(root, opts);
325
+ if (manifestPaths.length > 0) {
326
+ return { ecosystem: 'pyproject', manifestPaths };
327
+ }
328
+ }
329
+ const hasJsLock = fs.existsSync(path.join(root, 'bun.lock'))
330
+ || fs.existsSync(path.join(root, 'pnpm-lock.yaml'))
277
331
  || fs.existsSync(path.join(root, 'yarn.lock'))
278
332
  || fs.existsSync(path.join(root, 'package-lock.json'));
279
333
  if (fs.existsSync(packageJson) && hasJsLock) {
@@ -382,12 +436,45 @@ function batchError(message, wantMetadata, metadata) {
382
436
  }
383
437
  return err;
384
438
  }
439
+ /**
440
+ * @overload
441
+ * @param {string} workspaceRoot
442
+ * @param {true} html
443
+ * @param {Options & { batchMetadata: true }} opts
444
+ * @returns {Promise<{ analysis: string, metadata: BatchAnalysisMetadata }>}
445
+ * @throws {Error}
446
+ */
447
+ /**
448
+ * @overload
449
+ * @param {string} workspaceRoot
450
+ * @param {true} html
451
+ * @param {Options & { batchMetadata?: false }} [opts={}]
452
+ * @returns {Promise<string>}
453
+ * @throws {Error}
454
+ */
455
+ /**
456
+ * @overload
457
+ * @param {string} workspaceRoot
458
+ * @param {false} html
459
+ * @param {Options & { batchMetadata: true }} opts
460
+ * @returns {Promise<{ analysis: Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>, metadata: BatchAnalysisMetadata }>}
461
+ * @throws {Error}
462
+ */
463
+ /**
464
+ * @overload
465
+ * @param {string} workspaceRoot
466
+ * @param {false} html
467
+ * @param {Options & { batchMetadata?: false }} [opts={}]
468
+ * @returns {Promise<Object.<string, import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport>>}
469
+ * @throws {Error}
470
+ */
385
471
  /**
386
472
  * Get stack analysis for all workspace packages/crates (batch).
387
473
  * Detects ecosystem from workspace root: Cargo (Cargo.toml + Cargo.lock) or JS/TS (package.json + lock file).
388
474
  * SBOMs are generated in parallel (see `batchConcurrency`) unless `continueOnError: false` (fail-fast sequential).
389
475
  * With `opts.batchMetadata` / `TRUSTIFY_DA_BATCH_METADATA`, returns `{ analysis, metadata }` including validation and SBOM errors.
390
476
  *
477
+ * @overload
391
478
  * @param {string} workspaceRoot - Path to workspace root (containing lock file and workspace config)
392
479
  * @param {boolean} [html=false] - true returns HTML, false returns JSON report
393
480
  * @param {Options} [opts={}] - `batchConcurrency`, discovery ignores, `continueOnError` (default true), `batchMetadata` (default false)
@@ -418,7 +505,7 @@ async function stackAnalysisBatch(workspaceRoot, html = false, opts = {}) {
418
505
  }
419
506
  }
420
507
  if (manifestPaths.length === 0) {
421
- throw new Error(`No workspace manifests found at ${root}. Ensure Cargo.toml+Cargo.lock or package.json+lock file exist.`);
508
+ throw new Error(`No workspace manifests found at ${root}. Ensure a supported workspace root exists (Cargo.toml+Cargo.lock, pom.xml, build.gradle, go.work, pyproject.toml+uv.lock, or package.json+lock file).`);
422
509
  }
423
510
  const workspaceOpts = { ...opts, TRUSTIFY_DA_WORKSPACE_DIR: root };
424
511
  const concurrency = resolveBatchConcurrency(opts);
@@ -9,10 +9,10 @@
9
9
  * @param {import('@trustify-da/trustify-da-api-model/model/v5/AnalysisReport').AnalysisReport} [analysisResult] - analysis result that includes licenses array from backend
10
10
  * @returns {Promise<{ projectLicense: { manifest: Object|null, file: Object|null, mismatch: boolean }, incompatibleDependencies: Array<{ purl: string, licenses: string[], category?: string, reason: string }>, error?: string }>}
11
11
  */
12
- export function runLicenseCheck(sbomContent: string, manifestPath: string, url: string, opts?: import("../index.js").Options, analysisResult?: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport): Promise<{
12
+ export function runLicenseCheck(sbomContent: string, manifestPath: string, url: string, opts?: import("../index.js").Options, analysisResult?: any): Promise<{
13
13
  projectLicense: {
14
- manifest: any | null;
15
- file: any | null;
14
+ manifest: Object | null;
15
+ file: Object | null;
16
16
  mismatch: boolean;
17
17
  };
18
18
  incompatibleDependencies: Array<{
@@ -85,11 +85,14 @@ export async function runLicenseCheck(sbomContent, manifestPath, url, opts = {},
85
85
  continue;
86
86
  const status = getCompatibility(projectCategory, entry.category);
87
87
  if (status === 'incompatible') {
88
+ const reason = entry.category?.toUpperCase() === 'UNKNOWN'
89
+ ? 'License not recognized as a standard SPDX identifier. Manual review recommended to verify compatibility.'
90
+ : 'Dependency license(s) are incompatible with the project license.';
88
91
  incompatibleDependencies.push({
89
92
  purl,
90
93
  licenses: entry.licenses,
91
94
  category: entry.category,
92
- reason: 'Dependency license(s) are incompatible with the project license.'
95
+ reason
93
96
  });
94
97
  }
95
98
  }
@@ -114,9 +114,12 @@ export function getCompatibility(projectCategory, dependencyCategory) {
114
114
  }
115
115
  const proj = projectCategory.toUpperCase();
116
116
  const dep = dependencyCategory.toUpperCase();
117
- if (proj === 'UNKNOWN' || dep === 'UNKNOWN') {
117
+ if (proj === 'UNKNOWN') {
118
118
  return 'unknown';
119
119
  }
120
+ if (dep === 'UNKNOWN') {
121
+ return 'incompatible';
122
+ }
120
123
  const restrictiveness = {
121
124
  'PERMISSIVE': 1,
122
125
  'WEAK_COPYLEFT': 2,
@@ -6,7 +6,7 @@
6
6
  * @param {import('../index.js').Options} [opts={}] - options (proxy, token, TRUSTIFY_DA_BACKEND_URL, etc.)
7
7
  * @returns {Promise<Object|null>} License details or null if not found
8
8
  */
9
- export function getLicenseDetails(spdxId: string, opts?: import("../index.js").Options): Promise<any | null>;
9
+ export function getLicenseDetails(spdxId: string, opts?: import("../index.js").Options): Promise<Object | null>;
10
10
  /**
11
11
  * Normalize the LicensesResponse shape (array of LicenseProviderResult) into a map of purl -> license info.
12
12
  * Each provider result has { status, summary, packages } where packages is { [purl]: { concluded, evidence } }.
@@ -28,7 +28,7 @@ export function normalizeLicensesResponse(data: unknown, purls?: string[]): Map<
28
28
  * @param {string[]} [purls] - optional list of purls to restrict to
29
29
  * @returns {Map<string, { licenses: string[], category?: string }>}
30
30
  */
31
- export function licensesFromReport(analysisReport: import("@trustify-da/trustify-da-api-model/model/v5/AnalysisReport").AnalysisReport, purls?: string[]): Map<string, {
31
+ export function licensesFromReport(analysisReport: any, purls?: string[]): Map<string, {
32
32
  licenses: string[];
33
33
  category?: string;
34
34
  }>;
@@ -78,7 +78,7 @@ export class ImageRef {
78
78
  * @param {string} [platform]
79
79
  * @param {import("index.js").Options} [opts={}]
80
80
  */
81
- constructor(image: string, platform?: string, opts?: import("index.js").Options);
81
+ constructor(image: string, platform?: string, opts?: any);
82
82
  /** @type {Image} */
83
83
  image: Image;
84
84
  /** @type {Platform} */
@@ -242,8 +242,22 @@ export class ImageRef {
242
242
  getPackageURL() {
243
243
  /** @type {Object.<string, string>} */
244
244
  const qualifiers = {};
245
- const repositoryUrl = this.image.getNameWithoutTag();
245
+ let repositoryUrl = this.image.getNameWithoutTag();
246
246
  const simpleName = this.image.getSimpleName();
247
+ // Normalize Docker Hub image references so all forms produce the same PURL:
248
+ // node → docker.io/node
249
+ // docker.io/library/node → docker.io/node
250
+ if (repositoryUrl != null) {
251
+ const lower = repositoryUrl.toLowerCase();
252
+ if (lower === simpleName.toLowerCase()) {
253
+ // Bare name (e.g. "node") — default to docker.io
254
+ repositoryUrl = `docker.io/${simpleName}`;
255
+ }
256
+ else if (lower.startsWith('docker.io/library/')) {
257
+ // Official image with library/ prefix — strip it
258
+ repositoryUrl = `docker.io/${lower.substring('docker.io/library/'.length)}`;
259
+ }
260
+ }
247
261
  if (repositoryUrl != null && repositoryUrl.toLowerCase() !== simpleName.toLowerCase()) {
248
262
  qualifiers[ImageRef.REPOSITORY_QUALIFIER] = repositoryUrl.toLowerCase();
249
263
  }
@@ -4,7 +4,7 @@
4
4
  * @param {import("../index.js").Options} [opts={}] - optional various options to pass along the application
5
5
  * @returns {{}}
6
6
  */
7
- export function generateImageSBOM(imageRef: import("./images").ImageRef, opts?: import("../index.js").Options): {};
7
+ export function generateImageSBOM(imageRef: any, opts?: import("../index.js").Options): {};
8
8
  /**
9
9
  *
10
10
  * @param {string} image
@@ -25,7 +25,7 @@ export function getImagePlatform(opts?: import("../index.js").Options): Platform
25
25
  * @returns {Object.<string, string>} - The image digests
26
26
  * @throws {Error} If the image info is invalid
27
27
  */
28
- export function getImageDigests(imageRef: import("./images").ImageRef, opts?: import("../index.js").Options): {
28
+ export function getImageDigests(imageRef: any, opts?: import("../index.js").Options): {
29
29
  [x: string]: string;
30
30
  };
31
31
  export type SyftImageSource = {
@@ -34,9 +34,9 @@ export type SyftImageSource = {
34
34
  getVariant: () => string;
35
35
  };
36
36
  export type SyftImageSourceType = {
37
- getOs: (arg0: any) => string;
38
- getArch: (arg0: any) => string;
39
- getVariant: (arg0: any) => string;
37
+ getOs: (arg0: Object) => string;
38
+ getArch: (arg0: Object) => string;
39
+ getVariant: (arg0: Object) => string;
40
40
  };
41
41
  import { ImageRef } from './images.js';
42
42
  import { Platform } from './platform.js';
@@ -135,7 +135,7 @@ function execSyft(imageRef, opts = {}) {
135
135
  function getSyftEnvs(dockerPath, podmanPath) {
136
136
  let path = null;
137
137
  if (dockerPath && podmanPath) {
138
- path = `${dockerPath}${File.pathSeparator}${podmanPath}`;
138
+ path = `${dockerPath}${delimiter}${podmanPath}`;
139
139
  }
140
140
  else if (dockerPath) {
141
141
  path = dockerPath;
@@ -276,7 +276,16 @@ function podmanGetVariant(opts = {}) {
276
276
  * @returns {string} - The information
277
277
  */
278
278
  function dockerPodmanInfo(dockerSupplier, podmanSupplier, opts = {}) {
279
- return dockerSupplier(opts) || podmanSupplier(opts);
279
+ try {
280
+ const result = dockerSupplier(opts);
281
+ if (result) {
282
+ return result;
283
+ }
284
+ }
285
+ catch (_) {
286
+ // docker not available, fall through to podman
287
+ }
288
+ return podmanSupplier(opts);
280
289
  }
281
290
  /**
282
291
  * Gets the digests for an image
@@ -21,7 +21,7 @@ export function match(manifest: string, providers: [Provider], opts?: {
21
21
  TRUSTIFY_DA_WORKSPACE_DIR?: string;
22
22
  }): Provider;
23
23
  /** @typedef {{ecosystem: string, contentType: string, content: string}} Provided */
24
- /** @typedef {{isSupported: function(string): boolean, validateLockFile: function(string, Object): void, provideComponent: function(string, {}): Provided | Promise<Provided>, provideStack: function(string, {}): Provided | Promise<Provided>, readLicenseFromManifest: function(string): string | null}} Provider */
24
+ /** @typedef {{isSupported: function(string): boolean, validateLockFile: function(string, Object): void, provideComponent: function(string, {}): Provided | Promise<Provided>, provideStack: function(string, {}): Provided | Promise<Provided>, readLicenseFromManifest: function(string, Object=): string | null, packageManagerName: function(): string}} Provider */
25
25
  /**
26
26
  * MUST include all providers here.
27
27
  * @type {[Provider]}
@@ -34,8 +34,9 @@ export type Provided = {
34
34
  };
35
35
  export type Provider = {
36
36
  isSupported: (arg0: string) => boolean;
37
- validateLockFile: (arg0: string, arg1: any) => void;
37
+ validateLockFile: (arg0: string, arg1: Object) => void;
38
38
  provideComponent: (arg0: string, arg1: {}) => Provided | Promise<Provided>;
39
39
  provideStack: (arg0: string, arg1: {}) => Provided | Promise<Provided>;
40
- readLicenseFromManifest: (arg0: string) => string | null;
40
+ readLicenseFromManifest: (arg0: string, arg1: Object | undefined) => string | null;
41
+ packageManagerName: () => string;
41
42
  };
@@ -3,15 +3,18 @@ import golangGomodulesProvider from './providers/golang_gomodules.js';
3
3
  import Java_gradle_groovy from "./providers/java_gradle_groovy.js";
4
4
  import Java_gradle_kotlin from "./providers/java_gradle_kotlin.js";
5
5
  import Java_maven from "./providers/java_maven.js";
6
+ import Javascript_bun from './providers/javascript_bun.js';
6
7
  import Javascript_npm from './providers/javascript_npm.js';
7
8
  import Javascript_pnpm from './providers/javascript_pnpm.js';
8
9
  import Javascript_yarn from './providers/javascript_yarn.js';
10
+ import dockerfileProvider from './providers/oci_dockerfile.js';
9
11
  import pythonPipProvider from './providers/python_pip.js';
12
+ import Python_pip_pyproject from './providers/python_pip_pyproject.js';
10
13
  import Python_poetry from './providers/python_poetry.js';
11
14
  import Python_uv from './providers/python_uv.js';
12
15
  import rustCargoProvider from './providers/rust_cargo.js';
13
16
  /** @typedef {{ecosystem: string, contentType: string, content: string}} Provided */
14
- /** @typedef {{isSupported: function(string): boolean, validateLockFile: function(string, Object): void, provideComponent: function(string, {}): Provided | Promise<Provided>, provideStack: function(string, {}): Provided | Promise<Provided>, readLicenseFromManifest: function(string): string | null}} Provider */
17
+ /** @typedef {{isSupported: function(string): boolean, validateLockFile: function(string, Object): void, provideComponent: function(string, {}): Provided | Promise<Provided>, provideStack: function(string, {}): Provided | Promise<Provided>, readLicenseFromManifest: function(string, Object=): string | null, packageManagerName: function(): string}} Provider */
15
18
  /**
16
19
  * MUST include all providers here.
17
20
  * @type {[Provider]}
@@ -20,6 +23,7 @@ export const availableProviders = [
20
23
  new Java_maven(),
21
24
  new Java_gradle_groovy(),
22
25
  new Java_gradle_kotlin(),
26
+ new Javascript_bun(),
23
27
  new Javascript_pnpm(),
24
28
  new Javascript_yarn(),
25
29
  new Javascript_npm(),
@@ -27,7 +31,9 @@ export const availableProviders = [
27
31
  pythonPipProvider,
28
32
  new Python_poetry(),
29
33
  new Python_uv(),
30
- rustCargoProvider
34
+ new Python_pip_pyproject(),
35
+ rustCargoProvider,
36
+ dockerfileProvider
31
37
  ];
32
38
  /**
33
39
  * Match a provider by manifest type only (no lock file check). Used for license reading.
@@ -1,4 +1,4 @@
1
- export type ecosystem_maven = import("../provider").Provider;
1
+ export type ecosystem_maven = any;
2
2
  /** @typedef {import('../provider').Provider} */
3
3
  /** @typedef {import('../provider').Provided} Provided */
4
4
  /** @typedef {{name: string, version: string}} Package */
@@ -20,6 +20,11 @@ export default class Base_Java {
20
20
  CONFLICT_REGEX: RegExp;
21
21
  globalBinary: string;
22
22
  localWrapper: string;
23
+ /**
24
+ * Returns the package manager name (e.g. mvn, gradle)
25
+ * @returns {string}
26
+ */
27
+ packageManagerName(): string;
23
28
  /**
24
29
  * Recursively populates the SBOM instance with the parsed graph
25
30
  * @param {string} src - Source dependency to start the calculations from
@@ -28,6 +33,13 @@ export default class Base_Java {
28
33
  * @param {Sbom} sbom - The SBOM where the dependencies are being added
29
34
  */
30
35
  parseDependencyTree(src: string, srcDepth: number, lines: any[], sbom: Sbom): void;
36
+ /**
37
+ * Calculates how deep in the graph is the given line
38
+ * @param {string} line - line to calculate the depth from
39
+ * @returns {number} The calculated depth
40
+ * @protected
41
+ */
42
+ protected _getDepth(line: string): number;
31
43
  /**
32
44
  * Create a PackageURL from any line in a Text Graph dependency tree for a manifest path.
33
45
  * @param {string} line - line to parse from a dependencies.txt file
@@ -57,18 +69,8 @@ export default class Base_Java {
57
69
  * @returns string
58
70
  */
59
71
  selectToolBinary(manifestPath: string, opts: {}): string | null;
60
- /**
61
- *
62
- * @param {string} startingManifest - the path of the manifest from which to start searching for the wrapper
63
- * @param {string} repoRoot - the root of the repository at which point to stop searching for mvnw, derived via git if unset and then fallsback
64
- * to the root of the drive the manifest is on (assumes absolute path is given)
65
- * @returns {string|undefined}
66
- */
67
- traverseForWrapper(startingManifest: string, repoRoot?: string): string | undefined;
68
- normalizePath(thePath: any): string;
69
- #private;
70
72
  }
71
- export type Provided = import("../provider").Provided;
73
+ export type Provided = any;
72
74
  export type Package = {
73
75
  name: string;
74
76
  version: string;