snyk 1.921.0 → 1.922.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.
@@ -1851,7 +1851,6 @@ const pathLib = __webpack_require__(85622);
1851
1851
  const url_1 = __webpack_require__(78835);
1852
1852
  const upperFirst = __webpack_require__(90039);
1853
1853
  const camelCase = __webpack_require__(76884);
1854
- const child_process_1 = __webpack_require__(63129);
1855
1854
  const remediation_based_format_issues_1 = __webpack_require__(57995);
1856
1855
  const legacy_format_issue_1 = __webpack_require__(63540);
1857
1856
  const common_1 = __webpack_require__(53110);
@@ -1860,6 +1859,7 @@ const get_severity_value_1 = __webpack_require__(24898);
1860
1859
  const sarif_output_1 = __webpack_require__(5034);
1861
1860
  const version_1 = __webpack_require__(38217);
1862
1861
  const config_1 = __webpack_require__(22541);
1862
+ const utils_1 = __webpack_require__(3713);
1863
1863
  const debug = Debug('iac-output');
1864
1864
  function formatIacIssue(issue, isNew, path) {
1865
1865
  const newBadge = isNew ? ' (new)' : '';
@@ -1942,7 +1942,13 @@ function createSarifOutputForIac(iacTestResponses) {
1942
1942
  const basePath = detect_1.isLocalFolder(iacTestResponses[0].path)
1943
1943
  ? pathLib.resolve('.', iacTestResponses[0].path)
1944
1944
  : pathLib.resolve('.');
1945
- const repoRoot = getRepoRoot(basePath);
1945
+ let repoRoot;
1946
+ try {
1947
+ repoRoot = utils_1.getRepoRoot();
1948
+ }
1949
+ catch {
1950
+ repoRoot = pathLib.join(basePath, '/'); // the slash at the end is required, otherwise the artifactLocation.uri starts with a slash
1951
+ }
1946
1952
  const issues = iacTestResponses.reduce((collect, res) => {
1947
1953
  if (res.result) {
1948
1954
  // targetFile is the computed relative path of the scanned file
@@ -2082,19 +2088,6 @@ function mapIacTestResponseToSarifResults(issues) {
2082
2088
  });
2083
2089
  }
2084
2090
  exports.mapIacTestResponseToSarifResults = mapIacTestResponseToSarifResults;
2085
- function getRepoRoot(basePath) {
2086
- try {
2087
- const cwd = process.cwd();
2088
- const stdout = child_process_1.execSync('git rev-parse --show-toplevel', {
2089
- encoding: 'utf8',
2090
- cwd,
2091
- });
2092
- return stdout.trim() + '/';
2093
- }
2094
- catch {
2095
- return basePath;
2096
- }
2097
- }
2098
2091
  function getPathRelativeToRepoRoot(repoRoot, basePath, filePath) {
2099
2092
  const fullPath = pathLib.resolve(basePath, filePath).replace(/\\/g, '/');
2100
2093
  return fullPath.replace(repoRoot, '');
@@ -2110,6 +2103,27 @@ function shareResultsOutput(iacOutputMeta) {
2110
2103
  exports.shareResultsOutput = shareResultsOutput;
2111
2104
 
2112
2105
 
2106
+ /***/ }),
2107
+
2108
+ /***/ 3713:
2109
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2110
+
2111
+ "use strict";
2112
+
2113
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2114
+ exports.getRepoRoot = void 0;
2115
+ const child_process_1 = __webpack_require__(63129);
2116
+ function getRepoRoot() {
2117
+ const cwd = process.cwd();
2118
+ const stdout = child_process_1.execSync('git rev-parse --show-toplevel', {
2119
+ encoding: 'utf8',
2120
+ cwd,
2121
+ });
2122
+ return stdout.trim() + '/';
2123
+ }
2124
+ exports.getRepoRoot = getRepoRoot;
2125
+
2126
+
2113
2127
  /***/ }),
2114
2128
 
2115
2129
  /***/ 4960:
@@ -2429,11 +2443,13 @@ function formatTestMetaSection(iacMeta) {
2429
2443
  return metaSection;
2430
2444
  }
2431
2445
  function formatCountsSection(testData) {
2446
+ var _a, _b;
2432
2447
  const filesWithIssues = testData.results.filter((result) => result.result.cloudConfigResults.length).length;
2433
2448
  const filesWithoutIssues = testData.results.length - filesWithIssues;
2434
2449
  const countsSectionProperties = [];
2435
2450
  countsSectionProperties.push(`${color_utils_1.colors.success.bold(theme_1.icon.VALID)} Files without issues: ${color_utils_1.colors.info.bold(`${filesWithoutIssues}`)}`);
2436
2451
  countsSectionProperties.push(`${color_utils_1.colors.failure.bold(theme_1.icon.ISSUE)} Files with issues: ${color_utils_1.colors.info.bold(`${filesWithIssues}`)}`);
2452
+ countsSectionProperties.push(`${INDENT}Invalid files: ${color_utils_1.colors.info.bold(`${(_b = (_a = testData.failures) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0}`)}`);
2437
2453
  countsSectionProperties.push(`${INDENT}Ignored issues: ${color_utils_1.colors.info.bold(`${testData.ignoreCount}`)}`);
2438
2454
  let totalIssuesCount = 0;
2439
2455
  const issueCountsBySeverities = {