@cyclonedx/cdxgen 9.9.9 → 9.10.0

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
@@ -229,14 +229,14 @@ To generate SBOM for an older specification version, such as 1.4, pass the versi
229
229
  cdxgen -r -o bom.json --spec-version 1.4
230
230
  ```
231
231
 
232
- To generate SBOM for C or Python, ensure Java >= 17 is installed.
232
+ To generate SBOM for C or Python, ensure Java >= 21 is installed.
233
233
 
234
234
  ```shell
235
- # Install java >= 17
235
+ # Install java >= 21
236
236
  cdxgen -t c -o bom.json
237
237
  ```
238
238
 
239
- NOTE: cdxgen is known to freeze with Java 8 or 11, so ensure >= 17 is installed and JAVA_HOME environment variable is configured correctly. If in doubt, use the cdxgen container image.
239
+ NOTE: cdxgen is known to freeze with Java 8 or 11, so ensure >= 21 is installed and JAVA_HOME environment variable is configured correctly. If in doubt, use the cdxgen container image.
240
240
 
241
241
  ## Universal SBOM
242
242
 
package/evinser.js CHANGED
@@ -478,13 +478,15 @@ export const parseSliceUsages = async (
478
478
  purlLocationMap,
479
479
  purlImportsMap
480
480
  ) => {
481
- const usages = slice.usages;
482
- if (!usages || !usages.length) {
483
- return undefined;
484
- }
485
481
  const fileName = slice.fileName;
486
482
  const typesToLookup = new Set();
487
483
  const lKeyOverrides = {};
484
+ const usages = slice.usages || [];
485
+ // Annotations from usages
486
+ if (slice.signature && slice.signature.startsWith("@") && !usages.length) {
487
+ typesToLookup.add(slice.fullName);
488
+ addToOverrides(lKeyOverrides, slice.fullName, fileName, slice.lineNumber);
489
+ }
488
490
  for (const ausage of usages) {
489
491
  const ausageLine =
490
492
  ausage?.targetObj?.lineNumber || ausage?.definedBy?.lineNumber;
@@ -527,7 +529,17 @@ export const parseSliceUsages = async (
527
529
  .concat(ausage?.invokedCalls || [])
528
530
  .concat(ausage?.argToCalls || [])
529
531
  .concat(ausage?.procedures || [])) {
530
- if (acall.isExternal == false) {
532
+ if (acall.resolvedMethod && acall.resolvedMethod.startsWith("@")) {
533
+ typesToLookup.add(acall.callName);
534
+ if (acall.lineNumber) {
535
+ addToOverrides(
536
+ lKeyOverrides,
537
+ acall.callName,
538
+ fileName,
539
+ acall.lineNumber
540
+ );
541
+ }
542
+ } else if (acall.isExternal == false) {
531
543
  continue;
532
544
  }
533
545
  if (
package/index.js CHANGED
@@ -108,7 +108,8 @@ import {
108
108
  parseContainerFile,
109
109
  parseBitbucketPipelinesFile,
110
110
  getPyMetadata,
111
- addEvidenceForDotnet
111
+ addEvidenceForDotnet,
112
+ getSwiftPackageMetadata
112
113
  } from "./utils.js";
113
114
  import { spawnSync } from "node:child_process";
114
115
  import { fileURLToPath } from "node:url";
@@ -1266,7 +1267,7 @@ export const createJavaBom = async (path, options) => {
1266
1267
  );
1267
1268
  } else {
1268
1269
  console.log(
1269
- "1. Java version requirement: cdxgen container image bundles Java 20 with maven 3.9 which might be incompatible."
1270
+ "1. Java version requirement: cdxgen container image bundles Java 21 with maven 3.9 which might be incompatible."
1270
1271
  );
1271
1272
  }
1272
1273
  console.log(
@@ -3169,7 +3170,7 @@ export const createCppBom = (path, options) => {
3169
3170
  }
3170
3171
  }
3171
3172
  }
3172
- // The need for java >= 17 with atom is causing confusions since there could be C projects
3173
+ // The need for java >= 21 with atom is causing confusions since there could be C projects
3173
3174
  // inside of other project types. So we currently limit this analyis only when -t argument
3174
3175
  // is used.
3175
3176
  if (
@@ -3628,7 +3629,7 @@ export const createHelmBom = (path, options) => {
3628
3629
  * @param path to the project
3629
3630
  * @param options Parse options from the cli
3630
3631
  */
3631
- export const createSwiftBom = (path, options) => {
3632
+ export const createSwiftBom = async (path, options) => {
3632
3633
  const swiftFiles = getAllFiles(
3633
3634
  path,
3634
3635
  (options.multiProject ? "**/" : "") + "Package*.swift",
@@ -3704,6 +3705,9 @@ export const createSwiftBom = (path, options) => {
3704
3705
  }
3705
3706
  }
3706
3707
  }
3708
+ if (FETCH_LICENSE) {
3709
+ pkgList = await getSwiftPackageMetadata(pkgList);
3710
+ }
3707
3711
  return buildBomNSData(options, pkgList, "swift", {
3708
3712
  src: path,
3709
3713
  filename: swiftFiles.join(", "),
@@ -4899,7 +4903,7 @@ export const createMultiXBom = async (pathList, options) => {
4899
4903
  )
4900
4904
  );
4901
4905
  }
4902
- bomData = createSwiftBom(path, options);
4906
+ bomData = await createSwiftBom(path, options);
4903
4907
  if (
4904
4908
  bomData &&
4905
4909
  bomData.bomJson &&
@@ -5329,7 +5333,7 @@ export const createXBom = async (path, options) => {
5329
5333
  options
5330
5334
  );
5331
5335
  if (swiftFiles.length || pkgResolvedFiles.length) {
5332
- return createSwiftBom(path, options);
5336
+ return await createSwiftBom(path, options);
5333
5337
  }
5334
5338
  };
5335
5339
 
@@ -5585,7 +5589,7 @@ export const createBom = async (path, options) => {
5585
5589
  case "cloudbuild":
5586
5590
  return createCloudBuildBom(path, options);
5587
5591
  case "swift":
5588
- return createSwiftBom(path, options);
5592
+ return await createSwiftBom(path, options);
5589
5593
  default:
5590
5594
  // In recurse mode return multi-language Bom
5591
5595
  // https://github.com/cyclonedx/cdxgen/issues/95
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyclonedx/cdxgen",
3
- "version": "9.9.9",
3
+ "version": "9.10.0",
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.7.2",
86
+ "@appthreat/atom": "1.7.5",
87
87
  "@cyclonedx/cdxgen-plugins-bin": "^1.5.4",
88
88
  "@cyclonedx/cdxgen-plugins-bin-windows-amd64": "^1.5.4",
89
89
  "@cyclonedx/cdxgen-plugins-bin-arm64": "^1.5.4",
@@ -103,7 +103,7 @@
103
103
  "devDependencies": {
104
104
  "caxa": "^3.0.1",
105
105
  "docsify-cli": "^4.4.4",
106
- "eslint": "^8.55.0",
106
+ "eslint": "^8.56.0",
107
107
  "eslint-config-prettier": "^9.1.0",
108
108
  "eslint-plugin-prettier": "^5.0.1",
109
109
  "jest": "^29.7.0",
package/utils.js CHANGED
@@ -404,6 +404,34 @@ export function readLicenseText(
404
404
  return null;
405
405
  }
406
406
 
407
+ export const getSwiftPackageMetadata = async (pkgList) => {
408
+ const cdepList = [];
409
+ for (const p of pkgList) {
410
+ if (p.repository && p.repository.url) {
411
+ if (p.repository.url.includes("://github.com/")) {
412
+ try {
413
+ p.license = await getRepoLicense(p.repository.url, undefined);
414
+ } catch (e) {
415
+ console.error("error fetching repo license from", p.repository.url);
416
+ }
417
+ } else {
418
+ if (DEBUG_MODE) {
419
+ console.log(
420
+ p.repository.url,
421
+ "is currently not supported to fetch for licenses"
422
+ );
423
+ }
424
+ }
425
+ } else {
426
+ if (DEBUG_MODE) {
427
+ console.warn("no repository url found for", p.name);
428
+ }
429
+ }
430
+ cdepList.push(p);
431
+ }
432
+ return cdepList;
433
+ };
434
+
407
435
  /**
408
436
  * Method to retrieve metadata for npm packages by querying npmjs
409
437
  *
@@ -2107,7 +2135,7 @@ export const executeGradleProperties = function (dir, rootPath, subProject) {
2107
2135
  } else {
2108
2136
  console.error(result.stdout, result.stderr);
2109
2137
  console.log(
2110
- "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 20 with gradle 8 which might be incompatible."
2138
+ "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 21 with gradle 8 which might be incompatible."
2111
2139
  );
2112
2140
  }
2113
2141
  if (result.stderr.includes("not get unknown property")) {
@@ -3333,21 +3361,30 @@ export const repoMetadataToGitHubApiUrl = function (repoMetadata) {
3333
3361
  };
3334
3362
 
3335
3363
  /**
3336
- * Method to construct GitHub api url from repo metadata or one of multiple formats of repo URLs
3364
+ * Method to split GitHub url into its parts
3337
3365
  * @param {String} repoUrl Repository url
3338
- * @param {Object} repoMetadata Object containing group and package name strings
3339
- * @return {String|undefined} github api url (or undefined - if not a GitHub repo)
3366
+ * @return {[String]} parts from url
3340
3367
  */
3341
- export const toGitHubApiUrl = function (repoUrl, repoMetadata) {
3342
- if (!repoUrl || !repoUrl.includes("://github.com/")) {
3343
- return repoMetadataToGitHubApiUrl(repoMetadata);
3344
- }
3368
+ export const getGithubUrlParts = (repoUrl) => {
3345
3369
  if (repoUrl.toLowerCase().endsWith(".git")) {
3346
3370
  repoUrl = repoUrl.slice(0, -4);
3347
3371
  }
3348
3372
  repoUrl.replace(/\/$/, "");
3349
3373
  const parts = repoUrl.split("/");
3374
+ return parts;
3375
+ };
3350
3376
 
3377
+ /**
3378
+ * Method to construct GitHub api url from repo metadata or one of multiple formats of repo URLs
3379
+ * @param {String} repoUrl Repository url
3380
+ * @param {Object} repoMetadata Object containing group and package name strings
3381
+ * @return {String|undefined} github api url (or undefined - if not a GitHub repo)
3382
+ */
3383
+ export const toGitHubApiUrl = function (repoUrl, repoMetadata) {
3384
+ if (repoMetadata) {
3385
+ return repoMetadataToGitHubApiUrl(repoMetadata);
3386
+ }
3387
+ const parts = getGithubUrlParts(repoUrl);
3351
3388
  if (parts.length < 5 || parts[2] !== "github.com") {
3352
3389
  return undefined; // Not a valid GitHub repo URL
3353
3390
  } else {
@@ -6122,87 +6159,89 @@ export const convertOSQueryResults = function (
6122
6159
  return pkgList;
6123
6160
  };
6124
6161
 
6125
- export const _swiftDepPkgList = (
6162
+ const purlFromUrlString = (type, repoUrl, version) => {
6163
+ let namespace = "",
6164
+ name;
6165
+ if (repoUrl && repoUrl.includes("://github.com/")) {
6166
+ const parts = getGithubUrlParts(repoUrl);
6167
+ if (parts.length < 5 || parts[2] !== "github.com") {
6168
+ return undefined; // Not a valid GitHub repo URL
6169
+ } else {
6170
+ namespace = parts[2] + "/" + parts[3];
6171
+ name = parts[4];
6172
+ }
6173
+ } else if (repoUrl && repoUrl.startsWith("/")) {
6174
+ const parts = repoUrl.split("/");
6175
+ name = parts[parts.length - 1];
6176
+ } else {
6177
+ if (DEBUG_MODE) {
6178
+ console.warn("unsupported repo url for swift type");
6179
+ }
6180
+ return undefined;
6181
+ }
6182
+
6183
+ const purl = new PackageURL(type, namespace, name, version, null, null);
6184
+ return purl;
6185
+ };
6186
+
6187
+ /**
6188
+ * Parse swift dependency tree output json object
6189
+ * @param {string} jsonObject Swift dependencies json object
6190
+ * @param {string} pkgFile Package.swift file
6191
+ */
6192
+ export const parseSwiftJsonTreeObject = (
6126
6193
  pkgList,
6127
6194
  dependenciesList,
6128
- depKeys,
6129
- jsonData
6195
+ jsonObject,
6196
+ pkgFile
6130
6197
  ) => {
6131
- if (jsonData && jsonData.dependencies) {
6132
- for (const adep of jsonData.dependencies) {
6133
- const urlOrPath = adep.url || adep.path;
6134
- const apkg = {
6135
- group: adep.identity || "",
6136
- name: adep.name,
6137
- version: adep.version
6138
- };
6139
- const purl = new PackageURL(
6140
- "swift",
6141
- apkg.group,
6142
- apkg.name,
6143
- apkg.version,
6144
- null,
6145
- null
6146
- );
6147
- const purlString = decodeURIComponent(purl.toString());
6148
- if (urlOrPath) {
6149
- if (urlOrPath.startsWith("http")) {
6150
- apkg.repository = { url: urlOrPath };
6151
- if (apkg.path) {
6152
- apkg.properties = [
6153
- {
6154
- name: "SrcPath",
6155
- value: apkg.path
6156
- }
6157
- ];
6158
- }
6159
- } else {
6160
- apkg.properties = [
6161
- {
6162
- name: "SrcPath",
6163
- value: urlOrPath
6164
- }
6165
- ];
6166
- }
6167
- }
6168
- pkgList.push(apkg);
6169
- // Handle the immediate dependencies before recursing
6170
- if (adep.dependencies && adep.dependencies.length) {
6171
- const deplist = [];
6172
- for (const cdep of adep.dependencies) {
6173
- const deppurl = new PackageURL(
6174
- "swift",
6175
- cdep.identity || "",
6176
- cdep.name,
6177
- cdep.version,
6178
- null,
6179
- null
6180
- );
6181
- const deppurlString = decodeURIComponent(deppurl.toString());
6182
- deplist.push(deppurlString);
6183
- }
6184
- if (!depKeys[purlString]) {
6185
- dependenciesList.push({
6186
- ref: purlString,
6187
- dependsOn: deplist
6188
- });
6189
- depKeys[purlString] = true;
6190
- }
6191
- if (adep.dependencies && adep.dependencies.length) {
6192
- _swiftDepPkgList(pkgList, dependenciesList, depKeys, adep);
6193
- }
6194
- } else {
6195
- if (!depKeys[purlString]) {
6196
- dependenciesList.push({
6197
- ref: purlString,
6198
- dependsOn: []
6199
- });
6200
- depKeys[purlString] = true;
6201
- }
6198
+ const urlOrPath = jsonObject.url || jsonObject.path;
6199
+ const version = jsonObject.version;
6200
+ const purl = purlFromUrlString("swift", urlOrPath, version);
6201
+ const purlString = decodeURIComponent(purl.toString());
6202
+ const rootPkg = {
6203
+ name: purl.name,
6204
+ group: purl.namespace,
6205
+ version: purl.version,
6206
+ purl: purlString,
6207
+ "bom-ref": purlString
6208
+ };
6209
+ if (urlOrPath) {
6210
+ if (urlOrPath.startsWith("http")) {
6211
+ rootPkg.repository = { url: urlOrPath };
6212
+ } else {
6213
+ const properties = [];
6214
+ properties.push({
6215
+ name: "SrcPath",
6216
+ value: urlOrPath
6217
+ });
6218
+ if (pkgFile) {
6219
+ properties.push({
6220
+ name: "SrcFile",
6221
+ value: pkgFile
6222
+ });
6202
6223
  }
6224
+ rootPkg.properties = properties;
6203
6225
  }
6204
6226
  }
6205
- return { pkgList, dependenciesList };
6227
+ pkgList.push(rootPkg);
6228
+ const depList = [];
6229
+ if (jsonObject.dependencies) {
6230
+ for (const dependency of jsonObject.dependencies) {
6231
+ const res = parseSwiftJsonTreeObject(
6232
+ pkgList,
6233
+ dependenciesList,
6234
+ dependency,
6235
+ pkgFile
6236
+ );
6237
+ depList.push(res);
6238
+ }
6239
+ }
6240
+ dependenciesList.push({
6241
+ ref: purlString,
6242
+ dependsOn: depList
6243
+ });
6244
+ return purlString;
6206
6245
  };
6207
6246
 
6208
6247
  /**
@@ -6216,64 +6255,9 @@ export const parseSwiftJsonTree = (rawOutput, pkgFile) => {
6216
6255
  }
6217
6256
  const pkgList = [];
6218
6257
  const dependenciesList = [];
6219
- const depKeys = {};
6220
- let rootPkg = {};
6221
- let jsonData = {};
6222
6258
  try {
6223
- jsonData = JSON.parse(rawOutput);
6224
- if (jsonData && jsonData.name) {
6225
- rootPkg = {
6226
- group: jsonData.identity || "",
6227
- name: jsonData.name,
6228
- version: jsonData.version
6229
- };
6230
- const urlOrPath = jsonData.url || jsonData.path;
6231
- if (urlOrPath) {
6232
- if (urlOrPath.startsWith("http")) {
6233
- rootPkg.repository = { url: urlOrPath };
6234
- } else {
6235
- rootPkg.properties = [
6236
- {
6237
- name: "SrcPath",
6238
- value: urlOrPath
6239
- },
6240
- {
6241
- name: "SrcFile",
6242
- value: pkgFile
6243
- }
6244
- ];
6245
- }
6246
- }
6247
- const purl = new PackageURL(
6248
- "swift",
6249
- rootPkg.group,
6250
- rootPkg.name,
6251
- rootPkg.version,
6252
- null,
6253
- null
6254
- );
6255
- const bomRefString = decodeURIComponent(purl.toString());
6256
- rootPkg["bom-ref"] = bomRefString;
6257
- pkgList.push(rootPkg);
6258
- const deplist = [];
6259
- for (const rd of jsonData.dependencies) {
6260
- const deppurl = new PackageURL(
6261
- "swift",
6262
- rd.identity || "",
6263
- rd.name,
6264
- rd.version,
6265
- null,
6266
- null
6267
- );
6268
- const deppurlString = decodeURIComponent(deppurl.toString());
6269
- deplist.push(deppurlString);
6270
- }
6271
- dependenciesList.push({
6272
- ref: bomRefString,
6273
- dependsOn: deplist
6274
- });
6275
- _swiftDepPkgList(pkgList, dependenciesList, depKeys, jsonData);
6276
- }
6259
+ const jsonData = JSON.parse(rawOutput);
6260
+ parseSwiftJsonTreeObject(pkgList, dependenciesList, jsonData, pkgFile);
6277
6261
  } catch (e) {
6278
6262
  if (DEBUG_MODE) {
6279
6263
  console.log(e);
@@ -6304,10 +6288,16 @@ export const parseSwiftResolved = (resolvedFile) => {
6304
6288
  resolvedList = pkgData.object.pins;
6305
6289
  }
6306
6290
  for (const adep of resolvedList) {
6307
- const apkg = {
6308
- name: adep.package || adep.identity,
6309
- group: "",
6310
- version: adep.state.version || adep.state.revision,
6291
+ const locationOrUrl = adep.location || adep.repositoryURL;
6292
+ const version = adep.state.version || adep.state.revision;
6293
+ const purl = purlFromUrlString("swift", locationOrUrl, version);
6294
+ const purlString = decodeURIComponent(purl.toString());
6295
+ const rootPkg = {
6296
+ name: purl.name,
6297
+ group: purl.namespace,
6298
+ version: purl.version,
6299
+ purl: purlString,
6300
+ "bom-ref": purlString,
6311
6301
  properties: [
6312
6302
  {
6313
6303
  name: "SrcFile",
@@ -6328,11 +6318,10 @@ export const parseSwiftResolved = (resolvedFile) => {
6328
6318
  }
6329
6319
  }
6330
6320
  };
6331
- const repLocation = adep.location || adep.repositoryURL;
6332
- if (repLocation) {
6333
- apkg.repository = { url: repLocation };
6321
+ if (locationOrUrl) {
6322
+ rootPkg.repository = { url: locationOrUrl };
6334
6323
  }
6335
- pkgList.push(apkg);
6324
+ pkgList.push(rootPkg);
6336
6325
  }
6337
6326
  } catch (err) {
6338
6327
  // continue regardless of error
@@ -6595,7 +6584,7 @@ export const collectJarNS = function (jarPath, pomPathMap = {}) {
6595
6584
  ) {
6596
6585
  jarCommandAvailable = false;
6597
6586
  console.log(
6598
- "jar command is not available in PATH. Ensure JDK >= 17 is installed and set the environment variables JAVA_HOME and PATH to the bin directory inside JAVA_HOME."
6587
+ "jar command is not available in PATH. Ensure JDK >= 21 is installed and set the environment variables JAVA_HOME and PATH to the bin directory inside JAVA_HOME."
6599
6588
  );
6600
6589
  }
6601
6590
  const consolelines = (jarResult.stdout || "").split("\n");
package/utils.test.js CHANGED
@@ -2919,28 +2919,29 @@ test("parse swift deps files", () => {
2919
2919
  );
2920
2920
  expect(retData.pkgList.length).toEqual(5);
2921
2921
  expect(retData.pkgList[0]).toEqual({
2922
- group: "swift-markdown",
2923
2922
  name: "swift-markdown",
2923
+ group: "",
2924
+ purl: "pkg:swift/swift-markdown@unspecified",
2924
2925
  version: "unspecified",
2925
2926
  properties: [
2926
2927
  { name: "SrcPath", value: "/Volumes/Work/sandbox/swift-markdown" },
2927
2928
  { name: "SrcFile", value: "./test/data/swift-deps.json" }
2928
2929
  ],
2929
- "bom-ref": "pkg:swift/swift-markdown/swift-markdown@unspecified"
2930
+ "bom-ref": "pkg:swift/swift-markdown@unspecified"
2930
2931
  });
2931
2932
  expect(retData.dependenciesList.length).toEqual(5);
2932
2933
  expect(retData.dependenciesList[0]).toEqual({
2933
- ref: "pkg:swift/swift-markdown/swift-markdown@unspecified",
2934
- dependsOn: [
2935
- "pkg:swift/swift-cmark/cmark-gfm@unspecified",
2936
- "pkg:swift/swift-argument-parser/swift-argument-parser@1.0.3",
2937
- "pkg:swift/swift-docc-plugin/SwiftDocCPlugin@1.1.0"
2938
- ]
2934
+ ref: "pkg:swift/github.com/apple/swift-cmark@unspecified",
2935
+ dependsOn: []
2939
2936
  });
2940
2937
  expect(retData.dependenciesList[retData.dependenciesList.length - 1]).toEqual(
2941
2938
  {
2942
- ref: "pkg:swift/swift-docc-symbolkit/SymbolKit@1.0.0",
2943
- dependsOn: []
2939
+ ref: "pkg:swift/swift-markdown@unspecified",
2940
+ dependsOn: [
2941
+ "pkg:swift/github.com/apple/swift-cmark@unspecified",
2942
+ "pkg:swift/github.com/apple/swift-argument-parser@1.0.3",
2943
+ "pkg:swift/github.com/apple/swift-docc-plugin@1.1.0"
2944
+ ]
2944
2945
  }
2945
2946
  );
2946
2947
  retData = parseSwiftJsonTree(
@@ -2949,8 +2950,9 @@ test("parse swift deps files", () => {
2949
2950
  );
2950
2951
  expect(retData.pkgList.length).toEqual(5);
2951
2952
  expect(retData.pkgList[0]).toEqual({
2952
- group: "swift-certificates",
2953
2953
  name: "swift-certificates",
2954
+ group: "",
2955
+ purl: "pkg:swift/swift-certificates@unspecified",
2954
2956
  version: "unspecified",
2955
2957
  properties: [
2956
2958
  {
@@ -2959,36 +2961,37 @@ test("parse swift deps files", () => {
2959
2961
  },
2960
2962
  { name: "SrcFile", value: "./test/data/swift-deps.json" }
2961
2963
  ],
2962
- "bom-ref": "pkg:swift/swift-certificates/swift-certificates@unspecified"
2964
+ "bom-ref": "pkg:swift/swift-certificates@unspecified"
2963
2965
  });
2964
2966
  expect(retData.dependenciesList).toEqual([
2965
2967
  {
2966
- ref: "pkg:swift/swift-certificates/swift-certificates@unspecified",
2967
- dependsOn: ["pkg:swift/swift-crypto/swift-crypto@2.4.0"]
2968
+ ref: "pkg:swift/github.com/apple/swift-docc-symbolkit@1.0.0",
2969
+ dependsOn: []
2968
2970
  },
2969
2971
  {
2970
- ref: "pkg:swift/swift-crypto/swift-crypto@2.4.0",
2971
- dependsOn: ["pkg:swift/swift-asn1/swift-asn1@0.7.0"]
2972
+ ref: "pkg:swift/github.com/apple/swift-docc-plugin@1.1.0",
2973
+ dependsOn: ["pkg:swift/github.com/apple/swift-docc-symbolkit@1.0.0"]
2972
2974
  },
2973
2975
  {
2974
- ref: "pkg:swift/swift-asn1/swift-asn1@0.7.0",
2975
- dependsOn: ["pkg:swift/swift-docc-plugin/SwiftDocCPlugin@1.1.0"]
2976
+ ref: "pkg:swift/github.com/apple/swift-asn1@0.7.0",
2977
+ dependsOn: ["pkg:swift/github.com/apple/swift-docc-plugin@1.1.0"]
2976
2978
  },
2977
2979
  {
2978
- ref: "pkg:swift/swift-docc-plugin/SwiftDocCPlugin@1.1.0",
2979
- dependsOn: ["pkg:swift/swift-docc-symbolkit/SymbolKit@1.0.0"]
2980
+ ref: "pkg:swift/github.com/apple/swift-crypto@2.4.0",
2981
+ dependsOn: ["pkg:swift/github.com/apple/swift-asn1@0.7.0"]
2980
2982
  },
2981
2983
  {
2982
- ref: "pkg:swift/swift-docc-symbolkit/SymbolKit@1.0.0",
2983
- dependsOn: []
2984
+ ref: "pkg:swift/swift-certificates@unspecified",
2985
+ dependsOn: ["pkg:swift/github.com/apple/swift-crypto@2.4.0"]
2984
2986
  }
2985
2987
  ]);
2986
2988
  let pkgList = parseSwiftResolved("./test/data/Package.resolved");
2987
2989
  expect(pkgList.length).toEqual(4);
2988
2990
  expect(pkgList[0]).toEqual({
2989
2991
  name: "swift-argument-parser",
2990
- group: "",
2992
+ group: "github.com/apple",
2991
2993
  version: "1.0.3",
2994
+ purl: "pkg:swift/github.com/apple/swift-argument-parser@1.0.3",
2992
2995
  properties: [{ name: "SrcFile", value: "./test/data/Package.resolved" }],
2993
2996
  evidence: {
2994
2997
  identity: {
@@ -3003,14 +3006,16 @@ test("parse swift deps files", () => {
3003
3006
  ]
3004
3007
  }
3005
3008
  },
3009
+ "bom-ref": "pkg:swift/github.com/apple/swift-argument-parser@1.0.3",
3006
3010
  repository: { url: "https://github.com/apple/swift-argument-parser" }
3007
3011
  });
3008
3012
  pkgList = parseSwiftResolved("./test/data/Package2.resolved");
3009
3013
  expect(pkgList.length).toEqual(4);
3010
3014
  expect(pkgList[0]).toEqual({
3011
3015
  name: "swift-argument-parser",
3012
- group: "",
3016
+ group: "github.com/apple",
3013
3017
  version: "1.2.2",
3018
+ purl: "pkg:swift/github.com/apple/swift-argument-parser@1.2.2",
3014
3019
  properties: [{ name: "SrcFile", value: "./test/data/Package2.resolved" }],
3015
3020
  evidence: {
3016
3021
  identity: {
@@ -3025,6 +3030,7 @@ test("parse swift deps files", () => {
3025
3030
  ]
3026
3031
  }
3027
3032
  },
3033
+ "bom-ref": "pkg:swift/github.com/apple/swift-argument-parser@1.2.2",
3028
3034
  repository: { url: "https://github.com/apple/swift-argument-parser.git" }
3029
3035
  });
3030
3036
  });