@cdxgen/cdxgen 13.0.0 → 13.1.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 +26 -13
- package/bin/audit.js +6 -0
- package/bin/cdxgen.js +140 -8
- package/bin/convert.js +7 -0
- package/bin/evinse.js +1 -1
- package/bin/hbom.js +13 -4
- package/bin/tracebom.js +9 -1
- package/data/component-tags.json +8 -1
- package/data/frameworks-list.json +86 -1
- package/data/remediations.json +1144 -0
- package/data/rules/asar-archives.yaml +1 -1
- package/data/rules/build-fidelity.yaml +782 -0
- package/data/rules/package-integrity.yaml +13 -13
- package/lib/audit/index.js +48 -4
- package/lib/audit/scoring.js +2 -8
- package/lib/cli/bomAssembly.js +83 -15
- package/lib/cli/cliOptions.js +124 -7
- package/lib/cli/index.js +76 -48
- package/lib/cli/jsBom.js +32 -3
- package/lib/cli/jvmBom.js +1494 -1315
- package/lib/cli/managedBom.js +97 -28
- package/lib/cli/nativeBom.js +189 -10
- package/lib/core/buildLedger.js +799 -0
- package/lib/core/deferredExit.js +141 -0
- package/lib/core/env.js +69 -1
- package/lib/core/fs.js +60 -0
- package/lib/core/logger.js +76 -25
- package/lib/core/severity.js +16 -0
- package/lib/core/syncFileWriter.js +106 -0
- package/lib/core/ui.js +46 -2
- package/lib/ecosystems/ecosystems.js +9 -0
- package/lib/ecosystems/gradleutils.js +355 -15
- package/lib/ecosystems/parsers-js.js +26 -0
- package/lib/ecosystems/parsers-jvm.js +9 -0
- package/lib/ecosystems/parsers-misc.js +16 -2
- package/lib/ecosystems/parsers-python.js +171 -35
- package/lib/ecosystems/parsers-rust.js +12 -2
- package/lib/ecosystems/pypiClassifiers.js +326 -0
- package/lib/ecosystems/pythonutils.js +49 -1
- package/lib/ecosystems/rubyutils.js +13 -0
- package/lib/ecosystems/utils.js +9 -1
- package/lib/evinser/evinser.js +30 -12
- package/lib/helpers/remote/dependency-track.js +81 -14
- package/lib/inventory/auditCategories.js +9 -0
- package/lib/inventory/depsUtils.js +72 -0
- package/lib/inventory/dosai.js +431 -22
- package/lib/inventory/envcontext.js +211 -19
- package/lib/inventory/fetchBatch.js +57 -0
- package/lib/inventory/jvmToolEnv.js +593 -0
- package/lib/inventory/osinfo.js +123 -16
- package/lib/inventory/table.js +9 -5
- package/lib/inventory/toolRequirements.js +903 -0
- package/lib/managers/binary.js +216 -40
- package/lib/managers/docker.js +26 -5
- package/lib/server/server.js +1 -1
- package/lib/stages/postgen/annotationBuilder.js +97 -0
- package/lib/stages/postgen/auditBom.js +76 -79
- package/lib/stages/postgen/introspection/annotate.js +320 -0
- package/lib/stages/postgen/introspection/commandFacts.js +293 -0
- package/lib/stages/postgen/introspection/emit.js +192 -0
- package/lib/stages/postgen/introspection/formulationEvidence.js +427 -0
- package/lib/stages/postgen/introspection/markers.js +227 -0
- package/lib/stages/postgen/introspection/reflect.js +1214 -0
- package/lib/stages/postgen/introspection/report.js +1208 -0
- package/lib/stages/postgen/introspection/score.js +1067 -0
- package/lib/stages/postgen/introspection/shapeCommand.js +304 -0
- package/lib/stages/postgen/parentEdge.js +156 -0
- package/lib/stages/postgen/postgen.js +115 -2
- package/lib/stages/postgen/ruleEngine.js +17 -0
- package/lib/stages/pregen/envAudit.js +42 -2
- package/lib/stages/pregen/pregen.js +1171 -6
- package/lib/validator/bomValidator.js +11 -2
- package/package.json +14 -14
- package/types/lib/audit/index.d.ts.map +1 -1
- package/types/lib/audit/scoring.d.ts +2 -8
- package/types/lib/audit/scoring.d.ts.map +1 -1
- package/types/lib/cli/bomAssembly.d.ts +14 -0
- package/types/lib/cli/bomAssembly.d.ts.map +1 -1
- package/types/lib/cli/cliOptions.d.ts +2 -1
- package/types/lib/cli/cliOptions.d.ts.map +1 -1
- package/types/lib/cli/index.d.ts +8 -0
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/cli/jsBom.d.ts.map +1 -1
- 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/buildLedger.d.ts +272 -0
- package/types/lib/core/buildLedger.d.ts.map +1 -0
- package/types/lib/core/deferredExit.d.ts +84 -0
- package/types/lib/core/deferredExit.d.ts.map +1 -0
- package/types/lib/core/env.d.ts +22 -1
- package/types/lib/core/env.d.ts.map +1 -1
- package/types/lib/core/fs.d.ts +21 -0
- package/types/lib/core/fs.d.ts.map +1 -1
- package/types/lib/core/logger.d.ts +14 -1
- package/types/lib/core/logger.d.ts.map +1 -1
- package/types/lib/core/severity.d.ts +11 -0
- package/types/lib/core/severity.d.ts.map +1 -0
- package/types/lib/core/syncFileWriter.d.ts +33 -0
- package/types/lib/core/syncFileWriter.d.ts.map +1 -0
- package/types/lib/core/ui.d.ts +1 -1
- package/types/lib/core/ui.d.ts.map +1 -1
- package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
- package/types/lib/ecosystems/gradleutils.d.ts +33 -0
- package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-jvm.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
- package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
- package/types/lib/ecosystems/pypiClassifiers.d.ts +80 -0
- package/types/lib/ecosystems/pypiClassifiers.d.ts.map +1 -0
- package/types/lib/ecosystems/pythonutils.d.ts +20 -0
- package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
- package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
- package/types/lib/ecosystems/utils.d.ts +4 -4
- package/types/lib/ecosystems/utils.d.ts.map +1 -1
- package/types/lib/evinser/evinser.d.ts +5 -1
- package/types/lib/evinser/evinser.d.ts.map +1 -1
- package/types/lib/helpers/remote/dependency-track.d.ts +45 -4
- package/types/lib/helpers/remote/dependency-track.d.ts.map +1 -1
- package/types/lib/inventory/auditCategories.d.ts +8 -0
- package/types/lib/inventory/auditCategories.d.ts.map +1 -1
- package/types/lib/inventory/depsUtils.d.ts.map +1 -1
- package/types/lib/inventory/dosai.d.ts +20 -0
- package/types/lib/inventory/dosai.d.ts.map +1 -1
- package/types/lib/inventory/envcontext.d.ts.map +1 -1
- package/types/lib/inventory/fetchBatch.d.ts +9 -0
- package/types/lib/inventory/fetchBatch.d.ts.map +1 -1
- package/types/lib/inventory/jvmToolEnv.d.ts +189 -0
- package/types/lib/inventory/jvmToolEnv.d.ts.map +1 -0
- package/types/lib/inventory/osinfo.d.ts +83 -2
- package/types/lib/inventory/osinfo.d.ts.map +1 -1
- package/types/lib/inventory/table.d.ts +4 -1
- package/types/lib/inventory/table.d.ts.map +1 -1
- package/types/lib/inventory/toolRequirements.d.ts +216 -0
- package/types/lib/inventory/toolRequirements.d.ts.map +1 -0
- package/types/lib/managers/binary.d.ts +71 -0
- package/types/lib/managers/binary.d.ts.map +1 -1
- package/types/lib/managers/docker.d.ts.map +1 -1
- package/types/lib/stages/postgen/annotationBuilder.d.ts +53 -0
- package/types/lib/stages/postgen/annotationBuilder.d.ts.map +1 -0
- package/types/lib/stages/postgen/auditBom.d.ts.map +1 -1
- package/types/lib/stages/postgen/introspection/annotate.d.ts +81 -0
- package/types/lib/stages/postgen/introspection/annotate.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/commandFacts.d.ts +32 -0
- package/types/lib/stages/postgen/introspection/commandFacts.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/emit.d.ts +71 -0
- package/types/lib/stages/postgen/introspection/emit.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/formulationEvidence.d.ts +154 -0
- package/types/lib/stages/postgen/introspection/formulationEvidence.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/markers.d.ts +57 -0
- package/types/lib/stages/postgen/introspection/markers.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/reflect.d.ts +77 -0
- package/types/lib/stages/postgen/introspection/reflect.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/report.d.ts +85 -0
- package/types/lib/stages/postgen/introspection/report.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/score.d.ts +149 -0
- package/types/lib/stages/postgen/introspection/score.d.ts.map +1 -0
- package/types/lib/stages/postgen/introspection/shapeCommand.d.ts +79 -0
- package/types/lib/stages/postgen/introspection/shapeCommand.d.ts.map +1 -0
- package/types/lib/stages/postgen/parentEdge.d.ts +35 -0
- package/types/lib/stages/postgen/parentEdge.d.ts.map +1 -0
- package/types/lib/stages/postgen/postgen.d.ts +2 -2
- package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
- package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
- package/types/lib/stages/pregen/envAudit.d.ts.map +1 -1
- package/types/lib/stages/pregen/pregen.d.ts +131 -0
- package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
- package/types/lib/validator/bomValidator.d.ts.map +1 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the ecosystem a declared tool belongs to.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} tool Declared tool name
|
|
5
|
+
* @returns {string} cdxgen ecosystem name, or "generic" for unknown tools.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ecosystemForTool(tool: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Check whether a version identifier carries a prerelease suffix such as
|
|
10
|
+
* `-rc-3`, `-M2`, or `-milestone-1`. The marker list is exact so that vendor
|
|
11
|
+
* suffixes that merely begin with the same letters, such as the `-crac` java
|
|
12
|
+
* distributions, stay classified as stable.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} version Version identifier
|
|
15
|
+
* @returns {boolean} True for prerelease versions.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isPrereleaseVersion(version: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Compare two dotted version identifiers. Numeric components are compared
|
|
20
|
+
* numerically, stable releases rank above prereleases, and prerelease
|
|
21
|
+
* suffixes are compared token-wise so `rc-9` beats `rc-10` only when
|
|
22
|
+
* numerically larger. Missing components count as zero, so `21` equals
|
|
23
|
+
* `21.0.0`.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} a First version
|
|
26
|
+
* @param {string} b Second version
|
|
27
|
+
* @returns {number} Negative when a < b, positive when a > b, zero on equality.
|
|
28
|
+
*/
|
|
29
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
30
|
+
/**
|
|
31
|
+
* Extract the JDK major from a `java --version` style description such as
|
|
32
|
+
* `openjdk 21.0.11 2025-04-15` or a bare sdkman java identifier such as
|
|
33
|
+
* `25-tem`. General availability releases print an undotted major
|
|
34
|
+
* (`openjdk 25 2025-09-16`), so the first token starting with a digit is
|
|
35
|
+
* used rather than requiring a dotted version.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} versionDesc Version description string
|
|
38
|
+
* @returns {number|undefined} JDK major version.
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractJavaMajor(versionDesc: string): number | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Extract the first version-looking token from a tool version description,
|
|
43
|
+
* such as `go version go1.23.1 darwin/arm64` or `rustc 1.82.0 (f6e511eec
|
|
44
|
+
* 2024-10-08)`. Leading letters (`v20.11.1`, `go1.23.1`) and quoting are
|
|
45
|
+
* stripped before validation.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} versionDesc Raw version description
|
|
48
|
+
* @returns {string|undefined} The version token, when one is found.
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractVersionToken(versionDesc: string): string | undefined;
|
|
51
|
+
export type RequirementVerdict = "satisfied" | "violated" | "unparseable";
|
|
52
|
+
/**
|
|
53
|
+
* Verdict of a declared-requirement check. `unparseable` means the wanted or
|
|
54
|
+
* found value carries no comparable version, which is never evidence of a
|
|
55
|
+
* defect: an unparseable requirement must not produce a mismatch.
|
|
56
|
+
*
|
|
57
|
+
* @typedef {"satisfied"|"violated"|"unparseable"} RequirementVerdict
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Check whether a found version satisfies a declared requirement. Wanted
|
|
61
|
+
* forms handled: exact versions (`3.9.9`), major-only and partial pins
|
|
62
|
+
* (`21`, `20.11`), `.x` ranges (`20.x`), caret and tilde ranges (`^20.11`,
|
|
63
|
+
* `~4.9`), comparison ranges (`>=18`, `<21`), hyphen ranges (`1.9 - 2.3`),
|
|
64
|
+
* whitespace-conjoined ranges (`>=18 <=20`), `||` alternatives, and the
|
|
65
|
+
* unconstrained `*`/`latest`. Anything else is unparseable and never
|
|
66
|
+
* violates.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} found Version actually present, possibly embedded in a
|
|
69
|
+
* longer description such as `go version go1.23.1 darwin/arm64`.
|
|
70
|
+
* @param {string} wanted Declared requirement.
|
|
71
|
+
* @returns {RequirementVerdict} Verdict of the check.
|
|
72
|
+
*/
|
|
73
|
+
export declare function checkVersionRequirement(found: string, wanted: string): RequirementVerdict;
|
|
74
|
+
/**
|
|
75
|
+
* Classify the result of a failed tool probe. A probe that was denied the
|
|
76
|
+
* right to run must be reported as `denied` — the tool may well be present —
|
|
77
|
+
* while only evidence that the command does not exist counts as `missing`.
|
|
78
|
+
*
|
|
79
|
+
* @param {Object|string|undefined} result Result object from spawnSync, or
|
|
80
|
+
* undefined when no result shape is known.
|
|
81
|
+
* @returns {"found"|"denied"|"missing"} Classification of the probe result.
|
|
82
|
+
*/
|
|
83
|
+
export declare function classifyProbeResult(result: Object | string | undefined): "found" | "denied" | "missing";
|
|
84
|
+
/**
|
|
85
|
+
* Classify the active environment restriction that would stop a command from
|
|
86
|
+
* running, without the human-readable wording. `describeSpawnRestriction`
|
|
87
|
+
* derives its message from this classifier, and consumers that need to act on
|
|
88
|
+
* the cause rather than the prose use it directly.
|
|
89
|
+
*
|
|
90
|
+
* @param {string} command Command that would run
|
|
91
|
+
* @returns {"dry-run"|"secure-mode"|"allowlist"|"deno"|undefined} Restriction cause, or undefined when nothing restricts the command.
|
|
92
|
+
*/
|
|
93
|
+
export declare function classifySpawnRestriction(command: string): "dry-run" | "secure-mode" | "allowlist" | "deno" | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Explain why a command probe may not run in the current environment, so a
|
|
96
|
+
* failed probe can be reported as degraded evidence rather than a missing
|
|
97
|
+
* tool.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} command Command that was probed
|
|
100
|
+
* @returns {string|undefined} Human-readable restriction, or undefined when
|
|
101
|
+
* the environment does not restrict the command.
|
|
102
|
+
*/
|
|
103
|
+
export declare function describeSpawnRestriction(command: string): string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Parse the content of an asdf/mise `.tool-versions` file into the first
|
|
106
|
+
* version each tool declares. Comment lines and inline comments are ignored;
|
|
107
|
+
* a tool line listing several versions keeps the first.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} content `.tool-versions` file content
|
|
110
|
+
* @returns {Object|undefined} Map of tool name to declared version.
|
|
111
|
+
*/
|
|
112
|
+
export declare function parseToolVersionsFile(content: string): Object | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Parse the `go` and `toolchain` directives of a `go.mod` file. The
|
|
115
|
+
* `toolchain` directive wins when both are present because it names the
|
|
116
|
+
* exact toolchain the module asks for.
|
|
117
|
+
*
|
|
118
|
+
* @param {string} content `go.mod` file content
|
|
119
|
+
* @returns {Object|undefined} `{ tool, version, directive }` with
|
|
120
|
+
* `directive` naming the line the version came from.
|
|
121
|
+
*/
|
|
122
|
+
export declare function parseGoModFile(content: string): Object | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Parse a `rust-toolchain.toml` or plain `rust-toolchain` file into its
|
|
125
|
+
* channel. Target-specific subsections are ignored, so only the `[toolchain]`
|
|
126
|
+
* section's `channel` key is read.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} content Toolchain file content
|
|
129
|
+
* @returns {Object|undefined} `{ channel }` when a channel is declared.
|
|
130
|
+
*/
|
|
131
|
+
export declare function parseRustToolchainFile(content: string): Object | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Parse a `package.json` content into the tool requirements it declares
|
|
134
|
+
* through `engines` and `packageManager`. The `packageManager` pin's
|
|
135
|
+
* integrity-hash suffix (`pnpm@9.1.0+sha512.…`) is stripped to the bare
|
|
136
|
+
* version.
|
|
137
|
+
*
|
|
138
|
+
* @param {string} content `package.json` content
|
|
139
|
+
* @returns {Object|undefined} Map of tool name to declared version.
|
|
140
|
+
*/
|
|
141
|
+
export declare function parsePackageJsonToolRequirements(content: string): Object | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Parse a `global.json` file into the .NET SDK version it pins.
|
|
144
|
+
*
|
|
145
|
+
* @param {string} content `global.json` content
|
|
146
|
+
* @returns {Object|undefined} Map with the `dotnet` requirement.
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseGlobalJsonToolRequirements(content: string): Object | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Parse the `requires-python` declaration of a `pyproject.toml` file.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} content `pyproject.toml` content
|
|
153
|
+
* @returns {Object|undefined} Map with the `python` requirement.
|
|
154
|
+
*/
|
|
155
|
+
export declare function parsePyprojectRequiresPython(content: string): Object | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* Parse an `.nvmrc` file into the Node.js version it requests.
|
|
158
|
+
*
|
|
159
|
+
* @param {string} content `.nvmrc` content
|
|
160
|
+
* @returns {Object|undefined} Map with the `node` requirement.
|
|
161
|
+
*/
|
|
162
|
+
export declare function parseNvmrc(content: string): Object | undefined;
|
|
163
|
+
/**
|
|
164
|
+
* Parse a `.python-version` file into the interpreter version it requests.
|
|
165
|
+
*
|
|
166
|
+
* @param {string} content `.python-version` content
|
|
167
|
+
* @returns {Object|undefined} Map with the `python` requirement.
|
|
168
|
+
*/
|
|
169
|
+
export declare function parsePythonVersionFile(content: string): Object | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* Parse a `.java-version` file into the JDK version it pins. Both the bare
|
|
172
|
+
* major (`21`) and a full version (`21.0.5`) occur in the wild, and both are
|
|
173
|
+
* passed through verbatim — an install command needs the exact declaration.
|
|
174
|
+
*
|
|
175
|
+
* The legacy `1.N` spelling of a pre-9 release (`1.8`, `1.8.0_302`) is
|
|
176
|
+
* normalised to its modern major (`8`), because it is the major line that
|
|
177
|
+
* names a package: the literal declaration yields `Temurin.1.JDK`, which no
|
|
178
|
+
* provisioner offers.
|
|
179
|
+
*
|
|
180
|
+
* Distribution-prefixed values written by version managers (`temurin-21`,
|
|
181
|
+
* `openjdk64-17.0.1`) name a vendor build rather than a release, so they are
|
|
182
|
+
* left unparsed rather than turned into an install argument no provisioner
|
|
183
|
+
* accepts; the run then reports the version as unresolved and the agent asks.
|
|
184
|
+
*
|
|
185
|
+
* @param {string} content `.java-version` content
|
|
186
|
+
* @returns {Object|undefined} Map with the `java` requirement.
|
|
187
|
+
*/
|
|
188
|
+
export declare function parseJavaVersionFile(content: string): Object | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Parse the `BUNDLED WITH` section of a `Gemfile.lock` into the bundler
|
|
191
|
+
* version the lockfile was written with.
|
|
192
|
+
*
|
|
193
|
+
* @param {string} content `Gemfile.lock` content
|
|
194
|
+
* @returns {string|undefined} Bundler version, when declared.
|
|
195
|
+
*/
|
|
196
|
+
export declare function parseGemfileLockBundlerVersion(content: string): string | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Read every declared tool requirement a project directory declares through
|
|
199
|
+
* its well-known tool pin files: `.tool-versions`, `.nvmrc`, `.java-version`,
|
|
200
|
+
* `.python-version`, `pyproject.toml`, `go.mod`, `rust-toolchain.toml`,
|
|
201
|
+
* `rust-toolchain`, `package.json`, and `global.json`. Missing files are
|
|
202
|
+
* skipped; each entry names the file that declared it so the report can
|
|
203
|
+
* trace every expectation back to its source.
|
|
204
|
+
*
|
|
205
|
+
* @param {string} projectPath Project directory to inspect
|
|
206
|
+
* @returns {Array<{tool: string, wanted: string, source: string, ecosystem: string, path: string}>}
|
|
207
|
+
* Declared requirements, empty when the directory declares none.
|
|
208
|
+
*/
|
|
209
|
+
export declare function readDeclaredToolRequirements(projectPath: string): Array<{
|
|
210
|
+
tool: string;
|
|
211
|
+
wanted: string;
|
|
212
|
+
source: string;
|
|
213
|
+
ecosystem: string;
|
|
214
|
+
path: string;
|
|
215
|
+
}>;
|
|
216
|
+
//# sourceMappingURL=toolRequirements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolRequirements.d.ts","sourceRoot":"","sources":["../../../lib/inventory/toolRequirements.js"],"names":[],"mappings":"AAqEA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAH1B,MAG0B,GAFxB,MAAM,CAIlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAHhC,MAGgC,GAF9B,OAAO,CAanB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAJtB,MAIsB,EAAE,CAAC,EAHzB,MAGyB,GAFvB,MAAM,CA0ClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAHjC,MAGiC,GAF/B,MAAM,GAAC,SAAS,CAyB5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAHpC,MAGoC,GAFlC,MAAM,GAAC,SAAS,CAgB5B;AAOE,YAAgD,kBAAkB,GAAxD,WAAW,GAAC,UAAU,GAAC,aAAa,CAAoB;AALrE;;;;;;GAMG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EALlC,MAKkC,EAAE,MAAM,EAH1C,MAG0C,GAFxC,kBAAkB,CAsB9B;AAyID;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAJ/B,MAAM,GAAC,MAAM,GAAC,SAIiB,GAF7B,OAAO,GAAC,QAAQ,GAAC,SAAS,CAmCtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAHrC,MAGqC,GAFnC,SAAS,GAAC,aAAa,GAAC,WAAW,GAAC,MAAM,GAAC,SAAS,CAkChE;AASD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAJrC,MAIqC,GAHnC,MAAM,GAAC,SAAS,CAM5B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAHlC,MAGkC,GAFhC,MAAM,GAAC,SAAS,CAuB5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAJ3B,MAI2B,GAHzB,MAAM,GAAC,SAAS,CAiC5B;AAaD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAHnC,MAGmC,GAFjC,MAAM,GAAC,SAAS,CAqC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAH7C,MAG6C,GAF3C,MAAM,GAAC,SAAS,CAgC5B;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAH5C,MAG4C,GAF1C,MAAM,GAAC,SAAS,CAiB5B;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAHzC,MAGyC,GAFvC,MAAM,GAAC,SAAS,CAa5B;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAHvB,MAGuB,GAFrB,MAAM,GAAC,SAAS,CAY5B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAHnC,MAGmC,GAFjC,MAAM,GAAC,SAAS,CAQ5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAHjC,MAGiC,GAF/B,MAAM,GAAC,SAAS,CAY5B;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAH3C,MAG2C,GAFzC,MAAM,GAAC,SAAS,CAwB5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAJ7C,MAI6C,GAH3C,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,CAwFlG"}
|
|
@@ -22,6 +22,77 @@ export declare function getCargoAuditableInfo(src: string): string | undefined;
|
|
|
22
22
|
* @returns {undefined|Object} Command output
|
|
23
23
|
*/
|
|
24
24
|
export declare function executeSourcekitten(args: any[]): undefined | Object;
|
|
25
|
+
/**
|
|
26
|
+
* Canonicalise the distro vendor namespace of an OS package component
|
|
27
|
+
* produced by trivy, regardless of whether trivy expressed the vendor via the
|
|
28
|
+
* purl namespace or the component group (it is inconsistent between
|
|
29
|
+
* packages). e.g. pkg:rpm/alma/... -> pkg:rpm/almalinux/... and
|
|
30
|
+
* pkg:rpm/cbl-mariner/... -> pkg:rpm/azure-linux/... so the purls match the
|
|
31
|
+
* vulnerability feeds. Also aligns the ``distro`` qualifier vendor prefix
|
|
32
|
+
* (alma-9.8 -> almalinux-9.8, mariner-2.0 -> azure-linux-2.0), including
|
|
33
|
+
* spellings that disagree with the namespace, and rebuilds ``group`` and
|
|
34
|
+
* ``bom-ref`` from the rewritten purl.
|
|
35
|
+
*
|
|
36
|
+
* The namespace table is OS_NAMESPACE_ALIAS from lib/inventory/osinfo.js so
|
|
37
|
+
* the trivy path and the os-release path (getDistroInfo) cannot drift apart.
|
|
38
|
+
*
|
|
39
|
+
* A `distro` qualifier that is not purl-safe (trivy emits Amazon Linux as
|
|
40
|
+
* `amazon-2023.12.20260727+(Amazon Linux)`) is replaced with the os-release
|
|
41
|
+
* derived value, or dropped when there is none: an unusable qualifier
|
|
42
|
+
* invalidates the purl and fails validation for the whole BOM.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} comp trivy OS package component (mutated in place)
|
|
45
|
+
* @param {Object} purlObj parsed PackageURL of comp.purl (mutated in place)
|
|
46
|
+
* @param {string} name component package name (basename form)
|
|
47
|
+
* @param {string} group component group derived from the trivy component name
|
|
48
|
+
* @param {string} [distroId] canonical os-release distro id, e.g. "amazon-2023"
|
|
49
|
+
* @returns {string} the canonicalised group
|
|
50
|
+
*/
|
|
51
|
+
export declare function canonicaliseOsPackageNamespace(comp: Object, purlObj: Object, name: string, group: string, distroId?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Repair a `distro` qualifier that cannot survive purl parsing, in place.
|
|
54
|
+
*
|
|
55
|
+
* trivy stamps Amazon Linux with the full pretty version — the qualifier
|
|
56
|
+
* arrives as `distro=amazon-2023.12.20260727+%28Amazon+Linux%29`, whose spaces
|
|
57
|
+
* and parentheses `Purl.parse` rejects outright ("Invalid character in
|
|
58
|
+
* qualifier distro"). The component then bypasses every canonicalisation below
|
|
59
|
+
* (they all need a parsed purl) and reaches the BOM verbatim, where schema
|
|
60
|
+
* validation fails and the *entire* SBOM is discarded — an Amazon Linux scan
|
|
61
|
+
* produces no output at all today.
|
|
62
|
+
*
|
|
63
|
+
* The release is already known from os-release, so the unusable value is
|
|
64
|
+
* swapped for it; with no usable replacement the qualifier is dropped, since a
|
|
65
|
+
* missing qualifier costs one matching hint while an invalid one costs the
|
|
66
|
+
* whole document.
|
|
67
|
+
*
|
|
68
|
+
* @param {Object} comp component whose purl may carry an unusable qualifier
|
|
69
|
+
* @param {string} [distroId] canonical os-release distro id, e.g. "amazon-2023"
|
|
70
|
+
* @returns {Object} the same component
|
|
71
|
+
*/
|
|
72
|
+
export declare function repairOsComponentPurl(comp: Object, distroId?: string): Object;
|
|
73
|
+
/**
|
|
74
|
+
* Drop source-package shadow components that duplicate a real installed
|
|
75
|
+
* package, in place.
|
|
76
|
+
*
|
|
77
|
+
* A shadow is emitted whenever an rpm/deb declares a source name different
|
|
78
|
+
* from its own (bzip2-libs -> bzip2) so that scanners keying on source names
|
|
79
|
+
* still match. When the source package is *itself* installed at the same
|
|
80
|
+
* version, the shadow's purl is identical to the real component's and the two
|
|
81
|
+
* collapse in trimComponents() — which keeps whichever was seen first and
|
|
82
|
+
* never merges `tags`. Seen-first is trivy's listing order, so the outcome is
|
|
83
|
+
* arbitrary: when the shadow wins, a genuinely installed package is reported
|
|
84
|
+
* with `tags: ["source"]` and identity confidence 0, the very marker the
|
|
85
|
+
* shadow carries so consumers can filter shadows out. That turns a real
|
|
86
|
+
* package into a filtered-away one.
|
|
87
|
+
*
|
|
88
|
+
* Dropping the redundant shadow is loss-free: it duplicates the real
|
|
89
|
+
* component's purl (so nothing that matches on purl changes) and its bom-ref
|
|
90
|
+
* is byte-identical, so no dependency reference can dangle.
|
|
91
|
+
*
|
|
92
|
+
* @param {Array} pkgList component list, mutated in place
|
|
93
|
+
* @returns {Array} the same list, for convenience
|
|
94
|
+
*/
|
|
95
|
+
export declare function dropRedundantSourceComponents(pkgList: any[]): any[];
|
|
25
96
|
/**
|
|
26
97
|
* Get the packages installed in the container image filesystem.
|
|
27
98
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../lib/managers/binary.js"],"names":[],"mappings":"AA0YA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,AAH9C,CACA,EADQ,MAAM,EAGqC,GAFzC,MAAM,EAAE,CAgBpB;AA4FD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAJ9B,MAI8B,GAH5B,MAAM,GAAC,SAAS,CAmB5B;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,OAAA,GAF3B,SAAS,GAAC,MAAM,CAkB5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,GAAG,QAAA,EAAE,WAAW,EAL7B,MAK6B,EAAE,OAAO,KAAK,GAFrD,MAAM,
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../lib/managers/binary.js"],"names":[],"mappings":"AA0YA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,AAH9C,CACA,EADQ,MAAM,EAGqC,GAFzC,MAAM,EAAE,CAgBpB;AA4FD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAJ9B,MAI8B,GAH5B,MAAM,GAAC,SAAS,CAmB5B;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,OAAA,GAF3B,SAAS,GAAC,MAAM,CAkB5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EARK,MAQL,EACJ,OAAO,EARE,MAQF,EACP,IAAI,EARK,MAQL,EACJ,KAAK,EARI,MAQJ,EACL,QAAQ,AARP,CACA,EADQ,MAQD,GAPG,MAAM,CAgDlB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAJ/B,MAI+B,EAAE,QAAQ,AAHjD,CACA,EADQ,MAGyC,GAFvC,MAAM,CA6BlB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,OAAA,SAoBpD;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,GAAG,QAAA,EAAE,WAAW,EAL7B,MAK6B,EAAE,OAAO,KAAK,GAFrD,MAAM,CA4mBlB;AAkwDD;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,AALvD,CACA,EADQ,MAAM,EAK8C,GAJlD;IAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAC,CAmEnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EALzB,MAKyB,GAJvB,MAAM,GAAC,SAAS,CA8D5B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAJxB,MAIwB,EAAE,UAAU,EAHpC,MAGoC,WA6C9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EANrB,MAMqB,EAAE,aAAa,EALpC,MAKoC,EAAE,QAAQ,EAJ9C,OAI8C,GAF7C,OAAO,CAiClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../lib/managers/docker.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../lib/managers/docker.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAwCrC,yDAAyD;AACzD,eAAO,MAAM,KAAK,SAA0B,CAAC;AAC7C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAFtB,MAEoC,CAAC;AAsQ/C;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,SAHnB,MAAM,KACJ,MAiBZ,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,QAoB3B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,QA2CnC;AAyTD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,aANf,MAAM,gBAEN,MAAM,KACJ,OAAO,CAAC,MAAM,GAAC,SAAS,CA6HpC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,SANb,MAAM,UACN,MAAM,gBACN,MAAM,KACJ,OAAO,CAAC,MAAM,GAAC,MAAM,GAAC,SAAS,CAgC3C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;;CA2E1B,CAAC;AAkCF;;GAEG;AACH,eAAO,MAAM,QAAQ,sCA2LpB,CAAC;AAGC,YAA4B,gBAAgB,GAAlC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAkB;AAiH/C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,kBANZ,MAAM,OACN,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,OAAO,CAqF3B,CAAC;AAiGF;;;GAGG;AACH,eAAO,MAAM,aAAa,mEAqGzB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,iBATrB,MAAM,aACN,MAAM,WACN,MAAM,wBACN,MAAM,WACN,MAAM,KACJ,OAAO,CAAC,MAAM,CAgI1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,oDAkJvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,iDAkJ1B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,kBALb,MAAM,UACN,OAAO,KACL,OAAO,CAAC,MAAM,GAAC,SAAS,CAKpC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,cALpB,MAAM,iBACN,MAAM,KACJ,MAAM,GAAC,SA2CnB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,qBAHpB,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,CAAC,cACnC,KAAK,CAAC,MAAM,CAAC,SA4BvB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared assembly of CycloneDX document-level annotations.
|
|
3
|
+
*
|
|
4
|
+
* Two postgen features attach findings to the BOM document as annotations
|
|
5
|
+
* whose `subjects` is the BOM serial number: the BOM audit's rule findings and
|
|
6
|
+
* the build introspection's remediations. Both describe the document rather
|
|
7
|
+
* than a component, both are annotated by the cdxgen tool component from
|
|
8
|
+
* metadata, and both carry the document's own timestamp because an annotation
|
|
9
|
+
* describes the document it is attached to. The structured facts travel as
|
|
10
|
+
* `name`/`value` pairs rendered into the annotation text, one `:evidence:<key>`
|
|
11
|
+
* entry per evidence item.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Flatten an evidence object into `:evidence:<key>` property entries. Nested
|
|
15
|
+
* values are serialized as JSON so every property value stays a string.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} propertyNamePrefix Property namespace, e.g. "cdx:audit".
|
|
18
|
+
* @param {Object} evidence Arbitrary key/value evidence facts.
|
|
19
|
+
* @returns {{name: string, value: string}[]} Property entries.
|
|
20
|
+
*/
|
|
21
|
+
export declare function evidenceProperties(propertyNamePrefix: string, evidence: Object): {
|
|
22
|
+
name: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}[];
|
|
25
|
+
/**
|
|
26
|
+
* Build one document-level annotation. Returns undefined when the BOM carries
|
|
27
|
+
* no cdxgen tool component to annotate with; the caller decides whether that
|
|
28
|
+
* is worth a warning.
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} params Annotation inputs.
|
|
31
|
+
* @param {Object} params.bomJson CycloneDX BOM the annotation describes.
|
|
32
|
+
* @param {string} params.message Leading annotation sentence.
|
|
33
|
+
* @param {{name: string, value: string}[]} params.properties Structured facts rendered into the annotation text.
|
|
34
|
+
* @returns {Object|undefined} CycloneDX annotation, or undefined without an annotator.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildDocumentAnnotation({ bomJson, message, properties }: {
|
|
37
|
+
bomJson: Object;
|
|
38
|
+
message: string;
|
|
39
|
+
properties: {
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
}[];
|
|
43
|
+
}): Object | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Warn that a document could not be annotated because it carries no cdxgen
|
|
46
|
+
* tool component. Suppressed outside debug mode, where the missing annotator
|
|
47
|
+
* is an expected shape for foreign BOMs.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} feature Feature that wanted to annotate.
|
|
50
|
+
* @returns {void}
|
|
51
|
+
*/
|
|
52
|
+
export declare function warnMissingAnnotator(feature: string): void;
|
|
53
|
+
//# sourceMappingURL=annotationBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotationBuilder.d.ts","sourceRoot":"","sources":["../../../../lib/stages/postgen/annotationBuilder.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,kBAAkB,EAJ1C,MAI0C,EAAE,QAAQ,EAHpD,MAGoD,GAFlD;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,EAAE,CAe3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,EALrE;IAAuB,OAAO,EAAtB,MAAM,CACd;IAAuB,OAAO,EAAtB,MAAM,CACd;IAAgD,UAAU,EAAlD;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,EAAE,CACvC;CAEqE,GAF3D,MAAM,GAAC,SAAS,CAkB5B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAHjC,MAGiC,GAF/B,IAAI,CAQhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditBom.d.ts","sourceRoot":"","sources":["../../../../lib/stages/postgen/auditBom.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auditBom.d.ts","sourceRoot":"","sources":["../../../../lib/stages/postgen/auditBom.js"],"names":[],"mappings":"AAyEA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAH1B,MAG0B,GAFxB,OAAO,CAInB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAH1B,MAG0B,GAFxB,OAAO,CA4BnB;AAuBD;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,OAAO,AAH1D,CACA,EADQ,MAGuD,GAFrD,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAKrG;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAHvC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAGvC,GAFrC,MAAM,CAOlB;AA+BD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAHzC,MAGyC,EAAE,OAAO,GAFlD,MAEuD,QAuBjE;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAAC,OAAO,EAH9C,MAG8C,EAAE,OAAO,GAFvD,MAE4D,iBAkCtE;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAJ3B,MAI2B,EAAE,OAAO,EAHpC,MAGoC,GAFlC,OAAO,OAAO,CAwC1B;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,OAAA,GAFvC,MAAM,CAmClB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,OAAA,GAF/B,MAAM,CAQlB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,OAAA,EAAE,OAAO,EAHxC,MAGwC,SAyElD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,KAAA,EAAE,OAAO,KAAA,OAQpD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BOM mutations that carry the introspection verdict inside the document:
|
|
3
|
+
* eight metadata properties and a block of document-level annotations.
|
|
4
|
+
*
|
|
5
|
+
* Sidecar report files get lost; the BOM travels. A consumer who receives
|
|
6
|
+
* only the BOM still learns how much to trust it from the metadata properties,
|
|
7
|
+
* and the annotations carry one entry per remediation the loop should act on.
|
|
8
|
+
* No component or dependency is touched.
|
|
9
|
+
*
|
|
10
|
+
* Both mutations are replace-by-name: a document that was already introspected
|
|
11
|
+
* (a BOM enriched again after an evidence pass) loses its previous
|
|
12
|
+
* introspection state and gains a fresh one, so the verdict always describes
|
|
13
|
+
* the final document.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Version of the introspection BOM surface. Matches the JSON report's
|
|
17
|
+
* schemaVersion so the two stay comparable.
|
|
18
|
+
*
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
export declare const INTROSPECTION_SCHEMA_VERSION: string;
|
|
22
|
+
/**
|
|
23
|
+
* Namespace of every property and annotation entry this module emits.
|
|
24
|
+
*
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
export declare const INTROSPECTION_PROPERTY_PREFIX: string;
|
|
28
|
+
/**
|
|
29
|
+
* The metadata properties that summarize the verdict, in emission order. The
|
|
30
|
+
* overall tier and confidence are omitted when the run produced no scored row
|
|
31
|
+
* (nothing was graded, so no verdict is claimed); per-ecosystem rows cover the
|
|
32
|
+
* scored ecosystems only, since unsupported ones have neither a tier nor a
|
|
33
|
+
* score.
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} reflection Reflection document from reflectOnRun.
|
|
36
|
+
* @param {Object} scored Scoring document from scoreReflection.
|
|
37
|
+
* @returns {{name: string, value: string}[]} Metadata property entries.
|
|
38
|
+
*/
|
|
39
|
+
export declare function introspectionMetadataProperties(reflection: Object, scored: Object): {
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
}[];
|
|
43
|
+
/**
|
|
44
|
+
* Attach the introspection verdict to the document: metadata properties plus
|
|
45
|
+
* the summary and remediation annotations. Any introspection state left on the
|
|
46
|
+
* document by a previous pass is removed first, so enrichment flows that run
|
|
47
|
+
* post-processing twice leave exactly one verdict.
|
|
48
|
+
*
|
|
49
|
+
* @param {Object} bomJson CycloneDX BOM, mutated in place.
|
|
50
|
+
* @param {Object} reflection Reflection document from reflectOnRun.
|
|
51
|
+
* @param {Object} scored Scoring document from scoreReflection.
|
|
52
|
+
* @param {Object} [guards] Emission guards.
|
|
53
|
+
* @param {boolean} [guards.annotations] False skips the annotations, for documents at a spec version that predates them.
|
|
54
|
+
* @returns {Object} The mutated BOM.
|
|
55
|
+
*/
|
|
56
|
+
export declare function applyIntrospectionToBom(bomJson: Object, reflection: Object, scored: Object, guards?: {
|
|
57
|
+
annotations?: boolean;
|
|
58
|
+
}): Object;
|
|
59
|
+
/**
|
|
60
|
+
* Stamp every formulation workflow with the id of the run that reflected over
|
|
61
|
+
* the document, so a later consumer of the BOM can tell a formulation record
|
|
62
|
+
* this run generated from one that arrived with a foreign BOM. The stamp is
|
|
63
|
+
* replace-by-name, matching how the rest of the verdict mutates the
|
|
64
|
+
* document: a BOM enriched twice keeps only the latest run's id.
|
|
65
|
+
*
|
|
66
|
+
* @param {Object} bomJson CycloneDX BOM, mutated in place.
|
|
67
|
+
* @param {string} runId Run id of the introspection pass.
|
|
68
|
+
* @returns {Object} The mutated BOM.
|
|
69
|
+
*/
|
|
70
|
+
export declare function applyFormulationRunIdMarker(bomJson: Object, runId: string): Object;
|
|
71
|
+
/**
|
|
72
|
+
* Whether a BOM already carries an introspection verdict.
|
|
73
|
+
*
|
|
74
|
+
* Evidence collection re-processes a finished BOM through a fresh wrapper, so
|
|
75
|
+
* the document itself is the only marker that survives between passes.
|
|
76
|
+
*
|
|
77
|
+
* @param {Object} bomJson CycloneDX BOM.
|
|
78
|
+
* @returns {boolean} True when the BOM was already introspected.
|
|
79
|
+
*/
|
|
80
|
+
export declare function hasIntrospectionVerdict(bomJson: Object): boolean;
|
|
81
|
+
//# sourceMappingURL=annotate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotate.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/annotate.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,EAF/B,MAEuC,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,EAFhC,MAEsD,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,CAAC,UAAU,EAJ/C,MAI+C,EAAE,MAAM,EAHvD,MAGuD,GAFrD;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,EAAE,CA6C3C;AAoHD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EARE,MAQF,EACP,UAAU,EARD,MAQC,EACV,MAAM,EARG,MAQH,EACN,MAAM,AARL,CAEA,EADA;IAAyB,WAAW,AAApC,CACA,EADQ,OAAO,CACf;CAMU,GANA,MAAM,CAsClB;AAgBD;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAJxC,MAIwC,EAAE,KAAK,EAH/C,MAG+C,GAF7C,MAAM,CAsBlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAHpC,MAGoC,GAFlC,OAAO,CAOnB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command-facts collector for command shaping.
|
|
3
|
+
*
|
|
4
|
+
* Gathers, once per run and cached, the project facts the command resolver
|
|
5
|
+
* consumes: which maven and gradle wrapper scripts the project root carries,
|
|
6
|
+
* which Python manager owns its lock files, and which npm client the project
|
|
7
|
+
* names or locks. Detection is filesystem reads only — existence and, for
|
|
8
|
+
* the platform's own shell scripts, the executable bit. Nothing here spawns
|
|
9
|
+
* a process: whether a wrapper actually runs is a question the run itself
|
|
10
|
+
* answers elsewhere, and shaping that cannot know says so through the
|
|
11
|
+
* resolver's fallbacks.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Gather the command-shaping facts for a project root. The result is cached
|
|
15
|
+
* per root, so repeated scoring passes over the same project read the
|
|
16
|
+
* filesystem once.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} projectRoot Directory that was scanned.
|
|
19
|
+
* @param {Object} [options] Test hooks.
|
|
20
|
+
* @param {"posix"|"windows"} [options.platform] Platform override; defaults to the runtime platform.
|
|
21
|
+
* @returns {import("./shapeCommand.js").CommandFacts} Facts for the resolver.
|
|
22
|
+
*/
|
|
23
|
+
export declare function collectCommandFacts(projectRoot: string, options?: {
|
|
24
|
+
platform?: "posix" | "windows";
|
|
25
|
+
}): import("./shapeCommand.js").CommandFacts;
|
|
26
|
+
/**
|
|
27
|
+
* Forget the gathered facts. Test hook; a production run gathers once.
|
|
28
|
+
*
|
|
29
|
+
* @returns {void}
|
|
30
|
+
*/
|
|
31
|
+
export declare function clearCommandFactsCache(): void;
|
|
32
|
+
//# sourceMappingURL=commandFacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandFacts.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/commandFacts.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA+NH;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EALpC,MAKoC,EAAE,OAAO,AAJrD,CAEA,EADA;IAAoC,QAAQ,AAA5C,CACA,EADQ,OAAO,GAAC,SAAS,CACzB;CAE0D,GAFhD,OAAO,mBAAmB,EAAE,YAAY,CAyCpD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAFzB,IAAI,CAIhB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report emission for build introspection: resolving report destinations,
|
|
3
|
+
* writing the markdown and JSON reports, and printing the console summary.
|
|
4
|
+
*
|
|
5
|
+
* This module is the only place in the introspection chain that touches the
|
|
6
|
+
* filesystem or prints, which keeps every renderer above it pure and
|
|
7
|
+
* testable against committed fixtures. All writes go through the safe
|
|
8
|
+
* wrappers, and dry-run mode produces the report without writing anything.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Report destination meaning "write this report to the diagnostic stream".
|
|
12
|
+
*
|
|
13
|
+
* @type {string}
|
|
14
|
+
*/
|
|
15
|
+
export declare const INTROSPECTION_STDERR_TARGET: string;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the report destinations for a run. A user-provided path wins; the
|
|
18
|
+
* defaults are derived from the BOM output path so the reports travel with
|
|
19
|
+
* the BOM, falling back to the working directory when the BOM goes to stdout.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} [options] CLI options.
|
|
22
|
+
* @param {string} [options.output] Path the BOM is written to, or "-" for stdout.
|
|
23
|
+
* @param {string} [options.introspectReport] Requested markdown report path.
|
|
24
|
+
* @param {string} [options.introspectJson] Requested JSON report path.
|
|
25
|
+
* @returns {{reportPath: string, jsonPath: string}} Resolved destinations; "-" means the diagnostic stream.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveIntrospectionReportPaths(options?: {
|
|
28
|
+
output?: string;
|
|
29
|
+
introspectReport?: string;
|
|
30
|
+
introspectJson?: string;
|
|
31
|
+
}): {
|
|
32
|
+
reportPath: string;
|
|
33
|
+
jsonPath: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Mark every remediation in a scoring document blocked because a dry-run
|
|
37
|
+
* records intent without executing anything: no fix the report proposes can
|
|
38
|
+
* be applied by this run, so the loop must not try.
|
|
39
|
+
*
|
|
40
|
+
* @param {Object} scored Scoring document from scoreReflection, mutated in place.
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
export declare function blockRemediationsForDryRun(scored: Object): void;
|
|
44
|
+
/**
|
|
45
|
+
* Write the markdown and JSON reports for a completed reflection and return
|
|
46
|
+
* the destinations they reached. Dry-run mode prints the markdown report to
|
|
47
|
+
* the diagnostic stream instead of creating files, matching the read-only
|
|
48
|
+
* contract of the mode.
|
|
49
|
+
*
|
|
50
|
+
* @param {Object} reflection Reflection document from reflectOnRun.
|
|
51
|
+
* @param {Object} scored Scoring document from scoreReflection.
|
|
52
|
+
* @param {Object} [options] CLI options naming the report destinations.
|
|
53
|
+
* @returns {{reportTarget: string|undefined, jsonTarget: string|undefined, dryRun: boolean}} Destinations reached; undefined means the report was not produced as a file.
|
|
54
|
+
*/
|
|
55
|
+
export declare function emitIntrospectionReports(reflection: Object, scored: Object, options?: Object): {
|
|
56
|
+
reportTarget: string | undefined;
|
|
57
|
+
jsonTarget: string | undefined;
|
|
58
|
+
dryRun: boolean;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Print the console summary for a completed introspection. Called after the
|
|
62
|
+
* reports are delivered, so every path it names exists (or is the explicit
|
|
63
|
+
* stream marker). Diagnostics go to the diagnostic stream so a piped stdout
|
|
64
|
+
* never carries anything but the BOM payload.
|
|
65
|
+
*
|
|
66
|
+
* @param {Object} scored Scoring document from scoreReflection.
|
|
67
|
+
* @param {Object} [delivery] Destinations returned by emitIntrospectionReports.
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
export declare function printIntrospectionSummary(scored: Object, delivery?: Object): void;
|
|
71
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/emit.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAF9B,MAEoC,CAAC;AAO/C;;;;;;;;;;GAUG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,AANpD,CAIA,EAHA;IAAyB,MAAM,AAA/B,CACA,EADQ,MAAM,CACd;IAAyB,gBAAgB,AAAzC,CACA,EADQ,MAAM,CACd;IAAyB,cAAc,AAAvC,CACA,EADQ,MAAM,CACd;CAEyD,GAF/C;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAgBlD;AAiDD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAHtC,MAGsC,GAFpC,IAAI,CAchB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EALxC,MAKwC,EAAE,MAAM,EAJhD,MAIgD,EAAE,OAAO,AAHjE,CACA,EADQ,MAG8D,GAF5D;IAAC,YAAY,EAAE,MAAM,GAAC,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,GAAC,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAC,CAe3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAJrC,MAIqC,EAAE,QAAQ,AAHvD,CACA,EADQ,MAGoD,GAFlD,IAAI,CAwBhB"}
|