@cyclonedx/cdxgen 9.9.6 → 9.9.7

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 CHANGED
@@ -51,6 +51,7 @@ Most SBOM tools are like barcode scanners. They can scan a few package manifest
51
51
  | Docker compose | docker-compose\*.yml. Images would also be scanned. | N/A | |
52
52
  | Dockerfile | `*Dockerfile*` Images would also be scanned. | N/A | |
53
53
  | Containerfile | `*Containerfile*`. Images would also be scanned. | N/A | |
54
+ | Bitbucket Pipelines | `bitbucket-pipelines.yml` images and pipes would also be scanned. | N/A | |
54
55
  | Google CloudBuild configuration | cloudbuild.yaml | N/A | |
55
56
  | OpenAPI | openapi\*.json, openapi\*.yaml | N/A | |
56
57
 
package/index.js CHANGED
@@ -106,7 +106,8 @@ import {
106
106
  getNugetMetadata,
107
107
  frameworksList,
108
108
  parseContainerFile,
109
- parseBitbucketPipelinesFile
109
+ parseBitbucketPipelinesFile,
110
+ getPyMetadata
110
111
  } from "./utils.js";
111
112
  import { spawnSync } from "node:child_process";
112
113
  import { fileURLToPath } from "node:url";
@@ -2575,6 +2576,9 @@ export const createPythonBom = async (path, options) => {
2575
2576
  if (tempDir && tempDir.startsWith(tmpdir()) && rmSync) {
2576
2577
  rmSync(tempDir, { recursive: true, force: true });
2577
2578
  }
2579
+ if (FETCH_LICENSE) {
2580
+ pkgList = await getPyMetadata(pkgList, false);
2581
+ }
2578
2582
  return buildBomNSData(options, pkgList, "pypi", {
2579
2583
  allImports,
2580
2584
  src: path,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclonedx/cdxgen",
3
- "version": "9.9.6",
3
+ "version": "9.9.7",
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/utils.js CHANGED
@@ -19,8 +19,7 @@ import {
19
19
  readFileSync,
20
20
  rmSync,
21
21
  unlinkSync,
22
- writeFileSync,
23
- readdirSync
22
+ writeFileSync
24
23
  } from "node:fs";
25
24
  import got from "got";
26
25
  import Arborist from "@npmcli/arborist";
@@ -6683,30 +6682,13 @@ export const encodeForPurl = (s) => {
6683
6682
  export const getPomPropertiesFromMavenDir = function (mavenDir) {
6684
6683
  let pomProperties = {};
6685
6684
  if (existsSync(mavenDir) && lstatSync(mavenDir).isDirectory()) {
6686
- let mavenDirEntries = readdirSync(mavenDir, { withFileTypes: true });
6687
- mavenDirEntries.forEach((mavenDirEntry) => {
6688
- if (mavenDirEntry.isDirectory()) {
6689
- let groupDirEntries = readdirSync(
6690
- join(mavenDirEntry.path, mavenDirEntry.name),
6691
- { withFileTypes: true }
6692
- );
6693
- groupDirEntries.forEach((groupDirEntry) => {
6694
- if (groupDirEntry.isDirectory()) {
6695
- let pomPropertiesFile = join(
6696
- groupDirEntry.path,
6697
- groupDirEntry.name,
6698
- "pom.properties"
6699
- );
6700
- if (existsSync(pomPropertiesFile)) {
6701
- const pomPropertiesString = readFileSync(pomPropertiesFile, {
6702
- encoding: "utf-8"
6703
- });
6704
- pomProperties = parsePomProperties(pomPropertiesString);
6705
- }
6706
- }
6707
- });
6708
- }
6709
- });
6685
+ const pomPropertiesFiles = getAllFiles(mavenDir, "**/pom.properties");
6686
+ if (pomPropertiesFiles && pomPropertiesFiles.length) {
6687
+ const pomPropertiesString = readFileSync(pomPropertiesFiles[0], {
6688
+ encoding: "utf-8"
6689
+ });
6690
+ pomProperties = parsePomProperties(pomPropertiesString);
6691
+ }
6710
6692
  }
6711
6693
  return pomProperties;
6712
6694
  };
@@ -6845,17 +6827,17 @@ export const extractJarArchive = function (
6845
6827
  if (!name || !version || name === "" || version === "") {
6846
6828
  confidence = 0.5;
6847
6829
  technique = "filename";
6830
+ name = jarname.replace(".jar", "");
6848
6831
  const tmpA = jarname.split("-");
6849
6832
  if (tmpA && tmpA.length > 1) {
6850
6833
  const lastPart = tmpA[tmpA.length - 1];
6851
- if (!version || version === "") {
6852
- version = lastPart.replace(".jar", "");
6853
- }
6854
- if (!name || name === "") {
6834
+ // Bug #768. Check if we have any number before simplifying the name.
6835
+ if (/\d/.test(lastPart)) {
6836
+ if (!version || version === "") {
6837
+ version = lastPart.replace(".jar", "");
6838
+ }
6855
6839
  name = jarname.replace("-" + lastPart, "") || "";
6856
6840
  }
6857
- } else {
6858
- name = jarname.replace(".jar", "");
6859
6841
  }
6860
6842
  }
6861
6843
  if (