@cyclonedx/cdxgen 11.4.4 → 11.6.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.
- package/README.md +68 -64
- package/bin/cdxgen.js +31 -9
- package/lib/cli/index.js +336 -99
- package/lib/evinser/evinser.js +3 -0
- package/lib/evinser/{evinser.test.js → evinser.poku.js} +51 -33
- package/lib/evinser/{swiftsem.test.js → swiftsem.poku.js} +46 -45
- package/lib/helpers/cbomutils.poku.js +8 -0
- package/lib/helpers/{display.test.js → display.poku.js} +2 -2
- package/lib/helpers/dotnetutils.js +132 -0
- package/lib/helpers/dotnetutils.poku.js +429 -0
- package/lib/helpers/envcontext.js +20 -18
- package/lib/helpers/{envcontext.test.js → envcontext.poku.js} +24 -24
- package/lib/helpers/logger.js +0 -2
- package/lib/helpers/{protobom.test.js → protobom.poku.js} +12 -10
- package/lib/helpers/utils.js +853 -88
- package/lib/helpers/{utils.test.js → utils.poku.js} +1999 -1349
- package/lib/helpers/validator.js +10 -0
- package/lib/managers/binary.js +89 -11
- package/lib/managers/docker.js +47 -37
- package/lib/managers/{docker.test.js → docker.poku.js} +70 -59
- package/lib/parsers/iri.js +504 -0
- package/lib/parsers/iri.poku.js +406 -0
- package/lib/server/server.js +130 -7
- package/lib/server/server.poku.js +387 -0
- package/lib/stages/postgen/{annotator.test.js → annotator.poku.js} +11 -14
- package/lib/stages/postgen/{postgen.test.js → postgen.poku.js} +15 -15
- package/package.json +34 -16
- package/types/cli/index.d.ts +295 -0
- package/types/cli/index.d.ts.map +1 -0
- package/types/evinser/scalasem.d.ts +6 -0
- package/types/evinser/scalasem.d.ts.map +1 -0
- package/types/evinser/swiftsem.d.ts +103 -0
- package/types/evinser/swiftsem.d.ts.map +1 -0
- package/types/helpers/analyzer.d.ts +5 -0
- package/types/helpers/analyzer.d.ts.map +1 -0
- package/types/helpers/cbomutils.d.ts +15 -0
- package/types/helpers/cbomutils.d.ts.map +1 -0
- package/types/helpers/db.d.ts +19 -0
- package/types/helpers/db.d.ts.map +1 -0
- package/types/helpers/display.d.ts +12 -0
- package/types/helpers/display.d.ts.map +1 -0
- package/types/helpers/dotnetutils.d.ts +45 -0
- package/types/helpers/dotnetutils.d.ts.map +1 -0
- package/types/helpers/envcontext.d.ts +264 -0
- package/types/helpers/envcontext.d.ts.map +1 -0
- package/types/helpers/logger.d.ts +12 -0
- package/types/helpers/logger.d.ts.map +1 -0
- package/types/helpers/protobom.d.ts +3 -0
- package/types/helpers/protobom.d.ts.map +1 -0
- package/types/helpers/utils.d.ts +1556 -0
- package/types/helpers/utils.d.ts.map +1 -0
- package/types/helpers/validator.d.ts +11 -0
- package/types/helpers/validator.d.ts.map +1 -0
- package/types/lib/cli/index.d.ts +8 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/evinser/evinser.d.ts +2 -1
- package/types/lib/helpers/dotnetutils.d.ts +45 -0
- package/types/lib/helpers/dotnetutils.d.ts.map +1 -0
- package/types/lib/helpers/envcontext.d.ts +3 -8
- package/types/lib/helpers/envcontext.d.ts.map +1 -1
- package/types/lib/helpers/logger.d.ts +0 -1
- package/types/lib/helpers/logger.d.ts.map +1 -1
- package/types/lib/helpers/utils.d.ts +68 -66
- 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.map +1 -1
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/server/server.d.ts +22 -2
- package/types/lib/server/server.d.ts.map +1 -1
- package/types/managers/binary.d.ts +37 -0
- package/types/managers/binary.d.ts.map +1 -0
- package/types/managers/docker.d.ts +56 -0
- package/types/managers/docker.d.ts.map +1 -0
- package/types/managers/oci.d.ts +2 -0
- package/types/managers/oci.d.ts.map +1 -0
- package/types/managers/piptree.d.ts +2 -0
- package/types/managers/piptree.d.ts.map +1 -0
- package/types/parsers/iri.d.ts +72 -0
- package/types/parsers/iri.d.ts.map +1 -0
- package/types/server/server.d.ts +34 -0
- package/types/server/server.d.ts.map +1 -0
- package/types/stages/postgen/annotator.d.ts +27 -0
- package/types/stages/postgen/annotator.d.ts.map +1 -0
- package/types/stages/postgen/postgen.d.ts +51 -0
- package/types/stages/postgen/postgen.d.ts.map +1 -0
- package/types/stages/pregen/pregen.d.ts +59 -0
- package/types/stages/pregen/pregen.d.ts.map +1 -0
- package/jest.config.js +0 -7
- package/lib/helpers/cbomutils.test.js +0 -8
- package/lib/server/server.test.js +0 -126
package/README.md
CHANGED
|
@@ -117,73 +117,76 @@ Commands:
|
|
|
117
117
|
cdxgen completion Generate bash/zsh completion
|
|
118
118
|
|
|
119
119
|
Options:
|
|
120
|
-
-o, --output
|
|
121
|
-
-t, --type
|
|
122
|
-
|
|
123
|
-
--exclude-type
|
|
124
|
-
|
|
125
|
-
-r, --recurse
|
|
120
|
+
-o, --output Output file. Default bom.json [default: "bom.json"]
|
|
121
|
+
-t, --type Project type. Please refer to https://cyclonedx.github.io/cdxgen/#/PROJECT_TYPES for s
|
|
122
|
+
upported languages/platforms. [array]
|
|
123
|
+
--exclude-type Project types to exclude. Please refer to https://cyclonedx.github.io/cdxgen/#/PROJECT
|
|
124
|
+
_TYPES for supported languages/platforms.
|
|
125
|
+
-r, --recurse Recurse mode suitable for mono-repos. Defaults to true. Pass --no-recurse to disable.
|
|
126
126
|
[boolean] [default: true]
|
|
127
|
-
-p, --print
|
|
128
|
-
-c, --resolve-class
|
|
129
|
-
--deep
|
|
130
|
-
|
|
131
|
-
--server-url
|
|
132
|
-
--skip-dt-tls-check
|
|
133
|
-
--api-key
|
|
134
|
-
--project-group
|
|
135
|
-
--project-name
|
|
136
|
-
--project-version
|
|
137
|
-
--project-id
|
|
138
|
-
|
|
139
|
-
--parent-project-id
|
|
140
|
-
--required-only
|
|
141
|
-
|
|
142
|
-
--fail-on-error
|
|
143
|
-
--no-babel
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
--server
|
|
148
|
-
--server-
|
|
149
|
-
--
|
|
150
|
-
|
|
127
|
+
-p, --print Print the SBOM as a table with tree. [boolean]
|
|
128
|
+
-c, --resolve-class Resolve class names for packages. jars only for now. [boolean]
|
|
129
|
+
--deep Perform deep searches for components. Useful while scanning C/C++ apps, live OS and oc
|
|
130
|
+
i images. [boolean]
|
|
131
|
+
--server-url Dependency track url. Eg: https://deptrack.cyclonedx.io
|
|
132
|
+
--skip-dt-tls-check Skip TLS certificate check when calling Dependency-Track. [boolean] [default: false]
|
|
133
|
+
--api-key Dependency track api key
|
|
134
|
+
--project-group Dependency track project group
|
|
135
|
+
--project-name Dependency track project name. Default use the directory name
|
|
136
|
+
--project-version Dependency track project version [string] [default: ""]
|
|
137
|
+
--project-id Dependency track project id. Either provide the id or the project name and version tog
|
|
138
|
+
ether [string]
|
|
139
|
+
--parent-project-id Dependency track parent project id [string]
|
|
140
|
+
--required-only Include only the packages with required scope on the SBOM. Would set compositions.aggr
|
|
141
|
+
egate to incomplete unless --no-auto-compositions is passed. [boolean]
|
|
142
|
+
--fail-on-error Fail if any dependency extractor fails. [boolean]
|
|
143
|
+
--no-babel Do not use babel to perform usage analysis for JavaScript/TypeScript projects.
|
|
144
|
+
[boolean]
|
|
145
|
+
--generate-key-and-sign Generate an RSA public/private key pair and then sign the generated SBOM using JSON We
|
|
146
|
+
b Signatures. [boolean]
|
|
147
|
+
--server Run cdxgen as a server [boolean]
|
|
148
|
+
--server-host Listen address [default: "127.0.0.1"]
|
|
149
|
+
--server-port Listen port [default: "9090"]
|
|
150
|
+
--install-deps Install dependencies automatically for some projects. Defaults to true but disabled fo
|
|
151
|
+
r containers and oci scans. Use --no-install-deps to disable this feature.
|
|
151
152
|
[boolean] [default: true]
|
|
152
|
-
--validate
|
|
153
|
-
|
|
154
|
-
--evidence
|
|
155
|
-
--spec-version
|
|
156
|
-
|
|
157
|
-
--filter
|
|
158
|
-
|
|
159
|
-
--only
|
|
160
|
-
|
|
161
|
-
--author
|
|
162
|
-
|
|
163
|
-
--profile
|
|
153
|
+
--validate Validate the generated SBOM using json schema. Defaults to true. Pass --no-validate to
|
|
154
|
+
disable. [boolean] [default: true]
|
|
155
|
+
--evidence Generate SBOM with evidence for supported languages. [boolean] [default: false]
|
|
156
|
+
--spec-version CycloneDX Specification version to use. Defaults to 1.6
|
|
157
|
+
[number] [choices: 1.4, 1.5, 1.6, 1.7] [default: 1.6]
|
|
158
|
+
--filter Filter components containing this word in purl or component.properties.value. Multiple
|
|
159
|
+
values allowed. [array]
|
|
160
|
+
--only Include components only containing this word in purl. Useful to generate BOM with firs
|
|
161
|
+
t party components alone. Multiple values allowed. [array]
|
|
162
|
+
--author The person(s) who created the BOM. Set this value if you're intending the modify the B
|
|
163
|
+
OM and claim authorship. [array] [default: "OWASP Foundation"]
|
|
164
|
+
--profile BOM profile to use for generation. Default generic.
|
|
164
165
|
[choices: "appsec", "research", "operational", "threat-modeling", "license-compliance", "generic", "machine-learning",
|
|
165
166
|
"ml", "deep-learning", "ml-deep", "ml-tiny"] [default: "generic"]
|
|
166
|
-
--
|
|
167
|
-
|
|
168
|
-
--
|
|
169
|
-
--
|
|
167
|
+
--include-regex glob pattern to include. This overrides the default pattern used during auto-detection
|
|
168
|
+
. [string]
|
|
169
|
+
--exclude, --exclude-regex Additional glob pattern(s) to ignore [array]
|
|
170
|
+
--export-proto Serialize and export BOM as protobuf binary. [boolean] [default: false]
|
|
171
|
+
--proto-bin-file Path for the serialized protobuf binary. [default: "bom.cdx"]
|
|
172
|
+
--include-formulation Generate formulation section with git metadata and build tools. Defaults to false.
|
|
170
173
|
[boolean] [default: false]
|
|
171
|
-
--include-crypto
|
|
172
|
-
--standard
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
--include-crypto Include crypto libraries as components. [boolean] [default: false]
|
|
175
|
+
--standard The list of standards which may consist of regulations, industry or organizational-spe
|
|
176
|
+
cific standards, maturity models, best practices, or any other requirements which can
|
|
177
|
+
be evaluated against or attested to.
|
|
175
178
|
[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
|
|
176
179
|
s-1.0.0", "ssaf-DRAFT-2023-11"]
|
|
177
|
-
--json-pretty
|
|
178
|
-
--min-confidence
|
|
179
|
-
|
|
180
|
-
--technique
|
|
180
|
+
--json-pretty Pretty-print the generated BOM json. [boolean] [default: false]
|
|
181
|
+
--min-confidence Minimum confidence needed for the identity of a component from 0 - 1, where 1 is 100%
|
|
182
|
+
confidence. [number] [default: 0]
|
|
183
|
+
--technique Analysis technique to use
|
|
181
184
|
[array] [choices: "auto", "source-code-analysis", "binary-analysis", "manifest-analysis", "hash-comparison", "instrume
|
|
182
185
|
ntation", "filename"]
|
|
183
|
-
--auto-compositions
|
|
186
|
+
--auto-compositions Automatically set compositions when the BOM was filtered. Defaults to true
|
|
184
187
|
[boolean] [default: true]
|
|
185
|
-
-h, --help
|
|
186
|
-
-v, --version
|
|
188
|
+
-h, --help Show help [boolean]
|
|
189
|
+
-v, --version Show version number [boolean]
|
|
187
190
|
```
|
|
188
191
|
|
|
189
192
|
All boolean arguments accept `--no` prefix to toggle the behavior.
|
|
@@ -214,14 +217,11 @@ To recursively generate a single BOM for all languages pass `-r` argument.
|
|
|
214
217
|
cdxgen -r -o bom.json
|
|
215
218
|
```
|
|
216
219
|
|
|
217
|
-
The default specification used by cdxgen is 1.
|
|
220
|
+
The default specification used by cdxgen is 1.6. To generate BOM for a different specification version, such as 1.5 or 1.4, pass the version number using the `--spec-version` argument.
|
|
218
221
|
|
|
219
222
|
```shell
|
|
220
|
-
# 1.
|
|
221
|
-
cdxgen -r -o bom.json --spec-version 1.
|
|
222
|
-
|
|
223
|
-
# 1.4 is supported by most tools
|
|
224
|
-
cdxgen -r -o bom.json --spec-version 1.4
|
|
223
|
+
# 1.5 is supported by most tools
|
|
224
|
+
cdxgen -r -o bom.json --spec-version 1.5
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
To generate SBOM for C or Python, ensure Java >= 21 is installed.
|
|
@@ -543,7 +543,11 @@ cdxgen --help
|
|
|
543
543
|
|
|
544
544
|
## Sponsors
|
|
545
545
|
|
|
546
|
-
<
|
|
546
|
+
<div style="display: flex; align-items: center; gap: 20px;">
|
|
547
|
+
<img src="./docs/_media/LevoLogo-LightBg.jpg" width="200" height="auto">
|
|
548
|
+
<img src="./docs/_media/GithubLogo-LightBg.png" width="170" height="auto">
|
|
549
|
+
<img src="./docs/_media/MicrosoftLogo.png" width="180" height="auto">
|
|
550
|
+
</div>
|
|
547
551
|
|
|
548
552
|
<!-- LINK LABELS -->
|
|
549
553
|
<!-- Badges -->
|
package/bin/cdxgen.js
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
commandsExecuted,
|
|
30
30
|
DEBUG_MODE,
|
|
31
31
|
dirNameStr,
|
|
32
|
+
getRuntimeInformation,
|
|
32
33
|
getTmpDir,
|
|
33
34
|
isMac,
|
|
34
35
|
isSecureMode,
|
|
@@ -66,7 +67,9 @@ for (const configPattern of configPaths) {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
const
|
|
70
|
+
const _yargs = yargs(hideBin(process.argv));
|
|
71
|
+
|
|
72
|
+
const args = _yargs
|
|
70
73
|
.env("CDXGEN")
|
|
71
74
|
.parserConfiguration({
|
|
72
75
|
"greedy-arrays": false,
|
|
@@ -261,8 +264,15 @@ const args = yargs(hideBin(process.argv))
|
|
|
261
264
|
hidden: true,
|
|
262
265
|
choices: ["pre-build", "build", "post-build"],
|
|
263
266
|
})
|
|
267
|
+
.option("include-regex", {
|
|
268
|
+
description:
|
|
269
|
+
"glob pattern to include. This overrides the default pattern used during auto-detection.",
|
|
270
|
+
type: "string",
|
|
271
|
+
})
|
|
264
272
|
.option("exclude", {
|
|
273
|
+
alias: "exclude-regex",
|
|
265
274
|
description: "Additional glob pattern(s) to ignore",
|
|
275
|
+
type: "array",
|
|
266
276
|
})
|
|
267
277
|
.option("export-proto", {
|
|
268
278
|
type: "boolean",
|
|
@@ -346,7 +356,6 @@ const args = yargs(hideBin(process.argv))
|
|
|
346
356
|
.array("filter")
|
|
347
357
|
.array("only")
|
|
348
358
|
.array("author")
|
|
349
|
-
.array("exclude")
|
|
350
359
|
.array("standard")
|
|
351
360
|
.array("feature-flags")
|
|
352
361
|
.array("technique")
|
|
@@ -375,25 +384,36 @@ const args = yargs(hideBin(process.argv))
|
|
|
375
384
|
.epilogue("for documentation, visit https://cyclonedx.github.io/cdxgen")
|
|
376
385
|
.config(config)
|
|
377
386
|
.scriptName("cdxgen")
|
|
378
|
-
.version()
|
|
387
|
+
.version(version())
|
|
379
388
|
.alias("v", "version")
|
|
380
|
-
.help(
|
|
381
|
-
.
|
|
389
|
+
.help(false)
|
|
390
|
+
.option("help", {
|
|
391
|
+
alias: "h",
|
|
392
|
+
type: "boolean",
|
|
393
|
+
description: "Show help",
|
|
394
|
+
})
|
|
382
395
|
.wrap(Math.min(120, yargs().terminalWidth())).argv;
|
|
383
396
|
|
|
384
397
|
if (process.env?.CDXGEN_NODE_OPTIONS) {
|
|
385
398
|
process.env.NODE_OPTIONS = `${process.env.NODE_OPTIONS || ""} ${process.env.CDXGEN_NODE_OPTIONS}`;
|
|
386
399
|
}
|
|
387
400
|
|
|
388
|
-
if (args.
|
|
401
|
+
if (args.help) {
|
|
402
|
+
console.log(`${version()}\n`);
|
|
403
|
+
_yargs.showHelp();
|
|
404
|
+
process.exit(0);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function version() {
|
|
389
408
|
const packageJsonAsString = fs.readFileSync(
|
|
390
|
-
join(dirName, "
|
|
409
|
+
join(dirName, "package.json"),
|
|
391
410
|
"utf-8",
|
|
392
411
|
);
|
|
393
412
|
const packageJson = JSON.parse(packageJsonAsString);
|
|
394
413
|
|
|
395
|
-
|
|
396
|
-
|
|
414
|
+
const runtimeInfo = getRuntimeInformation();
|
|
415
|
+
|
|
416
|
+
return `\x1b[1mCycloneDX Generator ${packageJson.version}\x1b[0m\nRuntime: ${runtimeInfo.runtime}, Version: ${runtimeInfo.version}`;
|
|
397
417
|
}
|
|
398
418
|
|
|
399
419
|
if (process.env.GLOBAL_AGENT_HTTP_PROXY || process.env.HTTP_PROXY) {
|
|
@@ -447,6 +467,8 @@ const options = Object.assign({}, args, {
|
|
|
447
467
|
isSecureMode && args.output === "bom.json"
|
|
448
468
|
? resolve(join(filePath, args.output))
|
|
449
469
|
: args.output,
|
|
470
|
+
exclude: args.exclude || args.excludeRegex,
|
|
471
|
+
include: args.include || args.includeRegex,
|
|
450
472
|
});
|
|
451
473
|
// Should we create the output directory?
|
|
452
474
|
const outputDirectory = dirname(options.output);
|