snyk 1.729.0 → 1.730.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.
- package/dist/cli/917.index.js +31 -0
- package/dist/cli/917.index.js.map +1 -1
- package/dist/cli/commands/test/iac-local-execution/math-utils.d.ts +7 -0
- package/dist/cli/commands/test/iac-local-execution/types.d.ts +1 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/lib/snyk-test/iac-test-result.d.ts +1 -0
- package/help/commands-docs/_SNYK_COMMAND_OPTIONS.md +4 -0
- package/help/commands-man/snyk-auth.1 +4 -4
- package/help/commands-man/snyk-code.1 +3 -3
- package/help/commands-man/snyk-config.1 +5 -5
- package/help/commands-man/snyk-container.1 +5 -5
- package/help/commands-man/snyk-help.1 +4 -4
- package/help/commands-man/snyk-iac.1 +4 -4
- package/help/commands-man/snyk-ignore.1 +6 -6
- package/help/commands-man/snyk-monitor.1 +11 -8
- package/help/commands-man/snyk-policy.1 +4 -4
- package/help/commands-man/snyk-protect.1 +6 -6
- package/help/commands-man/snyk-test.1 +11 -8
- package/help/commands-man/snyk-wizard.1 +6 -6
- package/help/commands-man/snyk-woof.1 +4 -4
- package/help/commands-man/snyk.1 +10 -7
- package/help/commands-md/snyk-monitor.md +4 -0
- package/help/commands-md/snyk-test.md +4 -0
- package/help/commands-md/snyk.md +4 -0
- package/help/commands-txt/snyk-monitor.txt +64 -58
- package/help/commands-txt/snyk-test.txt +64 -58
- package/help/commands-txt/snyk.txt +64 -58
- package/help/generator/generator.ts +29 -26
- package/package.json +2 -2
package/dist/cli/917.index.js
CHANGED
|
@@ -74,10 +74,13 @@ exports.formatTestError = formatTestError;
|
|
|
74
74
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75
75
|
exports.performanceAnalyticsObject = exports.PerformanceAnalyticsKey = exports.addIacAnalytics = void 0;
|
|
76
76
|
const analytics = __webpack_require__(82744);
|
|
77
|
+
const math_utils_1 = __webpack_require__(48537);
|
|
77
78
|
function addIacAnalytics(formattedResults,
|
|
78
79
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
79
80
|
ignoredIssuesCount) {
|
|
80
81
|
let totalIssuesCount = 0;
|
|
82
|
+
const customRulesIdsFoundInIssues = {};
|
|
83
|
+
let issuesFromCustomRulesCount = 0;
|
|
81
84
|
const issuesByType = {};
|
|
82
85
|
const packageManagers = Array();
|
|
83
86
|
formattedResults.forEach((res) => {
|
|
@@ -90,14 +93,22 @@ ignoredIssuesCount) {
|
|
|
90
93
|
issuesByType[packageManagerConfig] = (_a = issuesByType[packageManagerConfig]) !== null && _a !== void 0 ? _a : {};
|
|
91
94
|
issuesByType[packageManagerConfig][policy.severity] =
|
|
92
95
|
(issuesByType[packageManagerConfig][policy.severity] || 0) + 1;
|
|
96
|
+
if (policy.isGeneratedByCustomRule) {
|
|
97
|
+
issuesFromCustomRulesCount++;
|
|
98
|
+
customRulesIdsFoundInIssues[policy.publicId] = true;
|
|
99
|
+
}
|
|
93
100
|
});
|
|
94
101
|
});
|
|
102
|
+
const uniqueCustomRulesCount = Object.keys(customRulesIdsFoundInIssues).length;
|
|
95
103
|
analytics.add('packageManager', Array.from(new Set(packageManagers)));
|
|
96
104
|
analytics.add('iac-issues-count', totalIssuesCount);
|
|
97
105
|
analytics.add('iac-ignored-issues-count', ignoredIssuesCount);
|
|
98
106
|
analytics.add('iac-type', issuesByType);
|
|
99
107
|
analytics.add('iac-metrics', exports.performanceAnalyticsObject);
|
|
100
108
|
analytics.add('iac-test-count', formattedResults.length);
|
|
109
|
+
analytics.add('iac-custom-rules-issues-count', issuesFromCustomRulesCount);
|
|
110
|
+
analytics.add('iac-custom-rules-issues-percentage', math_utils_1.calculatePercentage(issuesFromCustomRulesCount, totalIssuesCount));
|
|
111
|
+
analytics.add('iac-custom-rules-coverage-count', uniqueCustomRulesCount);
|
|
101
112
|
}
|
|
102
113
|
exports.addIacAnalytics = addIacAnalytics;
|
|
103
114
|
var PerformanceAnalyticsKey;
|
|
@@ -868,6 +879,24 @@ class FailedToCleanLocalCacheError extends errors_1.CustomError {
|
|
|
868
879
|
}
|
|
869
880
|
|
|
870
881
|
|
|
882
|
+
/***/ }),
|
|
883
|
+
|
|
884
|
+
/***/ 48537:
|
|
885
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
886
|
+
|
|
887
|
+
"use strict";
|
|
888
|
+
|
|
889
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
890
|
+
exports.calculatePercentage = void 0;
|
|
891
|
+
/**
|
|
892
|
+
* Calculate percentage from relative and total amounts.
|
|
893
|
+
* @param relativeValue The relative amount.
|
|
894
|
+
* @param totalValue The total amount.
|
|
895
|
+
* @returns The calculated precentage.
|
|
896
|
+
*/
|
|
897
|
+
exports.calculatePercentage = (relativeValue, totalValue) => +(totalValue ? (relativeValue / totalValue) * 100 : 0).toFixed(2);
|
|
898
|
+
|
|
899
|
+
|
|
871
900
|
/***/ }),
|
|
872
901
|
|
|
873
902
|
/***/ 78272:
|
|
@@ -1371,6 +1400,7 @@ const engineTypeToProjectType = {
|
|
|
1371
1400
|
};
|
|
1372
1401
|
function formatScanResult(scanResult, meta, options) {
|
|
1373
1402
|
const fileType = extract_line_number_1.getFileTypeForParser(scanResult.fileType);
|
|
1403
|
+
const isGeneratedByCustomRule = scanResult.engineType === types_1.EngineType.Custom;
|
|
1374
1404
|
let treeByDocId;
|
|
1375
1405
|
try {
|
|
1376
1406
|
treeByDocId = cloud_config_parser_1.getTrees(fileType, scanResult.fileContent);
|
|
@@ -1401,6 +1431,7 @@ function formatScanResult(scanResult, meta, options) {
|
|
|
1401
1431
|
severity: policy.severity,
|
|
1402
1432
|
lineNumber,
|
|
1403
1433
|
documentation: `https://snyk.io/security-rules/${policy.publicId}`,
|
|
1434
|
+
isGeneratedByCustomRule,
|
|
1404
1435
|
};
|
|
1405
1436
|
});
|
|
1406
1437
|
const { targetFilePath, projectName, targetFile } = computePaths(scanResult.filePath, options.path);
|