snyk 1.816.0 → 1.817.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/293.index.js
CHANGED
|
@@ -1776,10 +1776,10 @@ const url_1 = __webpack_require__(78835);
|
|
|
1776
1776
|
const upperFirst = __webpack_require__(90039);
|
|
1777
1777
|
const remediation_based_format_issues_1 = __webpack_require__(57995);
|
|
1778
1778
|
const legacy_format_issue_1 = __webpack_require__(63540);
|
|
1779
|
-
const legacy_1 = __webpack_require__(34013);
|
|
1780
1779
|
const common_1 = __webpack_require__(53110);
|
|
1781
1780
|
const detect_1 = __webpack_require__(45318);
|
|
1782
1781
|
const get_severity_value_1 = __webpack_require__(24898);
|
|
1782
|
+
const sarif_output_1 = __webpack_require__(5034);
|
|
1783
1783
|
const debug = Debug('iac-output');
|
|
1784
1784
|
function formatIacIssue(issue, isNew, path) {
|
|
1785
1785
|
const newBadge = isNew ? ' (new)' : '';
|
|
@@ -1901,9 +1901,6 @@ function createSarifOutputForIac(iacTestResponses) {
|
|
|
1901
1901
|
};
|
|
1902
1902
|
}
|
|
1903
1903
|
exports.createSarifOutputForIac = createSarifOutputForIac;
|
|
1904
|
-
function getIssueLevel(severity) {
|
|
1905
|
-
return severity === legacy_1.SEVERITY.HIGH ? 'error' : 'warning';
|
|
1906
|
-
}
|
|
1907
1904
|
function extractReportingDescriptor(results) {
|
|
1908
1905
|
const tool = {};
|
|
1909
1906
|
results.forEach(({ issue }) => {
|
|
@@ -1949,7 +1946,7 @@ function extractReportingDescriptor(results) {
|
|
|
1949
1946
|
markdown: `${issueMarkdown}${impactMarkdown}${resolveMarkdown}`.replace(/^\s+/g, ''),
|
|
1950
1947
|
},
|
|
1951
1948
|
defaultConfiguration: {
|
|
1952
|
-
level: getIssueLevel(issue.severity),
|
|
1949
|
+
level: sarif_output_1.getIssueLevel(issue.severity),
|
|
1953
1950
|
},
|
|
1954
1951
|
properties: {
|
|
1955
1952
|
tags,
|
|
@@ -2541,6 +2538,112 @@ function reachablePathsTemplate(samplePaths, extraPathsCount) {
|
|
|
2541
2538
|
}
|
|
2542
2539
|
|
|
2543
2540
|
|
|
2541
|
+
/***/ }),
|
|
2542
|
+
|
|
2543
|
+
/***/ 5034:
|
|
2544
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2545
|
+
|
|
2546
|
+
"use strict";
|
|
2547
|
+
|
|
2548
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2549
|
+
exports.getResults = exports.getTool = exports.getIssueLevel = exports.createSarifOutputForContainers = void 0;
|
|
2550
|
+
const legacy_1 = __webpack_require__(34013);
|
|
2551
|
+
const upperFirst = __webpack_require__(90039);
|
|
2552
|
+
function createSarifOutputForContainers(testResults) {
|
|
2553
|
+
const sarifRes = {
|
|
2554
|
+
version: '2.1.0',
|
|
2555
|
+
runs: [],
|
|
2556
|
+
};
|
|
2557
|
+
testResults.forEach((testResult) => {
|
|
2558
|
+
sarifRes.runs.push({
|
|
2559
|
+
tool: getTool(testResult),
|
|
2560
|
+
results: getResults(testResult),
|
|
2561
|
+
});
|
|
2562
|
+
});
|
|
2563
|
+
return sarifRes;
|
|
2564
|
+
}
|
|
2565
|
+
exports.createSarifOutputForContainers = createSarifOutputForContainers;
|
|
2566
|
+
function getIssueLevel(severity) {
|
|
2567
|
+
return severity === legacy_1.SEVERITY.HIGH || severity === legacy_1.SEVERITY.CRITICAL
|
|
2568
|
+
? 'error'
|
|
2569
|
+
: 'warning';
|
|
2570
|
+
}
|
|
2571
|
+
exports.getIssueLevel = getIssueLevel;
|
|
2572
|
+
function getTool(testResult) {
|
|
2573
|
+
const tool = {
|
|
2574
|
+
driver: {
|
|
2575
|
+
name: 'Snyk Container',
|
|
2576
|
+
rules: [],
|
|
2577
|
+
},
|
|
2578
|
+
};
|
|
2579
|
+
if (!testResult.vulnerabilities) {
|
|
2580
|
+
return tool;
|
|
2581
|
+
}
|
|
2582
|
+
const pushedIds = {};
|
|
2583
|
+
tool.driver.rules = testResult.vulnerabilities
|
|
2584
|
+
.map((vuln) => {
|
|
2585
|
+
if (pushedIds[vuln.id]) {
|
|
2586
|
+
return;
|
|
2587
|
+
}
|
|
2588
|
+
const level = getIssueLevel(vuln.severity);
|
|
2589
|
+
const cve = vuln['identifiers']['CVE'][0];
|
|
2590
|
+
pushedIds[vuln.id] = true;
|
|
2591
|
+
return {
|
|
2592
|
+
id: vuln.id,
|
|
2593
|
+
shortDescription: {
|
|
2594
|
+
text: `${upperFirst(vuln.severity)} severity - ${vuln.title} vulnerability in ${vuln.packageName}`,
|
|
2595
|
+
},
|
|
2596
|
+
fullDescription: {
|
|
2597
|
+
text: cve
|
|
2598
|
+
? `(${cve}) ${vuln.name}@${vuln.version}`
|
|
2599
|
+
: `${vuln.name}@${vuln.version}`,
|
|
2600
|
+
},
|
|
2601
|
+
help: {
|
|
2602
|
+
text: '',
|
|
2603
|
+
markdown: vuln.description,
|
|
2604
|
+
},
|
|
2605
|
+
defaultConfiguration: {
|
|
2606
|
+
level: level,
|
|
2607
|
+
},
|
|
2608
|
+
properties: {
|
|
2609
|
+
tags: ['security', ...vuln.identifiers.CWE],
|
|
2610
|
+
},
|
|
2611
|
+
};
|
|
2612
|
+
})
|
|
2613
|
+
.filter(Boolean);
|
|
2614
|
+
return tool;
|
|
2615
|
+
}
|
|
2616
|
+
exports.getTool = getTool;
|
|
2617
|
+
function getResults(testResult) {
|
|
2618
|
+
const results = [];
|
|
2619
|
+
if (!testResult.vulnerabilities) {
|
|
2620
|
+
return results;
|
|
2621
|
+
}
|
|
2622
|
+
testResult.vulnerabilities.forEach((vuln) => {
|
|
2623
|
+
results.push({
|
|
2624
|
+
ruleId: vuln.id,
|
|
2625
|
+
message: {
|
|
2626
|
+
text: `This file introduces a vulnerable ${vuln.packageName} package with a ${vuln.severity} severity vulnerability.`,
|
|
2627
|
+
},
|
|
2628
|
+
locations: [
|
|
2629
|
+
{
|
|
2630
|
+
physicalLocation: {
|
|
2631
|
+
artifactLocation: {
|
|
2632
|
+
uri: testResult.displayTargetFile,
|
|
2633
|
+
},
|
|
2634
|
+
region: {
|
|
2635
|
+
startLine: vuln.lineNumber || 1,
|
|
2636
|
+
},
|
|
2637
|
+
},
|
|
2638
|
+
},
|
|
2639
|
+
],
|
|
2640
|
+
});
|
|
2641
|
+
});
|
|
2642
|
+
return results;
|
|
2643
|
+
}
|
|
2644
|
+
exports.getResults = getResults;
|
|
2645
|
+
|
|
2646
|
+
|
|
2544
2647
|
/***/ }),
|
|
2545
2648
|
|
|
2546
2649
|
/***/ 98202:
|