@cyclonedx/cdxgen 9.9.1 → 9.9.3

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 CHANGED
@@ -1063,12 +1063,14 @@ export const createJarBom = async (path, options) => {
1063
1063
  } else {
1064
1064
  jarFiles = getAllFiles(
1065
1065
  path,
1066
- (options.multiProject ? "**/" : "") + "*.[jw]ar"
1066
+ (options.multiProject ? "**/" : "") + "*.[jw]ar",
1067
+ options
1067
1068
  );
1068
1069
  // Jenkins plugins
1069
1070
  const hpiFiles = getAllFiles(
1070
1071
  path,
1071
- (options.multiProject ? "**/" : "") + "*.hpi"
1072
+ (options.multiProject ? "**/" : "") + "*.hpi",
1073
+ options
1072
1074
  );
1073
1075
  if (hpiFiles.length) {
1074
1076
  jarFiles = jarFiles.concat(hpiFiles);
@@ -1143,7 +1145,8 @@ export const createJavaBom = async (path, options) => {
1143
1145
  // maven - pom.xml
1144
1146
  const pomFiles = getAllFiles(
1145
1147
  path,
1146
- (options.multiProject ? "**/" : "") + "pom.xml"
1148
+ (options.multiProject ? "**/" : "") + "pom.xml",
1149
+ options
1147
1150
  );
1148
1151
  let bomJsonFiles = [];
1149
1152
  if (
@@ -1153,7 +1156,7 @@ export const createJavaBom = async (path, options) => {
1153
1156
  ) {
1154
1157
  const cdxMavenPlugin =
1155
1158
  process.env.CDX_MAVEN_PLUGIN ||
1156
- "org.cyclonedx:cyclonedx-maven-plugin:2.7.9";
1159
+ "org.cyclonedx:cyclonedx-maven-plugin:2.7.10";
1157
1160
  const cdxMavenGoal = process.env.CDX_MAVEN_GOAL || "makeAggregateBom";
1158
1161
  let mvnArgs = [`${cdxMavenPlugin}:${cdxMavenGoal}`, "-DoutputName=bom"];
1159
1162
  if (includeMavenTestScope) {
@@ -1179,15 +1182,15 @@ export const createJavaBom = async (path, options) => {
1179
1182
  const mavenCmd = getMavenCommand(basePath, path);
1180
1183
  // Should we attempt to resolve class names
1181
1184
  if (options.resolveClass || options.deep) {
1182
- console.log(
1183
- "Creating class names list based on available jars. This might take a few mins ..."
1184
- );
1185
- jarNSMapping = collectMvnDependencies(
1185
+ const tmpjarNSMapping = collectMvnDependencies(
1186
1186
  mavenCmd,
1187
1187
  basePath,
1188
1188
  true,
1189
1189
  false
1190
1190
  );
1191
+ if (tmpjarNSMapping && Object.keys(tmpjarNSMapping).length) {
1192
+ jarNSMapping = { ...jarNSMapping, ...tmpjarNSMapping };
1193
+ }
1191
1194
  }
1192
1195
  console.log(
1193
1196
  `Executing '${mavenCmd} ${mvnArgs.join(" ")}' in`,
@@ -1202,10 +1205,10 @@ export const createJavaBom = async (path, options) => {
1202
1205
  });
1203
1206
  // Check if the cyclonedx plugin created the required bom.xml file
1204
1207
  // Sometimes the plugin fails silently for complex maven projects
1205
- bomJsonFiles = getAllFiles(path, "**/target/*.json");
1208
+ bomJsonFiles = getAllFiles(path, "**/target/*.json", options);
1206
1209
  // Check if the bom json files got created in a directory other than target
1207
1210
  if (!bomJsonFiles.length) {
1208
- bomJsonFiles = getAllFiles(path, "**/bom*.json");
1211
+ bomJsonFiles = getAllFiles(path, "**/bom*.json", options);
1209
1212
  }
1210
1213
  const bomGenerated = bomJsonFiles.length;
1211
1214
  if (!bomGenerated || result.status !== 0 || result.error) {
@@ -1296,7 +1299,7 @@ export const createJavaBom = async (path, options) => {
1296
1299
  }
1297
1300
  }
1298
1301
  } // for
1299
- const bomFiles = getAllFiles(path, "**/target/bom.xml");
1302
+ const bomFiles = getAllFiles(path, "**/target/bom.xml", options);
1300
1303
  for (const abjson of bomJsonFiles) {
1301
1304
  let bomJsonObj = undefined;
1302
1305
  try {
@@ -1359,7 +1362,8 @@ export const createJavaBom = async (path, options) => {
1359
1362
  // gradle
1360
1363
  const gradleFiles = getAllFiles(
1361
1364
  path,
1362
- (options.multiProject ? "**/" : "") + "build.gradle*"
1365
+ (options.multiProject ? "**/" : "") + "build.gradle*",
1366
+ options
1363
1367
  );
1364
1368
  const allProjects = [];
1365
1369
  const allProjectsAddedPurls = [];
@@ -1541,9 +1545,6 @@ export const createJavaBom = async (path, options) => {
1541
1545
  }
1542
1546
  // Should we attempt to resolve class names
1543
1547
  if (options.resolveClass || options.deep) {
1544
- console.log(
1545
- "Creating class names list based on available jars. This might take a few mins ..."
1546
- );
1547
1548
  jarNSMapping = collectJarNS(GRADLE_CACHE_DIR);
1548
1549
  }
1549
1550
  pkgList = await getMvnMetadata(pkgList, jarNSMapping);
@@ -1558,7 +1559,7 @@ export const createJavaBom = async (path, options) => {
1558
1559
 
1559
1560
  // Bazel
1560
1561
  // Look for the BUILD file only in the root directory
1561
- const bazelFiles = getAllFiles(path, "BUILD");
1562
+ const bazelFiles = getAllFiles(path, "BUILD", options);
1562
1563
  if (
1563
1564
  bazelFiles &&
1564
1565
  bazelFiles.length &&
@@ -1665,7 +1666,8 @@ export const createJavaBom = async (path, options) => {
1665
1666
  let sbtProjectFiles = getAllFiles(
1666
1667
  path,
1667
1668
  (options.multiProject ? "**/" : "") +
1668
- "project/{build.properties,*.sbt,*.scala}"
1669
+ "project/{build.properties,*.sbt,*.scala}",
1670
+ options
1669
1671
  );
1670
1672
 
1671
1673
  let sbtProjects = [];
@@ -1680,7 +1682,8 @@ export const createJavaBom = async (path, options) => {
1680
1682
  if (!sbtProjects.length) {
1681
1683
  sbtProjectFiles = getAllFiles(
1682
1684
  path,
1683
- (options.multiProject ? "**/" : "") + "*.sbt"
1685
+ (options.multiProject ? "**/" : "") + "*.sbt",
1686
+ options
1684
1687
  );
1685
1688
  for (const i in sbtProjectFiles) {
1686
1689
  const baseDir = dirname(sbtProjectFiles[i]);
@@ -1693,7 +1696,8 @@ export const createJavaBom = async (path, options) => {
1693
1696
  );
1694
1697
  const sbtLockFiles = getAllFiles(
1695
1698
  path,
1696
- (options.multiProject ? "**/" : "") + "build.sbt.lock"
1699
+ (options.multiProject ? "**/" : "") + "build.sbt.lock",
1700
+ options
1697
1701
  );
1698
1702
 
1699
1703
  if (sbtProjects && sbtProjects.length) {
@@ -1827,9 +1831,6 @@ export const createJavaBom = async (path, options) => {
1827
1831
  }
1828
1832
  // Should we attempt to resolve class names
1829
1833
  if (options.resolveClass || options.deep) {
1830
- console.log(
1831
- "Creating class names list based on available jars. This might take a few mins ..."
1832
- );
1833
1834
  jarNSMapping = collectJarNS(SBT_CACHE_DIR);
1834
1835
  }
1835
1836
  pkgList = await getMvnMetadata(pkgList, jarNSMapping);
@@ -1859,7 +1860,7 @@ export const createNodejsBom = async (path, options) => {
1859
1860
  let ppurl = "";
1860
1861
  // Docker mode requires special handling
1861
1862
  if (["docker", "oci", "os"].includes(options.projectType)) {
1862
- const pkgJsonFiles = getAllFiles(path, "**/package.json");
1863
+ const pkgJsonFiles = getAllFiles(path, "**/package.json", options);
1863
1864
  // Are there any package.json files in the container?
1864
1865
  if (pkgJsonFiles.length) {
1865
1866
  for (const pj of pkgJsonFiles) {
@@ -1890,30 +1891,36 @@ export const createNodejsBom = async (path, options) => {
1890
1891
  }
1891
1892
  const yarnLockFiles = getAllFiles(
1892
1893
  path,
1893
- (options.multiProject ? "**/" : "") + "yarn.lock"
1894
+ (options.multiProject ? "**/" : "") + "yarn.lock",
1895
+ options
1894
1896
  );
1895
1897
  const shrinkwrapFiles = getAllFiles(
1896
1898
  path,
1897
- (options.multiProject ? "**/" : "") + "npm-shrinkwrap.json"
1899
+ (options.multiProject ? "**/" : "") + "npm-shrinkwrap.json",
1900
+ options
1898
1901
  );
1899
1902
  let pkgLockFiles = getAllFiles(
1900
1903
  path,
1901
- (options.multiProject ? "**/" : "") + "package-lock.json"
1904
+ (options.multiProject ? "**/" : "") + "package-lock.json",
1905
+ options
1902
1906
  );
1903
1907
  if (shrinkwrapFiles.length) {
1904
1908
  pkgLockFiles = pkgLockFiles.concat(shrinkwrapFiles);
1905
1909
  }
1906
1910
  const pnpmLockFiles = getAllFiles(
1907
1911
  path,
1908
- (options.multiProject ? "**/" : "") + "pnpm-lock.yaml"
1912
+ (options.multiProject ? "**/" : "") + "pnpm-lock.yaml",
1913
+ options
1909
1914
  );
1910
1915
  const minJsFiles = getAllFiles(
1911
1916
  path,
1912
- (options.multiProject ? "**/" : "") + "*min.js"
1917
+ (options.multiProject ? "**/" : "") + "*min.js",
1918
+ options
1913
1919
  );
1914
1920
  const bowerFiles = getAllFiles(
1915
1921
  path,
1916
- (options.multiProject ? "**/" : "") + "bower.json"
1922
+ (options.multiProject ? "**/" : "") + "bower.json",
1923
+ options
1917
1924
  );
1918
1925
  // Parse min js files
1919
1926
  if (minJsFiles && minJsFiles.length) {
@@ -2179,7 +2186,8 @@ export const createNodejsBom = async (path, options) => {
2179
2186
  if (!pkgList.length && existsSync(join(path, "node_modules"))) {
2180
2187
  const pkgJsonFiles = getAllFiles(
2181
2188
  join(path, "node_modules"),
2182
- "**/package.json"
2189
+ "**/package.json",
2190
+ options
2183
2191
  );
2184
2192
  manifestFiles = manifestFiles.concat(pkgJsonFiles);
2185
2193
  for (const pkgjf of pkgJsonFiles) {
@@ -2241,37 +2249,44 @@ export const createPythonBom = async (path, options) => {
2241
2249
  const pipenvMode = existsSync(join(path, "Pipfile"));
2242
2250
  let poetryFiles = getAllFiles(
2243
2251
  path,
2244
- (options.multiProject ? "**/" : "") + "poetry.lock"
2252
+ (options.multiProject ? "**/" : "") + "poetry.lock",
2253
+ options
2245
2254
  );
2246
2255
  const pdmLockFiles = getAllFiles(
2247
2256
  path,
2248
- (options.multiProject ? "**/" : "") + "pdm.lock"
2257
+ (options.multiProject ? "**/" : "") + "pdm.lock",
2258
+ options
2249
2259
  );
2250
2260
  if (pdmLockFiles && pdmLockFiles.length) {
2251
2261
  poetryFiles = poetryFiles.concat(pdmLockFiles);
2252
2262
  }
2253
2263
  let reqFiles = getAllFiles(
2254
2264
  path,
2255
- (options.multiProject ? "**/" : "") + "*requirements*.txt"
2265
+ (options.multiProject ? "**/" : "") + "*requirements*.txt",
2266
+ options
2256
2267
  );
2257
2268
  reqFiles = reqFiles.filter(
2258
2269
  (f) => !f.includes(join("mercurial", "helptext", "internals"))
2259
2270
  );
2260
2271
  const reqDirFiles = getAllFiles(
2261
2272
  path,
2262
- (options.multiProject ? "**/" : "") + "requirements/*.txt"
2273
+ (options.multiProject ? "**/" : "") + "requirements/*.txt",
2274
+ options
2263
2275
  );
2264
2276
  const metadataFiles = getAllFiles(
2265
2277
  path,
2266
- (options.multiProject ? "**/site-packages/**/" : "") + "METADATA"
2278
+ (options.multiProject ? "**/site-packages/**/" : "") + "METADATA",
2279
+ options
2267
2280
  );
2268
2281
  const whlFiles = getAllFiles(
2269
2282
  path,
2270
- (options.multiProject ? "**/" : "") + "*.whl"
2283
+ (options.multiProject ? "**/" : "") + "*.whl",
2284
+ options
2271
2285
  );
2272
2286
  const eggInfoFiles = getAllFiles(
2273
2287
  path,
2274
- (options.multiProject ? "**/" : "") + "*.egg-info"
2288
+ (options.multiProject ? "**/" : "") + "*.egg-info",
2289
+ options
2275
2290
  );
2276
2291
  const setupPy = join(path, "setup.py");
2277
2292
  const pyProjectFile = join(path, "pyproject.toml");
@@ -2609,7 +2624,8 @@ export const createGoBom = async (path, options) => {
2609
2624
  // Read in go.sum and merge all go.sum files.
2610
2625
  const gosumFiles = getAllFiles(
2611
2626
  path,
2612
- (options.multiProject ? "**/" : "") + "go.sum"
2627
+ (options.multiProject ? "**/" : "") + "go.sum",
2628
+ options
2613
2629
  );
2614
2630
 
2615
2631
  // If USE_GOSUM is true|1, generate BOM components only using go.sum.
@@ -2723,13 +2739,15 @@ export const createGoBom = async (path, options) => {
2723
2739
  // Read in data from Gopkg.lock files if they exist
2724
2740
  const gopkgLockFiles = getAllFiles(
2725
2741
  path,
2726
- (options.multiProject ? "**/" : "") + "Gopkg.lock"
2742
+ (options.multiProject ? "**/" : "") + "Gopkg.lock",
2743
+ options
2727
2744
  );
2728
2745
 
2729
2746
  // Read in go.mod files and parse BOM components with checksums from gosumData
2730
2747
  const gomodFiles = getAllFiles(
2731
2748
  path,
2732
- (options.multiProject ? "**/" : "") + "go.mod"
2749
+ (options.multiProject ? "**/" : "") + "go.mod",
2750
+ options
2733
2751
  );
2734
2752
  if (gomodFiles.length) {
2735
2753
  let shouldManuallyParse = false;
@@ -2925,11 +2943,13 @@ export const createRustBom = async (path, options) => {
2925
2943
  }
2926
2944
  let cargoLockFiles = getAllFiles(
2927
2945
  path,
2928
- (options.multiProject ? "**/" : "") + "Cargo.lock"
2946
+ (options.multiProject ? "**/" : "") + "Cargo.lock",
2947
+ options
2929
2948
  );
2930
2949
  const cargoFiles = getAllFiles(
2931
2950
  path,
2932
- (options.multiProject ? "**/" : "") + "Cargo.toml"
2951
+ (options.multiProject ? "**/" : "") + "Cargo.toml",
2952
+ options
2933
2953
  );
2934
2954
  const cargoMode = cargoFiles.length;
2935
2955
  const cargoLockMode = cargoLockFiles.length;
@@ -2952,7 +2972,8 @@ export const createRustBom = async (path, options) => {
2952
2972
  // Get the new lock files
2953
2973
  cargoLockFiles = getAllFiles(
2954
2974
  path,
2955
- (options.multiProject ? "**/" : "") + "Cargo.lock"
2975
+ (options.multiProject ? "**/" : "") + "Cargo.lock",
2976
+ options
2956
2977
  );
2957
2978
  if (cargoLockFiles.length) {
2958
2979
  for (const f of cargoLockFiles) {
@@ -2982,11 +3003,13 @@ export const createRustBom = async (path, options) => {
2982
3003
  export const createDartBom = async (path, options) => {
2983
3004
  const pubFiles = getAllFiles(
2984
3005
  path,
2985
- (options.multiProject ? "**/" : "") + "pubspec.lock"
3006
+ (options.multiProject ? "**/" : "") + "pubspec.lock",
3007
+ options
2986
3008
  );
2987
3009
  const pubSpecYamlFiles = getAllFiles(
2988
3010
  path,
2989
- (options.multiProject ? "**/" : "") + "pubspec.yaml"
3011
+ (options.multiProject ? "**/" : "") + "pubspec.yaml",
3012
+ options
2990
3013
  );
2991
3014
  let pkgList = [];
2992
3015
  if (pubFiles.length) {
@@ -3032,29 +3055,38 @@ export const createDartBom = async (path, options) => {
3032
3055
  */
3033
3056
  export const createCppBom = (path, options) => {
3034
3057
  let parentComponent = undefined;
3058
+ let dependencies = [];
3035
3059
  const addedParentComponentsMap = {};
3036
3060
  const conanLockFiles = getAllFiles(
3037
3061
  path,
3038
- (options.multiProject ? "**/" : "") + "conan.lock"
3062
+ (options.multiProject ? "**/" : "") + "conan.lock",
3063
+ options
3039
3064
  );
3040
3065
  const conanFiles = getAllFiles(
3041
3066
  path,
3042
- (options.multiProject ? "**/" : "") + "conanfile.txt"
3067
+ (options.multiProject ? "**/" : "") + "conanfile.txt",
3068
+ options
3043
3069
  );
3044
3070
  let cmakeLikeFiles = [];
3045
3071
  const mesonBuildFiles = getAllFiles(
3046
3072
  path,
3047
- (options.multiProject ? "**/" : "") + "meson.build"
3073
+ (options.multiProject ? "**/" : "") + "meson.build",
3074
+ options
3048
3075
  );
3049
3076
  if (mesonBuildFiles && mesonBuildFiles.length) {
3050
3077
  cmakeLikeFiles = cmakeLikeFiles.concat(mesonBuildFiles);
3051
3078
  }
3052
3079
  cmakeLikeFiles = cmakeLikeFiles.concat(
3053
- getAllFiles(path, (options.multiProject ? "**/" : "") + "CMakeLists.txt")
3080
+ getAllFiles(
3081
+ path,
3082
+ (options.multiProject ? "**/" : "") + "CMakeLists.txt",
3083
+ options
3084
+ )
3054
3085
  );
3055
3086
  const cmakeFiles = getAllFiles(
3056
3087
  path,
3057
- (options.multiProject ? "**/" : "") + "*.cmake"
3088
+ (options.multiProject ? "**/" : "") + "*.cmake",
3089
+ options
3058
3090
  );
3059
3091
  if (cmakeFiles && cmakeFiles.length) {
3060
3092
  cmakeLikeFiles = cmakeLikeFiles.concat(cmakeFiles);
@@ -3082,16 +3114,19 @@ export const createCppBom = (path, options) => {
3082
3114
  pkgList = pkgList.concat(dlist);
3083
3115
  }
3084
3116
  }
3085
- } else if (cmakeLikeFiles.length) {
3117
+ }
3118
+ if (cmakeLikeFiles.length) {
3086
3119
  for (const f of cmakeLikeFiles) {
3087
3120
  if (DEBUG_MODE) {
3088
3121
  console.log(`Parsing ${f}`);
3089
3122
  }
3090
- const retMap = parseCmakeLikeFile(f, "conan");
3123
+ const basePath = dirname(f);
3124
+ const retMap = parseCmakeLikeFile(f, "generic");
3091
3125
  if (retMap.pkgList && retMap.pkgList.length) {
3092
3126
  pkgList = pkgList.concat(retMap.pkgList);
3093
3127
  }
3094
3128
  if (
3129
+ basePath === path &&
3095
3130
  retMap.parentComponent &&
3096
3131
  Object.keys(retMap.parentComponent).length
3097
3132
  ) {
@@ -3104,6 +3139,13 @@ export const createCppBom = (path, options) => {
3104
3139
  addedParentComponentsMap[retMap.parentComponent.name] = true;
3105
3140
  }
3106
3141
  }
3142
+ } else if (
3143
+ retMap.parentComponent &&
3144
+ Object.keys(retMap.parentComponent).length &&
3145
+ !addedParentComponentsMap[retMap.parentComponent.name]
3146
+ ) {
3147
+ retMap.parentComponent.type = "library";
3148
+ pkgList.push(retMap.parentComponent);
3107
3149
  }
3108
3150
  }
3109
3151
  }
@@ -3135,20 +3177,41 @@ export const createCppBom = (path, options) => {
3135
3177
  // Now we check with atom and attempt to detect all external modules via usages
3136
3178
  // We pass the current list of packages so that we enhance the current list and replace
3137
3179
  // components inadvertently. For example, we might resolved a name, version and url information already via cmake
3138
- const dlist = getCppModules(path, options, osPkgsList, pkgList);
3139
- if (dlist && dlist.length) {
3140
- pkgList = pkgList.concat(dlist);
3180
+ const retMap = getCppModules(path, options, osPkgsList, pkgList);
3181
+ if (retMap.pkgList && retMap.pkgList.length) {
3182
+ pkgList = pkgList.concat(retMap.pkgList);
3183
+ }
3184
+ if (retMap.dependenciesList) {
3185
+ if (dependencies.length) {
3186
+ dependencies = mergeDependencies(
3187
+ dependencies,
3188
+ retMap.dependenciesList,
3189
+ parentComponent
3190
+ );
3191
+ } else {
3192
+ dependencies = retMap.dependenciesList;
3193
+ }
3194
+ }
3195
+ if (!parentComponent) {
3196
+ parentComponent = retMap.parentComponent;
3197
+ } else {
3198
+ parentComponent.components = parentComponent.components || [];
3199
+ if (!addedParentComponentsMap[retMap.parentComponent.name]) {
3200
+ parentComponent.components.push(retMap.parentComponent);
3201
+ addedParentComponentsMap[retMap.parentComponent.name] = true;
3202
+ }
3141
3203
  }
3142
3204
  }
3143
3205
  if (!options.createMultiXBom) {
3144
3206
  if (!parentComponent) {
3145
- parentComponent = createDefaultParentComponent(path, "conan", options);
3207
+ parentComponent = createDefaultParentComponent(path, "generic", options);
3146
3208
  }
3147
3209
  options.parentComponent = parentComponent;
3148
3210
  }
3149
- return buildBomNSData(options, pkgList, "conan", {
3211
+ return buildBomNSData(options, pkgList, "generic", {
3150
3212
  src: path,
3151
- parentComponent
3213
+ parentComponent,
3214
+ dependencies
3152
3215
  });
3153
3216
  };
3154
3217
 
@@ -3161,11 +3224,13 @@ export const createCppBom = (path, options) => {
3161
3224
  export const createClojureBom = (path, options) => {
3162
3225
  const ednFiles = getAllFiles(
3163
3226
  path,
3164
- (options.multiProject ? "**/" : "") + "deps.edn"
3227
+ (options.multiProject ? "**/" : "") + "deps.edn",
3228
+ options
3165
3229
  );
3166
3230
  const leinFiles = getAllFiles(
3167
3231
  path,
3168
- (options.multiProject ? "**/" : "") + "project.clj"
3232
+ (options.multiProject ? "**/" : "") + "project.clj",
3233
+ options
3169
3234
  );
3170
3235
  let pkgList = [];
3171
3236
  if (leinFiles.length) {
@@ -3281,7 +3346,8 @@ export const createClojureBom = (path, options) => {
3281
3346
  export const createHaskellBom = (path, options) => {
3282
3347
  const cabalFiles = getAllFiles(
3283
3348
  path,
3284
- (options.multiProject ? "**/" : "") + "cabal.project.freeze"
3349
+ (options.multiProject ? "**/" : "") + "cabal.project.freeze",
3350
+ options
3285
3351
  );
3286
3352
  let pkgList = [];
3287
3353
  if (cabalFiles.length) {
@@ -3312,7 +3378,8 @@ export const createHaskellBom = (path, options) => {
3312
3378
  export const createElixirBom = (path, options) => {
3313
3379
  const mixFiles = getAllFiles(
3314
3380
  path,
3315
- (options.multiProject ? "**/" : "") + "mix.lock"
3381
+ (options.multiProject ? "**/" : "") + "mix.lock",
3382
+ options
3316
3383
  );
3317
3384
  let pkgList = [];
3318
3385
  if (mixFiles.length) {
@@ -3341,7 +3408,11 @@ export const createElixirBom = (path, options) => {
3341
3408
  * @param options Parse options from the cli
3342
3409
  */
3343
3410
  export const createGitHubBom = (path, options) => {
3344
- const ghactionFiles = getAllFiles(path, ".github/workflows/" + "*.yml");
3411
+ const ghactionFiles = getAllFiles(
3412
+ path,
3413
+ ".github/workflows/" + "*.yml",
3414
+ options
3415
+ );
3345
3416
  let pkgList = [];
3346
3417
  if (ghactionFiles.length) {
3347
3418
  for (const f of ghactionFiles) {
@@ -3369,7 +3440,7 @@ export const createGitHubBom = (path, options) => {
3369
3440
  * @param options Parse options from the cli
3370
3441
  */
3371
3442
  export const createCloudBuildBom = (path, options) => {
3372
- const cbFiles = getAllFiles(path, "cloudbuild.yml");
3443
+ const cbFiles = getAllFiles(path, "cloudbuild.yml", options);
3373
3444
  let pkgList = [];
3374
3445
  if (cbFiles.length) {
3375
3446
  for (const f of cbFiles) {
@@ -3460,7 +3531,8 @@ export const createJenkinsBom = async (path, options) => {
3460
3531
  let pkgList = [];
3461
3532
  const hpiFiles = getAllFiles(
3462
3533
  path,
3463
- (options.multiProject ? "**/" : "") + "*.hpi"
3534
+ (options.multiProject ? "**/" : "") + "*.hpi",
3535
+ options
3464
3536
  );
3465
3537
  const tempDir = mkdtempSync(join(tmpdir(), "hpi-deps-"));
3466
3538
  if (hpiFiles.length) {
@@ -3474,7 +3546,7 @@ export const createJenkinsBom = async (path, options) => {
3474
3546
  }
3475
3547
  }
3476
3548
  }
3477
- const jsFiles = getAllFiles(tempDir, "**/*.js");
3549
+ const jsFiles = getAllFiles(tempDir, "**/*.js", options);
3478
3550
  if (jsFiles.length) {
3479
3551
  for (const f of jsFiles) {
3480
3552
  if (DEBUG_MODE) {
@@ -3508,7 +3580,8 @@ export const createHelmBom = (path, options) => {
3508
3580
  let pkgList = [];
3509
3581
  const yamlFiles = getAllFiles(
3510
3582
  path,
3511
- (options.multiProject ? "**/" : "") + "*.yaml"
3583
+ (options.multiProject ? "**/" : "") + "*.yaml",
3584
+ options
3512
3585
  );
3513
3586
  if (yamlFiles.length) {
3514
3587
  for (const f of yamlFiles) {
@@ -3538,11 +3611,13 @@ export const createHelmBom = (path, options) => {
3538
3611
  export const createSwiftBom = (path, options) => {
3539
3612
  const swiftFiles = getAllFiles(
3540
3613
  path,
3541
- (options.multiProject ? "**/" : "") + "Package*.swift"
3614
+ (options.multiProject ? "**/" : "") + "Package*.swift",
3615
+ options
3542
3616
  );
3543
3617
  const pkgResolvedFiles = getAllFiles(
3544
3618
  path,
3545
- (options.multiProject ? "**/" : "") + "Package.resolved"
3619
+ (options.multiProject ? "**/" : "") + "Package.resolved",
3620
+ options
3546
3621
  );
3547
3622
  let pkgList = [];
3548
3623
  let dependencies = [];
@@ -3635,19 +3710,23 @@ export const createContainerSpecLikeBom = async (path, options) => {
3635
3710
  const origProjectType = options.projectType;
3636
3711
  let dcFiles = getAllFiles(
3637
3712
  path,
3638
- (options.multiProject ? "**/" : "") + "*.yml"
3713
+ (options.multiProject ? "**/" : "") + "*.yml",
3714
+ options
3639
3715
  );
3640
3716
  const yamlFiles = getAllFiles(
3641
3717
  path,
3642
- (options.multiProject ? "**/" : "") + "*.yaml"
3718
+ (options.multiProject ? "**/" : "") + "*.yaml",
3719
+ options
3643
3720
  );
3644
3721
  let oapiFiles = getAllFiles(
3645
3722
  path,
3646
- (options.multiProject ? "**/" : "") + "open*.json"
3723
+ (options.multiProject ? "**/" : "") + "open*.json",
3724
+ options
3647
3725
  );
3648
3726
  const oapiYamlFiles = getAllFiles(
3649
3727
  path,
3650
- (options.multiProject ? "**/" : "") + "open*.yaml"
3728
+ (options.multiProject ? "**/" : "") + "open*.yaml",
3729
+ options
3651
3730
  );
3652
3731
  if (oapiYamlFiles && oapiYamlFiles.length) {
3653
3732
  oapiFiles = oapiFiles.concat(oapiYamlFiles);
@@ -3656,7 +3735,7 @@ export const createContainerSpecLikeBom = async (path, options) => {
3656
3735
  dcFiles = dcFiles.concat(yamlFiles);
3657
3736
  }
3658
3737
  // Privado.ai json files
3659
- const privadoFiles = getAllFiles(path, ".privado/" + "*.json");
3738
+ const privadoFiles = getAllFiles(path, ".privado/" + "*.json", options);
3660
3739
  // parse yaml manifest files
3661
3740
  if (dcFiles.length) {
3662
3741
  for (const f of dcFiles) {
@@ -3910,11 +3989,13 @@ export const createContainerSpecLikeBom = async (path, options) => {
3910
3989
  export const createPHPBom = (path, options) => {
3911
3990
  const composerJsonFiles = getAllFiles(
3912
3991
  path,
3913
- (options.multiProject ? "**/" : "") + "composer.json"
3992
+ (options.multiProject ? "**/" : "") + "composer.json",
3993
+ options
3914
3994
  );
3915
3995
  let composerLockFiles = getAllFiles(
3916
3996
  path,
3917
- (options.multiProject ? "**/" : "") + "composer.lock"
3997
+ (options.multiProject ? "**/" : "") + "composer.lock",
3998
+ options
3918
3999
  );
3919
4000
  let pkgList = [];
3920
4001
  const composerJsonMode = composerJsonFiles.length;
@@ -3970,7 +4051,8 @@ export const createPHPBom = (path, options) => {
3970
4051
  }
3971
4052
  composerLockFiles = getAllFiles(
3972
4053
  path,
3973
- (options.multiProject ? "**/" : "") + "composer.lock"
4054
+ (options.multiProject ? "**/" : "") + "composer.lock",
4055
+ options
3974
4056
  );
3975
4057
  if (composerLockFiles.length) {
3976
4058
  for (const f of composerLockFiles) {
@@ -3999,11 +4081,13 @@ export const createPHPBom = (path, options) => {
3999
4081
  export const createRubyBom = async (path, options) => {
4000
4082
  const gemFiles = getAllFiles(
4001
4083
  path,
4002
- (options.multiProject ? "**/" : "") + "Gemfile"
4084
+ (options.multiProject ? "**/" : "") + "Gemfile",
4085
+ options
4003
4086
  );
4004
4087
  let gemLockFiles = getAllFiles(
4005
4088
  path,
4006
- (options.multiProject ? "**/" : "") + "Gemfile.lock"
4089
+ (options.multiProject ? "**/" : "") + "Gemfile.lock",
4090
+ options
4007
4091
  );
4008
4092
  let pkgList = [];
4009
4093
  const gemFileMode = gemFiles.length;
@@ -4027,7 +4111,8 @@ export const createRubyBom = async (path, options) => {
4027
4111
  }
4028
4112
  gemLockFiles = getAllFiles(
4029
4113
  path,
4030
- (options.multiProject ? "**/" : "") + "Gemfile.lock"
4114
+ (options.multiProject ? "**/" : "") + "Gemfile.lock",
4115
+ options
4031
4116
  );
4032
4117
  if (gemLockFiles.length) {
4033
4118
  for (const f of gemLockFiles) {
@@ -4064,27 +4149,33 @@ export const createCsharpBom = async (
4064
4149
  let dependencies = [];
4065
4150
  const csProjFiles = getAllFiles(
4066
4151
  path,
4067
- (options.multiProject ? "**/" : "") + "*.csproj"
4152
+ (options.multiProject ? "**/" : "") + "*.csproj",
4153
+ options
4068
4154
  );
4069
4155
  const pkgConfigFiles = getAllFiles(
4070
4156
  path,
4071
- (options.multiProject ? "**/" : "") + "packages.config"
4157
+ (options.multiProject ? "**/" : "") + "packages.config",
4158
+ options
4072
4159
  );
4073
4160
  const projAssetsFiles = getAllFiles(
4074
4161
  path,
4075
- (options.multiProject ? "**/" : "") + "project.assets.json"
4162
+ (options.multiProject ? "**/" : "") + "project.assets.json",
4163
+ options
4076
4164
  );
4077
4165
  const pkgLockFiles = getAllFiles(
4078
4166
  path,
4079
- (options.multiProject ? "**/" : "") + "packages.lock.json"
4167
+ (options.multiProject ? "**/" : "") + "packages.lock.json",
4168
+ options
4080
4169
  );
4081
4170
  const paketLockFiles = getAllFiles(
4082
4171
  path,
4083
- (options.multiProject ? "**/" : "") + "paket.lock"
4172
+ (options.multiProject ? "**/" : "") + "paket.lock",
4173
+ options
4084
4174
  );
4085
4175
  const nupkgFiles = getAllFiles(
4086
4176
  path,
4087
- (options.multiProject ? "**/" : "") + "*.nupkg"
4177
+ (options.multiProject ? "**/" : "") + "*.nupkg",
4178
+ options
4088
4179
  );
4089
4180
  let pkgList = [];
4090
4181
  if (nupkgFiles.length && projAssetsFiles.length === 0) {
@@ -4859,17 +4950,20 @@ export const createXBom = async (path, options) => {
4859
4950
  // maven - pom.xml
4860
4951
  const pomFiles = getAllFiles(
4861
4952
  path,
4862
- (options.multiProject ? "**/" : "") + "pom.xml"
4953
+ (options.multiProject ? "**/" : "") + "pom.xml",
4954
+ options
4863
4955
  );
4864
4956
  // gradle
4865
4957
  const gradleFiles = getAllFiles(
4866
4958
  path,
4867
- (options.multiProject ? "**/" : "") + "build.gradle*"
4959
+ (options.multiProject ? "**/" : "") + "build.gradle*",
4960
+ options
4868
4961
  );
4869
4962
  // scala sbt
4870
4963
  const sbtFiles = getAllFiles(
4871
4964
  path,
4872
- (options.multiProject ? "**/" : "") + "{build.sbt,Build.scala}*"
4965
+ (options.multiProject ? "**/" : "") + "{build.sbt,Build.scala}*",
4966
+ options
4873
4967
  );
4874
4968
  if (pomFiles.length || gradleFiles.length || sbtFiles.length) {
4875
4969
  return await createJavaBom(path, options);
@@ -4884,17 +4978,20 @@ export const createXBom = async (path, options) => {
4884
4978
  }
4885
4979
  const reqFiles = getAllFiles(
4886
4980
  path,
4887
- (options.multiProject ? "**/" : "") + "*requirements*.txt"
4981
+ (options.multiProject ? "**/" : "") + "*requirements*.txt",
4982
+ options
4888
4983
  );
4889
4984
  const reqDirFiles = getAllFiles(
4890
4985
  path,
4891
- (options.multiProject ? "**/" : "") + "requirements/*.txt"
4986
+ (options.multiProject ? "**/" : "") + "requirements/*.txt",
4987
+ options
4892
4988
  );
4893
4989
  const requirementsMode =
4894
4990
  (reqFiles && reqFiles.length) || (reqDirFiles && reqDirFiles.length);
4895
4991
  const whlFiles = getAllFiles(
4896
4992
  path,
4897
- (options.multiProject ? "**/" : "") + "*.whl"
4993
+ (options.multiProject ? "**/" : "") + "*.whl",
4994
+ options
4898
4995
  );
4899
4996
  if (requirementsMode || whlFiles.length) {
4900
4997
  return await createPythonBom(path, options);
@@ -4902,15 +4999,18 @@ export const createXBom = async (path, options) => {
4902
4999
  // go
4903
5000
  const gosumFiles = getAllFiles(
4904
5001
  path,
4905
- (options.multiProject ? "**/" : "") + "go.sum"
5002
+ (options.multiProject ? "**/" : "") + "go.sum",
5003
+ options
4906
5004
  );
4907
5005
  const gomodFiles = getAllFiles(
4908
5006
  path,
4909
- (options.multiProject ? "**/" : "") + "go.mod"
5007
+ (options.multiProject ? "**/" : "") + "go.mod",
5008
+ options
4910
5009
  );
4911
5010
  const gopkgLockFiles = getAllFiles(
4912
5011
  path,
4913
- (options.multiProject ? "**/" : "") + "Gopkg.lock"
5012
+ (options.multiProject ? "**/" : "") + "Gopkg.lock",
5013
+ options
4914
5014
  );
4915
5015
  if (gomodFiles.length || gosumFiles.length || gopkgLockFiles.length) {
4916
5016
  return await createGoBom(path, options);
@@ -4919,11 +5019,13 @@ export const createXBom = async (path, options) => {
4919
5019
  // rust
4920
5020
  const cargoLockFiles = getAllFiles(
4921
5021
  path,
4922
- (options.multiProject ? "**/" : "") + "Cargo.lock"
5022
+ (options.multiProject ? "**/" : "") + "Cargo.lock",
5023
+ options
4923
5024
  );
4924
5025
  const cargoFiles = getAllFiles(
4925
5026
  path,
4926
- (options.multiProject ? "**/" : "") + "Cargo.toml"
5027
+ (options.multiProject ? "**/" : "") + "Cargo.toml",
5028
+ options
4927
5029
  );
4928
5030
  if (cargoLockFiles.length || cargoFiles.length) {
4929
5031
  return await createRustBom(path, options);
@@ -4932,11 +5034,13 @@ export const createXBom = async (path, options) => {
4932
5034
  // php
4933
5035
  const composerJsonFiles = getAllFiles(
4934
5036
  path,
4935
- (options.multiProject ? "**/" : "") + "composer.json"
5037
+ (options.multiProject ? "**/" : "") + "composer.json",
5038
+ options
4936
5039
  );
4937
5040
  const composerLockFiles = getAllFiles(
4938
5041
  path,
4939
- (options.multiProject ? "**/" : "") + "composer.lock"
5042
+ (options.multiProject ? "**/" : "") + "composer.lock",
5043
+ options
4940
5044
  );
4941
5045
  if (composerJsonFiles.length || composerLockFiles.length) {
4942
5046
  return createPHPBom(path, options);
@@ -4945,11 +5049,13 @@ export const createXBom = async (path, options) => {
4945
5049
  // Ruby
4946
5050
  const gemFiles = getAllFiles(
4947
5051
  path,
4948
- (options.multiProject ? "**/" : "") + "Gemfile"
5052
+ (options.multiProject ? "**/" : "") + "Gemfile",
5053
+ options
4949
5054
  );
4950
5055
  const gemLockFiles = getAllFiles(
4951
5056
  path,
4952
- (options.multiProject ? "**/" : "") + "Gemfile.lock"
5057
+ (options.multiProject ? "**/" : "") + "Gemfile.lock",
5058
+ options
4953
5059
  );
4954
5060
  if (gemFiles.length || gemLockFiles.length) {
4955
5061
  return await createRubyBom(path, options);
@@ -4958,7 +5064,8 @@ export const createXBom = async (path, options) => {
4958
5064
  // .Net
4959
5065
  const csProjFiles = getAllFiles(
4960
5066
  path,
4961
- (options.multiProject ? "**/" : "") + "*.csproj"
5067
+ (options.multiProject ? "**/" : "") + "*.csproj",
5068
+ options
4962
5069
  );
4963
5070
  if (csProjFiles.length) {
4964
5071
  return await createCsharpBom(path, options);
@@ -4967,11 +5074,13 @@ export const createXBom = async (path, options) => {
4967
5074
  // Dart
4968
5075
  const pubFiles = getAllFiles(
4969
5076
  path,
4970
- (options.multiProject ? "**/" : "") + "pubspec.lock"
5077
+ (options.multiProject ? "**/" : "") + "pubspec.lock",
5078
+ options
4971
5079
  );
4972
5080
  const pubSpecFiles = getAllFiles(
4973
5081
  path,
4974
- (options.multiProject ? "**/" : "") + "pubspec.yaml"
5082
+ (options.multiProject ? "**/" : "") + "pubspec.yaml",
5083
+ options
4975
5084
  );
4976
5085
  if (pubFiles.length || pubSpecFiles.length) {
4977
5086
  return await createDartBom(path, options);
@@ -4980,7 +5089,8 @@ export const createXBom = async (path, options) => {
4980
5089
  // Haskell
4981
5090
  const hackageFiles = getAllFiles(
4982
5091
  path,
4983
- (options.multiProject ? "**/" : "") + "cabal.project.freeze"
5092
+ (options.multiProject ? "**/" : "") + "cabal.project.freeze",
5093
+ options
4984
5094
  );
4985
5095
  if (hackageFiles.length) {
4986
5096
  return createHaskellBom(path, options);
@@ -4989,7 +5099,8 @@ export const createXBom = async (path, options) => {
4989
5099
  // Elixir
4990
5100
  const mixFiles = getAllFiles(
4991
5101
  path,
4992
- (options.multiProject ? "**/" : "") + "mix.lock"
5102
+ (options.multiProject ? "**/" : "") + "mix.lock",
5103
+ options
4993
5104
  );
4994
5105
  if (mixFiles.length) {
4995
5106
  return createElixirBom(path, options);
@@ -4998,19 +5109,23 @@ export const createXBom = async (path, options) => {
4998
5109
  // cpp
4999
5110
  const conanLockFiles = getAllFiles(
5000
5111
  path,
5001
- (options.multiProject ? "**/" : "") + "conan.lock"
5112
+ (options.multiProject ? "**/" : "") + "conan.lock",
5113
+ options
5002
5114
  );
5003
5115
  const conanFiles = getAllFiles(
5004
5116
  path,
5005
- (options.multiProject ? "**/" : "") + "conanfile.txt"
5117
+ (options.multiProject ? "**/" : "") + "conanfile.txt",
5118
+ options
5006
5119
  );
5007
5120
  const cmakeListFiles = getAllFiles(
5008
5121
  path,
5009
- (options.multiProject ? "**/" : "") + "CMakeLists.txt"
5122
+ (options.multiProject ? "**/" : "") + "CMakeLists.txt",
5123
+ options
5010
5124
  );
5011
5125
  const mesonBuildFiles = getAllFiles(
5012
5126
  path,
5013
- (options.multiProject ? "**/" : "") + "meson.build"
5127
+ (options.multiProject ? "**/" : "") + "meson.build",
5128
+ options
5014
5129
  );
5015
5130
  if (
5016
5131
  conanLockFiles.length ||
@@ -5024,18 +5139,24 @@ export const createXBom = async (path, options) => {
5024
5139
  // clojure
5025
5140
  const ednFiles = getAllFiles(
5026
5141
  path,
5027
- (options.multiProject ? "**/" : "") + "deps.edn"
5142
+ (options.multiProject ? "**/" : "") + "deps.edn",
5143
+ options
5028
5144
  );
5029
5145
  const leinFiles = getAllFiles(
5030
5146
  path,
5031
- (options.multiProject ? "**/" : "") + "project.clj"
5147
+ (options.multiProject ? "**/" : "") + "project.clj",
5148
+ options
5032
5149
  );
5033
5150
  if (ednFiles.length || leinFiles.length) {
5034
5151
  return createClojureBom(path, options);
5035
5152
  }
5036
5153
 
5037
5154
  // GitHub actions
5038
- const ghactionFiles = getAllFiles(path, ".github/workflows/" + "*.yml");
5155
+ const ghactionFiles = getAllFiles(
5156
+ path,
5157
+ ".github/workflows/" + "*.yml",
5158
+ options
5159
+ );
5039
5160
  if (ghactionFiles.length) {
5040
5161
  return createGitHubBom(path, options);
5041
5162
  }
@@ -5043,7 +5164,8 @@ export const createXBom = async (path, options) => {
5043
5164
  // Jenkins plugins
5044
5165
  const hpiFiles = getAllFiles(
5045
5166
  path,
5046
- (options.multiProject ? "**/" : "") + "*.hpi"
5167
+ (options.multiProject ? "**/" : "") + "*.hpi",
5168
+ options
5047
5169
  );
5048
5170
  if (hpiFiles.length) {
5049
5171
  return await createJenkinsBom(path, options);
@@ -5052,11 +5174,13 @@ export const createXBom = async (path, options) => {
5052
5174
  // Helm charts
5053
5175
  const chartFiles = getAllFiles(
5054
5176
  path,
5055
- (options.multiProject ? "**/" : "") + "Chart.yaml"
5177
+ (options.multiProject ? "**/" : "") + "Chart.yaml",
5178
+ options
5056
5179
  );
5057
5180
  const yamlFiles = getAllFiles(
5058
5181
  path,
5059
- (options.multiProject ? "**/" : "") + "values.yaml"
5182
+ (options.multiProject ? "**/" : "") + "values.yaml",
5183
+ options
5060
5184
  );
5061
5185
  if (chartFiles.length || yamlFiles.length) {
5062
5186
  return createHelmBom(path, options);
@@ -5065,15 +5189,18 @@ export const createXBom = async (path, options) => {
5065
5189
  // Docker compose, kubernetes and skaffold
5066
5190
  const dcFiles = getAllFiles(
5067
5191
  path,
5068
- (options.multiProject ? "**/" : "") + "docker-compose*.yml"
5192
+ (options.multiProject ? "**/" : "") + "docker-compose*.yml",
5193
+ options
5069
5194
  );
5070
5195
  const skFiles = getAllFiles(
5071
5196
  path,
5072
- (options.multiProject ? "**/" : "") + "skaffold.yaml"
5197
+ (options.multiProject ? "**/" : "") + "skaffold.yaml",
5198
+ options
5073
5199
  );
5074
5200
  const deplFiles = getAllFiles(
5075
5201
  path,
5076
- (options.multiProject ? "**/" : "") + "deployment.yaml"
5202
+ (options.multiProject ? "**/" : "") + "deployment.yaml",
5203
+ options
5077
5204
  );
5078
5205
  if (dcFiles.length || skFiles.length || deplFiles.length) {
5079
5206
  return await createContainerSpecLikeBom(path, options);
@@ -5082,7 +5209,8 @@ export const createXBom = async (path, options) => {
5082
5209
  // Google CloudBuild
5083
5210
  const cbFiles = getAllFiles(
5084
5211
  path,
5085
- (options.multiProject ? "**/" : "") + "cloudbuild.yaml"
5212
+ (options.multiProject ? "**/" : "") + "cloudbuild.yaml",
5213
+ options
5086
5214
  );
5087
5215
  if (cbFiles.length) {
5088
5216
  return createCloudBuildBom(path, options);
@@ -5091,11 +5219,13 @@ export const createXBom = async (path, options) => {
5091
5219
  // Swift
5092
5220
  const swiftFiles = getAllFiles(
5093
5221
  path,
5094
- (options.multiProject ? "**/" : "") + "Package*.swift"
5222
+ (options.multiProject ? "**/" : "") + "Package*.swift",
5223
+ options
5095
5224
  );
5096
5225
  const pkgResolvedFiles = getAllFiles(
5097
5226
  path,
5098
- (options.multiProject ? "**/" : "") + "Package.resolved"
5227
+ (options.multiProject ? "**/" : "") + "Package.resolved",
5228
+ options
5099
5229
  );
5100
5230
  if (swiftFiles.length || pkgResolvedFiles.length) {
5101
5231
  return createSwiftBom(path, options);