snyk 1.1297.0 → 1.1297.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.
@@ -220686,38 +220686,6 @@ try {
220686
220686
  } catch (er) {}
220687
220687
 
220688
220688
 
220689
- /***/ }),
220690
-
220691
- /***/ 17426:
220692
- /***/ ((__unused_webpack_module, exports) => {
220693
-
220694
- "use strict";
220695
-
220696
- Object.defineProperty(exports, "__esModule", ({ value: true }));
220697
- exports.coordsToString = exports.parseCoordinate = void 0;
220698
- function parseCoordinate(coordinate) {
220699
- if (!coordinate)
220700
- return {};
220701
- const [name, version] = coordinate.split('@');
220702
- const [groupId, artifactId, type, classifier] = name === null || name === void 0 ? void 0 : name.split(':');
220703
- return {
220704
- groupId: groupId || undefined,
220705
- artifactId: artifactId || undefined,
220706
- version: version || undefined,
220707
- type: type || undefined,
220708
- classifier: classifier || undefined,
220709
- };
220710
- }
220711
- exports.parseCoordinate = parseCoordinate;
220712
- function coordsToString(coords) {
220713
- let name = `${coords.groupId || 'unknown'}:${coords.artifactId || 'unknown'}:${coords.type || 'jar'}`;
220714
- if (coords.classifier)
220715
- name += `:${coords.classifier}`;
220716
- return `${name}@${coords.version || 'unknown'}`;
220717
- }
220718
- exports.coordsToString = coordsToString;
220719
- //# sourceMappingURL=coordinate.js.map
220720
-
220721
220689
  /***/ }),
220722
220690
 
220723
220691
  /***/ 45339:
@@ -220811,8 +220779,7 @@ function leftPad(s, n) {
220811
220779
  Object.defineProperty(exports, "__esModule", ({ value: true }));
220812
220780
  exports.findChildren = exports.buildGraph = void 0;
220813
220781
  const dep_graph_1 = __webpack_require__(23423);
220814
- const coordinate_1 = __webpack_require__(17426);
220815
- async function buildGraph(gradleGraph, rootPkgName, projectVersion, verbose, sha1Map) {
220782
+ async function buildGraph(gradleGraph, rootPkgName, projectVersion, verbose, coordinateMap) {
220816
220783
  const pkgManager = { name: 'gradle' };
220817
220784
  const isEmptyGraph = !gradleGraph || Object.keys(gradleGraph).length === 0;
220818
220785
  const depGraphBuilder = new dep_graph_1.DepGraphBuilder(pkgManager, {
@@ -220839,20 +220806,18 @@ async function buildGraph(gradleGraph, rootPkgName, projectVersion, verbose, sha
220839
220806
  continue;
220840
220807
  let { name = 'unknown', version = 'unknown' } = node;
220841
220808
  let pkgIdProvenance = undefined;
220842
- if (sha1Map) {
220843
- if (sha1Map[id]) {
220844
- id = sha1Map[id];
220845
- const coord = (0, coordinate_1.parseCoordinate)(id);
220846
- const newName = `${coord.groupId}:${coord.artifactId}`;
220847
- const newVersion = coord.version;
220809
+ if (coordinateMap) {
220810
+ if (coordinateMap[id]) {
220811
+ id = coordinateMap[id];
220812
+ const [newName, newVersion] = id.split('@');
220848
220813
  if (name !== newName || version !== newVersion) {
220849
220814
  pkgIdProvenance = `${name}@${version}`; // record pkg id provenance if re coordinated
220850
- name = newName;
220851
- version = newVersion;
220852
220815
  }
220816
+ name = newName;
220817
+ version = newVersion;
220853
220818
  }
220854
- if (sha1Map[parentId]) {
220855
- parentId = sha1Map[parentId];
220819
+ if (coordinateMap[parentId]) {
220820
+ parentId = coordinateMap[parentId];
220856
220821
  }
220857
220822
  }
220858
220823
  const visited = visitedMap[id];
@@ -220928,7 +220893,6 @@ const gradle_attributes_pretty_1 = __webpack_require__(89173);
220928
220893
  const graph_1 = __webpack_require__(23012);
220929
220894
  const search_1 = __webpack_require__(45479);
220930
220895
  const debugModule = __webpack_require__(15158);
220931
- const coordinate_1 = __webpack_require__(17426);
220932
220896
  // To enable debugging output, use `snyk -d`
220933
220897
  let logger = null;
220934
220898
  function debugLog(s) {
@@ -221195,6 +221159,17 @@ async function getAllDepsWithPlugin(root, targetFile, options, gradleVersion) {
221195
221159
  logger(`The following attributes and their possible values were found in your configurations: ${jsonAttrsPretty}`);
221196
221160
  return extractedJSON;
221197
221161
  }
221162
+ function splitCoordinate(coordinate) {
221163
+ const coordTest = /^[\w.-]+:[\w.-]+@[\w.-]+$/.test(coordinate);
221164
+ if (!coordTest)
221165
+ return {};
221166
+ const [groupId, artifactId, version] = coordinate.split(/:|@/);
221167
+ const pomCoord = {};
221168
+ pomCoord.artifactId = artifactId;
221169
+ pomCoord.groupId = groupId;
221170
+ pomCoord.version = version;
221171
+ return pomCoord;
221172
+ }
221198
221173
  async function getAllDeps(root, targetFile, options, snykHttpClient) {
221199
221174
  const command = getCommand(root, targetFile);
221200
221175
  const gradleVersion = await getGradleVersion(root, command, []);
@@ -221207,14 +221182,14 @@ async function getAllDeps(root, targetFile, options, snykHttpClient) {
221207
221182
  if (versionBuildInfo) {
221208
221183
  extractedJSON.versionBuildInfo = versionBuildInfo;
221209
221184
  }
221210
- const sha1Map = {};
221185
+ const coordinateMap = {};
221211
221186
  if (extractedJSON.sha1Map) {
221212
221187
  const getCoordinateFromHash = async (hash) => {
221213
221188
  const originalCoordinate = extractedJSON.sha1Map[hash];
221214
- const depCoord = (0, coordinate_1.parseCoordinate)(originalCoordinate);
221189
+ const depCoord = splitCoordinate(originalCoordinate);
221215
221190
  try {
221216
221191
  const coordinate = await (0, search_1.getMavenPackageInfo)(hash, depCoord, snykHttpClient);
221217
- sha1Map[hash] = coordinate;
221192
+ coordinateMap[originalCoordinate] = coordinate;
221218
221193
  }
221219
221194
  catch (err) {
221220
221195
  debugLog(err);
@@ -221224,7 +221199,7 @@ async function getAllDeps(root, targetFile, options, snykHttpClient) {
221224
221199
  concurrency: 100,
221225
221200
  });
221226
221201
  }
221227
- return await processProjectsInExtractedJSON(extractedJSON, options['print-graph'], sha1Map);
221202
+ return await processProjectsInExtractedJSON(extractedJSON, options['print-graph'], coordinateMap);
221228
221203
  }
221229
221204
  catch (err) {
221230
221205
  const error = err;
@@ -221294,7 +221269,7 @@ ${chalk.red.bold(mainErrorMessage)}`;
221294
221269
  throw error;
221295
221270
  }
221296
221271
  }
221297
- async function processProjectsInExtractedJSON(extractedJSON, verbose, sha1Map) {
221272
+ async function processProjectsInExtractedJSON(extractedJSON, verbose, coordinateMap) {
221298
221273
  for (const projectId in extractedJSON.projects) {
221299
221274
  const { defaultProject, defaultProjectKey } = extractedJSON;
221300
221275
  const { gradleGraph, projectVersion } = extractedJSON.projects[projectId];
@@ -221306,7 +221281,7 @@ async function processProjectsInExtractedJSON(extractedJSON, verbose, sha1Map) {
221306
221281
  if (isSubProject) {
221307
221282
  rootPkgName = `${defaultProject}/${projectId}`;
221308
221283
  }
221309
- extractedJSON.projects[projectId].depGraph = await (0, graph_1.buildGraph)(gradleGraph, rootPkgName, projectVersion, verbose, sha1Map);
221284
+ extractedJSON.projects[projectId].depGraph = await (0, graph_1.buildGraph)(gradleGraph, rootPkgName, projectVersion, verbose, coordinateMap);
221310
221285
  // this property usage ends here
221311
221286
  delete extractedJSON.projects[projectId].gradleGraph;
221312
221287
  }
@@ -221413,6 +221388,7 @@ exports.exportsForTests = {
221413
221388
  getVersionBuildInfo,
221414
221389
  toCamelCase,
221415
221390
  getGradleAttributesPretty: gradle_attributes_pretty_1.getGradleAttributesPretty,
221391
+ splitCoordinate,
221416
221392
  };
221417
221393
  //# sourceMappingURL=index.js.map
221418
221394
 
@@ -221427,7 +221403,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
221427
221403
  exports.getMavenPackageInfo = void 0;
221428
221404
  const packageurl_js_1 = __webpack_require__(38382);
221429
221405
  const _1 = __webpack_require__(71673);
221430
- const coordinate_1 = __webpack_require__(17426);
221431
221406
  const PACKAGE_SEARCH_TYPE = 'maven';
221432
221407
  const PACKAGE_SEARCH_VERSION = '2022-09-21~beta';
221433
221408
  async function getMavenPackageInfo(sha1, depCoords, snykHttpClient) {
@@ -221449,21 +221424,26 @@ async function getMavenPackageInfo(sha1, depCoords, snykHttpClient) {
221449
221424
  });
221450
221425
  if ((res === null || res === void 0 ? void 0 : res.statusCode) >= 400 || !body) {
221451
221426
  (0, _1.debugLog)(`Failed to resolve ${JSON.stringify(depCoords)} using sha1 '${sha1}.`);
221452
- // use input coordinates if sha1 cannot be resolved for whatever reason
221453
- return (0, coordinate_1.coordsToString)(depCoords);
221454
221427
  }
221428
+ let groupId;
221429
+ let artifactId;
221430
+ let version;
221455
221431
  try {
221456
221432
  const purlString = (_a = body === null || body === void 0 ? void 0 : body.data[0]) === null || _a === void 0 ? void 0 : _a.id;
221457
221433
  const pkg = packageurl_js_1.PackageURL.fromString(purlString);
221458
- const { namespace, name, version } = pkg;
221459
- depCoords.groupId = namespace;
221460
- depCoords.artifactId = name;
221461
- depCoords.version = version;
221434
+ const { namespace, name, version: pkgVersion } = pkg;
221435
+ groupId = namespace;
221436
+ artifactId = name;
221437
+ version = pkgVersion;
221462
221438
  }
221463
221439
  catch (_error) {
221464
221440
  (0, _1.debugLog)(`Failed to parse purl components for ${JSON.stringify(depCoords)} using sha1 '${sha1}.`);
221465
221441
  }
221466
- return (0, coordinate_1.coordsToString)(depCoords);
221442
+ const groupIdString = groupId || 'unknown';
221443
+ const artifactIdString = artifactId ||
221444
+ `${depCoords.artifactId ? `${depCoords.artifactId}-` : ''}${sha1}`;
221445
+ const versionString = version || 'unknown';
221446
+ return `${groupIdString}:${artifactIdString}@${versionString}`;
221467
221447
  }
221468
221448
  exports.getMavenPackageInfo = getMavenPackageInfo;
221469
221449
  //# sourceMappingURL=search.js.map