snyk 1.1307.0 → 1.1307.1

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.
Files changed (41) hide show
  1. package/dist/cli/778.index.js +177 -14
  2. package/dist/cli/778.index.js.map +1 -1
  3. package/dist/cli/thirdPartyNotice.json +6 -6
  4. package/help/cli-commands/README.md +8 -2
  5. package/help/cli-commands/cos-finding-list.md +112 -0
  6. package/help/cli-commands/cos-finding-show.md +48 -0
  7. package/help/cli-commands/cos-finding.md +34 -0
  8. package/help/cli-commands/cos-scan-cancel.md +49 -0
  9. package/help/cli-commands/cos-scan-list.md +98 -0
  10. package/help/cli-commands/cos-scan-report.md +73 -0
  11. package/help/cli-commands/cos-scan-start.md +105 -0
  12. package/help/cli-commands/cos-scan-status.md +72 -0
  13. package/help/cli-commands/cos-scan.md +39 -0
  14. package/help/cli-commands/cos-target-add.md +53 -0
  15. package/help/cli-commands/cos-target-dump.md +60 -0
  16. package/help/cli-commands/cos-target-list.md +52 -0
  17. package/help/cli-commands/cos-target-show.md +62 -0
  18. package/help/cli-commands/cos-target-template.md +97 -0
  19. package/help/cli-commands/cos-target.md +38 -0
  20. package/help/cli-commands/cos.md +42 -0
  21. package/node_modules/global-agent/node_modules/semver/README.md +67 -0
  22. package/node_modules/global-agent/node_modules/semver/bin/semver.js +16 -2
  23. package/node_modules/global-agent/node_modules/semver/classes/comparator.js +39 -34
  24. package/node_modules/global-agent/node_modules/semver/classes/range.js +43 -29
  25. package/node_modules/global-agent/node_modules/semver/classes/semver.js +32 -17
  26. package/node_modules/global-agent/node_modules/semver/functions/coerce.js +1 -1
  27. package/node_modules/global-agent/node_modules/semver/functions/diff.js +58 -16
  28. package/node_modules/global-agent/node_modules/semver/functions/inc.js +3 -2
  29. package/node_modules/global-agent/node_modules/semver/functions/parse.js +5 -22
  30. package/node_modules/global-agent/node_modules/semver/index.js +1 -0
  31. package/node_modules/global-agent/node_modules/semver/internal/constants.js +15 -2
  32. package/node_modules/global-agent/node_modules/semver/internal/parse-options.js +14 -10
  33. package/node_modules/global-agent/node_modules/semver/internal/re.js +11 -0
  34. package/node_modules/global-agent/node_modules/semver/package.json +8 -7
  35. package/node_modules/global-agent/node_modules/semver/ranges/intersects.js +1 -1
  36. package/node_modules/global-agent/node_modules/semver/ranges/subset.js +6 -3
  37. package/package.json +6 -1
  38. package/src/generated/sha256sums.txt +9 -9
  39. package/src/generated/version +1 -1
  40. package/wrapper_dist/generated/sha256sums.txt +9 -9
  41. package/wrapper_dist/generated/version +1 -1
@@ -7269,19 +7269,28 @@ function captureSegment (state, start, end, checkJson) {
7269
7269
  }
7270
7270
  }
7271
7271
 
7272
+ function chargeMergeWork (state) {
7273
+ state.totalMergeKeys++
7274
+
7275
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
7276
+ throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')')
7277
+ }
7278
+ }
7279
+
7272
7280
  function mergeMappings (state, destination, source, overridableKeys) {
7273
7281
  if (!common.isObject(source)) {
7274
7282
  throwError(state, 'cannot merge mappings; the provided source object is unacceptable')
7275
7283
  }
7276
7284
 
7285
+ // Count the source mapping itself to bound sequences of empty mappings.
7286
+ chargeMergeWork(state)
7287
+
7277
7288
  const sourceKeys = Object.keys(source)
7278
7289
 
7279
7290
  for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
7280
7291
  const key = sourceKeys[index]
7281
7292
 
7282
- if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
7283
- throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')')
7284
- }
7293
+ chargeMergeWork(state)
7285
7294
 
7286
7295
  if (!_hasOwnProperty.call(destination, key)) {
7287
7296
  setProperty(destination, key, source[key])
@@ -7324,6 +7333,10 @@ function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, val
7324
7333
 
7325
7334
  if (keyTag === 'tag:yaml.org,2002:merge') {
7326
7335
  if (Array.isArray(valueNode)) {
7336
+ if (valueNode.length > 100) {
7337
+ throwError(state, 'abnormal merge sequence size')
7338
+ }
7339
+
7327
7340
  for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
7328
7341
  mergeMappings(state, _result, valueNode[index], overridableKeys)
7329
7342
  }
@@ -144838,6 +144851,14 @@ function captureSegment(state, start, end, checkJson) {
144838
144851
  }
144839
144852
  }
144840
144853
 
144854
+ function chargeMergeWork(state) {
144855
+ state.totalMergeKeys += 1;
144856
+
144857
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
144858
+ throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')');
144859
+ }
144860
+ }
144861
+
144841
144862
  function mergeMappings(state, destination, source, overridableKeys) {
144842
144863
  var sourceKeys, key, index, quantity;
144843
144864
 
@@ -144845,14 +144866,15 @@ function mergeMappings(state, destination, source, overridableKeys) {
144845
144866
  throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
144846
144867
  }
144847
144868
 
144869
+ // Count the source mapping itself to bound sequences of empty mappings.
144870
+ chargeMergeWork(state);
144871
+
144848
144872
  sourceKeys = Object.keys(source);
144849
144873
 
144850
144874
  for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
144851
144875
  key = sourceKeys[index];
144852
144876
 
144853
- if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
144854
- throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')');
144855
- }
144877
+ chargeMergeWork(state);
144856
144878
 
144857
144879
  if (!_hasOwnProperty.call(destination, key)) {
144858
144880
  setProperty(destination, key, source[key]);
@@ -144897,6 +144919,10 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
144897
144919
 
144898
144920
  if (keyTag === 'tag:yaml.org,2002:merge') {
144899
144921
  if (Array.isArray(valueNode)) {
144922
+ if (valueNode.length > 100) {
144923
+ throwError(state, 'abnormal merge sequence size');
144924
+ }
144925
+
144900
144926
  for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
144901
144927
  mergeMappings(state, _result, valueNode[index], overridableKeys);
144902
144928
  }
@@ -231409,6 +231435,105 @@ exports.extractArchive = (0, generic_archive_extractor_1.createExtractArchive)(g
231409
231435
 
231410
231436
  /***/ }),
231411
231437
 
231438
+ /***/ 644:
231439
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
231440
+
231441
+ "use strict";
231442
+
231443
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
231444
+ exports.parsePlatform = exports.fetchAttestationsFromRegistry = void 0;
231445
+ const docker_registry_v2_client_1 = __webpack_require__(28310);
231446
+ const Debug = __webpack_require__(6807);
231447
+ const error_utils_1 = __webpack_require__(40035);
231448
+ const layer_1 = __webpack_require__(29633);
231449
+ const debug = Debug("snyk");
231450
+ const MEDIATYPE_IN_TOTO = "application/vnd.in-toto+json";
231451
+ const PREDICATE_TYPE_ANNOTATION = "in-toto.io/predicate-type";
231452
+ const SLSA_PROVENANCE_PREFIX = "https://slsa.dev/provenance/";
231453
+ // Fetches provenance attestations for an image directly from its source registry.
231454
+ async function fetchAttestationsFromRegistry(ref) {
231455
+ var _a;
231456
+ const { registryBase, repo, imageReference, username, password, platform } = ref;
231457
+ let manifest;
231458
+ try {
231459
+ manifest = await (0, docker_registry_v2_client_1.getAttestationManifest)(registryBase, repo, imageReference, username, password, undefined, platform);
231460
+ }
231461
+ catch (error) {
231462
+ debug(`[provenance] failed to fetch attestation manifest for ${repo}@${imageReference}: ${(0, error_utils_1.getErrorMessage)(error)}`);
231463
+ return [];
231464
+ }
231465
+ if (!manifest ||
231466
+ !Array.isArray(manifest.layers) ||
231467
+ manifest.layers.length === 0) {
231468
+ return [];
231469
+ }
231470
+ const inTotoStatements = {};
231471
+ for (const layer of manifest.layers) {
231472
+ if (layer.mediaType !== MEDIATYPE_IN_TOTO) {
231473
+ continue;
231474
+ }
231475
+ const predicateType = (_a = layer.annotations) === null || _a === void 0 ? void 0 : _a[PREDICATE_TYPE_ANNOTATION];
231476
+ if (predicateType && !predicateType.startsWith(SLSA_PROVENANCE_PREFIX)) {
231477
+ continue;
231478
+ }
231479
+ if (typeof layer.size === "number" && layer.size > layer_1.MAX_JSON_SIZE_BYTES) {
231480
+ debug(`[provenance] skipping oversized attestation layer ${layer.digest} (${layer.size} bytes > ${layer_1.MAX_JSON_SIZE_BYTES})`);
231481
+ continue;
231482
+ }
231483
+ try {
231484
+ const blob = await (0, docker_registry_v2_client_1.getLayer)(registryBase, repo, layer.digest, username, password);
231485
+ inTotoStatements[layer.digest] = JSON.parse(blob.toString("utf-8"));
231486
+ }
231487
+ catch (error) {
231488
+ debug(`[provenance] skipping layer ${layer.digest}: ${(0, error_utils_1.getErrorMessage)(error)}`);
231489
+ }
231490
+ }
231491
+ if (Object.keys(inTotoStatements).length === 0) {
231492
+ return [];
231493
+ }
231494
+ if (!manifest.manifestDigest) {
231495
+ debug(`[provenance] no descriptor digest for attestation manifest ${repo}@${imageReference}; skipping`);
231496
+ return [];
231497
+ }
231498
+ const resolvedManifest = {
231499
+ schemaVersion: String(manifest.schemaVersion),
231500
+ mediaType: manifest.mediaType,
231501
+ config: { digest: manifest.config.digest },
231502
+ layers: manifest.layers.map((layer) => ({
231503
+ digest: layer.digest,
231504
+ mediaType: layer.mediaType,
231505
+ size: layer.size,
231506
+ annotations: layer.annotations,
231507
+ })),
231508
+ };
231509
+ return [
231510
+ {
231511
+ manifestDigest: manifest.manifestDigest,
231512
+ manifest: resolvedManifest,
231513
+ inTotoStatements,
231514
+ },
231515
+ ];
231516
+ }
231517
+ exports.fetchAttestationsFromRegistry = fetchAttestationsFromRegistry;
231518
+ function parsePlatform(platform) {
231519
+ if (!platform) {
231520
+ return undefined;
231521
+ }
231522
+ const info = (0, layer_1.getOciPlatformInfoFromOptionString)(platform);
231523
+ if (!info.os || !info.architecture) {
231524
+ return undefined;
231525
+ }
231526
+ return {
231527
+ os: info.os,
231528
+ architecture: info.architecture,
231529
+ variant: info.variant,
231530
+ };
231531
+ }
231532
+ exports.parsePlatform = parsePlatform;
231533
+ //# sourceMappingURL=fetch-registry-provenance-attestations.js.map
231534
+
231535
+ /***/ }),
231536
+
231412
231537
  /***/ 98065:
231413
231538
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
231414
231539
 
@@ -232088,7 +232213,7 @@ exports.getImageIdFromManifest = getImageIdFromManifest;
232088
232213
  "use strict";
232089
232214
 
232090
232215
  Object.defineProperty(exports, "__esModule", ({ value: true }));
232091
- exports.getManifest = exports.isImageManifest = exports.extractArchive = void 0;
232216
+ exports.getOciPlatformInfoFromOptionString = exports.getManifest = exports.isImageManifest = exports.extractArchive = exports.MAX_JSON_SIZE_BYTES = void 0;
232092
232217
  const Debug = __webpack_require__(6807);
232093
232218
  const fs_1 = __webpack_require__(57147);
232094
232219
  const path_1 = __webpack_require__(71017);
@@ -232106,7 +232231,7 @@ const MEDIATYPE_OCI_MANIFEST_LIST_V1 = "application/vnd.oci.image.index.v1+json"
232106
232231
  const MEDIATYPE_IN_TOTO = "application/vnd.in-toto+json";
232107
232232
  // Maximum size for JSON metadata files. Matches the limit in streamToJson.
232108
232233
  // Files larger than this are layer blobs, not JSON metadata.
232109
- const MAX_JSON_SIZE_BYTES = 2 * 1024 * 1024;
232234
+ exports.MAX_JSON_SIZE_BYTES = 2 * 1024 * 1024;
232110
232235
  /**
232111
232236
  * Retrieve the products of files content from the specified oci-archive.
232112
232237
  *
@@ -232189,7 +232314,7 @@ async function extractMetadata(ociArchiveFilesystemPath) {
232189
232314
  mainIndexFile = await (0, stream_utils_1.streamToJson)(stream);
232190
232315
  }
232191
232316
  else if (isBlobPath(normalizedHeaderName) &&
232192
- (header.size === undefined || header.size <= MAX_JSON_SIZE_BYTES)) {
232317
+ (header.size === undefined || header.size <= exports.MAX_JSON_SIZE_BYTES)) {
232193
232318
  // Small blob file - try to parse as JSON metadata
232194
232319
  // Large files and non-blob files (oci-layout, etc.) are skipped
232195
232320
  const jsonContent = await tryParseJsonMetadata(stream);
@@ -232262,7 +232387,7 @@ async function tryParseJsonMetadata(stream) {
232262
232387
  }
232263
232388
  }
232264
232389
  bytes += chunk.length;
232265
- if (bytes <= MAX_JSON_SIZE_BYTES) {
232390
+ if (bytes <= exports.MAX_JSON_SIZE_BYTES) {
232266
232391
  chunks.push(chunk.toString("utf8"));
232267
232392
  }
232268
232393
  });
@@ -232450,6 +232575,7 @@ function getOciPlatformInfoFromOptionString(platform) {
232450
232575
  variant,
232451
232576
  };
232452
232577
  }
232578
+ exports.getOciPlatformInfoFromOptionString = getOciPlatformInfoFromOptionString;
232453
232579
  function getImageManifestInfo(manifests, platformInfo) {
232454
232580
  // manifests do not always have a plaform, this is the case for OCI
232455
232581
  // images built with Docker when no platform is specified
@@ -235598,13 +235724,19 @@ exports.extractContent = extractContent;
235598
235724
 
235599
235725
  Object.defineProperty(exports, "__esModule", ({ value: true }));
235600
235726
  exports.analyzeStatically = void 0;
235727
+ const Debug = __webpack_require__(6807);
235601
235728
  const analyzer = __webpack_require__(55269);
235729
+ const image_inspector_1 = __webpack_require__(95710);
235602
235730
  const dependency_tree_1 = __webpack_require__(95997);
235731
+ const error_utils_1 = __webpack_require__(40035);
235603
235732
  const image_1 = __webpack_require__(92748);
235733
+ const fetch_registry_provenance_attestations_1 = __webpack_require__(644);
235604
235734
  const oci_distribution_metadata_1 = __webpack_require__(19103);
235605
235735
  const option_utils_1 = __webpack_require__(48587);
235606
235736
  const parser_1 = __webpack_require__(45062);
235607
235737
  const response_builder_1 = __webpack_require__(75319);
235738
+ const types_1 = __webpack_require__(93677);
235739
+ const debug = Debug("snyk");
235608
235740
  async function analyzeStatically(targetImage, dockerfileAnalysis, imageType, imagePath, globsToFind, options, imageName) {
235609
235741
  var _a, _b;
235610
235742
  const totalStart = Date.now();
@@ -235620,6 +235752,24 @@ async function analyzeStatically(targetImage, dockerfileAnalysis, imageType, ima
235620
235752
  imageLayers: parsedAnalysisResult.imageLayers,
235621
235753
  packageFormat: parsedAnalysisResult.packageFormat,
235622
235754
  };
235755
+ if (imageType === types_1.ImageType.Identifier &&
235756
+ (!analysis.attestations || analysis.attestations.length === 0)) {
235757
+ try {
235758
+ const { hostname, imageName: repo, tag, } = (0, image_inspector_1.extractImageDetails)(targetImage);
235759
+ analysis.attestations = await (0, fetch_registry_provenance_attestations_1.fetchAttestationsFromRegistry)({
235760
+ registryBase: hostname,
235761
+ repo,
235762
+ imageReference: tag,
235763
+ username: options.username,
235764
+ password: options.password,
235765
+ platform: (0, fetch_registry_provenance_attestations_1.parsePlatform)(options.platform),
235766
+ });
235767
+ }
235768
+ catch (error) {
235769
+ // Best-effort: provenance is optional; never fail the scan over it.
235770
+ debug(`[provenance] failed to fetch attestations from registry for ${targetImage}: ${(0, error_utils_1.getErrorMessage)(error)}`);
235771
+ }
235772
+ }
235623
235773
  const excludeBaseImageVulns = (0, option_utils_1.isTrue)(options["exclude-base-image-vulns"]);
235624
235774
  const names = (0, image_1.getImageNames)(options, imageName);
235625
235775
  let ociDistributionMetadata;
@@ -236000,7 +236150,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
236000
236150
  exports.PLUGIN_VERSION = void 0;
236001
236151
  // This file is auto-generated during the release process.
236002
236152
  // Do not edit manually.
236003
- exports.PLUGIN_VERSION = "9.19.0";
236153
+ exports.PLUGIN_VERSION = "9.20.0";
236004
236154
  //# sourceMappingURL=version.js.map
236005
236155
 
236006
236156
  /***/ }),
@@ -262188,19 +262338,28 @@ function captureSegment (state, start, end, checkJson) {
262188
262338
  }
262189
262339
  }
262190
262340
 
262341
+ function chargeMergeWork (state) {
262342
+ state.totalMergeKeys++
262343
+
262344
+ if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
262345
+ throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')')
262346
+ }
262347
+ }
262348
+
262191
262349
  function mergeMappings (state, destination, source, overridableKeys) {
262192
262350
  if (!common.isObject(source)) {
262193
262351
  throwError(state, 'cannot merge mappings; the provided source object is unacceptable')
262194
262352
  }
262195
262353
 
262354
+ // Count the source mapping itself to bound sequences of empty mappings.
262355
+ chargeMergeWork(state)
262356
+
262196
262357
  const sourceKeys = Object.keys(source)
262197
262358
 
262198
262359
  for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
262199
262360
  const key = sourceKeys[index]
262200
262361
 
262201
- if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) {
262202
- throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')')
262203
- }
262362
+ chargeMergeWork(state)
262204
262363
 
262205
262364
  if (!_hasOwnProperty.call(destination, key)) {
262206
262365
  setProperty(destination, key, source[key])
@@ -262243,6 +262402,10 @@ function storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, val
262243
262402
 
262244
262403
  if (keyTag === 'tag:yaml.org,2002:merge') {
262245
262404
  if (Array.isArray(valueNode)) {
262405
+ if (valueNode.length > 100) {
262406
+ throwError(state, 'abnormal merge sequence size')
262407
+ }
262408
+
262246
262409
  for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
262247
262410
  mergeMappings(state, _result, valueNode[index], overridableKeys)
262248
262411
  }