@cdxgen/cdxgen 13.4.0 → 13.5.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 +7 -7
- package/bin/cdxgen-secure.js +15 -0
- package/bin/cdxgen.js +25 -5
- package/bin/evinse.js +5 -0
- package/bin/hbom.js +15 -7
- package/bin/repl.js +29 -0
- package/data/cbomosdb-queries.json +13 -1
- package/data/component-tags.json +8 -0
- package/data/queries-darwin.json +25 -1
- package/data/queries-win.json +19 -1
- package/data/queries.json +41 -0
- package/data/remediations.json +283 -1
- package/data/rules/cbom-security.yaml +235 -4
- package/data/rules/go-binaries.yaml +46 -0
- package/data/rules/golem-go.yaml +80 -0
- package/data/rules/hbom-compliance.yaml +40 -22
- package/data/rules/hbom-performance.yaml +7 -1
- package/data/rules/host-topology.yaml +1 -1
- package/data/rules/obom-runtime.yaml +31 -2
- package/data/rules/php-runtime.yaml +143 -0
- package/lib/audit/index.js +14 -0
- package/lib/cli/bomAssembly.js +28 -3
- package/lib/cli/cliOptions.js +110 -3
- package/lib/cli/index.js +73 -4
- package/lib/cli/jvmBom.js +126 -20
- package/lib/cli/managedBom.js +711 -71
- package/lib/cli/nativeBom.js +225 -28
- package/lib/core/env.js +30 -8
- package/lib/core/fs.js +28 -19
- package/lib/core/httpClient.js +74 -45
- package/lib/core/projectConfig.js +1 -0
- package/lib/core/projectTooling.js +97 -0
- package/lib/core/propertySanitizer.js +72 -0
- package/lib/ecosystems/golem.js +550 -6
- package/lib/ecosystems/gradleutils.js +30 -20
- package/lib/ecosystems/parsers-dotnet.js +117 -18
- package/lib/ecosystems/parsers-go.js +1090 -367
- package/lib/ecosystems/parsers-jvm.js +259 -17
- package/lib/ecosystems/parsers-misc.js +229 -44
- package/lib/ecosystems/parsers-python.js +11 -10
- package/lib/ecosystems/rubyutils.js +6 -3
- package/lib/ecosystems/rusi.js +10 -0
- package/lib/ecosystems/scalacliutils.js +2 -1
- package/lib/ecosystems/scalasem.js +3 -1
- package/lib/evinser/evinser.js +126 -18
- package/lib/evinser/swiftsem.js +68 -5
- package/lib/inventory/agentSkillSpec.js +17 -0
- package/lib/inventory/apkInstalledDb.js +243 -0
- package/lib/inventory/atomUtils.js +33 -0
- package/lib/inventory/auditCategories.js +3 -3
- package/lib/inventory/cacheDir.js +52 -9
- package/lib/inventory/certificates.js +2371 -0
- package/lib/inventory/communityAiConfigParser.js +4 -9
- package/lib/inventory/deps.js +6 -4
- package/lib/inventory/display.js +200 -3
- package/lib/inventory/dosai.js +500 -58
- package/lib/inventory/dynamic.js +45 -3
- package/lib/inventory/envcontext.js +168 -5
- package/lib/inventory/evidenceUtils.js +436 -23
- package/lib/inventory/formulationParsers.js +3 -2
- package/lib/inventory/goBuildInfo.js +140 -0
- package/lib/inventory/hbom.js +67 -7
- package/lib/inventory/hbomAnalysis.js +16 -0
- package/lib/inventory/hostTopology.js +21 -0
- package/lib/inventory/osPackagePurl.js +244 -0
- package/lib/inventory/osPackageResolver.js +89 -87
- package/lib/inventory/osinfo.js +79 -31
- package/lib/inventory/osqueryTransform.js +114 -5
- package/lib/inventory/phpBuildInfo.js +487 -0
- package/lib/inventory/phpHostProbe.js +641 -0
- package/lib/inventory/rootfsCerts.js +426 -0
- package/lib/inventory/source.js +207 -3
- package/lib/inventory/spdx.js +144 -0
- package/lib/inventory/traceRunner.js +5 -1
- package/lib/inventory/tracedCrypto.js +129 -0
- package/lib/managers/binary.js +529 -183
- package/lib/managers/docker.js +166 -12
- package/lib/parsers/email.js +277 -0
- package/lib/parsers/largeJson.js +34 -2
- package/lib/server/server.js +186 -1
- package/lib/stages/postgen/annotator.js +17 -1
- package/lib/stages/postgen/introspection/reflect.js +4 -1
- package/lib/stages/postgen/postgen.js +5 -5
- package/lib/stages/postgen/ruleEngine.js +58 -1
- package/lib/stages/postgen/specVersionCompat.js +30 -0
- package/lib/stages/pregen/pregen.js +117 -5
- package/lib/validator/bomValidator.js +26 -5
- package/lib/validator/generated/runtime.mjs +13 -0
- package/lib/validator/generated/validate-1.6.mjs +26 -7
- package/lib/validator/generated/validate-1.7.mjs +31 -12
- package/lib/validator/generated/validate-2.0.mjs +30 -11
- package/package.json +17 -17
- package/types/bin/cdxgen-secure.d.ts +3 -0
- package/types/bin/cdxgen-secure.d.ts.map +1 -0
- package/types/bin/repl.d.ts.map +1 -1
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts +9 -2
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +43 -0
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jvmBom.d.ts +20 -0
- package/types/lib/cli/jvmBom.d.ts.map +1 -1
- package/types/lib/cli/managedBom.d.ts.map +1 -1
- package/types/lib/cli/nativeBom.d.ts.map +1 -1
- package/types/lib/core/env.d.ts +18 -2
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/httpClient.d.ts.map +1 -1
- package/types/lib/core/projectConfig.d.ts.map +1 -1
- package/types/lib/core/projectTooling.d.ts +41 -0
- package/types/lib/core/projectTooling.d.ts.map +1 -0
- package/types/lib/core/propertySanitizer.d.ts +26 -0
- package/types/lib/core/propertySanitizer.d.ts.map +1 -1
- package/types/lib/ecosystems/cppEvidence.d.ts +1 -1
- package/types/lib/ecosystems/golem.d.ts +81 -1
- package/types/lib/ecosystems/golem.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +10 -8
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-dotnet.d.ts +40 -4
- package/types/lib/ecosystems/parsers-dotnet.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-go.d.ts +85 -13
- package/types/lib/ecosystems/parsers-go.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-jvm.d.ts +28 -2
- package/types/lib/ecosystems/parsers-jvm.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts +18 -58
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts +4 -3
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/pythonutils.d.ts +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rusi.d.ts.map +1 -1
- package/types/lib/ecosystems/scalacliutils.d.ts.map +1 -1
- package/types/lib/ecosystems/scalasem.d.ts.map +1 -1
- package/types/lib/evinser/evinser.d.ts +25 -0
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/evinser/swiftsem.d.ts +10 -0
- package/types/lib/evinser/swiftsem.d.ts.map +1 -1
- package/types/lib/inventory/agentSkillSpec.d.ts +13 -0
- package/types/lib/inventory/agentSkillSpec.d.ts.map +1 -0
- package/types/lib/inventory/apkInstalledDb.d.ts +42 -0
- package/types/lib/inventory/apkInstalledDb.d.ts.map +1 -0
- package/types/lib/inventory/atomUtils.d.ts +14 -0
- package/types/lib/inventory/atomUtils.d.ts.map +1 -1
- package/types/lib/inventory/cacheDir.d.ts +12 -4
- package/types/lib/inventory/cacheDir.d.ts.map +1 -1
- package/types/lib/inventory/certificates.d.ts +205 -0
- package/types/lib/inventory/certificates.d.ts.map +1 -0
- package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
- package/types/lib/inventory/deps.d.ts +2 -1
- package/types/lib/inventory/deps.d.ts.map +1 -1
- package/types/lib/inventory/display.d.ts +18 -0
- package/types/lib/inventory/display.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +145 -6
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/dynamic.d.ts +6 -1
- package/types/lib/inventory/dynamic.d.ts.map +1 -1
- package/types/lib/inventory/envcontext.d.ts +40 -2
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/evidenceUtils.d.ts +29 -10
- package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
- package/types/lib/inventory/formulationParsers.d.ts.map +1 -1
- package/types/lib/inventory/goBuildInfo.d.ts +10 -0
- package/types/lib/inventory/goBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/hbom.d.ts.map +1 -1
- package/types/lib/inventory/hbomAnalysis.d.ts +10 -0
- package/types/lib/inventory/hbomAnalysis.d.ts.map +1 -1
- package/types/lib/inventory/hostTopology.d.ts.map +1 -1
- package/types/lib/inventory/osPackagePurl.d.ts +99 -0
- package/types/lib/inventory/osPackagePurl.d.ts.map +1 -0
- package/types/lib/inventory/osPackageResolver.d.ts +6 -2
- package/types/lib/inventory/osPackageResolver.d.ts.map +1 -1
- package/types/lib/inventory/osinfo.d.ts +31 -6
- package/types/lib/inventory/osinfo.d.ts.map +1 -1
- package/types/lib/inventory/osqueryTransform.d.ts +51 -0
- package/types/lib/inventory/osqueryTransform.d.ts.map +1 -1
- package/types/lib/inventory/phpBuildInfo.d.ts +142 -0
- package/types/lib/inventory/phpBuildInfo.d.ts.map +1 -0
- package/types/lib/inventory/phpHostProbe.d.ts +35 -0
- package/types/lib/inventory/phpHostProbe.d.ts.map +1 -0
- package/types/lib/inventory/rootfsCerts.d.ts +27 -0
- package/types/lib/inventory/rootfsCerts.d.ts.map +1 -0
- package/types/lib/inventory/source.d.ts +28 -0
- package/types/lib/inventory/source.d.ts.map +1 -1
- package/types/lib/inventory/spdx.d.ts +15 -0
- package/types/lib/inventory/spdx.d.ts.map +1 -1
- package/types/lib/inventory/traceRunner.d.ts +4 -1
- package/types/lib/inventory/traceRunner.d.ts.map +1 -1
- package/types/lib/inventory/tracedCrypto.d.ts +22 -0
- package/types/lib/inventory/tracedCrypto.d.ts.map +1 -1
- package/types/lib/managers/binary.d.ts +10 -0
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts +12 -0
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/parsers/email.d.ts +19 -0
- package/types/lib/parsers/email.d.ts.map +1 -0
- package/types/lib/parsers/largeJson.d.ts +13 -0
- package/types/lib/parsers/largeJson.d.ts.map +1 -1
- package/types/lib/server/server.d.ts +8 -0
- 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/introspection/reflect.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts +7 -4
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/postgen/specVersionCompat.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +14 -1
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { shouldRunPredictiveBomAudit } from "../core/env.js";
|
|
1
|
+
import { getCommandName, shouldRunPredictiveBomAudit } from "../core/env.js";
|
|
2
2
|
|
|
3
3
|
/** Frozen list of hardware-bill-of-materials (HBOM) audit categories. */
|
|
4
4
|
export const HBOM_AUDIT_CATEGORIES = Object.freeze([
|
|
@@ -186,11 +186,11 @@ export function validateBomAuditCategories(categories, rules) {
|
|
|
186
186
|
* @returns {string | undefined} Default category string, if any
|
|
187
187
|
*/
|
|
188
188
|
export function getDefaultBomAuditCategories(options, commandPath) {
|
|
189
|
-
const
|
|
189
|
+
const commandName = getCommandName(commandPath);
|
|
190
190
|
const defaultHbomCategories = options?.includeRuntime
|
|
191
191
|
? `${DEFAULT_HBOM_AUDIT_CATEGORIES},host-topology`
|
|
192
192
|
: DEFAULT_HBOM_AUDIT_CATEGORIES;
|
|
193
|
-
if (
|
|
193
|
+
if (commandName.startsWith("hbom")) {
|
|
194
194
|
return defaultHbomCategories;
|
|
195
195
|
}
|
|
196
196
|
const projectTypes = Array.isArray(options?.projectType)
|
|
@@ -28,13 +28,21 @@ import { isMac, isWin } from "../core/paths.js";
|
|
|
28
28
|
* rather than reading `isWin`/`isMac` here, or the Windows and Linux branches
|
|
29
29
|
* become untestable on a macOS developer machine.
|
|
30
30
|
*
|
|
31
|
+
* Every environment-derived root must be absolute by the *target* platform's
|
|
32
|
+
* rules, never the host's (`path.isAbsolute` would accept `\cache` on a
|
|
33
|
+
* Windows host): a relative value is ignored, so it cannot point inside the
|
|
34
|
+
* working directory. XDG requires this of `XDG_CACHE_HOME`; the home and
|
|
35
|
+
* `LOCALAPPDATA` roots get the same treatment for the same reason.
|
|
36
|
+
*
|
|
31
37
|
* @param {Object} inputs Resolution inputs.
|
|
32
38
|
* @param {"linux"|"macos"|"windows"} inputs.platform Which convention to apply.
|
|
33
|
-
* @param {string} [inputs.cdxgenCacheDir] `CDXGEN_CACHE_DIR
|
|
39
|
+
* @param {string} [inputs.cdxgenCacheDir] `CDXGEN_CACHE_DIR`, an explicit
|
|
40
|
+
* override taken as given.
|
|
34
41
|
* @param {string} [inputs.xdgCacheHome] `XDG_CACHE_HOME`. Ignored unless
|
|
35
|
-
*
|
|
36
|
-
* @param {string} [inputs.home] Home directory.
|
|
37
|
-
* @param {string} [inputs.localAppData] `LOCALAPPDATA`.
|
|
42
|
+
* `/`-rooted.
|
|
43
|
+
* @param {string} [inputs.home] Home directory. Ignored unless absolute.
|
|
44
|
+
* @param {string} [inputs.localAppData] `LOCALAPPDATA`. Ignored unless drive-
|
|
45
|
+
* or UNC-rooted; the home profile is the fallback.
|
|
38
46
|
* @returns {string|null} Absolute path, or null when nothing resolves.
|
|
39
47
|
*/
|
|
40
48
|
export function resolveCacheDirFor({
|
|
@@ -48,20 +56,55 @@ export function resolveCacheDirFor({
|
|
|
48
56
|
return path.resolve(cdxgenCacheDir);
|
|
49
57
|
}
|
|
50
58
|
if (platform === "windows") {
|
|
51
|
-
if (localAppData
|
|
59
|
+
if (isWindowsAbsolute(localAppData)) {
|
|
52
60
|
return path.join(localAppData, "cdxgen", "cache");
|
|
53
61
|
}
|
|
54
|
-
return home
|
|
62
|
+
return isWindowsAbsolute(home)
|
|
55
63
|
? path.join(home, "AppData", "Local", "cdxgen", "cache")
|
|
56
64
|
: null;
|
|
57
65
|
}
|
|
58
66
|
if (platform === "macos") {
|
|
59
|
-
return
|
|
67
|
+
return isPosixAbsolute(home)
|
|
68
|
+
? path.join(home, "Library", "Caches", "cdxgen")
|
|
69
|
+
: null;
|
|
60
70
|
}
|
|
61
|
-
if (
|
|
71
|
+
if (isPosixAbsolute(xdgCacheHome)) {
|
|
62
72
|
return path.join(xdgCacheHome, "cdxgen");
|
|
63
73
|
}
|
|
64
|
-
return home
|
|
74
|
+
return isPosixAbsolute(home) ? path.join(home, ".cache", "cdxgen") : null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Absolute by POSIX rules: `/`-rooted.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} [value] Candidate path
|
|
81
|
+
* @returns {boolean} Whether the path is absolute
|
|
82
|
+
*/
|
|
83
|
+
function isPosixAbsolute(value) {
|
|
84
|
+
return typeof value === "string" && value.startsWith("/");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Absolute by Windows rules: a drive letter followed by a separator (`C:\` or
|
|
89
|
+
* `C:/`), or a UNC path (`\\server\share`). `C:cache` (relative to the drive's
|
|
90
|
+
* current directory) and `\cache` (relative to the current drive) are not.
|
|
91
|
+
* Mirrors `is_windows_absolute` in cdxrs.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} [value] Candidate path
|
|
94
|
+
* @returns {boolean} Whether the path is absolute
|
|
95
|
+
*/
|
|
96
|
+
function isWindowsAbsolute(value) {
|
|
97
|
+
if (typeof value !== "string" || value.length < 3) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
const isSeparator = (char) => char === "\\" || char === "/";
|
|
101
|
+
const driveRooted = /^[a-zA-Z]$/.test(value[0]) && value[1] === ":";
|
|
102
|
+
if (driveRooted) {
|
|
103
|
+
return isSeparator(value[2]);
|
|
104
|
+
}
|
|
105
|
+
return (
|
|
106
|
+
isSeparator(value[0]) && isSeparator(value[1]) && !isSeparator(value[2])
|
|
107
|
+
);
|
|
65
108
|
}
|
|
66
109
|
|
|
67
110
|
/**
|