snyk 1.712.0 → 1.713.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.
@@ -164588,16 +164588,44 @@ exports.debug = debug_1.default('snyk-cpp-plugin');
164588
164588
 
164589
164589
  /***/ }),
164590
164590
 
164591
- /***/ 37815:
164591
+ /***/ 47724:
164592
164592
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
164593
164593
 
164594
164594
  "use strict";
164595
164595
 
164596
164596
  Object.defineProperty(exports, "__esModule", ({ value: true }));
164597
- exports.leftPad = exports.display = void 0;
164597
+ exports.getColorBySeverity = exports.leftPad = void 0;
164598
164598
  const chalk = __webpack_require__(97502);
164599
- const debug_1 = __webpack_require__(36583);
164600
- const dep_graph_1 = __webpack_require__(71479);
164599
+ function leftPad(text, padding = 4) {
164600
+ return padding <= 0 ? text : ' '.repeat(padding) + text;
164601
+ }
164602
+ exports.leftPad = leftPad;
164603
+ function getColorBySeverity(severity) {
164604
+ switch (severity) {
164605
+ case 'low':
164606
+ return chalk.blueBright;
164607
+ case 'medium':
164608
+ return chalk.yellowBright;
164609
+ case 'high':
164610
+ return chalk.redBright;
164611
+ default:
164612
+ return chalk.whiteBright;
164613
+ }
164614
+ }
164615
+ exports.getColorBySeverity = getColorBySeverity;
164616
+ //# sourceMappingURL=common.js.map
164617
+
164618
+ /***/ }),
164619
+
164620
+ /***/ 97934:
164621
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
164622
+
164623
+ "use strict";
164624
+
164625
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
164626
+ exports.displayErrors = exports.displayIssues = exports.displayDependenciesWithFilePaths = exports.displayDependencies = exports.selectDisplayStrategy = exports.displaySignatures = void 0;
164627
+ const chalk = __webpack_require__(97502);
164628
+ const common_1 = __webpack_require__(47724);
164601
164629
  function displaySignatures(scanResults) {
164602
164630
  const result = [chalk.whiteBright('Signatures')];
164603
164631
  for (const { facts = [] } of scanResults) {
@@ -164614,51 +164642,95 @@ function displaySignatures(scanResults) {
164614
164642
  }
164615
164643
  return result;
164616
164644
  }
164645
+ exports.displaySignatures = displaySignatures;
164646
+ function findDependencyLines(depGraph, options, depsFilePaths) {
164647
+ const showDepsFilePaths = (options && options['print-dep-paths']) || false;
164648
+ const isAllowedToShowDependenciesWithFilePaths = showDepsFilePaths && depsFilePaths && Object.keys(depsFilePaths).length > 0;
164649
+ if (isAllowedToShowDependenciesWithFilePaths) {
164650
+ return displayDependenciesWithFilePaths(depGraph, depsFilePaths);
164651
+ }
164652
+ const isAllowedToShowDependencies = (options && options['print-deps']) || false;
164653
+ const emptyDependencySection = '';
164654
+ return isAllowedToShowDependencies
164655
+ ? displayDependencies(depGraph)
164656
+ : [emptyDependencySection];
164657
+ }
164658
+ function selectDisplayStrategy(options, depGraph, testResult) {
164659
+ const { depsFilePaths, issues, issuesData } = testResult;
164660
+ const dependencySection = findDependencyLines(depGraph, options, depsFilePaths);
164661
+ const issuesSection = displayIssues(depGraph, issues, issuesData);
164662
+ return [dependencySection, issuesSection];
164663
+ }
164664
+ exports.selectDisplayStrategy = selectDisplayStrategy;
164617
164665
  function displayDependencies(depGraph) {
164618
- var _a;
164619
164666
  const result = [];
164620
- const depCount = ((_a = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs()) === null || _a === void 0 ? void 0 : _a.length) || 0;
164621
- if (depCount > 0) {
164622
- result.push(chalk.whiteBright('Dependencies\n'));
164667
+ const dependencies = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs();
164668
+ const hasDependencies = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0;
164669
+ if (!hasDependencies) {
164670
+ return result;
164623
164671
  }
164624
- for (const pkg of (depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs()) || []) {
164625
- result.push(leftPad(`${pkg.name}@${pkg.version}`));
164672
+ result.push(chalk.whiteBright('\nDependencies:\n'));
164673
+ for (const { name, version } of dependencies || []) {
164674
+ result.push(common_1.leftPad(`${name}@${version}`, 2));
164626
164675
  }
164627
164676
  if (result.length) {
164628
164677
  result.push('');
164629
164678
  }
164630
164679
  return result;
164631
164680
  }
164681
+ exports.displayDependencies = displayDependencies;
164682
+ function displayDependenciesWithFilePaths(depGraph, depsFilePaths) {
164683
+ let result = [];
164684
+ const dependencies = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs();
164685
+ const hasDependencies = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0;
164686
+ if (!hasDependencies) {
164687
+ return result;
164688
+ }
164689
+ result.push(chalk.whiteBright('\nDependencies:'));
164690
+ for (const { name, version } of dependencies) {
164691
+ const dependencyId = `${name}@${version}`;
164692
+ result.push(`\n${common_1.leftPad(dependencyId, 2)}`);
164693
+ if (depsFilePaths && depsFilePaths[dependencyId]) {
164694
+ const displayDepsFilePathsOutput = displayDepsFilePaths(depsFilePaths, dependencyId);
164695
+ result = [...result, ...displayDepsFilePathsOutput];
164696
+ }
164697
+ }
164698
+ result.push('');
164699
+ return result;
164700
+ }
164701
+ exports.displayDependenciesWithFilePaths = displayDependenciesWithFilePaths;
164702
+ function displayDepsFilePaths(depsFilePaths, dependencyId) {
164703
+ const maxFilePathsToBeDisplayed = 3;
164704
+ const result = [];
164705
+ result.push(`${common_1.leftPad('matching files:', 2)}`);
164706
+ const filePathsToDisplay = depsFilePaths[dependencyId].slice(0, maxFilePathsToBeDisplayed);
164707
+ for (const filePathToDisplay of filePathsToDisplay) {
164708
+ result.push(common_1.leftPad(`- ${filePathToDisplay}`, 4));
164709
+ }
164710
+ const hasToHideAndSayDepsFilePathsCount = depsFilePaths[dependencyId].length > 3;
164711
+ if (hasToHideAndSayDepsFilePathsCount) {
164712
+ result.push(common_1.leftPad(`... and ${depsFilePaths[dependencyId].length -
164713
+ maxFilePathsToBeDisplayed} more files`, 4));
164714
+ }
164715
+ return result;
164716
+ }
164632
164717
  function displayIssues(depGraph, issues, issuesData) {
164633
- var _a;
164634
164718
  const result = [];
164635
- const pkgCount = ((_a = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs()) === null || _a === void 0 ? void 0 : _a.length) || 0;
164636
- const depCount = pkgCount == 1 ? '1 dependency' : `${pkgCount} dependencies`;
164719
+ const dependencies = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs();
164720
+ const dependenciesCountMsg = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) == 1
164721
+ ? '1 dependency'
164722
+ : `${dependencies === null || dependencies === void 0 ? void 0 : dependencies.length} dependencies`;
164637
164723
  const issuesCount = issues.length == 1 ? '1 issue' : `${issues.length} issues`;
164638
164724
  const hasIssues = issues.length > 0;
164639
164725
  if (hasIssues) {
164640
- result.push(chalk.whiteBright('Issues'));
164726
+ result.push(chalk.whiteBright('Issues:'));
164641
164727
  for (const { pkgName: name, pkgVersion: version, issueId: vulnId, } of issues) {
164642
164728
  const { title, severity } = issuesData[vulnId];
164643
- let color;
164644
- switch (severity) {
164645
- case 'low':
164646
- color = chalk.blueBright;
164647
- break;
164648
- case 'medium':
164649
- color = chalk.yellowBright;
164650
- break;
164651
- case 'high':
164652
- color = chalk.redBright;
164653
- break;
164654
- default:
164655
- color = chalk.whiteBright;
164656
- break;
164657
- }
164729
+ const color = common_1.getColorBySeverity(severity);
164658
164730
  const severityAndTitle = color(`\n ✗ [${severity}] ${title}`);
164659
164731
  const nvdUrl = `https://nvd.nist.gov/vuln/detail/${vulnId}`;
164660
- const introducedThrough = leftPad(`Introduced through: ${name}@${version}`);
164661
- const urlText = leftPad(`URL: ${nvdUrl}`);
164732
+ const introducedThrough = common_1.leftPad(`Introduced through: ${name}@${version}`);
164733
+ const urlText = common_1.leftPad(`URL: ${nvdUrl}`);
164662
164734
  result.push(severityAndTitle);
164663
164735
  result.push(introducedThrough);
164664
164736
  result.push(urlText);
@@ -164668,12 +164740,15 @@ function displayIssues(depGraph, issues, issuesData) {
164668
164740
  const issuesFound = hasIssues
164669
164741
  ? chalk.redBright(issuesCount)
164670
164742
  : chalk.greenBright(issuesCount);
164671
- const identifiedUnmanagedDeps = `Tested ${depCount} for known issues, found ${issuesFound}.\n`;
164672
- const failedToIdentifyUnmanagedDeps = `\nCould not identify unmanaged dependencies to be tested.`;
164673
- const endlineMsg = pkgCount > 0 ? identifiedUnmanagedDeps : failedToIdentifyUnmanagedDeps;
164743
+ const identifiedUnmanagedDeps = `Tested ${dependenciesCountMsg} for known issues, found ${issuesFound}.\n`;
164744
+ const failedToIdentifyUnmanagedDeps = `Could not identify unmanaged dependencies to be tested.`;
164745
+ const endlineMsg = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0
164746
+ ? identifiedUnmanagedDeps
164747
+ : failedToIdentifyUnmanagedDeps;
164674
164748
  result.push(endlineMsg);
164675
164749
  return result;
164676
164750
  }
164751
+ exports.displayIssues = displayIssues;
164677
164752
  function displayErrors(errors) {
164678
164753
  const result = [];
164679
164754
  if (errors.length) {
@@ -164687,21 +164762,34 @@ function displayErrors(errors) {
164687
164762
  }
164688
164763
  return result;
164689
164764
  }
164765
+ exports.displayErrors = displayErrors;
164766
+ //# sourceMappingURL=display.js.map
164767
+
164768
+ /***/ }),
164769
+
164770
+ /***/ 62877:
164771
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
164772
+
164773
+ "use strict";
164774
+
164775
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
164776
+ exports.display = void 0;
164777
+ const debug_1 = __webpack_require__(36583);
164778
+ const dep_graph_1 = __webpack_require__(71479);
164779
+ const display_1 = __webpack_require__(97934);
164690
164780
  async function display(scanResults, testResults, errors, options) {
164691
164781
  try {
164692
164782
  const result = [];
164693
164783
  if (options === null || options === void 0 ? void 0 : options.debug) {
164694
- const signatureLines = displaySignatures(scanResults);
164784
+ const signatureLines = display_1.displaySignatures(scanResults);
164695
164785
  result.push(...signatureLines);
164696
164786
  }
164697
164787
  for (const testResult of testResults) {
164698
164788
  const depGraph = dep_graph_1.createFromJSON(testResult.depGraphData);
164699
- const dependencyLines = displayDependencies(depGraph);
164700
- result.push(...dependencyLines);
164701
- const issueLines = displayIssues(depGraph, testResult.issues, testResult.issuesData);
164702
- result.push(...issueLines);
164789
+ const [dependencySection, issuesSection] = display_1.selectDisplayStrategy(options, depGraph, testResult);
164790
+ result.push(...dependencySection, ...issuesSection);
164703
164791
  }
164704
- const errorLines = displayErrors(errors);
164792
+ const errorLines = display_1.displayErrors(errors);
164705
164793
  result.push(...errorLines);
164706
164794
  return result.join('\n');
164707
164795
  }
@@ -164711,11 +164799,7 @@ async function display(scanResults, testResults, errors, options) {
164711
164799
  }
164712
164800
  }
164713
164801
  exports.display = display;
164714
- function leftPad(text, padding = 4) {
164715
- return padding <= 0 ? text : ' '.repeat(padding) + text;
164716
- }
164717
- exports.leftPad = leftPad;
164718
- //# sourceMappingURL=display.js.map
164802
+ //# sourceMappingURL=index.js.map
164719
164803
 
164720
164804
  /***/ }),
164721
164805
 
@@ -164980,7 +165064,7 @@ exports.getTarget = getTarget;
164980
165064
 
164981
165065
  Object.defineProperty(exports, "__esModule", ({ value: true }));
164982
165066
  exports.scan = exports.display = void 0;
164983
- const display_1 = __webpack_require__(37815);
165067
+ const display_1 = __webpack_require__(62877);
164984
165068
  Object.defineProperty(exports, "display", ({ enumerable: true, get: function () { return display_1.display; } }));
164985
165069
  const scan_1 = __webpack_require__(74650);
164986
165070
  Object.defineProperty(exports, "scan", ({ enumerable: true, get: function () { return scan_1.scan; } }));