snyk 1.917.0 → 1.918.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.
@@ -2212,37 +2212,6 @@ const color_utils_1 = __webpack_require__(4960);
2212
2212
  exports.failuresTipOutput = color_utils_1.colors.failure.bold(common_1.reTryMessage + os_1.EOL + common_1.contactSupportMessage);
2213
2213
 
2214
2214
 
2215
- /***/ }),
2216
-
2217
- /***/ 62089:
2218
- /***/ ((__unused_webpack_module, exports) => {
2219
-
2220
- "use strict";
2221
-
2222
- Object.defineProperty(exports, "__esModule", ({ value: true }));
2223
- exports.formatScanResultsNewOutput = void 0;
2224
- function formatScanResultsNewOutput(oldFormattedResults, outputMeta) {
2225
- const newFormattedResults = {
2226
- results: {},
2227
- metadata: outputMeta,
2228
- };
2229
- oldFormattedResults.forEach((oldFormattedResult) => {
2230
- oldFormattedResult.result.cloudConfigResults.forEach((policyMetadata) => {
2231
- if (!newFormattedResults.results[policyMetadata.severity]) {
2232
- newFormattedResults.results[policyMetadata.severity] = [];
2233
- }
2234
- newFormattedResults.results[policyMetadata.severity].push({
2235
- policyMetadata,
2236
- targetFile: oldFormattedResult.targetFile,
2237
- targetFilePath: oldFormattedResult.targetFilePath,
2238
- });
2239
- });
2240
- });
2241
- return newFormattedResults;
2242
- }
2243
- exports.formatScanResultsNewOutput = formatScanResultsNewOutput;
2244
-
2245
-
2246
2215
  /***/ }),
2247
2216
 
2248
2217
  /***/ 49041:
@@ -2251,7 +2220,7 @@ exports.formatScanResultsNewOutput = formatScanResultsNewOutput;
2251
2220
  "use strict";
2252
2221
 
2253
2222
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2254
- var issues_list_1 = __webpack_require__(57962);
2223
+ var issues_list_1 = __webpack_require__(97695);
2255
2224
  Object.defineProperty(exports, "getIacDisplayedIssues", ({ enumerable: true, get: function () { return issues_list_1.getIacDisplayedIssues; } }));
2256
2225
  var test_summary_1 = __webpack_require__(42242);
2257
2226
  Object.defineProperty(exports, "formatIacTestSummary", ({ enumerable: true, get: function () { return test_summary_1.formatIacTestSummary; } }));
@@ -2284,7 +2253,38 @@ exports.shouldPrintIacInitialMessage = shouldPrintIacInitialMessage;
2284
2253
 
2285
2254
  /***/ }),
2286
2255
 
2287
- /***/ 57962:
2256
+ /***/ 68676:
2257
+ /***/ ((__unused_webpack_module, exports) => {
2258
+
2259
+ "use strict";
2260
+
2261
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2262
+ exports.formatScanResultsNewOutput = void 0;
2263
+ function formatScanResultsNewOutput(oldFormattedResults, outputMeta) {
2264
+ const newFormattedResults = {
2265
+ results: {},
2266
+ metadata: outputMeta,
2267
+ };
2268
+ oldFormattedResults.forEach((oldFormattedResult) => {
2269
+ oldFormattedResult.result.cloudConfigResults.forEach((issue) => {
2270
+ if (!newFormattedResults.results[issue.severity]) {
2271
+ newFormattedResults.results[issue.severity] = [];
2272
+ }
2273
+ newFormattedResults.results[issue.severity].push({
2274
+ issue,
2275
+ targetFile: oldFormattedResult.targetFile,
2276
+ projectType: oldFormattedResult.result.projectType,
2277
+ });
2278
+ });
2279
+ });
2280
+ return newFormattedResults;
2281
+ }
2282
+ exports.formatScanResultsNewOutput = formatScanResultsNewOutput;
2283
+
2284
+
2285
+ /***/ }),
2286
+
2287
+ /***/ 97695:
2288
2288
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2289
2289
 
2290
2290
  "use strict";
@@ -2296,37 +2296,81 @@ const capitalize = __webpack_require__(51633);
2296
2296
  const isEmpty = __webpack_require__(99245);
2297
2297
  const debug = __webpack_require__(15158);
2298
2298
  const color_utils_1 = __webpack_require__(4960);
2299
- const formatters_1 = __webpack_require__(62089);
2299
+ const formatters_1 = __webpack_require__(68676);
2300
+ const issue_1 = __webpack_require__(58863);
2301
+ const common_1 = __webpack_require__(53110);
2300
2302
  function getIacDisplayedIssues(results, outputMeta) {
2301
- let output = os_1.EOL + color_utils_1.colors.info.bold('Issues') + os_1.EOL;
2303
+ const titleOutput = color_utils_1.colors.info.bold('Issues');
2302
2304
  const formattedResults = formatters_1.formatScanResultsNewOutput(results, outputMeta);
2303
2305
  if (isEmpty(formattedResults.results)) {
2304
- return (output +
2306
+ return (titleOutput +
2305
2307
  os_1.EOL +
2306
2308
  ' '.repeat(2) +
2307
2309
  color_utils_1.colors.success.bold('No vulnerable paths were found!'));
2308
2310
  }
2309
- ['low', 'medium', 'high', 'critical'].forEach((severity) => {
2310
- if (formattedResults.results[severity]) {
2311
- const issues = formattedResults.results[severity];
2312
- output +=
2313
- os_1.EOL +
2314
- color_utils_1.colors.severities[severity](`${capitalize(severity)} Severity Issues: ${issues.length}`) +
2315
- os_1.EOL.repeat(2);
2316
- output += getIssuesOutput(issues);
2317
- debug(`iac display output - ${severity} severity ${issues.length} issues`);
2318
- }
2319
- });
2320
- return output;
2311
+ const severitySectionsOutput = Object.values(common_1.SEVERITY)
2312
+ .filter((severity) => !!formattedResults.results[severity])
2313
+ .map((severity) => {
2314
+ const severityResults = formattedResults.results[severity];
2315
+ const titleOutput = color_utils_1.colors.severities[severity](`${capitalize(severity)} Severity Issues: ${severityResults.length}`);
2316
+ const issuesOutput = severityResults.map(issue_1.formatIssue).join(os_1.EOL.repeat(2));
2317
+ debug(`iac display output - ${severity} severity ${severityResults.length} issues`);
2318
+ return titleOutput + os_1.EOL.repeat(2) + issuesOutput;
2319
+ })
2320
+ .join(os_1.EOL.repeat(2));
2321
+ return titleOutput + os_1.EOL.repeat(2) + severitySectionsOutput;
2321
2322
  }
2322
2323
  exports.getIacDisplayedIssues = getIacDisplayedIssues;
2323
- // CFG-1574 will continue the work on this function
2324
- function getIssuesOutput(issues) {
2325
- let output = '';
2326
- issues.forEach((issue) => {
2327
- output += color_utils_1.colors.info(`${issue.policyMetadata.title}`) + os_1.EOL;
2328
- });
2329
- return output;
2324
+
2325
+
2326
+ /***/ }),
2327
+
2328
+ /***/ 58863:
2329
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2330
+
2331
+ "use strict";
2332
+
2333
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2334
+ exports.formatIssue = void 0;
2335
+ const capitalize = __webpack_require__(51633);
2336
+ const chalk_1 = __webpack_require__(32589);
2337
+ const os_1 = __webpack_require__(12087);
2338
+ const constants_1 = __webpack_require__(68620);
2339
+ const remediation_based_format_issues_1 = __webpack_require__(57995);
2340
+ const color_utils_1 = __webpack_require__(4960);
2341
+ function formatIssue(result) {
2342
+ const titleOutput = formatTitle(result.issue);
2343
+ const propertiesOutput = formatProperties(result);
2344
+ return titleOutput + os_1.EOL + propertiesOutput;
2345
+ }
2346
+ exports.formatIssue = formatIssue;
2347
+ function formatTitle(issue) {
2348
+ const severity = issue.severity;
2349
+ const titleOutput = color_utils_1.colors.severities[severity](`[${capitalize([issue.severity])}] ${chalk_1.default.bold(issue.title)}`);
2350
+ return titleOutput;
2351
+ }
2352
+ function formatProperties(result) {
2353
+ var _a;
2354
+ const remediationKey = constants_1.iacRemediationTypes === null || constants_1.iacRemediationTypes === void 0 ? void 0 : constants_1.iacRemediationTypes[result.projectType];
2355
+ const properties = [
2356
+ [
2357
+ 'Info',
2358
+ `${result.issue.iacDescription.issue}${result.issue.iacDescription.issue.endsWith('.') ? '' : '.'} ${result.issue.iacDescription.impact}`,
2359
+ ],
2360
+ ['Rule', result.issue.documentation],
2361
+ ['Path', remediation_based_format_issues_1.printPath(result.issue.cloudConfigPath, 0)],
2362
+ ['File', result.targetFile],
2363
+ [
2364
+ 'Resolve',
2365
+ remediationKey && ((_a = result.issue.remediation) === null || _a === void 0 ? void 0 : _a[remediationKey])
2366
+ ? result.issue.remediation[remediationKey]
2367
+ : result.issue.iacDescription.resolve,
2368
+ ],
2369
+ ].filter(([, val]) => !!val);
2370
+ const maxPropertyNameLength = Math.max(...properties.map(([key]) => key.length));
2371
+ return properties
2372
+ .map(([key, value]) => `${key}: ${' '.repeat(maxPropertyNameLength - key.length)}${value}`)
2373
+ .join(os_1.EOL);
2330
2374
  }
2331
2375
 
2332
2376
 
@@ -3147,6 +3191,40 @@ function getFileContents(root, fileName) {
3147
3191
  exports.getFileContents = getFileContents;
3148
3192
 
3149
3193
 
3194
+ /***/ }),
3195
+
3196
+ /***/ 68620:
3197
+ /***/ ((__unused_webpack_module, exports) => {
3198
+
3199
+ "use strict";
3200
+
3201
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
3202
+ exports.iacRemediationTypes = exports.TEST_SUPPORTED_IAC_PROJECTS = exports.IacProjectType = void 0;
3203
+ var IacProjectType;
3204
+ (function (IacProjectType) {
3205
+ IacProjectType["K8S"] = "k8sconfig";
3206
+ IacProjectType["TERRAFORM"] = "terraformconfig";
3207
+ IacProjectType["CLOUDFORMATION"] = "cloudformationconfig";
3208
+ IacProjectType["ARM"] = "armconfig";
3209
+ IacProjectType["CUSTOM"] = "customconfig";
3210
+ IacProjectType["MULTI_IAC"] = "multiiacconfig";
3211
+ })(IacProjectType = exports.IacProjectType || (exports.IacProjectType = {}));
3212
+ exports.TEST_SUPPORTED_IAC_PROJECTS = [
3213
+ IacProjectType.K8S,
3214
+ IacProjectType.TERRAFORM,
3215
+ IacProjectType.CLOUDFORMATION,
3216
+ IacProjectType.ARM,
3217
+ IacProjectType.MULTI_IAC,
3218
+ IacProjectType.CUSTOM,
3219
+ ];
3220
+ exports.iacRemediationTypes = {
3221
+ armconfig: 'arm',
3222
+ cloudformationconfig: 'cloudformation',
3223
+ k8sconfig: 'kubernetes',
3224
+ terraformconfig: 'terraform',
3225
+ };
3226
+
3227
+
3150
3228
  /***/ }),
3151
3229
 
3152
3230
  /***/ 62435: