snyk 1.1150.0 → 1.1152.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/784.index.js +25 -20
- package/dist/cli/784.index.js.map +1 -1
- package/dist/cli/95.index.js +2 -4
- package/dist/cli/95.index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/dist/lib/plugins/sast/format/output-format.d.ts +6 -1
- package/help/cli-commands/code-test.md +15 -1
- package/help/cli-commands/container-monitor.md +1 -1
- package/help/cli-commands/container-test.md +7 -3
- package/help/cli-commands/iac-test.md +3 -1
- package/help/cli-commands/ignore.md +2 -0
- package/help/cli-commands/sbom.md +2 -12
- package/package.json +1 -1
- package/src/generated/sha256sums.txt +10 -10
- package/src/generated/version +1 -1
- package/wrapper_dist/generated/sha256sums.txt +10 -10
- package/wrapper_dist/generated/version +1 -1
package/dist/cli/784.index.js
CHANGED
|
@@ -4731,17 +4731,8 @@ async function getCodeAnalysis(root, options, sastSettings, requestId) {
|
|
|
4731
4731
|
return null;
|
|
4732
4732
|
}
|
|
4733
4733
|
result.analysisResults.sarif = parseSecurityResults(result.analysisResults.sarif);
|
|
4734
|
-
// Filter ignored issues when using report
|
|
4735
|
-
if (options.report) {
|
|
4736
|
-
result.analysisResults.sarif = filterIgnoredIssues(result.analysisResults.sarif);
|
|
4737
|
-
}
|
|
4738
4734
|
return result;
|
|
4739
4735
|
}
|
|
4740
|
-
function filterIgnoredIssues(codeAnalysis) {
|
|
4741
|
-
const results = codeAnalysis.runs[0].results;
|
|
4742
|
-
codeAnalysis.runs[0].results = results === null || results === void 0 ? void 0 : results.filter((rule) => { var _a, _b; return ((_b = (_a = rule.suppressions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0; });
|
|
4743
|
-
return codeAnalysis;
|
|
4744
|
-
}
|
|
4745
4736
|
function severityToAnalysisSeverity(severity) {
|
|
4746
4737
|
if (severity === legacy_1.SEVERITY.CRITICAL) {
|
|
4747
4738
|
throw new errors_1.FeatureNotSupportedBySnykCodeError(legacy_1.SEVERITY.CRITICAL);
|
|
@@ -4915,31 +4906,38 @@ const theme_1 = __webpack_require__(86988);
|
|
|
4915
4906
|
const common_1 = __webpack_require__(53110);
|
|
4916
4907
|
const right_pad_1 = __webpack_require__(80627);
|
|
4917
4908
|
const debug = Debug('code-output');
|
|
4918
|
-
function
|
|
4909
|
+
function filterIgnoredIssues(analysisResults) {
|
|
4910
|
+
return analysisResults.filter((rule) => { var _a, _b; return ((_b = (_a = rule.suppressions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) === 0; });
|
|
4911
|
+
}
|
|
4912
|
+
function getCodeDisplayedOutput(args) {
|
|
4919
4913
|
let issues = {};
|
|
4920
|
-
const sarif = testResults.analysisResults.sarif;
|
|
4914
|
+
const sarif = args.testResults.analysisResults.sarif;
|
|
4921
4915
|
if (sarif.runs[0].results) {
|
|
4922
|
-
|
|
4916
|
+
// Filter ignored issues (suppressions) from the sarif to display in the cli output
|
|
4917
|
+
// The sarif will remain unchanged and contain the suppressions
|
|
4918
|
+
const results = args.shouldFilterIgnored
|
|
4919
|
+
? filterIgnoredIssues(sarif.runs[0].results)
|
|
4920
|
+
: sarif.runs[0].results;
|
|
4923
4921
|
const rulesMap = getRulesMap(sarif.runs[0].tool.driver.rules || []);
|
|
4924
4922
|
issues = getIssues(results, rulesMap);
|
|
4925
4923
|
}
|
|
4926
4924
|
const issuesText = issues.low.join('') + issues.medium.join('') + issues.high.join('');
|
|
4927
4925
|
const summaryOKText = theme_1.color.status.success(`${theme_1.icon.VALID} Test completed`);
|
|
4928
4926
|
const codeIssueSummary = getCodeIssuesSummary(issues);
|
|
4929
|
-
let summary = prefix +
|
|
4927
|
+
let summary = args.prefix +
|
|
4930
4928
|
issuesText +
|
|
4931
4929
|
'\n' +
|
|
4932
4930
|
summaryOKText +
|
|
4933
4931
|
'\n\n' +
|
|
4934
|
-
meta +
|
|
4932
|
+
args.meta +
|
|
4935
4933
|
'\n\n' +
|
|
4936
4934
|
chalk_1.default.bold('Summary:') +
|
|
4937
4935
|
'\n\n' +
|
|
4938
4936
|
codeIssueSummary +
|
|
4939
4937
|
'\n\n';
|
|
4940
|
-
if (testResults.reportResults) {
|
|
4938
|
+
if (args.testResults.reportResults) {
|
|
4941
4939
|
summary +=
|
|
4942
|
-
getCodeReportDisplayedOutput(testResults.reportResults.reportUrl) +
|
|
4940
|
+
getCodeReportDisplayedOutput(args.testResults.reportResults.reportUrl) +
|
|
4943
4941
|
'\n\n';
|
|
4944
4942
|
}
|
|
4945
4943
|
return summary;
|
|
@@ -5060,6 +5058,7 @@ const output_format_1 = __webpack_require__(75802);
|
|
|
5060
5058
|
const errors_1 = __webpack_require__(55191);
|
|
5061
5059
|
const json_1 = __webpack_require__(27019);
|
|
5062
5060
|
const analytics = __webpack_require__(82744);
|
|
5061
|
+
const cloneDeep = __webpack_require__(83465);
|
|
5063
5062
|
const debug = debugLib('snyk-code');
|
|
5064
5063
|
exports.codePlugin = {
|
|
5065
5064
|
// We currently don't use scan/display. we will need to consolidate ecosystem plugins
|
|
@@ -5071,7 +5070,7 @@ exports.codePlugin = {
|
|
|
5071
5070
|
return '';
|
|
5072
5071
|
},
|
|
5073
5072
|
async test(paths, options) {
|
|
5074
|
-
var _a, _b, _c, _d, _e;
|
|
5073
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5075
5074
|
const requestId = uuid_1.v4();
|
|
5076
5075
|
debug(`Request ID: ${requestId}`);
|
|
5077
5076
|
try {
|
|
@@ -5083,7 +5082,8 @@ exports.codePlugin = {
|
|
|
5083
5082
|
if (!testResults) {
|
|
5084
5083
|
throw new errors_1.NoSupportedSastFiles();
|
|
5085
5084
|
}
|
|
5086
|
-
|
|
5085
|
+
// cloneDeep is used so the sarif is not changed when using the testResults getting the displayed output
|
|
5086
|
+
const sarifTypedResult = cloneDeep((_a = testResults === null || testResults === void 0 ? void 0 : testResults.analysisResults) === null || _a === void 0 ? void 0 : _a.sarif);
|
|
5087
5087
|
const numOfIssues = ((_c = (_b = sarifTypedResult.runs) === null || _b === void 0 ? void 0 : _b[0].results) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
5088
5088
|
analytics.add('sast-issues-found', numOfIssues);
|
|
5089
5089
|
let newOrg = options.org;
|
|
@@ -5092,9 +5092,14 @@ exports.codePlugin = {
|
|
|
5092
5092
|
}
|
|
5093
5093
|
const meta = output_format_1.getMeta({ ...options, org: newOrg }, path);
|
|
5094
5094
|
const prefix = output_format_1.getPrefix(path);
|
|
5095
|
-
let readableResult = output_format_1.getCodeDisplayedOutput(
|
|
5095
|
+
let readableResult = output_format_1.getCodeDisplayedOutput({
|
|
5096
|
+
testResults,
|
|
5097
|
+
meta,
|
|
5098
|
+
prefix,
|
|
5099
|
+
shouldFilterIgnored: (_d = options['report']) !== null && _d !== void 0 ? _d : false,
|
|
5100
|
+
});
|
|
5096
5101
|
if (numOfIssues > 0 && options['no-markdown']) {
|
|
5097
|
-
(
|
|
5102
|
+
(_f = (_e = sarifTypedResult.runs) === null || _e === void 0 ? void 0 : _e[0].results) === null || _f === void 0 ? void 0 : _f.forEach(({ message }) => {
|
|
5098
5103
|
delete message.markdown;
|
|
5099
5104
|
});
|
|
5100
5105
|
}
|