@cyclonedx/cdxgen 8.2.0 → 8.2.1

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/binary.js CHANGED
@@ -312,7 +312,9 @@ const getOSPackages = (src) => {
312
312
  if (DEBUG_MODE) {
313
313
  console.log(`Cleaning up ${tempDir}`);
314
314
  }
315
- fs.rmSync(tempDir, { recursive: true, force: true });
315
+ if (fs.rmSync) {
316
+ fs.rmSync(tempDir, { recursive: true, force: true });
317
+ }
316
318
  }
317
319
  if (tmpBom && tmpBom.components) {
318
320
  for (const comp of tmpBom.components) {
package/docker.js CHANGED
@@ -619,7 +619,9 @@ const exportImage = async (fullImageName) => {
619
619
  if (DEBUG_MODE) {
620
620
  console.log(`Cleaning up ${imageTarFile}`);
621
621
  }
622
- fs.rmSync(imageTarFile, { force: true });
622
+ if (fs.rmSync) {
623
+ fs.rmSync(imageTarFile, { force: true });
624
+ }
623
625
  }
624
626
  } else {
625
627
  let client = await getConnection();
package/index.js CHANGED
@@ -519,7 +519,10 @@ function addComponent(
519
519
  // Skip @types package for npm
520
520
  if (
521
521
  ptype == "npm" &&
522
- (group === "types" || !name || name.startsWith("@types"))
522
+ (group === "types" ||
523
+ group === "@types" ||
524
+ !name ||
525
+ name.startsWith("@types"))
523
526
  ) {
524
527
  return;
525
528
  }
@@ -531,7 +534,14 @@ function addComponent(
531
534
 
532
535
  let purl =
533
536
  pkg.purl ||
534
- new PackageURL(ptype, group, name, version, pkg.qualifiers, pkg.subpath);
537
+ new PackageURL(
538
+ ptype,
539
+ encodeURIComponent(group),
540
+ encodeURIComponent(name),
541
+ version,
542
+ pkg.qualifiers,
543
+ pkg.subpath
544
+ );
535
545
  let purlString = purl.toString();
536
546
  purlString = decodeURIComponent(purlString);
537
547
  let description = { "#cdata": pkg.description };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclonedx/cdxgen",
3
- "version": "8.2.0",
3
+ "version": "8.2.1",
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>",
package/server.js CHANGED
@@ -115,7 +115,7 @@ const start = async (options) => {
115
115
  }
116
116
  }
117
117
  res.end("\n");
118
- if (cleanup && srcDir && srcDir.startsWith(os.tmpdir())) {
118
+ if (cleanup && srcDir && srcDir.startsWith(os.tmpdir()) && fs.rmSync) {
119
119
  console.log(`Cleaning up ${srcDir}`);
120
120
  fs.rmSync(srcDir, { recursive: true, force: true });
121
121
  }
package/utils.js CHANGED
@@ -4208,6 +4208,7 @@ const extractJarArchive = function (jarFile, tempDir) {
4208
4208
  jarMetadata["Extension-Name"] ||
4209
4209
  jarMetadata["Implementation-Vendor-Id"] ||
4210
4210
  jarMetadata["Bundle-SymbolicName"] ||
4211
+ jarMetadata["Bundle-Vendor"] ||
4211
4212
  jarMetadata["Automatic-Module-Name"];
4212
4213
  let name = "";
4213
4214
  if (
@@ -4274,8 +4275,8 @@ const extractJarArchive = function (jarFile, tempDir) {
4274
4275
  }
4275
4276
  if (name && version) {
4276
4277
  pkgList.push({
4277
- group: group === "." ? "" : group || "",
4278
- name: name || "",
4278
+ group: group === "." ? "" : encodeURIComponent(group) || "",
4279
+ name: name ? encodeURIComponent(name) : "",
4279
4280
  version,
4280
4281
  properties: [
4281
4282
  {
package/utils.test.js CHANGED
@@ -1214,7 +1214,7 @@ test("parseYarnLock", async () => {
1214
1214
  }
1215
1215
  ]
1216
1216
  });
1217
-
1217
+ expect(parsedList.dependenciesList.length).toEqual(56);
1218
1218
  identMap = utils.yarnLockToIdentMap(
1219
1219
  fs.readFileSync("./test/data/yarn_locks/yarn.lock", "utf8")
1220
1220
  );
@@ -1329,6 +1329,7 @@ test("parseYarnLock", async () => {
1329
1329
  });
1330
1330
  parsedList = await utils.parseYarnLock("./test/data/yarn_locks/yarn4.lock");
1331
1331
  expect(parsedList.pkgList.length).toEqual(1);
1332
+ expect(parsedList.dependenciesList.length).toEqual(1);
1332
1333
  parsedList = await utils.parseYarnLock("./test/data/yarn_locks/yarn-at.lock");
1333
1334
  expect(parsedList.pkgList.length).toEqual(4);
1334
1335
  expect(parsedList.dependenciesList.length).toEqual(4);