@cyclonedx/cdxgen 11.2.1 → 11.2.3
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/bin/cdxgen.js +40 -9
- package/bin/evinse.js +5 -1
- package/data/component-tags.json +2 -2
- package/lib/cli/index.js +351 -78
- package/lib/evinser/evinser.js +167 -38
- package/lib/evinser/scalasem.js +52 -0
- package/lib/helpers/envcontext.js +1 -0
- package/lib/helpers/utils.js +238 -17
- package/lib/helpers/utils.test.js +1 -1
- package/lib/helpers/validator.js +10 -1
- package/lib/managers/binary.js +220 -77
- package/lib/managers/docker.js +16 -8
- package/lib/server/server.js +13 -10
- package/lib/stages/postgen/annotator.js +26 -3
- package/lib/stages/postgen/postgen.js +21 -7
- package/lib/stages/pregen/pregen.js +1 -1
- package/package.json +22 -17
- package/types/lib/cli/index.d.ts +2 -3
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/evinser/scalasem.d.ts +6 -0
- package/types/lib/evinser/scalasem.d.ts.map +1 -0
- package/types/lib/helpers/envcontext.d.ts +1 -0
- package/types/lib/helpers/envcontext.d.ts.map +1 -1
- package/types/lib/helpers/utils.d.ts +36 -1
- package/types/lib/helpers/utils.d.ts.map +1 -1
- package/types/lib/helpers/validator.d.ts.map +1 -1
- package/types/lib/managers/binary.d.ts +9 -9
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts +2 -0
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/lib/stages/postgen/annotator.d.ts.map +1 -1
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -147,7 +147,8 @@ Options:
|
|
|
147
147
|
--server-host Listen address [default: "127.0.0.1"]
|
|
148
148
|
--server-port Listen port [default: "9090"]
|
|
149
149
|
--install-deps Install dependencies automatically for some projects. Defaults to true but disabled for c
|
|
150
|
-
ontainers and oci scans. Use --no-install-deps to disable this feature.
|
|
150
|
+
ontainers and oci scans. Use --no-install-deps to disable this feature.
|
|
151
|
+
[boolean] [default: true]
|
|
151
152
|
--validate Validate the generated SBOM using json schema. Defaults to true. Pass --no-validate to di
|
|
152
153
|
sable. [boolean] [default: true]
|
|
153
154
|
--evidence Generate SBOM with evidence for supported languages. [boolean] [default: false]
|
|
@@ -170,6 +171,7 @@ Options:
|
|
|
170
171
|
luated against or attested to.
|
|
171
172
|
[array] [choices: "asvs-5.0", "asvs-4.0.3", "bsimm-v13", "masvs-2.0.0", "nist_ssdf-1.1", "pcissc-secure-slc-1.1", "scv
|
|
172
173
|
s-1.0.0", "ssaf-DRAFT-2023-11"]
|
|
174
|
+
--json-pretty Pretty-print the generated BOM json. [boolean] [default: false]
|
|
173
175
|
--min-confidence Minimum confidence needed for the identity of a component from 0 - 1, where 1 is 100% con
|
|
174
176
|
fidence. [number] [default: 0]
|
|
175
177
|
--technique Analysis technique to use
|
package/bin/cdxgen.js
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import { thoughtEnd, thoughtLog } from "../lib/helpers/logger.js";
|
|
25
25
|
import {
|
|
26
26
|
ATOM_DB,
|
|
27
|
+
DEBUG_MODE,
|
|
27
28
|
dirNameStr,
|
|
28
29
|
getTmpDir,
|
|
29
30
|
isMac,
|
|
@@ -221,6 +222,7 @@ const args = yargs(hideBin(process.argv))
|
|
|
221
222
|
description: "CycloneDX Specification version to use. Defaults to 1.6",
|
|
222
223
|
default: 1.6,
|
|
223
224
|
type: "number",
|
|
225
|
+
choices: [1.4, 1.5, 1.6],
|
|
224
226
|
})
|
|
225
227
|
.option("filter", {
|
|
226
228
|
description:
|
|
@@ -303,6 +305,11 @@ const args = yargs(hideBin(process.argv))
|
|
|
303
305
|
description:
|
|
304
306
|
"Do not show the donation banner. Set this attribute if you are an active sponsor for OWASP CycloneDX.",
|
|
305
307
|
})
|
|
308
|
+
.option("json-pretty", {
|
|
309
|
+
type: "boolean",
|
|
310
|
+
default: DEBUG_MODE,
|
|
311
|
+
description: "Pretty-print the generated BOM json.",
|
|
312
|
+
})
|
|
306
313
|
.option("feature-flags", {
|
|
307
314
|
description: "Experimental feature flags to enable. Advanced users only.",
|
|
308
315
|
hidden: true,
|
|
@@ -442,11 +449,23 @@ if (!options.projectType) {
|
|
|
442
449
|
"Ok, the user wants me to identify all the project types and generate a consolidated BOM document.",
|
|
443
450
|
);
|
|
444
451
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
452
|
+
// Handle dedicated cbom and saasbom commands
|
|
453
|
+
if (["cbom", "saasbom"].includes(process.argv[1])) {
|
|
454
|
+
if (process.argv[1].includes("cbom")) {
|
|
455
|
+
thoughtLog(
|
|
456
|
+
"Ok, the user wants to generate Cryptographic Bill-of-Materials (CBOM).",
|
|
457
|
+
);
|
|
458
|
+
options.includeCrypto = true;
|
|
459
|
+
} else if (process.argv[1].includes("saasbom")) {
|
|
460
|
+
thoughtLog(
|
|
461
|
+
"Ok, the user wants to generate a Software as a Service Bill-of-Materials (SaaSBOM). I should carefully collect the services, endpoints, and data flows.",
|
|
462
|
+
);
|
|
463
|
+
if (process.env?.CDXGEN_IN_CONTAINER !== "true") {
|
|
464
|
+
thoughtLog(
|
|
465
|
+
"Wait, I'm not running in a container. This means the chances of successfully collecting this inventory are quite low. Perhaps this is an advanced user who has set up atom and atom-tools already 🤔?",
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
450
469
|
options.evidence = true;
|
|
451
470
|
options.specVersion = 1.6;
|
|
452
471
|
options.deep = true;
|
|
@@ -693,7 +712,7 @@ const checkPermissions = (filePath, options) => {
|
|
|
693
712
|
"usages-slices-file",
|
|
694
713
|
"reachables-slices-file",
|
|
695
714
|
];
|
|
696
|
-
if (options?.type?.includes("swift")) {
|
|
715
|
+
if (options?.type?.includes("swift") || options?.type?.includes("scala")) {
|
|
697
716
|
slicesFilesKeys.push("semantics-slices-file");
|
|
698
717
|
}
|
|
699
718
|
for (const sf of slicesFilesKeys) {
|
|
@@ -798,7 +817,11 @@ const checkPermissions = (filePath, options) => {
|
|
|
798
817
|
fs.writeFileSync(jsonFile, bomNSData.bomJson);
|
|
799
818
|
jsonPayload = bomNSData.bomJson;
|
|
800
819
|
} else {
|
|
801
|
-
jsonPayload = JSON.stringify(
|
|
820
|
+
jsonPayload = JSON.stringify(
|
|
821
|
+
bomNSData.bomJson,
|
|
822
|
+
null,
|
|
823
|
+
options.jsonPretty ? 2 : null,
|
|
824
|
+
);
|
|
802
825
|
fs.writeFileSync(jsonFile, jsonPayload);
|
|
803
826
|
if (jsonFile.endsWith("bom.json")) {
|
|
804
827
|
thoughtLog(
|
|
@@ -900,7 +923,11 @@ const checkPermissions = (filePath, options) => {
|
|
|
900
923
|
bomJsonUnsignedObj.signature = signatureBlock;
|
|
901
924
|
fs.writeFileSync(
|
|
902
925
|
jsonFile,
|
|
903
|
-
JSON.stringify(
|
|
926
|
+
JSON.stringify(
|
|
927
|
+
bomJsonUnsignedObj,
|
|
928
|
+
null,
|
|
929
|
+
options.jsonPretty ? 2 : null,
|
|
930
|
+
),
|
|
904
931
|
);
|
|
905
932
|
thoughtLog(`Signing the BOM file "${jsonFile}".`);
|
|
906
933
|
if (publicKeyFile) {
|
|
@@ -937,7 +964,9 @@ const checkPermissions = (filePath, options) => {
|
|
|
937
964
|
}
|
|
938
965
|
} else if (!options.print) {
|
|
939
966
|
if (bomNSData.bomJson) {
|
|
940
|
-
console.log(
|
|
967
|
+
console.log(
|
|
968
|
+
JSON.stringify(bomNSData.bomJson, null, options.jsonPretty ? 2 : null),
|
|
969
|
+
);
|
|
941
970
|
} else {
|
|
942
971
|
console.log("Unable to produce BOM for", filePath);
|
|
943
972
|
console.log("Try running the command with -t <type> or -r argument");
|
|
@@ -967,6 +996,7 @@ const checkPermissions = (filePath, options) => {
|
|
|
967
996
|
includeCrypto: options.includeCrypto,
|
|
968
997
|
specVersion: options.specVersion,
|
|
969
998
|
profile: options.profile,
|
|
999
|
+
jsonPretty: options.jsonPretty,
|
|
970
1000
|
};
|
|
971
1001
|
const dbObjMap = await evinserModule.prepareDB(evinseOptions);
|
|
972
1002
|
if (dbObjMap) {
|
|
@@ -1003,6 +1033,7 @@ const checkPermissions = (filePath, options) => {
|
|
|
1003
1033
|
await submitBom(options, bomNSData.bomJson);
|
|
1004
1034
|
} catch (err) {
|
|
1005
1035
|
console.log(err);
|
|
1036
|
+
process.exit(1);
|
|
1006
1037
|
}
|
|
1007
1038
|
}
|
|
1008
1039
|
// Protobuf serialization
|
package/bin/evinse.js
CHANGED
|
@@ -73,6 +73,7 @@ const args = yargs(hideBin(process.argv))
|
|
|
73
73
|
"swift",
|
|
74
74
|
"ios",
|
|
75
75
|
"ruby",
|
|
76
|
+
"scala",
|
|
76
77
|
],
|
|
77
78
|
})
|
|
78
79
|
.option("db-path", {
|
|
@@ -127,7 +128,10 @@ const args = yargs(hideBin(process.argv))
|
|
|
127
128
|
.option("semantics-slices-file", {
|
|
128
129
|
description: "Use an existing semantics slices file.",
|
|
129
130
|
default: "semantics.slices.json",
|
|
130
|
-
|
|
131
|
+
})
|
|
132
|
+
.option("openapi-spec-file", {
|
|
133
|
+
description: "Use an existing openapi specification file (SaaSBOM).",
|
|
134
|
+
default: "openapi.json",
|
|
131
135
|
})
|
|
132
136
|
.option("print", {
|
|
133
137
|
alias: "p",
|
package/data/component-tags.json
CHANGED
|
@@ -320,8 +320,8 @@
|
|
|
320
320
|
{
|
|
321
321
|
"browser": [
|
|
322
322
|
"^(edge)",
|
|
323
|
-
"(firefox|chrome|opera|brave|mullvad|tor|chromium)",
|
|
324
|
-
"(microsoft+edge|microsoft+edge+webview2|microsoft+html)"
|
|
323
|
+
"^(firefox|chrome|opera|brave|mullvad|tor|chromium)",
|
|
324
|
+
"^(microsoft+edge|microsoft+edge+webview2|microsoft+html)"
|
|
325
325
|
]
|
|
326
326
|
},
|
|
327
327
|
{
|