snyk 1.1194.0 → 1.1196.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.
@@ -43087,7 +43087,7 @@ class DockerPull {
43087
43087
  const stagingDir = this.createDownloadedImageDestination(opt === null || opt === void 0 ? void 0 : opt.imageSavePath);
43088
43088
  try {
43089
43089
  if ((manifest === null || manifest === void 0 ? void 0 : manifest.manifestContentType) === docker_registry_v2_client_1.contentTypes.OCI_MANIFEST_V1) {
43090
- await this.buildOCIImage(manifest, imageConfig, missingLayers, stagingDir);
43090
+ await this.buildOCIImage(imageConfigMetadata.digest, manifest, imageConfig, missingLayers, stagingDir);
43091
43091
  }
43092
43092
  else {
43093
43093
  await this.buildImage(imageConfigMetadata.digest, imageConfig, layersConfigs, missingLayers, stagingDir);
@@ -43160,18 +43160,14 @@ class DockerPull {
43160
43160
  return {};
43161
43161
  }
43162
43162
  }
43163
- async buildOCIImage(manifest, imageConfig, layers, stagingDir) {
43163
+ async buildOCIImage(imageDigest, manifest, imageConfig, layers, stagingDir) {
43164
43164
  const pack = tar.pack();
43165
43165
  for (const layer of layers) {
43166
43166
  const digest = layer.config.digest.replace("sha256:", "");
43167
43167
  pack.entry({ name: path.join("blobs", "sha256", digest) }, layer.blob);
43168
43168
  }
43169
43169
  const configContent = JSON.stringify(imageConfig);
43170
- const configDigest = crypto
43171
- .createHash("sha256")
43172
- .update(configContent)
43173
- .digest("hex")
43174
- .toLowerCase();
43170
+ const configDigest = imageDigest.replace("sha256:", "");
43175
43171
  pack.entry({ name: path.join("blobs", "sha256", configDigest) }, configContent);
43176
43172
  // Ensure config digest and size is accurate following serialization round trip
43177
43173
  manifest.config.digest = `sha256:${configDigest}`;