snyk 1.855.0 → 1.856.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/245.index.js +20 -13
- package/dist/cli/245.index.js.map +1 -1
- package/dist/cli/85.index.js +18 -20
- package/dist/cli/85.index.js.map +1 -1
- package/dist/cli/977.index.js +18 -20
- package/dist/cli/977.index.js.map +1 -1
- package/dist/cli/commands/help/index.d.ts +3 -1
- package/dist/cli/index.js +6 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/thirdPartyNotice.json +2 -2
- package/help/cli-commands/iac-drift.md +1 -0
- package/package.json +1 -1
package/dist/cli/245.index.js
CHANGED
|
@@ -142978,6 +142978,12 @@ function selectDisplayStrategy(options, depGraph, testResult) {
|
|
|
142978
142978
|
return [dependencySection, issuesSection];
|
|
142979
142979
|
}
|
|
142980
142980
|
exports.selectDisplayStrategy = selectDisplayStrategy;
|
|
142981
|
+
function computeDependencyName(name, version) {
|
|
142982
|
+
return `${name}@${version || 'unknown'}`;
|
|
142983
|
+
}
|
|
142984
|
+
function computeDependencyId(name, version) {
|
|
142985
|
+
return `${name}@${version || ''}`;
|
|
142986
|
+
}
|
|
142981
142987
|
function displayDependencies(depGraph, fileSignaturesDetails, depsFilePaths = {}) {
|
|
142982
142988
|
var _a;
|
|
142983
142989
|
let result = [];
|
|
@@ -142988,8 +142994,9 @@ function displayDependencies(depGraph, fileSignaturesDetails, depsFilePaths = {}
|
|
|
142988
142994
|
}
|
|
142989
142995
|
result.push(chalk.whiteBright('\nDependencies:\n'));
|
|
142990
142996
|
for (const { name, version } of dependencies) {
|
|
142991
|
-
const dependencyId =
|
|
142992
|
-
|
|
142997
|
+
const dependencyId = computeDependencyId(name, version);
|
|
142998
|
+
const dependencyName = computeDependencyName(name, version);
|
|
142999
|
+
result.push(`\n${common_1.leftPad(dependencyName, 2)}`);
|
|
142993
143000
|
if (fileSignaturesDetails && ((_a = fileSignaturesDetails[dependencyId]) === null || _a === void 0 ? void 0 : _a.confidence)) {
|
|
142994
143001
|
result.push(common_1.leftPad(`confidence: ${fileSignaturesDetails[dependencyId].confidence.toFixed(3)}`, 2));
|
|
142995
143002
|
}
|
|
@@ -143032,10 +143039,11 @@ function displayIssues(depGraph, issues, issuesData, supportUnmanagedVulnDB = fa
|
|
|
143032
143039
|
const { title, severity } = issuesData[vulnId];
|
|
143033
143040
|
const color = common_1.getColorBySeverity(severity);
|
|
143034
143041
|
const severityAndTitle = color(`\n ✗ [${common_1.capitalize(severity)}] ${title}`);
|
|
143042
|
+
const dependencyName = computeDependencyName(name, version);
|
|
143035
143043
|
const vulnDetailsUrl = supportUnmanagedVulnDB
|
|
143036
143044
|
? `https://security.snyk.io/vuln/${vulnId}`
|
|
143037
143045
|
: `https://nvd.nist.gov/vuln/detail/${vulnId}`;
|
|
143038
|
-
const introducedThrough = common_1.leftPad(`Introduced through: ${
|
|
143046
|
+
const introducedThrough = common_1.leftPad(`Introduced through: ${dependencyName}`);
|
|
143039
143047
|
const urlText = common_1.leftPad(`URL: ${vulnDetailsUrl}`);
|
|
143040
143048
|
result.push(severityAndTitle);
|
|
143041
143049
|
result.push(introducedThrough);
|
|
@@ -143087,42 +143095,41 @@ async function display(scanResults, testResults, errors, options) {
|
|
|
143087
143095
|
if (errors.length > 0) {
|
|
143088
143096
|
error_1.exitWith(error_1.ExitCode.Error, display_1.displayErrors(errors).join('\n'));
|
|
143089
143097
|
}
|
|
143090
|
-
|
|
143098
|
+
let result = [];
|
|
143091
143099
|
let hasDependencies = false;
|
|
143092
143100
|
let hasVulnerabilities = false;
|
|
143093
143101
|
try {
|
|
143094
143102
|
if (options === null || options === void 0 ? void 0 : options.path) {
|
|
143095
143103
|
const prefix = chalk.bold.white(`\nTesting ${options.path}...\n`);
|
|
143096
|
-
result.
|
|
143104
|
+
result = result.concat(prefix);
|
|
143097
143105
|
}
|
|
143098
143106
|
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
143099
|
-
|
|
143100
|
-
result.push(...signatureLines);
|
|
143107
|
+
result = result.concat(display_1.displaySignatures(scanResults));
|
|
143101
143108
|
}
|
|
143102
143109
|
for (const testResult of testResults) {
|
|
143103
143110
|
const depGraph = dep_graph_1.createFromJSON(testResult.depGraphData);
|
|
143104
|
-
const [
|
|
143111
|
+
const [dependencies, issues] = display_1.selectDisplayStrategy(options, depGraph, testResult);
|
|
143105
143112
|
if (testResult.depGraphData.pkgs.length > 1) {
|
|
143106
143113
|
hasDependencies = true;
|
|
143107
143114
|
}
|
|
143108
143115
|
if (testResult.issues.length > 0) {
|
|
143109
143116
|
hasVulnerabilities = true;
|
|
143110
143117
|
}
|
|
143111
|
-
result.
|
|
143118
|
+
result = result.concat(dependencies, issues);
|
|
143112
143119
|
}
|
|
143113
143120
|
}
|
|
143114
143121
|
catch (error) {
|
|
143115
143122
|
debug_1.debug(error.message || `Error displaying the results: ${error}`);
|
|
143116
143123
|
error_1.exitWith(error_1.ExitCode.Error, 'Error displaying results.');
|
|
143117
143124
|
}
|
|
143125
|
+
const output = result.join('\n');
|
|
143118
143126
|
if (hasVulnerabilities) {
|
|
143119
|
-
error_1.exitWith(error_1.ExitCode.VulnerabilitiesFound,
|
|
143127
|
+
error_1.exitWith(error_1.ExitCode.VulnerabilitiesFound, output, testResults);
|
|
143120
143128
|
}
|
|
143121
143129
|
if (!hasDependencies) {
|
|
143122
|
-
|
|
143123
|
-
error_1.exitWith(error_1.ExitCode.NoSupportedFiles, result.join('\n'));
|
|
143130
|
+
error_1.exitWith(error_1.ExitCode.NoSupportedFiles, `${output}\nCould not detect supported target files in ${options === null || options === void 0 ? void 0 : options.path}`);
|
|
143124
143131
|
}
|
|
143125
|
-
return
|
|
143132
|
+
return output;
|
|
143126
143133
|
}
|
|
143127
143134
|
exports.display = display;
|
|
143128
143135
|
//# sourceMappingURL=index.js.map
|