snyk 1.1082.0 → 1.1083.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.
@@ -142599,7 +142599,7 @@ function isTarFile(name) {
142599
142599
  "use strict";
142600
142600
 
142601
142601
  Object.defineProperty(exports, "__esModule", ({ value: true }));
142602
- exports.ImageDigest = exports.ImageName = void 0;
142602
+ exports.getImageNames = exports.ImageDigest = exports.ImageName = void 0;
142603
142603
  class ImageName {
142604
142604
  constructor(targetImage, digests = {}) {
142605
142605
  // this regex has been copied from
@@ -142705,6 +142705,23 @@ class ImageDigest {
142705
142705
  }
142706
142706
  }
142707
142707
  exports.ImageDigest = ImageDigest;
142708
+ function getImageNames(options, imageName) {
142709
+ if (imageName) {
142710
+ return imageName.getAllNames();
142711
+ }
142712
+ const names = [];
142713
+ if (options === null || options === void 0 ? void 0 : options.imageNameAndTag) {
142714
+ const imageName = new ImageName(options.imageNameAndTag);
142715
+ names.push(...imageName.getAllNames());
142716
+ }
142717
+ if ((options === null || options === void 0 ? void 0 : options.imageNameAndDigest) &&
142718
+ (options === null || options === void 0 ? void 0 : options.imageNameAndDigest) !== (options === null || options === void 0 ? void 0 : options.imageNameAndTag)) {
142719
+ const imageName = new ImageName(options.imageNameAndDigest);
142720
+ names.push(...imageName.getAllNames());
142721
+ }
142722
+ return names;
142723
+ }
142724
+ exports.getImageNames = getImageNames;
142708
142725
  //# sourceMappingURL=image.js.map
142709
142726
 
142710
142727
  /***/ }),
@@ -144319,7 +144336,7 @@ const path_1 = __webpack_require__(85622);
144319
144336
  const stream_utils_1 = __webpack_require__(54540);
144320
144337
  const poetryManifestFiles = ["pyproject.toml", "poetry.lock"];
144321
144338
  const pipManifestFiles = ["requirements.txt"];
144322
- const pythonMetadataFilesRegex = /\/lib\/python.*?\/site-packages\/.*?\.dist-info\/METADATA/;
144339
+ const pythonMetadataFilesRegex = /\/lib\/python.*?\/(?:dist|site)-packages\/.*?\.dist-info\/METADATA/;
144323
144340
  const deletedPoetryAppFiles = poetryManifestFiles.map((file) => ".wh." + file);
144324
144341
  const deletedPipAppFiles = pipManifestFiles.map((file) => ".wh." + file);
144325
144342
  function poetryFilePathMatches(filePath) {
@@ -144654,7 +144671,7 @@ const dep_graph_1 = __webpack_require__(26326);
144654
144671
  // Module that provides functions to collect and build response after all
144655
144672
  // analyses' are done.
144656
144673
  const dockerfile_1 = __webpack_require__(79652);
144657
- async function buildResponse(depsAnalysis, dockerfileAnalysis, excludeBaseImageVulns, imageName) {
144674
+ async function buildResponse(depsAnalysis, dockerfileAnalysis, excludeBaseImageVulns, names) {
144658
144675
  var _a, _b;
144659
144676
  const deps = depsAnalysis.depTree.dependencies;
144660
144677
  const dockerfilePkgs = collectDockerfilePkgs(dockerfileAnalysis, deps);
@@ -144775,8 +144792,7 @@ async function buildResponse(depsAnalysis, dockerfileAnalysis, excludeBaseImageV
144775
144792
  type: "depGraph",
144776
144793
  data: depGraph,
144777
144794
  };
144778
- if (imageName) {
144779
- const names = imageName.getAllNames();
144795
+ if (names) {
144780
144796
  if (names.length > 0) {
144781
144797
  const imageNameInfo = { names };
144782
144798
  const imageNamesFact = {
@@ -144990,6 +145006,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
144990
145006
  exports.analyzeStatically = void 0;
144991
145007
  const analyzer = __webpack_require__(55269);
144992
145008
  const dependency_tree_1 = __webpack_require__(95997);
145009
+ const image_1 = __webpack_require__(92748);
144993
145010
  const option_utils_1 = __webpack_require__(48587);
144994
145011
  const parser_1 = __webpack_require__(45062);
144995
145012
  const response_builder_1 = __webpack_require__(75319);
@@ -145000,7 +145017,8 @@ async function analyzeStatically(targetImage, dockerfileAnalysis, imageType, ima
145000
145017
  const dependenciesTree = (0, dependency_tree_1.buildTree)(targetImage, parsedAnalysisResult.packageFormat, parsedAnalysisResult.depInfosList, parsedAnalysisResult.targetOS);
145001
145018
  const analysis = Object.assign(Object.assign({}, staticAnalysis), { depTree: dependenciesTree, imageId: parsedAnalysisResult.imageId, imageLayers: parsedAnalysisResult.imageLayers, packageFormat: parsedAnalysisResult.packageFormat });
145002
145019
  const excludeBaseImageVulns = (0, option_utils_1.isTrue)(options["exclude-base-image-vulns"]);
145003
- return (0, response_builder_1.buildResponse)(analysis, dockerfileAnalysis, excludeBaseImageVulns, imageName);
145020
+ const names = (0, image_1.getImageNames)(options, imageName);
145021
+ return (0, response_builder_1.buildResponse)(analysis, dockerfileAnalysis, excludeBaseImageVulns, names);
145004
145022
  }
145005
145023
  exports.analyzeStatically = analyzeStatically;
145006
145024
  //# sourceMappingURL=static.js.map
@@ -154137,10 +154155,10 @@ async function getGradleVersion(root, command) {
154137
154155
  }
154138
154156
  return gradleVersionOutput;
154139
154157
  }
154140
- async function getAllDepsWithPlugin(root, targetFile, options) {
154158
+ async function getAllDepsWithPlugin(root, targetFile, options, gradleVersion) {
154141
154159
  const command = getCommand(root, targetFile);
154142
154160
  const { injectedPluginFilePath, cleanupCallback } = await injectedPlugin('init.gradle');
154143
- const args = buildArgs(root, targetFile, injectedPluginFilePath, options);
154161
+ const args = buildArgs(root, targetFile, injectedPluginFilePath, options, gradleVersion);
154144
154162
  const fullCommandText = 'gradle command: ' + command + ' ' + args.join(' ');
154145
154163
  debugLog('Executing ' + fullCommandText);
154146
154164
  const stdoutText = await subProcess.execute(command, args, { cwd: root }, printIfEcho);
@@ -154170,7 +154188,7 @@ async function getAllDeps(root, targetFile, options, snykHttpClient) {
154170
154188
  throw new Error('Gradle 1.x is not supported');
154171
154189
  }
154172
154190
  try {
154173
- const extractedJSON = await getAllDepsWithPlugin(root, targetFile, options);
154191
+ const extractedJSON = await getAllDepsWithPlugin(root, targetFile, options, gradleVersion);
154174
154192
  const versionBuildInfo = getVersionBuildInfo(gradleVersion);
154175
154193
  if (versionBuildInfo) {
154176
154194
  extractedJSON.versionBuildInfo = versionBuildInfo;
@@ -154309,8 +154327,8 @@ function getCommand(root, targetFile) {
154309
154327
  }
154310
154328
  return 'gradle';
154311
154329
  }
154312
- function buildArgs(root, targetFile, initGradlePath, options) {
154313
- const args = [];
154330
+ function buildArgs(root, targetFile, initGradlePath, options, gradleVersion) {
154331
+ let args = [];
154314
154332
  const taskName = options.gradleNormalizeDeps
154315
154333
  ? 'snykNormalizedResolvedDepsJson'
154316
154334
  : 'snykResolvedDepsJson';
@@ -154352,6 +154370,10 @@ function buildArgs(root, targetFile, initGradlePath, options) {
154352
154370
  if (options.args) {
154353
154371
  args.push(...options.args);
154354
154372
  }
154373
+ // Gradle 7 introduced configuration caching which we don't support yet
154374
+ // If it is enabled in a gradle.properties file, it can be disabled on the command line with --no-configuration-cache
154375
+ if (gradleVersion.match(/Gradle 7/))
154376
+ args.push('--no-configuration-cache');
154355
154377
  // There might be a legacy --configuration option in 'args'.
154356
154378
  // It has been superseded by --configuration-matching option for Snyk CLI (see buildArgs),
154357
154379
  // but we are handling it to support the legacy setups.
@@ -154364,6 +154386,15 @@ function buildArgs(root, targetFile, initGradlePath, options) {
154364
154386
  args[i + 1] = '';
154365
154387
  }
154366
154388
  });
154389
+ const unsupportedArgs = ['--configuration-cache'];
154390
+ args = args.filter((arg) => {
154391
+ if (unsupportedArgs.includes(arg)) {
154392
+ debugLog(`Argument ${arg} not currently supported by Snyk.`);
154393
+ return false;
154394
+ }
154395
+ else
154396
+ return true;
154397
+ });
154367
154398
  return args.filter(Boolean);
154368
154399
  }
154369
154400
  exports.exportsForTests = {