@cyclonedx/cdxgen 9.11.0 → 9.11.2
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/index.js +49 -34
- package/package.json +2 -2
- package/utils.js +8 -1
package/index.js
CHANGED
|
@@ -1236,46 +1236,50 @@ export const createJavaBom = async (path, options) => {
|
|
|
1236
1236
|
maxBuffer: MAX_BUFFER
|
|
1237
1237
|
});
|
|
1238
1238
|
if (result.status !== 0 || result.error) {
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
if (
|
|
1244
|
-
result.stdout &&
|
|
1245
|
-
(result.stdout.includes("Non-resolvable parent POM") ||
|
|
1246
|
-
result.stdout.includes("points at wrong local POM"))
|
|
1247
|
-
) {
|
|
1239
|
+
// Our approach to recursively invoking the maven plugin for each sub-module is bound to result in failures
|
|
1240
|
+
// These could be due to a range of reasons that are covered below.
|
|
1241
|
+
if (pomFiles.length === 1 || DEBUG_MODE) {
|
|
1242
|
+
console.error(result.stdout, result.stderr);
|
|
1248
1243
|
console.log(
|
|
1249
|
-
"
|
|
1244
|
+
"Resolve the above maven error. This could be due to the following:\n"
|
|
1250
1245
|
);
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
)
|
|
1264
|
-
|
|
1246
|
+
if (
|
|
1247
|
+
result.stdout &&
|
|
1248
|
+
(result.stdout.includes("Non-resolvable parent POM") ||
|
|
1249
|
+
result.stdout.includes("points at wrong local POM"))
|
|
1250
|
+
) {
|
|
1251
|
+
console.log(
|
|
1252
|
+
"1. Check if the pom.xml contains valid settings such `parent.relativePath` to make mvn command work from within the sub-directory."
|
|
1253
|
+
);
|
|
1254
|
+
} else if (
|
|
1255
|
+
result.stdout &&
|
|
1256
|
+
(result.stdout.includes("Could not resolve dependencies") ||
|
|
1257
|
+
result.stdout.includes("no dependency information available"))
|
|
1258
|
+
) {
|
|
1259
|
+
console.log(
|
|
1260
|
+
"1. Try building the project with 'mvn package -Dmaven.test.skip=true' using the correct version of Java and maven before invoking cdxgen."
|
|
1261
|
+
);
|
|
1262
|
+
} else if (
|
|
1263
|
+
result.stdout &&
|
|
1264
|
+
result.stdout.includes(
|
|
1265
|
+
"Could not resolve target platform specification"
|
|
1266
|
+
)
|
|
1267
|
+
) {
|
|
1268
|
+
console.log(
|
|
1269
|
+
"1. Some projects can be built only from the root directory. Invoke cdxgen with --no-recurse option"
|
|
1270
|
+
);
|
|
1271
|
+
} else {
|
|
1272
|
+
console.log(
|
|
1273
|
+
"1. Java version requirement: cdxgen container image bundles Java 21 with maven 3.9 which might be incompatible."
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1265
1276
|
console.log(
|
|
1266
|
-
"
|
|
1277
|
+
"2. Private dependencies cannot be downloaded: Check if any additional arguments must be passed to maven and set them via MVN_ARGS environment variable."
|
|
1267
1278
|
);
|
|
1268
|
-
} else {
|
|
1269
1279
|
console.log(
|
|
1270
|
-
"
|
|
1280
|
+
"3. Check if all required environment variables including any maven profile arguments are passed correctly to this tool."
|
|
1271
1281
|
);
|
|
1272
1282
|
}
|
|
1273
|
-
console.log(
|
|
1274
|
-
"2. Private dependencies cannot be downloaded: Check if any additional arguments must be passed to maven and set them via MVN_ARGS environment variable."
|
|
1275
|
-
);
|
|
1276
|
-
console.log(
|
|
1277
|
-
"3. Check if all required environment variables including any maven profile arguments are passed correctly to this tool."
|
|
1278
|
-
);
|
|
1279
1283
|
// Do not fall back to methods that can produce incomplete results when failOnError is set
|
|
1280
1284
|
options.failOnError && process.exit(1);
|
|
1281
1285
|
console.log(
|
|
@@ -1718,7 +1722,18 @@ export const createJavaBom = async (path, options) => {
|
|
|
1718
1722
|
}
|
|
1719
1723
|
} else {
|
|
1720
1724
|
const SBT_CMD = process.env.SBT_CMD || "sbt";
|
|
1721
|
-
|
|
1725
|
+
let sbtVersion = determineSbtVersion(path);
|
|
1726
|
+
// If can't find sbt version at the root of repository then search in
|
|
1727
|
+
// sbt project array too because sometimes the project folder isn't at
|
|
1728
|
+
// root of repository
|
|
1729
|
+
if (sbtVersion == null) {
|
|
1730
|
+
for (const i in sbtProjects) {
|
|
1731
|
+
sbtVersion = determineSbtVersion(sbtProjects[i]);
|
|
1732
|
+
if (sbtVersion != null) {
|
|
1733
|
+
break;
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1722
1737
|
if (DEBUG_MODE) {
|
|
1723
1738
|
console.log("Detected sbt version: " + sbtVersion);
|
|
1724
1739
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyclonedx/cdxgen",
|
|
3
|
-
"version": "9.11.
|
|
3
|
+
"version": "9.11.2",
|
|
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>",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"yargs": "^17.7.2"
|
|
84
84
|
},
|
|
85
85
|
"optionalDependencies": {
|
|
86
|
-
"@appthreat/atom": "1.8.
|
|
86
|
+
"@appthreat/atom": "1.8.4",
|
|
87
87
|
"@appthreat/cdx-proto": "^0.0.4",
|
|
88
88
|
"@cyclonedx/cdxgen-plugins-bin": "^1.5.4",
|
|
89
89
|
"@cyclonedx/cdxgen-plugins-bin-windows-amd64": "^1.5.4",
|
package/utils.js
CHANGED
|
@@ -1260,6 +1260,9 @@ export const parsePnpmLock = async function (pnpmLock, parentComponent = null) {
|
|
|
1260
1260
|
).toString();
|
|
1261
1261
|
}
|
|
1262
1262
|
if (existsSync(pnpmLock)) {
|
|
1263
|
+
if (DEBUG_MODE) {
|
|
1264
|
+
console.log(`Parsing file ${pnpmLock}`);
|
|
1265
|
+
}
|
|
1263
1266
|
const lockData = readFileSync(pnpmLock, "utf8");
|
|
1264
1267
|
const yamlObj = _load(lockData);
|
|
1265
1268
|
if (!yamlObj) {
|
|
@@ -1295,7 +1298,7 @@ export const parsePnpmLock = async function (pnpmLock, parentComponent = null) {
|
|
|
1295
1298
|
} catch (e) {
|
|
1296
1299
|
// ignore parse errors
|
|
1297
1300
|
}
|
|
1298
|
-
const packages = yamlObj.packages;
|
|
1301
|
+
const packages = yamlObj.packages || {};
|
|
1299
1302
|
const pkgKeys = Object.keys(packages);
|
|
1300
1303
|
for (const k in pkgKeys) {
|
|
1301
1304
|
// Eg: @babel/code-frame/7.10.1
|
|
@@ -7207,6 +7210,9 @@ export const extractJarArchive = async function (
|
|
|
7207
7210
|
*/
|
|
7208
7211
|
export const determineSbtVersion = function (projectPath) {
|
|
7209
7212
|
const buildPropFile = join(projectPath, "project", "build.properties");
|
|
7213
|
+
if (DEBUG_MODE) {
|
|
7214
|
+
console.log("Looking for", buildPropFile);
|
|
7215
|
+
}
|
|
7210
7216
|
if (existsSync(buildPropFile)) {
|
|
7211
7217
|
const properties = propertiesReader(buildPropFile);
|
|
7212
7218
|
const property = properties.get("sbt.version");
|
|
@@ -7495,6 +7501,7 @@ export const executeAtom = (src, args) => {
|
|
|
7495
7501
|
timeout: TIMEOUT_MS,
|
|
7496
7502
|
detached: !isWin && !process.env.CI,
|
|
7497
7503
|
shell: isWin,
|
|
7504
|
+
killSignal: "SIGKILL",
|
|
7498
7505
|
env
|
|
7499
7506
|
});
|
|
7500
7507
|
if (result.stderr) {
|