snyk 1.1012.0 → 1.1014.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.
@@ -158338,7 +158338,8 @@ const static_6 = __webpack_require__(5809);
158338
158338
  const static_7 = __webpack_require__(96704);
158339
158339
  const static_8 = __webpack_require__(92578);
158340
158340
  const static_9 = __webpack_require__(88795);
158341
- const static_10 = __webpack_require__(45330);
158341
+ const static_10 = __webpack_require__(98157);
158342
+ const static_11 = __webpack_require__(45330);
158342
158343
  const option_utils_1 = __webpack_require__(48587);
158343
158344
  const applications_1 = __webpack_require__(19551);
158344
158345
  const java_1 = __webpack_require__(3823);
@@ -158353,12 +158354,13 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
158353
158354
  static_1.getApkDbFileContentAction,
158354
158355
  static_2.getDpkgFileContentAction,
158355
158356
  static_2.getExtFileContentAction,
158356
- static_10.getRpmDbFileContentAction,
158357
- static_10.getRpmSqliteDbFileContentAction,
158357
+ static_11.getRpmDbFileContentAction,
158358
+ static_11.getRpmSqliteDbFileContentAction,
158358
158359
  ...static_7.getOsReleaseActions,
158359
158360
  static_3.getNodeBinariesFileContentAction,
158360
158361
  static_3.getOpenJDKBinariesFileContentAction,
158361
158362
  static_4.getDpkgPackageFileContentAction,
158363
+ static_10.getRedHatRepositoriesContentAction,
158362
158364
  ];
158363
158365
  const checkForGlobs = shouldCheckForGlobs(globsToFind);
158364
158366
  if (checkForGlobs) {
@@ -158379,8 +158381,8 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
158379
158381
  const [apkDbFileContent, aptDbFileContent, rpmDbFileContent, rpmSqliteDbFileContent,] = await Promise.all([
158380
158382
  (0, static_1.getApkDbFileContent)(extractedLayers),
158381
158383
  (0, static_2.getAptDbFileContent)(extractedLayers),
158382
- (0, static_10.getRpmDbFileContent)(extractedLayers),
158383
- (0, static_10.getRpmSqliteDbFileContent)(extractedLayers),
158384
+ (0, static_11.getRpmDbFileContent)(extractedLayers),
158385
+ (0, static_11.getRpmSqliteDbFileContent)(extractedLayers),
158384
158386
  ]);
158385
158387
  const distrolessAptFiles = (0, static_4.getAptFiles)(extractedLayers);
158386
158388
  const manifestFiles = [];
@@ -158411,6 +158413,7 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
158411
158413
  throw new Error("Failed to detect installed OS packages");
158412
158414
  }
158413
158415
  const binaries = (0, static_3.getBinariesHashes)(extractedLayers);
158416
+ const redHatRepositories = (0, static_10.getRedHatRepositoriesFromExtractedLayers)(extractedLayers);
158414
158417
  const applicationDependenciesScanResults = [];
158415
158418
  if (appScan) {
158416
158419
  const nodeDependenciesScanResults = await (0, applications_1.nodeFilesToScannedProjects)((0, inputs_1.getFileContent)(extractedLayers, static_6.getNodeAppFileContentAction.actionName));
@@ -158435,6 +158438,7 @@ async function analyze(targetImage, dockerfileAnalysis, imageType, imagePath, gl
158435
158438
  autoDetectedUserInstructions,
158436
158439
  imageLabels,
158437
158440
  imageCreationTime,
158441
+ redHatRepositories,
158438
158442
  };
158439
158443
  }
158440
158444
  exports.analyze = analyze;
@@ -159540,7 +159544,7 @@ function isTarFile(name) {
159540
159544
  "use strict";
159541
159545
 
159542
159546
  Object.defineProperty(exports, "__esModule", ({ value: true }));
159543
- exports.getContentAsString = exports.getContentAsBuffer = exports.extractImageContent = void 0;
159547
+ exports.getContentAsString = exports.getContentAsBuffer = exports.isDeletedFile = exports.extractImageContent = void 0;
159544
159548
  const types_1 = __webpack_require__(93677);
159545
159549
  const dockerExtractor = __webpack_require__(40637);
159546
159550
  const ociExtractor = __webpack_require__(27044);
@@ -159581,18 +159585,34 @@ async function extractImageContent(imageType, fileSystemPath, extractActions) {
159581
159585
  exports.extractImageContent = extractImageContent;
159582
159586
  function layersWithLatestFileModifications(layers) {
159583
159587
  const extractedLayers = {};
159588
+ const removedFilesToIgnore = new Set();
159584
159589
  // TODO: This removes the information about the layer name, maybe we would need it in the future?
159585
159590
  for (const layer of layers) {
159586
159591
  // go over extracted files products found in this layer
159587
159592
  for (const filename of Object.keys(layer)) {
159588
- // file was not found
159589
- if (!Reflect.has(extractedLayers, filename)) {
159593
+ // if finding a deleted file - trimming to its original file name for excluding it from extractedLayers
159594
+ if (isDeletedFile(filename)) {
159595
+ removedFilesToIgnore.add(filename.replace(/.wh./, ""));
159596
+ }
159597
+ // not adding the original file to extractedLayers
159598
+ // and removing it from the set since it can be found in consecutive layers
159599
+ if (removedFilesToIgnore.has(filename)) {
159600
+ removedFilesToIgnore.delete(filename);
159601
+ }
159602
+ else if (
159603
+ // file was not found + avoid adding deleted files with .wh.
159604
+ !Reflect.has(extractedLayers, filename) &&
159605
+ !isDeletedFile(filename)) {
159590
159606
  extractedLayers[filename] = layer[filename];
159591
159607
  }
159592
159608
  }
159593
159609
  }
159594
159610
  return extractedLayers;
159595
159611
  }
159612
+ function isDeletedFile(filename) {
159613
+ return filename.match(/.wh./gm);
159614
+ }
159615
+ exports.isDeletedFile = isDeletedFile;
159596
159616
  function isBufferType(type) {
159597
159617
  return type.buffer !== undefined;
159598
159618
  }
@@ -159632,6 +159652,7 @@ const Debug = __webpack_require__(15158);
159632
159652
  const gunzip = __webpack_require__(65923);
159633
159653
  const path = __webpack_require__(85622);
159634
159654
  const tar_stream_1 = __webpack_require__(53871);
159655
+ const _1 = __webpack_require__(18141);
159635
159656
  const callbacks_1 = __webpack_require__(12518);
159636
159657
  const debug = Debug("snyk");
159637
159658
  /**
@@ -159651,7 +159672,8 @@ async function extractImageLayer(layerTarStream, extractActions) {
159651
159672
  if (matchedActions.length > 0) {
159652
159673
  try {
159653
159674
  const callbackResult = await (0, callbacks_1.applyCallbacks)(matchedActions, stream, headers.size);
159654
- if (!(0, callbacks_1.isResultEmpty)(callbackResult)) {
159675
+ if (!(0, callbacks_1.isResultEmpty)(callbackResult) ||
159676
+ (0, _1.isDeletedFile)(absoluteFileName)) {
159655
159677
  result[absoluteFileName] = callbackResult;
159656
159678
  }
159657
159679
  }
@@ -160960,9 +160982,11 @@ exports.getNodeAppFileContentAction = void 0;
160960
160982
  const path_1 = __webpack_require__(85622);
160961
160983
  const stream_utils_1 = __webpack_require__(54540);
160962
160984
  const nodeAppFiles = ["package.json", "package-lock.json", "yarn.lock"];
160985
+ const deletedAppFiles = nodeAppFiles.map((file) => ".wh." + file);
160963
160986
  function filePathMatches(filePath) {
160964
160987
  const fileName = (0, path_1.basename)(filePath);
160965
- return (filePath.indexOf("node_modules") === -1 && nodeAppFiles.includes(fileName));
160988
+ return (filePath.indexOf("node_modules") === -1 &&
160989
+ (nodeAppFiles.includes(fileName) || deletedAppFiles.includes(fileName)));
160966
160990
  }
160967
160991
  exports.getNodeAppFileContentAction = {
160968
160992
  actionName: "node-app-files",
@@ -161076,9 +161100,10 @@ exports.getPhpAppFileContentAction = void 0;
161076
161100
  const path_1 = __webpack_require__(85622);
161077
161101
  const stream_utils_1 = __webpack_require__(54540);
161078
161102
  const phpAppFiles = ["composer.json", "composer.lock"];
161103
+ const deletedAppFiles = phpAppFiles.map((file) => ".wh." + file);
161079
161104
  function filePathMatches(filePath) {
161080
161105
  const fileName = (0, path_1.basename)(filePath);
161081
- return phpAppFiles.includes(fileName);
161106
+ return phpAppFiles.includes(fileName) || deletedAppFiles.includes(fileName);
161082
161107
  }
161083
161108
  exports.getPhpAppFileContentAction = {
161084
161109
  actionName: "php-app-files",
@@ -161101,9 +161126,12 @@ const stream_utils_1 = __webpack_require__(54540);
161101
161126
  const poetryManifestFiles = ["pyproject.toml", "poetry.lock"];
161102
161127
  const pipManifestFiles = ["requirements.txt"];
161103
161128
  const pythonMetadataFilesRegex = /\/lib\/python.*?\/site-packages\/.*?\.dist-info\/METADATA/;
161129
+ const deletedPoetryAppFiles = poetryManifestFiles.map((file) => ".wh." + file);
161130
+ const deletedPipAppFiles = pipManifestFiles.map((file) => ".wh." + file);
161104
161131
  function poetryFilePathMatches(filePath) {
161105
161132
  const fileName = (0, path_1.basename)(filePath);
161106
- return poetryManifestFiles.includes(fileName);
161133
+ return (poetryManifestFiles.includes(fileName) ||
161134
+ deletedPoetryAppFiles.includes(fileName));
161107
161135
  }
161108
161136
  exports.getPoetryAppFileContentAction = {
161109
161137
  actionName: "poetry-app-files",
@@ -161113,7 +161141,8 @@ exports.getPoetryAppFileContentAction = {
161113
161141
  function pipFilePathMatches(filePath) {
161114
161142
  const fileName = (0, path_1.basename)(filePath);
161115
161143
  return (pipManifestFiles.includes(fileName) ||
161116
- pythonMetadataFilesRegex.test(filePath));
161144
+ pythonMetadataFilesRegex.test(filePath) ||
161145
+ deletedPipAppFiles.includes(fileName));
161117
161146
  }
161118
161147
  exports.getPipAppFileContentAction = {
161119
161148
  actionName: "pip-app-files",
@@ -161124,6 +161153,37 @@ exports.getPipAppFileContentAction = {
161124
161153
 
161125
161154
  /***/ }),
161126
161155
 
161156
+ /***/ 98157:
161157
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
161158
+
161159
+ "use strict";
161160
+
161161
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
161162
+ exports.getRedHatRepositoriesFromExtractedLayers = exports.getRedHatRepositoriesContentAction = void 0;
161163
+ const stream_utils_1 = __webpack_require__(54540);
161164
+ exports.getRedHatRepositoriesContentAction = {
161165
+ actionName: "redhat-content-manifests",
161166
+ filePathMatches: isRedHatContentManifest,
161167
+ callback: stream_utils_1.streamToJson,
161168
+ };
161169
+ function getRedHatRepositoriesFromExtractedLayers(extractedLayers) {
161170
+ const repositories = [];
161171
+ for (const filePath in extractedLayers) {
161172
+ if (isRedHatContentManifest(filePath)) {
161173
+ const contentManifest = extractedLayers[filePath]["redhat-content-manifests"];
161174
+ repositories.push(...contentManifest === null || contentManifest === void 0 ? void 0 : contentManifest.content_sets);
161175
+ }
161176
+ }
161177
+ return [...new Set(repositories)];
161178
+ }
161179
+ exports.getRedHatRepositoriesFromExtractedLayers = getRedHatRepositoriesFromExtractedLayers;
161180
+ function isRedHatContentManifest(filePath) {
161181
+ return filePath.startsWith("/root/buildinfo/content_manifests/");
161182
+ }
161183
+ //# sourceMappingURL=static.js.map
161184
+
161185
+ /***/ }),
161186
+
161127
161187
  /***/ 45330:
161128
161188
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
161129
161189
 
@@ -161495,6 +161555,13 @@ async function buildResponse(depsAnalysis, dockerfileAnalysis, excludeBaseImageV
161495
161555
  };
161496
161556
  additionalFacts.push(autoDetectedUserInstructionsFact);
161497
161557
  }
161558
+ if (depsAnalysis.redHatRepositories.length > 0) {
161559
+ const redHatRepositoriesFact = {
161560
+ type: "redHatRepositories",
161561
+ data: depsAnalysis.redHatRepositories,
161562
+ };
161563
+ additionalFacts.push(redHatRepositoriesFact);
161564
+ }
161498
161565
  const applicationDependenciesScanResults = (depsAnalysis.applicationDependenciesScanResults || []).map((appDepsScanResult) => {
161499
161566
  if (depsAnalysis.imageId) {
161500
161567
  const imageIdFact = {