@cyclonedx/cdxgen 10.3.0 → 10.3.2
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.
- package/README.md +3 -1
- package/binary.js +5 -8
- package/index.js +9 -22
- package/package.json +7 -7
- package/types/binary.d.ts.map +1 -1
- package/types/index.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
[](https://jsr.io/@cyclonedx/cdxgen) [](https://www.npmjs.com/package/@cyclonedx/cdxgen) [](https://github.com/CycloneDX/cdxgen/releases) [](https://github.com/CycloneDX/cdxgen/releases) [](https://github.com/CycloneDX/cdxgen/releases) [](./LICENSE.md) [](https://github.com/CycloneDX/cdxgen/graphs/contributors)
|
|
2
|
+
|
|
1
3
|
# CycloneDX Generator
|
|
2
4
|
|
|
3
5
|

|
|
4
6
|
|
|
5
|
-
[](https://jsr.io/@cyclonedx/cdxgen)
|
|
6
7
|
|
|
7
8
|
cdxgen is a CLI tool, library, [REPL](./ADVANCED.md), and server to create a valid and compliant [CycloneDX][cyclonedx-homepage] Bill of Materials (BOM) containing an aggregate of all project dependencies for C/C++, Node.js, PHP, Python, Ruby, Rust, Java, .Net, Dart, Haskell, Elixir, and Go projects in JSON format. CycloneDX is a full-stack BOM specification that is easily created, human and machine-readable, and simple to parse. The tool supports CycloneDX specification versions from 1.4 - 1.6.
|
|
8
9
|
|
|
@@ -367,6 +368,7 @@ cdxgen can retain the dependency tree under the `dependencies` attribute for a s
|
|
|
367
368
|
- Go (go.mod)
|
|
368
369
|
- PHP (composer.lock)
|
|
369
370
|
- Ruby (Gemfile.lock)
|
|
371
|
+
- Rust (Cargo.lock)
|
|
370
372
|
|
|
371
373
|
## Environment variables
|
|
372
374
|
|
package/binary.js
CHANGED
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
mkdirSync,
|
|
7
7
|
mkdtempSync,
|
|
8
8
|
readFileSync,
|
|
9
|
-
rmSync
|
|
9
|
+
rmSync,
|
|
10
|
+
lstatSync
|
|
10
11
|
} from "node:fs";
|
|
11
12
|
import { basename, dirname, join, resolve } from "node:path";
|
|
12
13
|
import { spawnSync } from "node:child_process";
|
|
@@ -19,12 +20,7 @@ let url = import.meta.url;
|
|
|
19
20
|
if (!url.startsWith("file://")) {
|
|
20
21
|
url = new URL(`file://${import.meta.url}`).toString();
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
// When cdxgen is used as a library, dirName would be inside the node_modules directory
|
|
24
|
-
// we need to locate the base directory of the dependent project in this case.
|
|
25
|
-
if (dirName.includes("node_modules")) {
|
|
26
|
-
dirName = dirName.split(join("node_modules", "@cyclonedx"))[0];
|
|
27
|
-
}
|
|
23
|
+
const dirName = import.meta ? dirname(fileURLToPath(url)) : __dirname;
|
|
28
24
|
|
|
29
25
|
const isWin = _platform() === "win32";
|
|
30
26
|
|
|
@@ -802,10 +798,11 @@ export function getBinaryBom(src, binaryBomFile, deepMode) {
|
|
|
802
798
|
if (DEBUG_MODE) {
|
|
803
799
|
console.log("Executing", BLINT_BIN, args.join(" "));
|
|
804
800
|
}
|
|
801
|
+
const cwd = lstatSync(src).isDirectory() ? src : dirname(src);
|
|
805
802
|
const result = spawnSync(BLINT_BIN, args, {
|
|
806
803
|
encoding: "utf-8",
|
|
807
804
|
timeout: TIMEOUT_MS,
|
|
808
|
-
cwd
|
|
805
|
+
cwd
|
|
809
806
|
});
|
|
810
807
|
if (result.status !== 0 || result.error) {
|
|
811
808
|
if (result.stderr) {
|
package/index.js
CHANGED
|
@@ -83,7 +83,6 @@ import {
|
|
|
83
83
|
parseGoModData,
|
|
84
84
|
parseGoModGraph,
|
|
85
85
|
parseGoModWhy,
|
|
86
|
-
parseGoVersionData,
|
|
87
86
|
parseGopkgData,
|
|
88
87
|
parseGosumData,
|
|
89
88
|
parseGradleDep,
|
|
@@ -149,7 +148,6 @@ import {
|
|
|
149
148
|
executeOsQuery,
|
|
150
149
|
getCargoAuditableInfo,
|
|
151
150
|
getDotnetSlices,
|
|
152
|
-
getGoBuildInfo,
|
|
153
151
|
getOSPackages,
|
|
154
152
|
getBinaryBom
|
|
155
153
|
} from "./binary.js";
|
|
@@ -2696,25 +2694,8 @@ export async function createGoBom(path, options) {
|
|
|
2696
2694
|
} catch (err) {
|
|
2697
2695
|
maybeBinary = false;
|
|
2698
2696
|
}
|
|
2699
|
-
if (maybeBinary) {
|
|
2700
|
-
|
|
2701
|
-
const dlist = await parseGoVersionData(buildInfoData);
|
|
2702
|
-
if (dlist && dlist.length) {
|
|
2703
|
-
pkgList = pkgList.concat(dlist);
|
|
2704
|
-
}
|
|
2705
|
-
// Since this pkg list is derived from the binary mark them as used.
|
|
2706
|
-
const allImports = {};
|
|
2707
|
-
for (const mpkg of pkgList) {
|
|
2708
|
-
const pkgFullName = `${mpkg.group}/${mpkg.name}`;
|
|
2709
|
-
allImports[pkgFullName] = true;
|
|
2710
|
-
}
|
|
2711
|
-
return buildBomNSData(options, pkgList, "golang", {
|
|
2712
|
-
allImports,
|
|
2713
|
-
dependencies,
|
|
2714
|
-
parentComponent,
|
|
2715
|
-
src: path,
|
|
2716
|
-
filename: path
|
|
2717
|
-
});
|
|
2697
|
+
if (maybeBinary || options.lifecycle === "post-build") {
|
|
2698
|
+
return createBinaryBom(path, options);
|
|
2718
2699
|
}
|
|
2719
2700
|
|
|
2720
2701
|
// Read in go.sum and merge all go.sum files.
|
|
@@ -4547,7 +4528,13 @@ export async function createCsharpBom(path, options) {
|
|
|
4547
4528
|
"1. Create a global.json file in the project directory to specify the required version of the dotnet SDK."
|
|
4548
4529
|
);
|
|
4549
4530
|
console.log(
|
|
4550
|
-
"2.
|
|
4531
|
+
"2. Use the environment variable `DOTNET_ROLL_FORWARD` to roll forward to a closest available SDK such as .Net core or dotnet 6."
|
|
4532
|
+
);
|
|
4533
|
+
console.log(
|
|
4534
|
+
"3. If the project uses the legacy .Net Framework 4.6/4.7, it might require Windows operating system."
|
|
4535
|
+
);
|
|
4536
|
+
console.log(
|
|
4537
|
+
"Alternatively, try using the unofficial `ghcr.io/appthreat/cdxgen-dotnet:v10` container image, which bundles a range of dotnet SDKs."
|
|
4551
4538
|
);
|
|
4552
4539
|
options.failOnError && process.exit(1);
|
|
4553
4540
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyclonedx/cdxgen",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.2",
|
|
4
4
|
"description": "Creates CycloneDX Software Bill of Materials (SBOM) from source or container image",
|
|
5
5
|
"homepage": "http://github.com/cyclonedx/cdxgen",
|
|
6
6
|
"author": "Prabhu Subramanian <prabhu@appthreat.com>",
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
"url": "https://github.com/cyclonedx/cdxgen/issues"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@babel/parser": "^7.24.
|
|
61
|
+
"@babel/parser": "^7.24.4",
|
|
62
62
|
"@babel/traverse": "^7.24.1",
|
|
63
|
-
"@npmcli/arborist": "7.4.
|
|
63
|
+
"@npmcli/arborist": "7.4.1",
|
|
64
64
|
"ajv": "^8.12.0",
|
|
65
|
-
"ajv-formats": "^
|
|
65
|
+
"ajv-formats": "^3.0.1",
|
|
66
66
|
"cheerio": "^1.0.0-rc.12",
|
|
67
67
|
"edn-data": "1.1.1",
|
|
68
68
|
"find-up": "7.0.0",
|
|
69
|
-
"glob": "^10.3.
|
|
69
|
+
"glob": "^10.3.12",
|
|
70
70
|
"global-agent": "^3.0.0",
|
|
71
71
|
"got": "14.2.1",
|
|
72
72
|
"iconv-lite": "^0.6.3",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"compression": "^1.7.4",
|
|
99
99
|
"connect": "^3.7.0",
|
|
100
100
|
"jsonata": "^2.0.4",
|
|
101
|
-
"sequelize": "^6.37.
|
|
101
|
+
"sequelize": "^6.37.2",
|
|
102
102
|
"sqlite3": "^5.1.7"
|
|
103
103
|
},
|
|
104
104
|
"files": [
|
|
@@ -114,6 +114,6 @@
|
|
|
114
114
|
"eslint-plugin-prettier": "^5.1.3",
|
|
115
115
|
"jest": "^29.7.0",
|
|
116
116
|
"prettier": "3.2.5",
|
|
117
|
-
"typescript": "^5.4.
|
|
117
|
+
"typescript": "^5.4.4"
|
|
118
118
|
}
|
|
119
119
|
}
|
package/types/binary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../binary.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../binary.js"],"names":[],"mappings":"AA8QA,iDA8BC;AAED,wDAmBC;AAED;;;;;;;EAqVC;AAiCD,gDAgDC;AAED;;;;;;GAMG;AACH,qCAJW,MAAM,cACN,MAAM,WA2BhB;AAED;;;;;;;;GAQG;AACH,kCANW,MAAM,iBACN,MAAM,YACN,OAAO,GAEN,OAAO,CA8BlB"}
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":"AA0rBA;;;;;;;;GAQG;AACH,gFAFW,MAAM,SAchB;AAwUD;;;;;;;GAOG;AACH,mCALW,MAAM,qBAiEhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM;;;;EAKhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM;;;;EAkBhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAuvBhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BAkZhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BAgWhB;AAED;;;;;GAKG;AACH,kCAHW,MAAM,8BAgThB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAiHhB;AAED;;;;;GAKG;AACH,oC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