snyk 1.1145.0 → 1.1146.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.
@@ -2857,6 +2857,56 @@ exports.UnsupportedEntitlementError = UnsupportedEntitlementError;
2857
2857
  UnsupportedEntitlementError.ERROR_CODE = 403;
2858
2858
 
2859
2859
 
2860
+ /***/ }),
2861
+
2862
+ /***/ 83539:
2863
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2864
+
2865
+ "use strict";
2866
+
2867
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2868
+ exports.getLevel = exports.getResults = void 0;
2869
+ const groupBy = __webpack_require__(20276);
2870
+ const map = __webpack_require__(80820);
2871
+ const legacy_1 = __webpack_require__(34013);
2872
+ function getResults(testResult) {
2873
+ const groupedVulnerabilities = groupBy(testResult.vulnerabilities, 'id');
2874
+ return map(groupedVulnerabilities, ([vuln]) => ({
2875
+ ruleId: vuln.id,
2876
+ level: getLevel(vuln),
2877
+ message: {
2878
+ text: `This file introduces a vulnerable ${vuln.packageName} package with a ${vuln.severity} severity vulnerability.`,
2879
+ },
2880
+ locations: [
2881
+ {
2882
+ physicalLocation: {
2883
+ artifactLocation: {
2884
+ uri: testResult.displayTargetFile,
2885
+ },
2886
+ region: {
2887
+ startLine: vuln.lineNumber || 1,
2888
+ },
2889
+ },
2890
+ },
2891
+ ],
2892
+ }));
2893
+ }
2894
+ exports.getResults = getResults;
2895
+ function getLevel(vuln) {
2896
+ switch (vuln.severity) {
2897
+ case legacy_1.SEVERITY.CRITICAL:
2898
+ case legacy_1.SEVERITY.HIGH:
2899
+ return 'error';
2900
+ case legacy_1.SEVERITY.MEDIUM:
2901
+ return 'warning';
2902
+ case legacy_1.SEVERITY.LOW:
2903
+ default:
2904
+ return 'note';
2905
+ }
2906
+ }
2907
+ exports.getLevel = getLevel;
2908
+
2909
+
2860
2910
  /***/ }),
2861
2911
 
2862
2912
  /***/ 56223:
@@ -3619,11 +3669,11 @@ exports.countSuppressedIssues = (suppressedIssues) => {
3619
3669
  "use strict";
3620
3670
 
3621
3671
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3622
- exports.getLevel = exports.getResults = exports.getRules = exports.createSarifOutputForOpenSource = void 0;
3672
+ exports.getRules = exports.createSarifOutputForOpenSource = void 0;
3623
3673
  const upperFirst = __webpack_require__(90039);
3624
3674
  const groupBy = __webpack_require__(20276);
3625
3675
  const map = __webpack_require__(80820);
3626
- const legacy_1 = __webpack_require__(34013);
3676
+ const get_sarif_result_1 = __webpack_require__(83539);
3627
3677
  const LOCK_FILES_TO_MANIFEST_MAP = {
3628
3678
  'Gemfile.lock': 'Gemfile',
3629
3679
  'package-lock.json': 'package.json',
@@ -3645,7 +3695,7 @@ function createSarifOutputForOpenSource(testResults) {
3645
3695
  rules: getRules(testResult),
3646
3696
  },
3647
3697
  },
3648
- results: getResults(testResult),
3698
+ results: get_sarif_result_1.getResults(testResult),
3649
3699
  })),
3650
3700
  };
3651
3701
  }
@@ -3699,42 +3749,6 @@ ${vuln.description}`.replace(/##\s/g, '# '),
3699
3749
  });
3700
3750
  }
3701
3751
  exports.getRules = getRules;
3702
- function getResults(testResult) {
3703
- const groupedVulnerabilities = groupBy(testResult.vulnerabilities, 'id');
3704
- return map(groupedVulnerabilities, ([vuln]) => ({
3705
- ruleId: vuln.id,
3706
- level: getLevel(vuln),
3707
- message: {
3708
- text: `This file introduces a vulnerable ${vuln.packageName} package with a ${vuln.severity} severity vulnerability.`,
3709
- },
3710
- locations: [
3711
- {
3712
- physicalLocation: {
3713
- artifactLocation: {
3714
- uri: testResult.displayTargetFile,
3715
- },
3716
- region: {
3717
- startLine: vuln.lineNumber || 1,
3718
- },
3719
- },
3720
- },
3721
- ],
3722
- }));
3723
- }
3724
- exports.getResults = getResults;
3725
- function getLevel(vuln) {
3726
- switch (vuln.severity) {
3727
- case legacy_1.SEVERITY.CRITICAL:
3728
- case legacy_1.SEVERITY.HIGH:
3729
- return 'error';
3730
- case legacy_1.SEVERITY.MEDIUM:
3731
- return 'warning';
3732
- case legacy_1.SEVERITY.LOW:
3733
- default:
3734
- return 'note';
3735
- }
3736
- }
3737
- exports.getLevel = getLevel;
3738
3752
  function getIntroducedThrough(vuln) {
3739
3753
  const [firstFrom, secondFrom] = vuln.from || [];
3740
3754
  return vuln.from.length > 2
@@ -3753,18 +3767,20 @@ function getIntroducedThrough(vuln) {
3753
3767
  "use strict";
3754
3768
 
3755
3769
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3756
- exports.getResults = exports.getTool = exports.getIssueLevel = exports.createSarifOutputForContainers = void 0;
3757
- const legacy_1 = __webpack_require__(34013);
3770
+ exports.getTool = exports.getIssueLevel = exports.createSarifOutputForContainers = void 0;
3758
3771
  const upperFirst = __webpack_require__(90039);
3772
+ const legacy_1 = __webpack_require__(34013);
3773
+ const get_sarif_result_1 = __webpack_require__(83539);
3759
3774
  function createSarifOutputForContainers(testResults) {
3760
3775
  const sarifRes = {
3776
+ $schema: 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json',
3761
3777
  version: '2.1.0',
3762
3778
  runs: [],
3763
3779
  };
3764
3780
  testResults.forEach((testResult) => {
3765
3781
  sarifRes.runs.push({
3766
3782
  tool: getTool(testResult),
3767
- results: getResults(testResult),
3783
+ results: get_sarif_result_1.getResults(testResult),
3768
3784
  });
3769
3785
  });
3770
3786
  return sarifRes;
@@ -3789,11 +3805,12 @@ function getTool(testResult) {
3789
3805
  const pushedIds = {};
3790
3806
  tool.driver.rules = testResult.vulnerabilities
3791
3807
  .map((vuln) => {
3808
+ var _a, _b, _c;
3792
3809
  if (pushedIds[vuln.id]) {
3793
3810
  return;
3794
3811
  }
3795
3812
  const level = getIssueLevel(vuln.severity);
3796
- const cve = vuln['identifiers']['CVE'][0];
3813
+ const cve = (_b = (_a = vuln.identifiers) === null || _a === void 0 ? void 0 : _a.CVE) === null || _b === void 0 ? void 0 : _b.join();
3797
3814
  pushedIds[vuln.id] = true;
3798
3815
  return {
3799
3816
  id: vuln.id,
@@ -3813,7 +3830,12 @@ function getTool(testResult) {
3813
3830
  level: level,
3814
3831
  },
3815
3832
  properties: {
3816
- tags: ['security', ...vuln.identifiers.CWE],
3833
+ tags: [
3834
+ 'security',
3835
+ ...(((_c = vuln.identifiers) === null || _c === void 0 ? void 0 : _c.CWE) || []),
3836
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
3837
+ testResult.packageManager,
3838
+ ],
3817
3839
  },
3818
3840
  };
3819
3841
  })
@@ -3821,34 +3843,6 @@ function getTool(testResult) {
3821
3843
  return tool;
3822
3844
  }
3823
3845
  exports.getTool = getTool;
3824
- function getResults(testResult) {
3825
- const results = [];
3826
- if (!testResult.vulnerabilities) {
3827
- return results;
3828
- }
3829
- testResult.vulnerabilities.forEach((vuln) => {
3830
- results.push({
3831
- ruleId: vuln.id,
3832
- message: {
3833
- text: `This file introduces a vulnerable ${vuln.packageName} package with a ${vuln.severity} severity vulnerability.`,
3834
- },
3835
- locations: [
3836
- {
3837
- physicalLocation: {
3838
- artifactLocation: {
3839
- uri: testResult.displayTargetFile,
3840
- },
3841
- region: {
3842
- startLine: vuln.lineNumber || 1,
3843
- },
3844
- },
3845
- },
3846
- ],
3847
- });
3848
- });
3849
- return results;
3850
- }
3851
- exports.getResults = getResults;
3852
3846
 
3853
3847
 
3854
3848
  /***/ }),