@cyclonedx/cdxgen 11.2.4 → 11.2.6
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 +12 -1
- package/bin/cdxgen.js +5 -3
- package/data/component-tags.json +1 -1
- package/data/frameworks-list.json +10 -0
- package/data/helpers/init.gradle +5 -0
- package/lib/cli/index.js +128 -87
- package/lib/evinser/evinser.js +7 -4
- package/lib/helpers/envcontext.js +4 -4
- package/lib/helpers/utils.js +109 -51
- package/lib/helpers/utils.test.js +1 -7
- package/lib/helpers/validator.js +1 -1
- package/lib/managers/binary.js +48 -3
- package/lib/managers/docker.js +39 -23
- package/lib/server/server.js +44 -4
- package/package.json +7 -3
- package/types/lib/cli/index.d.ts.map +1 -1
- package/types/lib/helpers/utils.d.ts +5 -3
- package/types/lib/helpers/utils.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.map +1 -1
- package/lib/helpers/package_specific/gradleutils.js +0 -48
- package/lib/helpers/package_specific/gradleutils.test.js +0 -65
package/README.md
CHANGED
|
@@ -516,7 +516,7 @@ Please check out our [contribute to CycloneDX/cdxgen documentation][github-contr
|
|
|
516
516
|
|
|
517
517
|
Before raising a PR, please run the following commands.
|
|
518
518
|
|
|
519
|
-
```
|
|
519
|
+
```shell
|
|
520
520
|
corepack enable pnpm
|
|
521
521
|
pnpm install --config.strict-dep-builds=true
|
|
522
522
|
# Generate types using jsdoc syntax
|
|
@@ -527,6 +527,17 @@ pnpm run lint
|
|
|
527
527
|
pnpm test
|
|
528
528
|
```
|
|
529
529
|
|
|
530
|
+
### Testing main branch
|
|
531
|
+
|
|
532
|
+
Use `pnpm add -g` command to quickly test the main branch.
|
|
533
|
+
|
|
534
|
+
```shell
|
|
535
|
+
corepack pnpm bin -g
|
|
536
|
+
corepack pnpm setup
|
|
537
|
+
corepack pnpm add -g --allow-build sqlite3 https://github.com/CycloneDX/cdxgen
|
|
538
|
+
cdxgen --help
|
|
539
|
+
```
|
|
540
|
+
|
|
530
541
|
## Sponsors
|
|
531
542
|
|
|
532
543
|
<img src="./docs/_media/LevoLogo-LightBg.jpg" width="200" height="auto">
|
package/bin/cdxgen.js
CHANGED
|
@@ -196,17 +196,14 @@ const args = yargs(hideBin(process.argv))
|
|
|
196
196
|
})
|
|
197
197
|
.option("usages-slices-file", {
|
|
198
198
|
description: "Path for the usages slices file created by atom.",
|
|
199
|
-
default: "usages.slices.json",
|
|
200
199
|
hidden: true,
|
|
201
200
|
})
|
|
202
201
|
.option("data-flow-slices-file", {
|
|
203
202
|
description: "Path for the data-flow slices file created by atom.",
|
|
204
|
-
default: "data-flow.slices.json",
|
|
205
203
|
hidden: true,
|
|
206
204
|
})
|
|
207
205
|
.option("reachables-slices-file", {
|
|
208
206
|
description: "Path for the reachables slices file created by atom.",
|
|
209
|
-
default: "reachables.slices.json",
|
|
210
207
|
hidden: true,
|
|
211
208
|
})
|
|
212
209
|
.option("semantics-slices-file", {
|
|
@@ -214,6 +211,10 @@ const args = yargs(hideBin(process.argv))
|
|
|
214
211
|
default: "semantics.slices.json",
|
|
215
212
|
hidden: true,
|
|
216
213
|
})
|
|
214
|
+
.option("openapi-spec-file", {
|
|
215
|
+
description: "Path for the openapi specification file (SaaSBOM).",
|
|
216
|
+
hidden: true,
|
|
217
|
+
})
|
|
217
218
|
.option("spec-version", {
|
|
218
219
|
description: "CycloneDX Specification version to use. Defaults to 1.6",
|
|
219
220
|
default: 1.6,
|
|
@@ -989,6 +990,7 @@ const checkPermissions = (filePath, options) => {
|
|
|
989
990
|
dataFlowSlicesFile: options.dataFlowSlicesFile,
|
|
990
991
|
reachablesSlicesFile: options.reachablesSlicesFile,
|
|
991
992
|
semanticsSlicesFile: options.semanticsSlicesFile,
|
|
993
|
+
openapiSpecFile: options.openapiSpecFile,
|
|
992
994
|
includeCrypto: options.includeCrypto,
|
|
993
995
|
specVersion: options.specVersion,
|
|
994
996
|
profile: options.profile,
|
package/data/component-tags.json
CHANGED
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
"System.Data",
|
|
6
6
|
"Microsoft.AspNetCore",
|
|
7
7
|
"Microsoft.NETCore",
|
|
8
|
+
"Microsoft.EntityFrameworkCore",
|
|
9
|
+
"pkg:nuget/EntityFramework",
|
|
10
|
+
"pkg:nuget/Microsoft.Build.Framework",
|
|
11
|
+
"EntityFrameworkCore",
|
|
12
|
+
"Microsoft.Data.OData",
|
|
13
|
+
"Microsoft.NETCore.Targets",
|
|
14
|
+
"System.Diagnostics.DiagnosticSource",
|
|
15
|
+
"Microsoft.OData.",
|
|
16
|
+
"Google.Cloud.",
|
|
17
|
+
"PnP.Framework",
|
|
8
18
|
"springframework",
|
|
9
19
|
"pkg:maven/us.springett/alpine",
|
|
10
20
|
"pkg:pypi/flask",
|
package/lib/cli/index.js
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
import { platform as _platform, arch, homedir } from "node:os";
|
|
16
16
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
17
17
|
import process from "node:process";
|
|
18
|
-
import { URL } from "node:url";
|
|
19
18
|
import got from "got";
|
|
20
19
|
import { load as loadYaml } from "js-yaml";
|
|
21
20
|
import { PackageURL } from "packageurl-js";
|
|
@@ -33,8 +32,6 @@ import {
|
|
|
33
32
|
listFiles,
|
|
34
33
|
} from "../helpers/envcontext.js";
|
|
35
34
|
import { thoughtLog } from "../helpers/logger.js";
|
|
36
|
-
|
|
37
|
-
import { analyzeBuildSettings } from "../helpers/package_specific/gradleutils.js";
|
|
38
35
|
import {
|
|
39
36
|
CARGO_CMD,
|
|
40
37
|
CLJ_CMD,
|
|
@@ -226,6 +223,14 @@ if (process.env.GRADLE_USER_HOME) {
|
|
|
226
223
|
);
|
|
227
224
|
}
|
|
228
225
|
|
|
226
|
+
// Construct path to gradle init script
|
|
227
|
+
const GRADLE_INIT_SCRIPT = resolve(
|
|
228
|
+
dirNameStr,
|
|
229
|
+
"data",
|
|
230
|
+
"helpers",
|
|
231
|
+
"init.gradle",
|
|
232
|
+
);
|
|
233
|
+
|
|
229
234
|
// Construct sbt cache directory
|
|
230
235
|
const SBT_CACHE_DIR =
|
|
231
236
|
process.env.SBT_CACHE_DIR || join(homedir(), ".ivy2", "cache");
|
|
@@ -1226,6 +1231,13 @@ function determinePackageType(pkg) {
|
|
|
1226
1231
|
}
|
|
1227
1232
|
}
|
|
1228
1233
|
}
|
|
1234
|
+
if (Object.prototype.hasOwnProperty.call(pkg, "tags")) {
|
|
1235
|
+
for (const tag of pkg.tags) {
|
|
1236
|
+
if (tag && tag.toLowerCase() === "framework") {
|
|
1237
|
+
return "framework";
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1229
1241
|
return "library";
|
|
1230
1242
|
}
|
|
1231
1243
|
|
|
@@ -1959,59 +1971,49 @@ export async function createJavaBom(path, options) {
|
|
|
1959
1971
|
options,
|
|
1960
1972
|
)
|
|
1961
1973
|
) {
|
|
1962
|
-
let
|
|
1974
|
+
let includedBuilds = [];
|
|
1963
1975
|
let allProjectsStr = [];
|
|
1964
|
-
let rootGradleModule = {};
|
|
1965
|
-
let includedProjectsFound = false;
|
|
1966
1976
|
if (process.env.GRADLE_INCLUDED_BUILDS) {
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
(b) => (!b.startsWith(":") ? `:${b}` : b),
|
|
1977
|
+
includedBuilds = process.env.GRADLE_INCLUDED_BUILDS.split(",").map((b) =>
|
|
1978
|
+
!b.startsWith(":") ? `:${b}` : b,
|
|
1970
1979
|
);
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
]) {
|
|
1982
|
-
if (
|
|
1983
|
-
|
|
1980
|
+
}
|
|
1981
|
+
let parallelPropTaskOut = executeParallelGradleProperties(
|
|
1982
|
+
gradleRootPath,
|
|
1983
|
+
[null].concat(includedBuilds),
|
|
1984
|
+
process.env.GRADLE_INCLUDED_BUILDS
|
|
1985
|
+
? []
|
|
1986
|
+
: ["--init-script", GRADLE_INIT_SCRIPT],
|
|
1987
|
+
);
|
|
1988
|
+
if (process.env.GRADLE_INCLUDED_BUILDS === undefined) {
|
|
1989
|
+
const outputLines = parallelPropTaskOut.split("\n");
|
|
1990
|
+
for (const [i, line] of outputLines.entries()) {
|
|
1991
|
+
if (line.startsWith("Root project '") || line.startsWith("Project '")) {
|
|
1992
|
+
break;
|
|
1984
1993
|
}
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
rootProjects.push(aib);
|
|
1990
|
-
includedProjectsFound = true;
|
|
1991
|
-
}
|
|
1994
|
+
if (line.startsWith("<CDXGEN:includedBuild>")) {
|
|
1995
|
+
const includedBuild = line.split(">");
|
|
1996
|
+
if (!includedBuilds.includes(includedBuild[1].trim())) {
|
|
1997
|
+
includedBuilds.push(includedBuild[1].trim());
|
|
1992
1998
|
}
|
|
1993
|
-
break;
|
|
1994
1999
|
}
|
|
1995
2000
|
}
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2001
|
+
if (includedBuilds.length > 0) {
|
|
2002
|
+
thoughtLog(
|
|
2003
|
+
`Wait, this gradle project uses composite builds. I must carefully process these ${includedBuilds.length} projects, in addition to the root.`,
|
|
2004
|
+
);
|
|
2005
|
+
if (DEBUG_MODE) {
|
|
2006
|
+
console.log(`Composite builds: ${includedBuilds.join(" ").trim()}.`);
|
|
2007
|
+
}
|
|
2008
|
+
parallelPropTaskOut = parallelPropTaskOut.concat(
|
|
2009
|
+
"\n",
|
|
2010
|
+
executeParallelGradleProperties(gradleRootPath, includedBuilds),
|
|
2004
2011
|
);
|
|
2005
2012
|
}
|
|
2006
2013
|
}
|
|
2007
|
-
const parallelPropTaskOut = executeParallelGradleProperties(
|
|
2008
|
-
gradleRootPath,
|
|
2009
|
-
rootProjects,
|
|
2010
|
-
);
|
|
2011
2014
|
const splitPropTaskOut = splitOutputByGradleProjects(parallelPropTaskOut, [
|
|
2012
2015
|
"properties",
|
|
2013
2016
|
]);
|
|
2014
|
-
|
|
2015
2017
|
for (const [key, propTaskOut] of splitPropTaskOut.entries()) {
|
|
2016
2018
|
const retMap = parseGradleProperties(propTaskOut);
|
|
2017
2019
|
const rootProject = retMap.rootProject;
|
|
@@ -2020,18 +2022,11 @@ export async function createJavaBom(path, options) {
|
|
|
2020
2022
|
rootProject,
|
|
2021
2023
|
retMap.metadata,
|
|
2022
2024
|
);
|
|
2025
|
+
if (!includedBuilds.includes(key)) {
|
|
2026
|
+
parentComponent = rootComponent;
|
|
2027
|
+
}
|
|
2023
2028
|
gradleModules.set(key, rootComponent);
|
|
2024
|
-
if (!
|
|
2025
|
-
if (rootGradleModule.name) {
|
|
2026
|
-
if (DEBUG_MODE) {
|
|
2027
|
-
console.log(
|
|
2028
|
-
`Received new root component: ${rootComponent.name} with key ${key}. Please verify the value used for included builds. Using the name ${rootGradleModule.name}.`,
|
|
2029
|
-
);
|
|
2030
|
-
}
|
|
2031
|
-
} else {
|
|
2032
|
-
rootGradleModule = rootComponent;
|
|
2033
|
-
}
|
|
2034
|
-
} else if (!allProjectsAddedPurls.includes(rootComponent["purl"])) {
|
|
2029
|
+
if (!allProjectsAddedPurls.includes(rootComponent["purl"])) {
|
|
2035
2030
|
allProjects.push(rootComponent);
|
|
2036
2031
|
rootDependsOn.add(rootComponent["bom-ref"]);
|
|
2037
2032
|
allProjectsAddedPurls.push(rootComponent["purl"]);
|
|
@@ -2039,7 +2034,6 @@ export async function createJavaBom(path, options) {
|
|
|
2039
2034
|
allProjectsStr = allProjectsStr.concat(retMap.projects);
|
|
2040
2035
|
}
|
|
2041
2036
|
}
|
|
2042
|
-
parentComponent = rootGradleModule;
|
|
2043
2037
|
// Get the sub-project properties and set the root dependencies
|
|
2044
2038
|
if (allProjectsStr?.length) {
|
|
2045
2039
|
const modulesToSkip = process.env.GRADLE_SKIP_MODULES
|
|
@@ -2129,32 +2123,36 @@ export async function createJavaBom(path, options) {
|
|
|
2129
2123
|
process.env.GRADLE_ARGS_DEPENDENCIES
|
|
2130
2124
|
? process.env.GRADLE_ARGS_DEPENDENCIES.split(" ")
|
|
2131
2125
|
: [],
|
|
2126
|
+
gradleCmd.length,
|
|
2132
2127
|
);
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2128
|
+
const allOutputs = [];
|
|
2129
|
+
for (const gradleArg of gradleArguments) {
|
|
2130
|
+
if (DEBUG_MODE) {
|
|
2131
|
+
console.log(
|
|
2132
|
+
`Executing ${gradleCmd} with arguments ${gradleArg.join(" ").substring(0, 150)}... in ${gradleRootPath}`,
|
|
2133
|
+
);
|
|
2134
|
+
}
|
|
2135
|
+
thoughtLog(
|
|
2136
|
+
`Let's invoke '${basename(gradleCmd)}' with the arguments '${gradleArg.join(" ").substring(0, 100)} ...'.`,
|
|
2140
2137
|
);
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2138
|
+
const sresult = spawnSync(gradleCmd, gradleArg, {
|
|
2139
|
+
cwd: gradleRootPath,
|
|
2140
|
+
encoding: "utf-8",
|
|
2141
|
+
shell: isWin,
|
|
2142
|
+
timeout: TIMEOUT_MS,
|
|
2143
|
+
maxBuffer: MAX_BUFFER,
|
|
2144
|
+
});
|
|
2145
|
+
if (sresult.status !== 0 || sresult.error) {
|
|
2146
|
+
if (options.failOnError || DEBUG_MODE) {
|
|
2147
|
+
console.error(sresult.stdout, sresult.stderr);
|
|
2148
|
+
}
|
|
2149
|
+
options.failOnError && process.exit(1);
|
|
2150
|
+
}
|
|
2151
|
+
if (sresult.stdout !== null) {
|
|
2152
|
+
allOutputs.push(sresult.stdout);
|
|
2154
2153
|
}
|
|
2155
|
-
options.failOnError && process.exit(1);
|
|
2156
2154
|
}
|
|
2157
|
-
const sstdout =
|
|
2155
|
+
const sstdout = allOutputs.join("\n");
|
|
2158
2156
|
if (sstdout) {
|
|
2159
2157
|
const cmdOutput = Buffer.from(sstdout).toString();
|
|
2160
2158
|
const perProjectOutput = splitOutputByGradleProjects(cmdOutput, [
|
|
@@ -2213,6 +2211,29 @@ export async function createJavaBom(path, options) {
|
|
|
2213
2211
|
}
|
|
2214
2212
|
options.failOnError && process.exit(1);
|
|
2215
2213
|
}
|
|
2214
|
+
if (
|
|
2215
|
+
(!process.env.GRADLE_STOP_DAEMON &&
|
|
2216
|
+
(!process.env.GRADLE_USE_DAEMON ||
|
|
2217
|
+
["true", "1"].includes(process.env.GRADLE_USE_DAEMON))) ||
|
|
2218
|
+
["true", "1"].includes(process.env.GRADLE_STOP_DAEMON)
|
|
2219
|
+
) {
|
|
2220
|
+
if (DEBUG_MODE) {
|
|
2221
|
+
console.log("Stopping gradle daemon...");
|
|
2222
|
+
}
|
|
2223
|
+
const sresult = spawnSync(gradleCmd, ["--stop"], {
|
|
2224
|
+
cwd: gradleRootPath,
|
|
2225
|
+
encoding: "utf-8",
|
|
2226
|
+
shell: isWin,
|
|
2227
|
+
timeout: TIMEOUT_MS,
|
|
2228
|
+
maxBuffer: MAX_BUFFER,
|
|
2229
|
+
});
|
|
2230
|
+
if (sresult.status !== 0 || sresult.error) {
|
|
2231
|
+
if (options.failOnError || DEBUG_MODE) {
|
|
2232
|
+
console.error(sresult.stdout, sresult.stderr);
|
|
2233
|
+
}
|
|
2234
|
+
options.failOnError && process.exit(1);
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2216
2237
|
// Should we attempt to resolve class names
|
|
2217
2238
|
if (options.resolveClass || options.deep) {
|
|
2218
2239
|
const tmpjarNSMapping = await collectJarNS(GRADLE_CACHE_DIR);
|
|
@@ -2581,14 +2602,16 @@ export async function createJavaBom(path, options) {
|
|
|
2581
2602
|
);
|
|
2582
2603
|
const millCmd = getMillCommand(millRootPath);
|
|
2583
2604
|
const millCommonArgs = [
|
|
2584
|
-
"--no-server",
|
|
2585
|
-
"--silent",
|
|
2586
|
-
"--disable-prompt",
|
|
2587
|
-
"--disable-callgraph",
|
|
2588
|
-
"-k",
|
|
2589
2605
|
"--color",
|
|
2590
2606
|
"false",
|
|
2607
|
+
"--disable-callgraph",
|
|
2608
|
+
"--disable-prompt",
|
|
2609
|
+
"--keep-going",
|
|
2610
|
+
"--silent",
|
|
2591
2611
|
];
|
|
2612
|
+
if (!["true", "1"].includes(process.env.MILL_USE_SERVER)) {
|
|
2613
|
+
millCommonArgs.unshift("--no-server");
|
|
2614
|
+
}
|
|
2592
2615
|
const millArgs = [...millCommonArgs, "__.ivyDepsTree"];
|
|
2593
2616
|
if (DEBUG_MODE) {
|
|
2594
2617
|
console.log("Executing", millCmd, millArgs.join(" "), "in", millRootPath);
|
|
@@ -2674,6 +2697,28 @@ export async function createJavaBom(path, options) {
|
|
|
2674
2697
|
parentComponent,
|
|
2675
2698
|
);
|
|
2676
2699
|
}
|
|
2700
|
+
if (
|
|
2701
|
+
(!process.env.MILL_SHUTDOWN_SERVER &&
|
|
2702
|
+
["true", "1"].includes(process.env.MILL_USE_SERVER)) ||
|
|
2703
|
+
["true", "1"].includes(process.env.MILL_SHUTDOWN_SERVER)
|
|
2704
|
+
) {
|
|
2705
|
+
if (DEBUG_MODE) {
|
|
2706
|
+
console.log("Shutting down mill server...");
|
|
2707
|
+
}
|
|
2708
|
+
const sresult = spawnSync(millCmd, ["shutdown"], {
|
|
2709
|
+
cwd: millRootPath,
|
|
2710
|
+
encoding: "utf-8",
|
|
2711
|
+
shell: isWin,
|
|
2712
|
+
timeout: TIMEOUT_MS,
|
|
2713
|
+
maxBuffer: MAX_BUFFER,
|
|
2714
|
+
});
|
|
2715
|
+
if (sresult.status !== 0 || sresult.error) {
|
|
2716
|
+
if (options.failOnError || DEBUG_MODE) {
|
|
2717
|
+
console.error(sresult.stdout, sresult.stderr);
|
|
2718
|
+
}
|
|
2719
|
+
options.failOnError && process.exit(1);
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2677
2722
|
}
|
|
2678
2723
|
|
|
2679
2724
|
pkgList = trimComponents(pkgList);
|
|
@@ -2722,11 +2767,7 @@ export async function createNodejsBom(path, options) {
|
|
|
2722
2767
|
let allImports = {};
|
|
2723
2768
|
let allExports = {};
|
|
2724
2769
|
if (
|
|
2725
|
-
!hasAnyProjectType(
|
|
2726
|
-
["docker", "oci", "container", "os", "pnpm"],
|
|
2727
|
-
options,
|
|
2728
|
-
false,
|
|
2729
|
-
) &&
|
|
2770
|
+
!hasAnyProjectType(["docker", "oci", "container", "os"], options, false) &&
|
|
2730
2771
|
!options.noBabel
|
|
2731
2772
|
) {
|
|
2732
2773
|
if (DEBUG_MODE) {
|
package/lib/evinser/evinser.js
CHANGED
|
@@ -235,6 +235,8 @@ export async function createSlice(
|
|
|
235
235
|
language = "js";
|
|
236
236
|
} else if (language.startsWith("python")) {
|
|
237
237
|
language = "python";
|
|
238
|
+
} else if (PROJECT_TYPE_ALIASES.scala.includes(language)) {
|
|
239
|
+
language = "scala";
|
|
238
240
|
}
|
|
239
241
|
if (
|
|
240
242
|
PROJECT_TYPE_ALIASES.swift.includes(language) &&
|
|
@@ -251,11 +253,13 @@ export async function createSlice(
|
|
|
251
253
|
? path.basename(options.output)
|
|
252
254
|
: path.dirname(options.output);
|
|
253
255
|
}
|
|
254
|
-
const slicesFile =
|
|
256
|
+
const slicesFile =
|
|
257
|
+
options[`${sliceType}SlicesFile`] ||
|
|
258
|
+
join(sliceOutputDir, `${language}-${sliceType}.slices.json`);
|
|
255
259
|
const openapiSpecFile = basename(
|
|
256
260
|
options.openapiSpecFile ||
|
|
257
261
|
process.env?.ATOM_TOOLS_OPENAPI_FILENAME ||
|
|
258
|
-
|
|
262
|
+
`${language}-openapi.json`,
|
|
259
263
|
);
|
|
260
264
|
// For some languages such as scala, semantics slices file would get created during usages slicing.
|
|
261
265
|
let semanticsSlicesFile;
|
|
@@ -317,7 +321,7 @@ export async function createSlice(
|
|
|
317
321
|
ATOM_TOOLS_OPENAPI_FILENAME: openapiSpecFile, // The file would get over-written
|
|
318
322
|
ATOM_TOOLS_OPENAPI_FORMAT:
|
|
319
323
|
process.env?.ATOM_TOOLS_OPENAPI_FORMAT || "openapi3.1.0", // editor.swagger.io doesn't support 3.1.0 yet
|
|
320
|
-
ATOM_TOOLS_WORK_DIR: resolve(filePath), // This must be the directory containing semantics.slices.json
|
|
324
|
+
ATOM_TOOLS_WORK_DIR: process.env?.ATOM_TOOLS_WORK_DIR || resolve(filePath), // This must be the directory containing semantics.slices.json
|
|
321
325
|
OPENAPI_SERVER_URL: process.env?.OPENAPI_SERVER_URL,
|
|
322
326
|
});
|
|
323
327
|
if (!result || !safeExistsSync(slicesFile)) {
|
|
@@ -1408,7 +1412,6 @@ export function createEvinseFile(sliceArtefacts, options) {
|
|
|
1408
1412
|
dataFlowFrames,
|
|
1409
1413
|
cryptoComponents,
|
|
1410
1414
|
cryptoGeneratePurls,
|
|
1411
|
-
openapiSpecFile,
|
|
1412
1415
|
} = sliceArtefacts;
|
|
1413
1416
|
const bomFile = options.input;
|
|
1414
1417
|
const evinseOutFile = options.output;
|
|
@@ -29,10 +29,10 @@ export const GIT_COMMAND = process.env.GIT_CMD || "git";
|
|
|
29
29
|
|
|
30
30
|
// sdkman tool aliases
|
|
31
31
|
export const SDKMAN_JAVA_TOOL_ALIASES = {
|
|
32
|
-
java8: process.env.JAVA8_TOOL || "8.0.
|
|
33
|
-
java11: process.env.JAVA11_TOOL || "11.0.
|
|
34
|
-
java17: process.env.JAVA17_TOOL || "17.0.
|
|
35
|
-
java21: process.env.JAVA21_TOOL || "21.0.
|
|
32
|
+
java8: process.env.JAVA8_TOOL || "8.0.452-amzn", // Temurin no longer offers java8 :(
|
|
33
|
+
java11: process.env.JAVA11_TOOL || "11.0.26-tem",
|
|
34
|
+
java17: process.env.JAVA17_TOOL || "17.0.15-tem",
|
|
35
|
+
java21: process.env.JAVA21_TOOL || "21.0.7-tem",
|
|
36
36
|
java22: process.env.JAVA22_TOOL || "22.0.2-tem",
|
|
37
37
|
java23: process.env.JAVA23_TOOL || "23.0.2-tem",
|
|
38
38
|
java24: process.env.JAVA24_TOOL || "24-tem",
|
package/lib/helpers/utils.js
CHANGED
|
@@ -3998,74 +3998,88 @@ export function parseGradleProperties(rawOutput, gradleModuleName = null) {
|
|
|
3998
3998
|
*
|
|
3999
3999
|
* @param {string} dir Directory to execute the command
|
|
4000
4000
|
* @param {array} allProjectsStr List of all sub-projects (including the preceding `:`)
|
|
4001
|
+
* @param {array} extraArgs List of extra arguments to use when calling gradle
|
|
4001
4002
|
*
|
|
4002
4003
|
* @returns {string} The combined output for all subprojects of the Gradle properties task
|
|
4003
4004
|
*/
|
|
4004
|
-
export function executeParallelGradleProperties(
|
|
4005
|
+
export function executeParallelGradleProperties(
|
|
4006
|
+
dir,
|
|
4007
|
+
allProjectsStr,
|
|
4008
|
+
extraArgs = [],
|
|
4009
|
+
) {
|
|
4005
4010
|
const gradleCmd = getGradleCommand(dir, null);
|
|
4006
4011
|
const gradleArgs = buildGradleCommandArguments(
|
|
4007
|
-
|
|
4012
|
+
extraArgs.concat(
|
|
4013
|
+
process.env.GRADLE_ARGS ? process.env.GRADLE_ARGS.split(" ") : [],
|
|
4014
|
+
),
|
|
4008
4015
|
allProjectsStr.map((project) =>
|
|
4009
4016
|
project ? `${project}:properties` : "properties",
|
|
4010
4017
|
),
|
|
4011
4018
|
process.env.GRADLE_ARGS_PROPERTIES
|
|
4012
4019
|
? process.env.GRADLE_ARGS_PROPERTIES.split(" ")
|
|
4013
4020
|
: [],
|
|
4021
|
+
gradleCmd.length,
|
|
4014
4022
|
);
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
);
|
|
4019
|
-
}
|
|
4020
|
-
const result = spawnSync(gradleCmd, gradleArgs, {
|
|
4021
|
-
cwd: dir,
|
|
4022
|
-
encoding: "utf-8",
|
|
4023
|
-
shell: isWin,
|
|
4024
|
-
maxBuffer: MAX_BUFFER,
|
|
4025
|
-
});
|
|
4026
|
-
if (result.status !== 0 || result.error) {
|
|
4027
|
-
if (process.env?.CDXGEN_IN_CONTAINER === "true") {
|
|
4028
|
-
thoughtLog(
|
|
4029
|
-
"Gradle build has failed. Perhaps the user is using the wrong container image?",
|
|
4030
|
-
);
|
|
4031
|
-
} else {
|
|
4032
|
-
thoughtLog(
|
|
4033
|
-
"Gradle build has failed. I recommend using Java container images.",
|
|
4034
|
-
);
|
|
4035
|
-
}
|
|
4036
|
-
if (result.stderr) {
|
|
4037
|
-
console.group("*** GRADLE BUILD ERRORS ***");
|
|
4038
|
-
console.error(result.stdout, result.stderr);
|
|
4039
|
-
console.groupEnd();
|
|
4040
|
-
console.log(
|
|
4041
|
-
"1. Check if the correct version of java and gradle are installed and available in PATH. For example, some project might require Java 11 with gradle 7.\n cdxgen container image bundles Java 23 with gradle 8 which might be incompatible.",
|
|
4042
|
-
);
|
|
4023
|
+
const allOutputs = [];
|
|
4024
|
+
for (const gradleArg of gradleArgs) {
|
|
4025
|
+
if (DEBUG_MODE) {
|
|
4043
4026
|
console.log(
|
|
4044
|
-
|
|
4027
|
+
`Executing ${gradleCmd} with arguments ${gradleArg.join(" ").substring(0, 150)}... in ${dir}`,
|
|
4045
4028
|
);
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4029
|
+
}
|
|
4030
|
+
const result = spawnSync(gradleCmd, gradleArg, {
|
|
4031
|
+
cwd: dir,
|
|
4032
|
+
encoding: "utf-8",
|
|
4033
|
+
shell: isWin,
|
|
4034
|
+
maxBuffer: MAX_BUFFER,
|
|
4035
|
+
});
|
|
4036
|
+
if (result.status !== 0 || result.error) {
|
|
4037
|
+
if (process.env?.CDXGEN_IN_CONTAINER === "true") {
|
|
4038
|
+
thoughtLog(
|
|
4039
|
+
"Gradle build has failed. Perhaps the user is using the wrong container image?",
|
|
4049
4040
|
);
|
|
4050
|
-
} else
|
|
4051
|
-
|
|
4052
|
-
"
|
|
4053
|
-
)
|
|
4054
|
-
|
|
4041
|
+
} else {
|
|
4042
|
+
thoughtLog(
|
|
4043
|
+
"Gradle build has failed. I recommend using Java container images.",
|
|
4044
|
+
);
|
|
4045
|
+
}
|
|
4046
|
+
if (result.stderr) {
|
|
4047
|
+
console.group("*** GRADLE BUILD ERRORS ***");
|
|
4048
|
+
console.error(result.stdout, result.stderr);
|
|
4049
|
+
console.groupEnd();
|
|
4055
4050
|
console.log(
|
|
4056
|
-
"
|
|
4051
|
+
"1. Check if the correct version of java and gradle are installed and available in PATH. For example, some project might require Java 11 with gradle 7.\n cdxgen container image bundles Java 23 with gradle 8 which might be incompatible.",
|
|
4057
4052
|
);
|
|
4058
|
-
} else if (result.stderr?.includes("Unrecognized option")) {
|
|
4059
4053
|
console.log(
|
|
4060
|
-
"
|
|
4054
|
+
"2. Try running cdxgen with the custom JDK11-based image `ghcr.io/cyclonedx/cdxgen-java11:v11`.",
|
|
4061
4055
|
);
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4056
|
+
if (result.stderr?.includes("not get unknown property")) {
|
|
4057
|
+
console.log(
|
|
4058
|
+
"3. Check if the SBOM is generated for the correct root project for your application.",
|
|
4059
|
+
);
|
|
4060
|
+
} else if (
|
|
4061
|
+
result.stderr?.includes(
|
|
4062
|
+
"In version catalog libs, import of external catalog file failed",
|
|
4063
|
+
)
|
|
4064
|
+
) {
|
|
4065
|
+
console.log(
|
|
4066
|
+
"3. Catalog file is required for gradle dependency resolution to succeed.",
|
|
4067
|
+
);
|
|
4068
|
+
} else if (result.stderr?.includes("Unrecognized option")) {
|
|
4069
|
+
console.log(
|
|
4070
|
+
"3. Try removing the unrecognized options to improve compatibility with a range of Java versions. Refer to the error message above.",
|
|
4071
|
+
);
|
|
4072
|
+
}
|
|
4073
|
+
if (result.stderr.includes("does not exist")) {
|
|
4074
|
+
return "";
|
|
4075
|
+
}
|
|
4065
4076
|
}
|
|
4066
4077
|
}
|
|
4078
|
+
if (result.stdout !== null) {
|
|
4079
|
+
allOutputs.push(result.stdout);
|
|
4080
|
+
}
|
|
4067
4081
|
}
|
|
4068
|
-
const stdout =
|
|
4082
|
+
const stdout = allOutputs.join("\n");
|
|
4069
4083
|
if (stdout) {
|
|
4070
4084
|
return Buffer.from(stdout).toString();
|
|
4071
4085
|
}
|
|
@@ -10451,6 +10465,10 @@ export function parseSbtTree(sbtTreeFile) {
|
|
|
10451
10465
|
name = pkgParts[0];
|
|
10452
10466
|
version = pkgParts[1];
|
|
10453
10467
|
}
|
|
10468
|
+
if (!name?.length) {
|
|
10469
|
+
console.log(pkgLine, "was not parsed correctly!");
|
|
10470
|
+
return;
|
|
10471
|
+
}
|
|
10454
10472
|
const purlString = new PackageURL(
|
|
10455
10473
|
"maven",
|
|
10456
10474
|
group,
|
|
@@ -12119,25 +12137,63 @@ export function getMillCommand(srcPath) {
|
|
|
12119
12137
|
* @param {string[]} gradleArguments The general gradle arguments, which must only be added once
|
|
12120
12138
|
* @param {string[]} gradleSubCommands The sub-commands that are to be executed by gradle
|
|
12121
12139
|
* @param {string[]} gradleSubCommandArguments The arguments specific to the sub-command(s), which much be added PER sub-command
|
|
12140
|
+
* @param {int} gradleCommandLength The length of the full gradle-command
|
|
12122
12141
|
*
|
|
12123
|
-
* @returns {string[]} Array of arguments to be added to the gradle command
|
|
12142
|
+
* @returns {string[]} Array of arrays of arguments to be added to the gradle command
|
|
12124
12143
|
*/
|
|
12125
12144
|
export function buildGradleCommandArguments(
|
|
12126
12145
|
gradleArguments,
|
|
12127
12146
|
gradleSubCommands,
|
|
12128
12147
|
gradleSubCommandArguments,
|
|
12148
|
+
gradleCommandLength,
|
|
12129
12149
|
) {
|
|
12130
|
-
|
|
12150
|
+
const mainGradleArguments = [
|
|
12131
12151
|
"--build-cache",
|
|
12132
12152
|
"--console",
|
|
12133
12153
|
"plain",
|
|
12134
12154
|
"--no-parallel",
|
|
12135
|
-
]
|
|
12155
|
+
]
|
|
12156
|
+
.concat(getGradleDaemonParameter())
|
|
12157
|
+
.concat(gradleArguments);
|
|
12158
|
+
const maxCliArgsLength = isWin
|
|
12159
|
+
? 7500 - gradleCommandLength - mainGradleArguments.join(" ").length - 2
|
|
12160
|
+
: -1;
|
|
12161
|
+
if (DEBUG_MODE && maxCliArgsLength !== -1) {
|
|
12162
|
+
console.log(
|
|
12163
|
+
"Running on Windows with a very long command -- splitting into multiple commands",
|
|
12164
|
+
);
|
|
12165
|
+
}
|
|
12166
|
+
const splitArgs = [];
|
|
12167
|
+
let allGradleArguments = [].concat(mainGradleArguments);
|
|
12168
|
+
let remainingLength = maxCliArgsLength;
|
|
12136
12169
|
for (const gradleSubCommand of gradleSubCommands) {
|
|
12170
|
+
const subCommandLength =
|
|
12171
|
+
[gradleSubCommand, ...gradleSubCommandArguments].join(" ").length + 1;
|
|
12172
|
+
if (maxCliArgsLength !== -1 && remainingLength - subCommandLength < 0) {
|
|
12173
|
+
splitArgs.push(allGradleArguments);
|
|
12174
|
+
allGradleArguments = [].concat(mainGradleArguments);
|
|
12175
|
+
remainingLength = maxCliArgsLength;
|
|
12176
|
+
}
|
|
12137
12177
|
allGradleArguments.push(gradleSubCommand);
|
|
12138
12178
|
allGradleArguments = allGradleArguments.concat(gradleSubCommandArguments);
|
|
12179
|
+
remainingLength -= subCommandLength;
|
|
12180
|
+
}
|
|
12181
|
+
if (allGradleArguments.length !== mainGradleArguments.length) {
|
|
12182
|
+
splitArgs.push(allGradleArguments);
|
|
12183
|
+
}
|
|
12184
|
+
return splitArgs;
|
|
12185
|
+
}
|
|
12186
|
+
|
|
12187
|
+
function getGradleDaemonParameter() {
|
|
12188
|
+
switch (process.env.GRADLE_USE_DAEMON) {
|
|
12189
|
+
case "default":
|
|
12190
|
+
return [];
|
|
12191
|
+
case "false":
|
|
12192
|
+
case "1":
|
|
12193
|
+
return ["--no-daemon"];
|
|
12194
|
+
default:
|
|
12195
|
+
return ["--daemon"];
|
|
12139
12196
|
}
|
|
12140
|
-
return allGradleArguments;
|
|
12141
12197
|
}
|
|
12142
12198
|
|
|
12143
12199
|
/**
|
|
@@ -12609,7 +12665,9 @@ function fullScanCocoaPod(dependency, component, options) {
|
|
|
12609
12665
|
component.authors = [];
|
|
12610
12666
|
if (podspec.authors.constructor === Object) {
|
|
12611
12667
|
Object.entries(podspec.authors).forEach(([name, email]) =>
|
|
12612
|
-
|
|
12668
|
+
email.includes("@")
|
|
12669
|
+
? component.authors.push({ name, email })
|
|
12670
|
+
: component.authors.push({ name }),
|
|
12613
12671
|
);
|
|
12614
12672
|
} else if (podspec.authors.constructor === Array) {
|
|
12615
12673
|
podspec.authors.forEach((name) => component.authors.push({ name }));
|
|
@@ -1386,7 +1386,7 @@ describe("go data with licenses", () => {
|
|
|
1386
1386
|
});
|
|
1387
1387
|
}, 120000);
|
|
1388
1388
|
|
|
1389
|
-
test("parseGoModData with licenses", async () => {
|
|
1389
|
+
test.skip("parseGoModData with licenses", async () => {
|
|
1390
1390
|
let retMap = await parseGoModData(null);
|
|
1391
1391
|
expect(retMap).toEqual({});
|
|
1392
1392
|
const gosumMap = {
|
|
@@ -2462,12 +2462,6 @@ test("parse github actions workflow data", () => {
|
|
|
2462
2462
|
name: "checkout",
|
|
2463
2463
|
version: "v4",
|
|
2464
2464
|
});
|
|
2465
|
-
dep_list = parseGitHubWorkflowData(
|
|
2466
|
-
readFileSync("./.github/workflows/app-release.yml", {
|
|
2467
|
-
encoding: "utf-8",
|
|
2468
|
-
}),
|
|
2469
|
-
);
|
|
2470
|
-
expect(dep_list.length).toEqual(3);
|
|
2471
2465
|
});
|
|
2472
2466
|
|
|
2473
2467
|
test("parse cs pkg data", () => {
|
package/lib/helpers/validator.js
CHANGED
|
@@ -285,7 +285,7 @@ export const validateRefs = (bomJson) => {
|
|
|
285
285
|
parentPurlType &&
|
|
286
286
|
childPurlType &&
|
|
287
287
|
parentPurlType !== childPurlType &&
|
|
288
|
-
!["oci", "generic"].includes(parentPurlType)
|
|
288
|
+
!["oci", "generic", "container"].includes(parentPurlType)
|
|
289
289
|
) {
|
|
290
290
|
warningsList.push(
|
|
291
291
|
`The parent package '${dep.ref}' (type ${parentPurlType}) depends on the child package '${don}' (type ${childPurlType}). This is a bug in cdxgen if this project is not a monorepo.`,
|
package/lib/managers/binary.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
statSync,
|
|
10
10
|
} from "node:fs";
|
|
11
11
|
import { arch as _arch, platform as _platform, homedir } from "node:os";
|
|
12
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
12
|
+
import { basename, delimiter, dirname, join, resolve } from "node:path";
|
|
13
13
|
import process from "node:process";
|
|
14
14
|
import { PackageURL } from "packageurl-js";
|
|
15
15
|
import {
|
|
@@ -28,8 +28,6 @@ import {
|
|
|
28
28
|
safeMkdirSync,
|
|
29
29
|
} from "../helpers/utils.js";
|
|
30
30
|
|
|
31
|
-
import { URL } from "node:url";
|
|
32
|
-
|
|
33
31
|
const dirName = dirNameStr;
|
|
34
32
|
|
|
35
33
|
const isWin = _platform() === "win32";
|
|
@@ -60,6 +58,9 @@ switch (arch) {
|
|
|
60
58
|
break;
|
|
61
59
|
}
|
|
62
60
|
|
|
61
|
+
// cdxgen plugins version
|
|
62
|
+
const CDXGEN_PLUGINS_VERSION = "1.6.10";
|
|
63
|
+
|
|
63
64
|
// Retrieve the cdxgen plugins directory
|
|
64
65
|
let CDXGEN_PLUGINS_DIR = process.env.CDXGEN_PLUGINS_DIR;
|
|
65
66
|
// Is there a non-empty local plugins directory
|
|
@@ -126,11 +127,54 @@ if (!CDXGEN_PLUGINS_DIR) {
|
|
|
126
127
|
`cdxgen-plugins-bin${pluginsBinSuffix}`,
|
|
127
128
|
"plugins",
|
|
128
129
|
);
|
|
130
|
+
// pnpm add -g
|
|
131
|
+
let altGlobalPlugins;
|
|
132
|
+
if (dirName.includes(join("node_modules", ".pnpm", "@cyclonedx+cdxgen"))) {
|
|
133
|
+
const tmpA = dirName.split(join("node_modules", ".pnpm"));
|
|
134
|
+
altGlobalPlugins = join(
|
|
135
|
+
tmpA[0],
|
|
136
|
+
"node_modules",
|
|
137
|
+
".pnpm",
|
|
138
|
+
`@cyclonedx+cdxgen-plugins-bin${pluginsBinSuffix}@${CDXGEN_PLUGINS_VERSION}`,
|
|
139
|
+
"node_modules",
|
|
140
|
+
"@cyclonedx",
|
|
141
|
+
`cdxgen-plugins-bin${pluginsBinSuffix}`,
|
|
142
|
+
"plugins",
|
|
143
|
+
);
|
|
144
|
+
} else if (dirName.includes(join(".pnpm", "@cyclonedx+cdxgen"))) {
|
|
145
|
+
// pnpm dlx
|
|
146
|
+
const tmpA = dirName.split(".pnpm");
|
|
147
|
+
altGlobalPlugins = join(
|
|
148
|
+
tmpA[0],
|
|
149
|
+
".pnpm",
|
|
150
|
+
`@cyclonedx+cdxgen-plugins-bin${pluginsBinSuffix}@${CDXGEN_PLUGINS_VERSION}`,
|
|
151
|
+
"node_modules",
|
|
152
|
+
"@cyclonedx",
|
|
153
|
+
`cdxgen-plugins-bin${pluginsBinSuffix}`,
|
|
154
|
+
"plugins",
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
const extraNMBinPath = join(
|
|
158
|
+
globalNodePath,
|
|
159
|
+
"..",
|
|
160
|
+
".pnpm",
|
|
161
|
+
"node_modules",
|
|
162
|
+
".bin",
|
|
163
|
+
);
|
|
129
164
|
if (existsSync(globalPlugins)) {
|
|
130
165
|
CDXGEN_PLUGINS_DIR = globalPlugins;
|
|
131
166
|
if (DEBUG_MODE) {
|
|
132
167
|
console.log("Found global plugins", CDXGEN_PLUGINS_DIR);
|
|
133
168
|
}
|
|
169
|
+
} else if (altGlobalPlugins && existsSync(altGlobalPlugins)) {
|
|
170
|
+
CDXGEN_PLUGINS_DIR = altGlobalPlugins;
|
|
171
|
+
// To help detect bin commands such as atom, astgen, etc, we need to set this to the PATH variable.
|
|
172
|
+
if (!process.env?.PATH?.includes(extraNMBinPath)) {
|
|
173
|
+
process.env.PATH = `${extraNMBinPath}${delimiter}${process.env.PATH}`;
|
|
174
|
+
}
|
|
175
|
+
if (DEBUG_MODE) {
|
|
176
|
+
console.log("Found global plugins", CDXGEN_PLUGINS_DIR);
|
|
177
|
+
}
|
|
134
178
|
}
|
|
135
179
|
}
|
|
136
180
|
}
|
|
@@ -232,6 +276,7 @@ const OS_DISTRO_ALIAS = {
|
|
|
232
276
|
"ubuntu-23.10": "mantic",
|
|
233
277
|
"ubuntu-24.04": "noble",
|
|
234
278
|
"ubuntu-24.10": "oracular",
|
|
279
|
+
"ubuntu-25.04": "plucky",
|
|
235
280
|
"debian-14": "forky",
|
|
236
281
|
"debian-14.5": "forky",
|
|
237
282
|
"debian-13": "trixie",
|
package/lib/managers/docker.js
CHANGED
|
@@ -650,22 +650,44 @@ export const getImage = async (fullImageName) => {
|
|
|
650
650
|
dockerCmd = "nerdctl";
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
let
|
|
653
|
+
let needsPull = true;
|
|
654
|
+
// Let's check the local cache first
|
|
655
|
+
let result = spawnSync(dockerCmd, ["images", "--format=json"], {
|
|
654
656
|
encoding: "utf-8",
|
|
655
657
|
});
|
|
656
|
-
if (result.status
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
658
|
+
if (result.status === 0 && result.stdout) {
|
|
659
|
+
for (const imgLine of result.stdout.split("\n")) {
|
|
660
|
+
try {
|
|
661
|
+
const imgObj = JSON.parse(Buffer.from(imgLine).toString());
|
|
662
|
+
if (
|
|
663
|
+
imgObj.Repository === fullImageName ||
|
|
664
|
+
imgObj?.Name?.endsWith(fullImageName)
|
|
665
|
+
) {
|
|
666
|
+
needsPull = false;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
} catch (err) {
|
|
670
|
+
// continue regardless of error
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (needsPull) {
|
|
675
|
+
result = spawnSync(dockerCmd, ["pull", fullImageName], {
|
|
676
|
+
encoding: "utf-8",
|
|
677
|
+
});
|
|
678
|
+
if (result.status !== 0 || result.error) {
|
|
679
|
+
if (result.stderr?.includes("docker daemon is not running")) {
|
|
680
|
+
console.log(
|
|
681
|
+
"Ensure Docker for Desktop is running as an administrator with 'Exposing daemon on TCP without TLS' setting turned on.",
|
|
682
|
+
);
|
|
683
|
+
} else if (result.stderr?.includes("not found")) {
|
|
684
|
+
console.log(
|
|
685
|
+
"Set the environment variable DOCKER_CMD to use an alternative command such as nerdctl or podman.",
|
|
686
|
+
);
|
|
687
|
+
} else {
|
|
688
|
+
console.log(result.stderr);
|
|
689
|
+
}
|
|
667
690
|
}
|
|
668
|
-
return localData;
|
|
669
691
|
}
|
|
670
692
|
result = spawnSync(dockerCmd, ["inspect", fullImageName], {
|
|
671
693
|
encoding: "utf-8",
|
|
@@ -901,22 +923,16 @@ export const extractTar = async (fullImageName, dir, options) => {
|
|
|
901
923
|
return false;
|
|
902
924
|
} else if (["EACCES"].includes(err.code)) {
|
|
903
925
|
console.log(err);
|
|
904
|
-
|
|
905
|
-
* We do not display errors messages for errors:
|
|
906
|
-
* 1) TAR_ENTRY_INFO is an informative error indicating that an entry is being modified.
|
|
907
|
-
* 2) TAR_ENTRY_INVALID indicates that a given entry is not valid tar archive entry and will be skipped.
|
|
908
|
-
*/
|
|
909
|
-
} else if (
|
|
910
|
-
DEBUG_MODE &&
|
|
911
|
-
["TAR_ENTRY_INFO", "TAR_ENTRY_INVALID"].includes(err.code)
|
|
912
|
-
) {
|
|
926
|
+
} else if (["TAR_ENTRY_INFO", "TAR_ENTRY_INVALID"].includes(err.code)) {
|
|
913
927
|
if (
|
|
914
928
|
err?.header?.path?.includes("{") ||
|
|
915
929
|
err?.message?.includes("linkpath required")
|
|
916
930
|
) {
|
|
917
931
|
return false;
|
|
918
932
|
}
|
|
919
|
-
|
|
933
|
+
if (DEBUG_MODE) {
|
|
934
|
+
console.log(err);
|
|
935
|
+
}
|
|
920
936
|
} else if (DEBUG_MODE) {
|
|
921
937
|
console.log(err.code, "is not handled yet in extractTar method.");
|
|
922
938
|
}
|
package/lib/server/server.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import http from "node:http";
|
|
4
|
-
import os from "node:os";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import process from "node:process";
|
|
7
|
-
import
|
|
6
|
+
import { URL } from "node:url";
|
|
8
7
|
import bodyParser from "body-parser";
|
|
9
8
|
import connect from "connect";
|
|
10
9
|
import { createBom, submitBom } from "../cli/index.js";
|
|
@@ -27,6 +26,24 @@ app.use(
|
|
|
27
26
|
);
|
|
28
27
|
app.use(compression());
|
|
29
28
|
|
|
29
|
+
function isAllowedHost(hostname) {
|
|
30
|
+
if (!process.env.CDXGEN_SERVER_ALLOWED_HOSTS) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return (process.env.CDXGEN_SERVER_ALLOWED_HOSTS || "")
|
|
34
|
+
.split(",")
|
|
35
|
+
.includes(hostname);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isAllowedPath(p) {
|
|
39
|
+
if (!process.env.CDXGEN_SERVER_ALLOWED_PATHS) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return (process.env.CDXGEN_SERVER_ALLOWED_PATHS || "")
|
|
43
|
+
.split(",")
|
|
44
|
+
.some((ap) => p.startsWith(ap));
|
|
45
|
+
}
|
|
46
|
+
|
|
30
47
|
const gitClone = (repoUrl, branch = null) => {
|
|
31
48
|
const tempDir = fs.mkdtempSync(
|
|
32
49
|
path.join(getTmpDir(), path.basename(repoUrl)),
|
|
@@ -172,7 +189,8 @@ const start = (options) => {
|
|
|
172
189
|
});
|
|
173
190
|
|
|
174
191
|
app.use("/sbom", async (req, res) => {
|
|
175
|
-
const
|
|
192
|
+
const requestUrl = new URL(req.url, `http://${req.headers.host}`);
|
|
193
|
+
const q = Object.fromEntries(requestUrl.searchParams.entries());
|
|
176
194
|
let cleanup = false;
|
|
177
195
|
const reqOptions = parseQueryString(
|
|
178
196
|
q,
|
|
@@ -190,9 +208,31 @@ const start = (options) => {
|
|
|
190
208
|
}
|
|
191
209
|
let srcDir = filePath;
|
|
192
210
|
if (filePath.startsWith("http") || filePath.startsWith("git")) {
|
|
211
|
+
// Validate the hostnames
|
|
212
|
+
const gitUrlObj = new URL(filePath);
|
|
213
|
+
if (!isAllowedHost(gitUrlObj.hostname)) {
|
|
214
|
+
res.writeHead(403, { "Content-Type": "application/json" });
|
|
215
|
+
return res.end(
|
|
216
|
+
JSON.stringify({
|
|
217
|
+
error: "Host Not Allowed",
|
|
218
|
+
details: `The Git URL host is not allowed: '${gitUrlObj.hostname}'.`,
|
|
219
|
+
}),
|
|
220
|
+
);
|
|
221
|
+
}
|
|
193
222
|
srcDir = gitClone(filePath, reqOptions.gitBranch);
|
|
194
223
|
cleanup = true;
|
|
195
|
-
} else
|
|
224
|
+
} else {
|
|
225
|
+
if (!isAllowedPath(path.resolve(srcDir))) {
|
|
226
|
+
res.writeHead(403, { "Content-Type": "application/json" });
|
|
227
|
+
return res.end(
|
|
228
|
+
JSON.stringify({
|
|
229
|
+
error: "Path Not Allowed",
|
|
230
|
+
details: `Path is not allowed: '${srcDir}'.`,
|
|
231
|
+
}),
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (srcDir !== path.resolve(srcDir)) {
|
|
196
236
|
console.log(
|
|
197
237
|
`Invoke the API with an absolute path '${path.resolve(srcDir)}' instead of '${srcDir}' to reduce security risks.`,
|
|
198
238
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyclonedx/cdxgen",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.6",
|
|
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>",
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
{
|
|
35
35
|
"name": "Adam Setch",
|
|
36
36
|
"url": "https://github.com/setchy"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Roland Asmann",
|
|
40
|
+
"url": "https://github.com/malice00"
|
|
37
41
|
}
|
|
38
42
|
],
|
|
39
43
|
"type": "module",
|
|
@@ -97,7 +101,7 @@
|
|
|
97
101
|
"yoctocolors": "^2.1.1"
|
|
98
102
|
},
|
|
99
103
|
"optionalDependencies": {
|
|
100
|
-
"@appthreat/atom": "2.1.
|
|
104
|
+
"@appthreat/atom": "2.1.16",
|
|
101
105
|
"@appthreat/cdx-proto": "1.0.1",
|
|
102
106
|
"@cyclonedx/cdxgen-plugins-bin": "1.6.10",
|
|
103
107
|
"@cyclonedx/cdxgen-plugins-bin-linux-arm": "1.6.10",
|
|
@@ -136,7 +140,7 @@
|
|
|
136
140
|
"negotiator": "^0.6.4"
|
|
137
141
|
},
|
|
138
142
|
"scripts": {
|
|
139
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --inject-globals false lib/managers/docker.test.js lib/helpers/
|
|
143
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --inject-globals false lib/managers/docker.test.js lib/helpers/utils.test.js lib/helpers/display.test.js lib/stages/postgen/postgen.test.js lib/evinser/swiftsem.test.js",
|
|
140
144
|
"watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch --inject-globals false",
|
|
141
145
|
"lint:check": "biome check",
|
|
142
146
|
"lint": "biome check --fix",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/cli/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/cli/index.js"],"names":[],"mappings":"AAu7BA;;;;;;;;GAQG;AACH,gFAFW,MAAM,SAchB;AA8XD;;;;;;;GAOG;AACH,mCALW,MAAM,qBAyEhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM;;;;EAKhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM;;;;EAkBhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAgvChB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BAmvBhB;AAED;;;;;;;;;;GAUG;AACH,+DAsEC;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BAkehB;AAED;;;;;GAKG;AACH,kCAHW,MAAM,8BA+YhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAuIhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAkEhB;AAED;;;;;GAKG;AACH,mCAHW,MAAM,qBA+KhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM,qBAsHhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,qBAuBhB;AAED;;;;;GAKG;AACH,mCAHW,MAAM,8BAqDhB;AAED;;;;;GAKG;AACH,uCAHW,MAAM,8BA4ChB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,qBA2BhB;AAED;;;;;GAKG;AACH,qCAHW,MAAM,8BA8IhB;AAED;;;;;GAKG;AACH,qCAHW,MAAM,8BAmJhB;AAED;;;;;GAKG;AACH,iDAHW,MAAM,qBAmUhB;AAED;;;;;GAKG;AACH,mCAHW,MAAM,qBAiJhB;AAED;;;;;GAKG;AACH,oCAHW,MAAM,8BAwNhB;AAED;;;;;GAKG;AACH,sCAHW,MAAM,8BA8ZhB;AAED;;;;;GAKG;AACH,2CAHW,MAAM;;;;;;;;;;;;;;;;;;;;GAoChB;AAED;;;;;;;;KA+DC;AAED;;;;;;GAMG;AACH,yDA+FC;AAED;;;;;;;;;GASG;AACH,2GAuCC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,EAAE,8BA6vBlB;AAED;;;;;GAKG;AACH,iCAHW,MAAM,8BAqUhB;AAED;;;;;GAKG;AACH,gCAHW,MAAM,qBA2QhB;AAED;;;;;;;GAOG;AACH,wDAHY,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC,CA2HjD"}
|
|
@@ -294,10 +294,11 @@ export function parseGradleProperties(rawOutput: string, gradleModuleName?: stri
|
|
|
294
294
|
*
|
|
295
295
|
* @param {string} dir Directory to execute the command
|
|
296
296
|
* @param {array} allProjectsStr List of all sub-projects (including the preceding `:`)
|
|
297
|
+
* @param {array} extraArgs List of extra arguments to use when calling gradle
|
|
297
298
|
*
|
|
298
299
|
* @returns {string} The combined output for all subprojects of the Gradle properties task
|
|
299
300
|
*/
|
|
300
|
-
export function executeParallelGradleProperties(dir: string, allProjectsStr: any[]): string;
|
|
301
|
+
export function executeParallelGradleProperties(dir: string, allProjectsStr: any[], extraArgs?: any[]): string;
|
|
301
302
|
/**
|
|
302
303
|
* Parse bazel action graph output
|
|
303
304
|
* @param {string} rawOutput Raw string output
|
|
@@ -1154,10 +1155,11 @@ export function getMillCommand(srcPath: string): string;
|
|
|
1154
1155
|
* @param {string[]} gradleArguments The general gradle arguments, which must only be added once
|
|
1155
1156
|
* @param {string[]} gradleSubCommands The sub-commands that are to be executed by gradle
|
|
1156
1157
|
* @param {string[]} gradleSubCommandArguments The arguments specific to the sub-command(s), which much be added PER sub-command
|
|
1158
|
+
* @param {int} gradleCommandLength The length of the full gradle-command
|
|
1157
1159
|
*
|
|
1158
|
-
* @returns {string[]} Array of arguments to be added to the gradle command
|
|
1160
|
+
* @returns {string[]} Array of arrays of arguments to be added to the gradle command
|
|
1159
1161
|
*/
|
|
1160
|
-
export function buildGradleCommandArguments(gradleArguments: string[], gradleSubCommands: string[], gradleSubCommandArguments: string[]): string[];
|
|
1162
|
+
export function buildGradleCommandArguments(gradleArguments: string[], gradleSubCommands: string[], gradleSubCommandArguments: string[], gradleCommandLength: int): string[];
|
|
1161
1163
|
/**
|
|
1162
1164
|
* Method to split the output produced by Gradle using parallel processing by project
|
|
1163
1165
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/helpers/utils.js"],"names":[],"mappings":"AA8EA;;;;;GAKG;AACH,0DAUC;AAED;;;;;;GAMG;AACH,yDAHmB,OAAO,UAazB;AAmFD,8CAKC;AAED,0CAIC;AAsBD,yCAYC;AAID,2CAQC;AAiOD;;;;;;;GAOG;AACH,4EAiBC;AAED;;;;;;GAMG;AACH,mGA2EC;AAED;;;;;;;;GAQG;AACH,yGAeC;AAyBD;;;;;;GAMG;AACH,qCAJW,MAAM,WACN,MAAM,2BA8BhB;AAED;;;;;;GAMG;AACH,+CAJW,MAAM,WACN,MAAM,+BA0BhB;AAYD;;;;GAIG;AACH,gCAFa,MAAM,CAIlB;AAED,iCAQC;AAED;;;;;;IAMI;AACJ,iDAJW,MAAM,GACJ,OAAO,CAWnB;AAED;;;;;;;;;GASG;AACH,iEA2BC;AAED;;;;;GAKG;AACH,6CAqDC;AAED;;;;;;GAMG;AACH,sEA0DC;AAED;;;;GAIG;AACH,4EAoCC;AAED;;;GAGG;AACH;;EAUC;AAED,sEA0BC;AAED;;;;GAIG;AACH,+DA4CC;AAED;;;;;GAKG;AACH,0CAHW,MAAM,WACN,OAAO,kBA+EjB;AAED;;;;;GAKG;AACH,0CAHW,MAAM,YACN,MAAM;;;GAygBhB;AAED;;;;;;;GAOG;AACH,6CAFW,MAAM,MA2DhB;AAgCD;;;;GAIG;AACH,4CAFW,MAAM;;;GA4OhB;AAED;;;;GAIG;AACH,4CAFW,MAAM,kBAiEhB;AAoHD;;;;;GAKG;AACH,kDAHW,MAAM,GACJ,MAAM,CAgBlB;AAED;;;;;;;;;;GAUG;AACH,wCARW,MAAM;;;;;;;;;;;;;;;;;;GAuvBhB;AAED;;;;GAIG;AACH,8CAFW,MAAM,kBA+ChB;AAED;;;;GAIG;AACH,sCAFW,MAAM,kBAgFhB;AAED;;;;;GAKG;AACH,kCAHW,MAAM,OAqIhB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,WACN,MAAM,OA+JhB;AAED;;;;;;;;;GASG;AACH,4CAPW,MAAM,gBACN,GAAG,aACH,GAAG,gBACH,MAAM,OA+GhB;AAiBD;;;;;;GAMG;AACH,0CALW,MAAM,oBACN,MAAM,kBACN,GAAG,mBACH,MAAM;;;;;;;;;GA6OhB;AAED;;;GAGG;AACH,uCAFW,MAAM,SAoChB;AAED;;;GAGG;AACH,wCAFW,MAAM,OAahB;AAED,yEAwBC;AAED;;;;GAIG;AACH,+CAFW,MAAM;;;EAwDhB;AAED;;;;;GAKG;AACH,iDAHW,MAAM,qBACN,MAAM;;;;;;;;EAmDhB;AAED
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/helpers/utils.js"],"names":[],"mappings":"AA8EA;;;;;GAKG;AACH,0DAUC;AAED;;;;;;GAMG;AACH,yDAHmB,OAAO,UAazB;AAmFD,8CAKC;AAED,0CAIC;AAsBD,yCAYC;AAID,2CAQC;AAiOD;;;;;;;GAOG;AACH,4EAiBC;AAED;;;;;;GAMG;AACH,mGA2EC;AAED;;;;;;;;GAQG;AACH,yGAeC;AAyBD;;;;;;GAMG;AACH,qCAJW,MAAM,WACN,M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2IhB;AAED,qDASC;AAED;;;;;;;EA2GC;AAED;;;EAgQC;AAED,sEA6BC;AAED;;;;;;;GAOG;AACH,mCALW,MAAM,WACN,MAAM;;;;;;;EAuQhB;AAED;;;;;;GAMG;AACH,2CAHW,MAAM,OAKhB;AAED,qDA0CC;AAgID;;;;;GAKG;AACH;;;GA2HC;AAED,yEAiIC;AAED;;;;;;GAMG;AACH,mDAkBC;AAED;;;;;;;;;;GAUG;AACH,0DAkBC;AAED;;;;;;GAMG;AACH,sFAsBC;AAED;;;;;;;GAOG;AACH,2EAgCC;AAED;;;;;GAKG;AACH,oDAsCC;AAED;;;;;;GAMG;AACH,sEA0BC;AAED;;;;;;;;;GASG;AACH,+GA+CC;AAtleD,gCAEc;AAEd,+BAEsD;AAEtD,4BAA4C;AAC5C,4BAA6C;AAC7C,2BAAmE;AA2DnE,iCAEE;AA2BF,iCAE0C;AAG1C,gCACmE;AAGnE,gCACsE;AAGtE,8BAA+B;AAe/B,4CAEmE;AAGnE,6CAEE;AAgBF,oCAAkD;AAGlD,uCAEuD;AAYvD,8BAAyC;AAgBzC,gCAA6C;AAY7C,8BAAiC;AAIjC,4BAA6B;AAI7B,2BAA2B;AAI3B,4BAA6B;AAI7B,2BAA2B;AAI3B,6BAA+B;AAI/B,0BAAyB;AAIzB,6BAA+B;AAM/B,2BAA2B;AAK3B,4BAA6B;AAK7B,mCAAoC;AAOpC,gDAC2D;AAE3D,2BAAuD;AAGvD,kDAWE;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiJE;;;;AA6JF,8BAQG;AAqgMH,8CAUE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../lib/managers/binary.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../lib/managers/binary.js"],"names":[],"mappings":"AAwVA,wDAkBC;AAED;;;;;GAKG;AACH,kDAFa,SAAS,MAAO,CAqB5B;AAED;;;;;;;GAOG;AACH,kEAqaC;AAsDD,gDAoDC;AAED;;;;;;GAMG;AACH,qCAJW,MAAM,cACN,MAAM,WA0ChB;AAED;;;;;;;;GAQG;AACH,kCANW,MAAM,iBACN,MAAM,YACN,OAAO,GAEN,OAAO,CA8BlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../lib/managers/docker.js"],"names":[],"mappings":"AAiFA;;GAEG;AACH,oCAmBC;AAED;;GAEG;AACH,4CA6CC;AA7HD,4BAA6C;AAC7C,kCAAmC,WAAW,CAAC;AAmCxC,kDAeN;AAqFM,iCAHI,MAAM,WACN,MAAM,iDAehB;AAqBM,6DAmBN;AAgLM,4EAsGN;AAEM,oFAwBN;AAUM;;;;;;;;EAyEN;AAsBM,
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../../lib/managers/docker.js"],"names":[],"mappings":"AAiFA;;GAEG;AACH,oCAmBC;AAED;;GAEG;AACH,4CA6CC;AA7HD,4BAA6C;AAC7C,kCAAmC,WAAW,CAAC;AAmCxC,kDAeN;AAqFM,iCAHI,MAAM,WACN,MAAM,iDAehB;AAqBM,6DAmBN;AAgLM,4EAsGN;AAEM,oFAwBN;AAUM;;;;;;;;EAyEN;AAsBM,2DAsMN;AAgBM,yFAqGN;AAMM;;;;;;;;;;;;;;GAwDN;AAEM;;;;;;;;GAyGN;AAMM,4EA+IN;AAKM,4EA2GN;AAEM,+EAEN;AAEM,4EAyCN;AAEM,iFA0BN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../lib/server/server.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../lib/server/server.js"],"names":[],"mappings":"AA8IA,yDAKC;AAED,0CAgJC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Function to parse the given gradle build file to identify properties such as included builds
|
|
5
|
-
*
|
|
6
|
-
* @param buildFile {build,settings}.gradle(.kts)? Build file in groovy or kotlin format
|
|
7
|
-
* @param buildContent String content to parse directly.
|
|
8
|
-
*/
|
|
9
|
-
export function analyzeBuildSettings(buildFile, buildContent) {
|
|
10
|
-
const includedBuilds = new Set();
|
|
11
|
-
if (!buildContent && !existsSync(buildFile)) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
const data = buildContent || readFileSync(buildFile, "utf-8");
|
|
15
|
-
let pluginManagementMode = false;
|
|
16
|
-
for (let aline of data.split("\n")) {
|
|
17
|
-
aline = aline.replaceAll("\r", "").trim();
|
|
18
|
-
if (aline.includes("pluginManagement {")) {
|
|
19
|
-
pluginManagementMode = true;
|
|
20
|
-
}
|
|
21
|
-
if (pluginManagementMode && aline === "}") {
|
|
22
|
-
pluginManagementMode = false;
|
|
23
|
-
}
|
|
24
|
-
if (!pluginManagementMode) {
|
|
25
|
-
if (aline.includes("includeBuild")) {
|
|
26
|
-
aline = aline.replace("includeBuild", "").replaceAll(/[ "'()]/g, "");
|
|
27
|
-
// Ignore relative includes for now
|
|
28
|
-
if (!aline.startsWith(".")) {
|
|
29
|
-
includedBuilds.add(`:${aline.trim()}`);
|
|
30
|
-
}
|
|
31
|
-
} else if (aline.includes("includedBuild(")) {
|
|
32
|
-
aline = aline
|
|
33
|
-
.split("includedBuild(")[1]
|
|
34
|
-
.split(")")[0]
|
|
35
|
-
.replaceAll(/[ "'()]/g, "");
|
|
36
|
-
if (!aline.startsWith(".")) {
|
|
37
|
-
includedBuilds.add(`:${aline.trim()}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (!includedBuilds.size) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
includedBuilds: Array.from(includedBuilds),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { afterAll, beforeAll, describe, expect, test } from "@jest/globals";
|
|
2
|
-
import { analyzeBuildSettings } from "./gradleutils.js";
|
|
3
|
-
|
|
4
|
-
test("analyzeBuildSettings tests", () => {
|
|
5
|
-
expect(analyzeBuildSettings()).toBeUndefined();
|
|
6
|
-
expect(
|
|
7
|
-
analyzeBuildSettings(
|
|
8
|
-
undefined,
|
|
9
|
-
`rootProject.name = "my-composite"
|
|
10
|
-
|
|
11
|
-
includeBuild("my-app")
|
|
12
|
-
includeBuild("my-utils")`,
|
|
13
|
-
),
|
|
14
|
-
).toEqual({
|
|
15
|
-
includedBuilds: [":my-app", ":my-utils"],
|
|
16
|
-
});
|
|
17
|
-
expect(
|
|
18
|
-
analyzeBuildSettings(
|
|
19
|
-
undefined,
|
|
20
|
-
`rootProject.name = 'my-composite'
|
|
21
|
-
|
|
22
|
-
includeBuild 'my-app'
|
|
23
|
-
includeBuild 'my-utils'`,
|
|
24
|
-
),
|
|
25
|
-
).toEqual({
|
|
26
|
-
includedBuilds: [":my-app", ":my-utils"],
|
|
27
|
-
});
|
|
28
|
-
expect(
|
|
29
|
-
analyzeBuildSettings(
|
|
30
|
-
undefined,
|
|
31
|
-
`tasks.register("run") {
|
|
32
|
-
dependsOn(gradle.includedBuild("my-app").task(":app:run"))
|
|
33
|
-
}`,
|
|
34
|
-
),
|
|
35
|
-
).toEqual({
|
|
36
|
-
includedBuilds: [":my-app"],
|
|
37
|
-
});
|
|
38
|
-
expect(
|
|
39
|
-
analyzeBuildSettings(
|
|
40
|
-
undefined,
|
|
41
|
-
`tasks.register('run') {
|
|
42
|
-
dependsOn gradle.includedBuild('my-app').task(':app:run')
|
|
43
|
-
}`,
|
|
44
|
-
),
|
|
45
|
-
).toEqual({
|
|
46
|
-
includedBuilds: [":my-app"],
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
expect(
|
|
50
|
-
analyzeBuildSettings(
|
|
51
|
-
undefined,
|
|
52
|
-
`pluginManagement {
|
|
53
|
-
includeBuild("../url-verifier-plugin")
|
|
54
|
-
}`,
|
|
55
|
-
),
|
|
56
|
-
).toBeUndefined();
|
|
57
|
-
expect(
|
|
58
|
-
analyzeBuildSettings(
|
|
59
|
-
undefined,
|
|
60
|
-
`pluginManagement {
|
|
61
|
-
includeBuild '../url-verifier-plugin'
|
|
62
|
-
}`,
|
|
63
|
-
),
|
|
64
|
-
).toBeUndefined();
|
|
65
|
-
});
|