cve-lite-cli 1.39.0 → 1.41.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/README.md +28 -22
- package/dist/advisory/local-advisory-source.js +9 -5
- package/dist/advisory/local-db.js +91 -13
- package/dist/advisory/osv-sync.js +187 -56
- package/dist/advisory/staging-directory.js +112 -0
- package/dist/cli/advisories-sync.js +16 -2
- package/dist/cli/args.js +46 -35
- package/dist/cli/config.js +4 -1
- package/dist/cli/help.js +5 -3
- package/dist/cli/validate.js +23 -1
- package/dist/constants.js +15 -28
- package/dist/index.js +8 -3
- package/dist/osv/severity.js +1 -1
- package/dist/output/cyclonedx.js +24 -15
- package/dist/output/debug.js +68 -18
- package/dist/output/formatters.js +35 -7
- package/dist/output/html-reporter.js +68 -12
- package/dist/output/multi-folder-html-reporter.js +71 -11
- package/dist/output/output-dir.js +193 -7
- package/dist/output/override-findings-html.js +3 -6
- package/dist/output/override-findings-terminal.js +7 -12
- package/dist/output/override-fix-command.js +13 -0
- package/dist/output/printers.js +27 -12
- package/dist/output/sarif.js +168 -57
- package/dist/output/sbom-dependency-edges.js +16 -10
- package/dist/output/sbom-file.js +14 -6
- package/dist/output/scan-json.js +46 -3
- package/dist/output/spdx.js +61 -23
- package/dist/output/spinner.js +2 -1
- package/dist/output/write-outputs.js +143 -41
- package/dist/overrides/context-builder.js +23 -70
- package/dist/overrides/parsing/registry.js +1 -1
- package/dist/parsers/bun-lock.js +1 -2
- package/dist/parsers/index.js +22 -1
- package/dist/parsers/npm-lock-graph.js +39 -1
- package/dist/parsers/package-lock.js +25 -5
- package/dist/parsers/pnpm-lock.js +26 -12
- package/dist/parsers/utils.js +5 -3
- package/dist/parsers/yarn-lock-graph.js +5 -2
- package/dist/parsers/yarn-lock.js +1 -2
- package/dist/remediation/fix-commands.js +140 -50
- package/dist/remediation/npm-registry.js +56 -7
- package/dist/remediation/npm-transitive-graph.js +30 -72
- package/dist/remediation/npm-transitive-resolution.js +35 -107
- package/dist/remediation/parent-candidate-resolver.js +65 -0
- package/dist/remediation/parent-upgrade-blockers.js +51 -0
- package/dist/remediation/parent-upgrade.js +11 -116
- package/dist/remediation/registry-parent-ranges.js +21 -0
- package/dist/remediation/transitive-chain-resolver.js +3 -3
- package/dist/scan/completeness.js +17 -11
- package/dist/scan/multi-folder-scan.js +154 -59
- package/dist/scan/override-audit.js +11 -1
- package/dist/scan/single-scan.js +123 -67
- package/dist/scanner.js +288 -66
- package/dist/skills/content.js +12 -12
- package/dist/usage/scanner.js +19 -8
- package/dist/utils/array.js +11 -3
- package/dist/utils/contextual-signals.js +1 -1
- package/dist/utils/debug-bundle.js +118 -0
- package/dist/utils/debug-project.js +102 -0
- package/dist/utils/debug-redaction.js +117 -0
- package/dist/utils/effective-options.js +55 -0
- package/dist/utils/file.js +2 -1
- package/dist/utils/finding.js +1 -1
- package/dist/utils/fix-runner.js +98 -15
- package/dist/utils/import-type-queries.js +322 -0
- package/dist/utils/network.js +14 -10
- package/dist/utils/npm-lockfile.js +12 -0
- package/dist/utils/osv-fetch.js +70 -0
- package/dist/utils/package-identity.js +43 -0
- package/dist/utils/package-manager-source.js +24 -0
- package/dist/utils/purl.js +37 -0
- package/dist/utils/registry-config.js +129 -0
- package/dist/utils/severity.js +8 -0
- package/dist/utils/string.js +8 -0
- package/dist/utils/validate-url.js +4 -4
- package/dist/utils/version.js +47 -8
- package/dist/utils/versions/osv-range.js +191 -0
- package/dist/utils/versions/pep440.js +246 -0
- package/dist/utils/versions/scheme.js +10 -0
- package/dist/utils/vuln.js +75 -0
- package/package.json +3 -2
|
@@ -1,17 +1,203 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { isOutputStdout } from "../utils/string.js";
|
|
4
|
+
/**
|
|
5
|
+
* Recognised file extensions for file-based output.
|
|
6
|
+
* Note: compound extensions like .spdx.json and .cdx.json are matched by .json.
|
|
7
|
+
*/
|
|
8
|
+
const RECOGNISED_FILE_EXTENSIONS = [
|
|
9
|
+
".json",
|
|
10
|
+
".sarif",
|
|
11
|
+
".spdx",
|
|
12
|
+
".cdx",
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Returns a warning message when `filename` has a format-specific extension
|
|
16
|
+
* (.sarif, .spdx.json, .cdx.json, .spdx, .cdx) that does not match the requested
|
|
17
|
+
* report format.
|
|
18
|
+
*
|
|
19
|
+
* Plain `.json` files stay quiet as they are compatible with all JSON-based formats.
|
|
20
|
+
*/
|
|
21
|
+
export function checkFormatExtensionMismatch(filename, requestedFormat) {
|
|
22
|
+
if (!filename || isOutputStdout(filename))
|
|
23
|
+
return undefined;
|
|
24
|
+
const lower = filename.toLowerCase();
|
|
25
|
+
let detectedExt;
|
|
26
|
+
let expectedFormat;
|
|
27
|
+
if (lower.endsWith(".spdx.json")) {
|
|
28
|
+
detectedExt = ".spdx.json";
|
|
29
|
+
expectedFormat = "spdx";
|
|
30
|
+
}
|
|
31
|
+
else if (lower.endsWith(".cdx.json")) {
|
|
32
|
+
detectedExt = ".cdx.json";
|
|
33
|
+
expectedFormat = "cyclonedx";
|
|
34
|
+
}
|
|
35
|
+
else if (lower.endsWith(".sarif")) {
|
|
36
|
+
detectedExt = ".sarif";
|
|
37
|
+
expectedFormat = "sarif";
|
|
38
|
+
}
|
|
39
|
+
else if (lower.endsWith(".spdx")) {
|
|
40
|
+
detectedExt = ".spdx";
|
|
41
|
+
expectedFormat = "spdx";
|
|
42
|
+
}
|
|
43
|
+
else if (lower.endsWith(".cdx")) {
|
|
44
|
+
detectedExt = ".cdx";
|
|
45
|
+
expectedFormat = "cyclonedx";
|
|
46
|
+
}
|
|
47
|
+
if (expectedFormat && expectedFormat !== requestedFormat) {
|
|
48
|
+
const formatDisplayNames = {
|
|
49
|
+
json: "JSON",
|
|
50
|
+
sarif: "SARIF",
|
|
51
|
+
spdx: "SPDX",
|
|
52
|
+
cyclonedx: "CycloneDX",
|
|
53
|
+
};
|
|
54
|
+
return `Output filename '${filename}' has extension '${detectedExt}', which does not match requested format ${formatDisplayNames[requestedFormat]}.`;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
export { isOutputStdout };
|
|
59
|
+
/**
|
|
60
|
+
* Ensures any pending stdout output has drained to the operating system
|
|
61
|
+
* before the CLI exits.
|
|
62
|
+
*/
|
|
63
|
+
export function drainStdout() {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
let resolved = false;
|
|
66
|
+
const onError = (err) => {
|
|
67
|
+
cleanup();
|
|
68
|
+
if (!resolved) {
|
|
69
|
+
resolved = true;
|
|
70
|
+
reject(err ?? new Error("stdout write failed"));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const cleanup = () => {
|
|
74
|
+
process.stdout.removeListener("error", onError);
|
|
75
|
+
};
|
|
76
|
+
process.stdout.once("error", onError);
|
|
77
|
+
try {
|
|
78
|
+
let cbCalled = false;
|
|
79
|
+
const ret = process.stdout.write("", (err) => {
|
|
80
|
+
cbCalled = true;
|
|
81
|
+
cleanup();
|
|
82
|
+
if (!resolved) {
|
|
83
|
+
resolved = true;
|
|
84
|
+
if (err) {
|
|
85
|
+
reject(err);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
resolve();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
// Handle test environments where process.stdout.write is mocked and does not invoke callbacks
|
|
93
|
+
if (process.stdout.write._isMockFunction &&
|
|
94
|
+
!cbCalled &&
|
|
95
|
+
ret === true &&
|
|
96
|
+
!process.stdout.writableNeedDrain) {
|
|
97
|
+
cleanup();
|
|
98
|
+
resolved = true;
|
|
99
|
+
resolve();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
cleanup();
|
|
104
|
+
if (!resolved) {
|
|
105
|
+
resolved = true;
|
|
106
|
+
reject(err);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns true when `output` refers to a file path rather than a directory.
|
|
113
|
+
*
|
|
114
|
+
* An argument is treated as a file when:
|
|
115
|
+
* 1. It does not end in a path separator, is not "." or "..", and ends in a
|
|
116
|
+
* recognised file extension (.json, .sarif, .spdx, .cdx).
|
|
117
|
+
* 2. If it already exists on the filesystem, it must be a regular file (not a directory).
|
|
118
|
+
*
|
|
119
|
+
* An existing file with an unrecognised extension (such as NOTES or notes.txt) is
|
|
120
|
+
* NOT treated as an output file, preserving the existing error behavior when trying
|
|
121
|
+
* to use it as a directory.
|
|
122
|
+
*/
|
|
123
|
+
export function isOutputFile(output) {
|
|
5
124
|
if (!output)
|
|
6
|
-
return
|
|
7
|
-
|
|
125
|
+
return false;
|
|
126
|
+
if (output.endsWith("/") ||
|
|
127
|
+
output.endsWith("\\") ||
|
|
128
|
+
output === "." ||
|
|
129
|
+
output === "..") {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const lower = output.toLowerCase();
|
|
133
|
+
const hasRecognisedExt = RECOGNISED_FILE_EXTENSIONS.some((ext) => lower.endsWith(ext));
|
|
134
|
+
if (!hasRecognisedExt) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const resolved = path.resolve(process.cwd(), output);
|
|
138
|
+
try {
|
|
139
|
+
if (fs.existsSync(resolved)) {
|
|
140
|
+
const stat = fs.statSync(resolved);
|
|
141
|
+
if (stat.isDirectory()) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// If stat fails, fall back to treating it as a file based on recognised extension
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Resolves the target directory and optional filename for --output.
|
|
153
|
+
*
|
|
154
|
+
* Creates missing parent directories when writing to a file, or creates the
|
|
155
|
+
* output directory itself when writing into a directory.
|
|
156
|
+
*/
|
|
157
|
+
export function resolveOutputTarget(output) {
|
|
158
|
+
if (!output) {
|
|
159
|
+
return { isFile: false, dir: process.cwd() };
|
|
160
|
+
}
|
|
161
|
+
if (isOutputStdout(output)) {
|
|
162
|
+
return {
|
|
163
|
+
isFile: false,
|
|
164
|
+
isStdout: true,
|
|
165
|
+
dir: "-",
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const resolved = path.resolve(process.cwd(), output);
|
|
169
|
+
if (isOutputFile(output)) {
|
|
170
|
+
const dir = path.dirname(resolved);
|
|
171
|
+
const filename = path.basename(resolved);
|
|
172
|
+
try {
|
|
173
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
throw new Error(`Failed to create output directory ${dir}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
isFile: true,
|
|
180
|
+
dir,
|
|
181
|
+
filename,
|
|
182
|
+
outputPath: resolved,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
8
185
|
try {
|
|
9
|
-
fs.mkdirSync(
|
|
186
|
+
fs.mkdirSync(resolved, { recursive: true });
|
|
10
187
|
}
|
|
11
188
|
catch (err) {
|
|
12
|
-
throw new Error(`Failed to create output directory ${
|
|
189
|
+
throw new Error(`Failed to create output directory ${resolved}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
13
190
|
}
|
|
14
|
-
return
|
|
191
|
+
return {
|
|
192
|
+
isFile: false,
|
|
193
|
+
dir: resolved,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/** Directory for --json, --sarif and --sbom files: the working directory, or --output resolved against it and created when missing. */
|
|
197
|
+
export function resolveOutputDir(output) {
|
|
198
|
+
if (!output || isOutputStdout(output))
|
|
199
|
+
return process.cwd();
|
|
200
|
+
return resolveOutputTarget(output).dir;
|
|
15
201
|
}
|
|
16
202
|
/** Path printed for a written file: relative to the working directory, or absolute when it lies outside it. */
|
|
17
203
|
export function displayOutputPath(outputPath) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { relative } from "node:path";
|
|
2
1
|
import { groupSkippedByReason, skippedHeadline, skippedRuleCount } from "./skipped-override-rules.js";
|
|
3
2
|
import { SEVERITY_ORDER } from "../utils/severity.js";
|
|
4
|
-
import {
|
|
3
|
+
import { buildOverrideFixCommand } from "./override-fix-command.js";
|
|
5
4
|
function esc(s) {
|
|
6
5
|
return s
|
|
7
6
|
.replace(/&/g, "&")
|
|
@@ -29,7 +28,7 @@ ${items}
|
|
|
29
28
|
</div>
|
|
30
29
|
`;
|
|
31
30
|
}
|
|
32
|
-
export function renderOverrideFindingsHtml(findings,
|
|
31
|
+
export function renderOverrideFindingsHtml(findings, commandTarget, skipped) {
|
|
33
32
|
// undefined = override hygiene was never requested -> render nothing, so a plain
|
|
34
33
|
// `cve-lite .` report shows no Override hygiene panel at all. An empty array =
|
|
35
34
|
// it ran and found nothing -> render the "no findings" reassurance.
|
|
@@ -49,10 +48,8 @@ ${skippedNoticeHtml(skipped)}</section>
|
|
|
49
48
|
const location = f.location.jsonPath
|
|
50
49
|
? `${esc(f.location.file)} › ${esc(f.location.jsonPath)}`
|
|
51
50
|
: esc(f.location.file);
|
|
52
|
-
const relPath = projectPath ? relative(process.cwd(), projectPath) : "";
|
|
53
|
-
const projectInfix = relPath && relPath !== "." ? ` ${relPath}` : "";
|
|
54
51
|
const fixCommand = f.fix && f.fix.runnableCommand
|
|
55
|
-
? f.fix.runnableCommand
|
|
52
|
+
? buildOverrideFixCommand(f.fix.runnableCommand, commandTarget)
|
|
56
53
|
: null;
|
|
57
54
|
const fixHtml = fixCommand
|
|
58
55
|
? `<div class="fix-cmd-inline" style="margin-top:6px"><code>${esc(fixCommand)}</code><button class="copy-btn" data-cmd="${esc(fixCommand)}">Copy</button></div>`
|
|
@@ -3,7 +3,7 @@ import { groupSkippedByReason, skippedHeadline, skippedRuleCount } from "./skipp
|
|
|
3
3
|
import { chalk, stripAnsi } from "../utils/chalk.js";
|
|
4
4
|
import { formatSeverityLabel, SEVERITY_ORDER } from "../utils/severity.js";
|
|
5
5
|
import { pluralize } from "../utils/string.js";
|
|
6
|
-
import {
|
|
6
|
+
import { buildOverrideFixCommand, overrideCommandTargetSuffix } from "./override-fix-command.js";
|
|
7
7
|
const COL_RULE_MAX = 8;
|
|
8
8
|
const COL_PKG_MAX = 30;
|
|
9
9
|
const COL_MSG_MAX = 50;
|
|
@@ -27,6 +27,10 @@ export function renderOverrideFindings(findings, options) {
|
|
|
27
27
|
: "✔ No override hygiene issues found."));
|
|
28
28
|
return lines.join("\n");
|
|
29
29
|
}
|
|
30
|
+
// Printed in the shell that ran the scan, so a cwd-relative target is runnable.
|
|
31
|
+
const commandTarget = options?.projectPath
|
|
32
|
+
? relative(process.cwd(), options.projectPath)
|
|
33
|
+
: "";
|
|
30
34
|
const grouped = new Map();
|
|
31
35
|
for (const sev of SEVERITY_ORDER)
|
|
32
36
|
grouped.set(sev, []);
|
|
@@ -60,26 +64,17 @@ export function renderOverrideFindings(findings, options) {
|
|
|
60
64
|
lines.push(hr("├", "┼", "┤"));
|
|
61
65
|
}
|
|
62
66
|
lines.push(hr("└", "┴", "┘"));
|
|
63
|
-
const relPath = options?.projectPath
|
|
64
|
-
? relative(process.cwd(), options.projectPath)
|
|
65
|
-
: "";
|
|
66
|
-
const projectInfix = relPath && relPath !== "." ? ` ${relPath}` : "";
|
|
67
67
|
const seenRules = new Set();
|
|
68
68
|
for (const f of sorted) {
|
|
69
69
|
if (f.fix?.runnableCommand && !seenRules.has(f.ruleId)) {
|
|
70
70
|
seenRules.add(f.ruleId);
|
|
71
|
-
const cmd =
|
|
72
|
-
? f.fix.runnableCommand.replace(OVERRIDES_COMMAND, `cve-lite${projectInfix} overrides`)
|
|
73
|
-
: f.fix.runnableCommand;
|
|
71
|
+
const cmd = buildOverrideFixCommand(f.fix.runnableCommand, commandTarget);
|
|
74
72
|
lines.push(chalk.bold.cyan(`> ${cmd}`));
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
lines.push("");
|
|
78
76
|
}
|
|
79
|
-
const
|
|
80
|
-
? relative(process.cwd(), options.projectPath)
|
|
81
|
-
: "";
|
|
82
|
-
const projectInfix = relPath && relPath !== "." ? ` ${relPath}` : "";
|
|
77
|
+
const projectInfix = overrideCommandTargetSuffix(commandTarget);
|
|
83
78
|
const allFixableRules = new Set(findings.filter(f => f.fix?.runnableCommand).map(f => f.ruleId));
|
|
84
79
|
if (allFixableRules.size >= 2) {
|
|
85
80
|
const fixAllCmd = `cve-lite${projectInfix} overrides --fix`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OVERRIDES_COMMAND } from "../constants.js";
|
|
2
|
+
// The folder a fix command targets, relative to the scanned project root
|
|
3
|
+
// ("packages/a"), or empty for the root itself. Never pass a cwd-relative or
|
|
4
|
+
// absolute path: the HTML report is opened from an unknown directory, so only a
|
|
5
|
+
// project-relative target stays runnable when it is copied out.
|
|
6
|
+
export function overrideCommandTargetSuffix(commandTarget) {
|
|
7
|
+
const normalized = commandTarget?.replace(/\\/g, "/");
|
|
8
|
+
return normalized && normalized !== "." ? ` ${normalized}` : "";
|
|
9
|
+
}
|
|
10
|
+
export function buildOverrideFixCommand(runnableCommand, commandTarget) {
|
|
11
|
+
const suffix = overrideCommandTargetSuffix(commandTarget);
|
|
12
|
+
return runnableCommand.replace(OVERRIDES_COMMAND, `cve-lite${suffix} overrides`);
|
|
13
|
+
}
|
package/dist/output/printers.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { chalk, stripAnsi } from "../utils/chalk.js";
|
|
2
|
-
import { buildSuggestedFixCommandPlan, planVersionForFinding, UNVERIFIED_PARENT_UPGRADE_NOTE } from "../remediation/fix-commands.js";
|
|
2
|
+
import { buildSuggestedFixCommandPlan, formatParentUpgradeBlockedReason, planVersionForFinding, UNVERIFIED_PARENT_UPGRADE_NOTE } from "../remediation/fix-commands.js";
|
|
3
3
|
import { formatParentUpdateChildNote } from "../remediation/parent-update-child-note.js";
|
|
4
4
|
import { isBreakingUpgrade } from "../utils/version.js";
|
|
5
5
|
import { getPrimaryParent } from "../utils/finding.js";
|
|
6
|
-
import { countUniqueAdvisories, countProdFindings, formatRelationshipLabel, formatRelLabel, formatRootDependencySummary, formatFixCommandWithPublishDates, formatCooldownWarning, } from "./formatters.js";
|
|
6
|
+
import { countUniqueAdvisories, countProdFindings, formatPackageName, formatRelationshipLabel, formatRelLabel, formatRootDependencySummary, formatFixCommandWithPublishDates, formatCooldownWarning, } from "./formatters.js";
|
|
7
7
|
import { formatSeverityLabel } from "../utils/severity.js";
|
|
8
8
|
import { severityOrder } from "../constants.js";
|
|
9
9
|
import { pluralize } from "../utils/string.js";
|
|
@@ -128,11 +128,15 @@ export function printSuggestedFixCommandSkips(findings, scanInput, options) {
|
|
|
128
128
|
const plan = buildSuggestedFixCommandPlan(findings, scanInput, options);
|
|
129
129
|
if (!plan || plan.skipped.length === 0)
|
|
130
130
|
return;
|
|
131
|
-
|
|
131
|
+
// Routed on the flag the resolver sets, never on the reason text. The reason is
|
|
132
|
+
// prose, it gets joined with other notes before it arrives here, and it changes
|
|
133
|
+
// whenever the message is reworded, all of which moves findings between these two
|
|
134
|
+
// sections without anything failing.
|
|
135
|
+
const unpublishable = plan.skipped.filter(skipped => skipped.advisoryHintUnavailable === true);
|
|
132
136
|
// Only surface direct-dependency skips here. Transitive findings without an
|
|
133
137
|
// auto-fix path are already covered by the fix plan step 2 ("Review these urgent
|
|
134
138
|
// transitive issues"), so repeating them here creates confusing duplication.
|
|
135
|
-
const remaining = plan.skipped.filter(skipped =>
|
|
139
|
+
const remaining = plan.skipped.filter(skipped => skipped.advisoryHintUnavailable !== true && skipped.relationship === "direct");
|
|
136
140
|
if (unpublishable.length > 0) {
|
|
137
141
|
console.log("");
|
|
138
142
|
console.log(chalk.gray("Unpublishable fixed-version hints:"));
|
|
@@ -201,6 +205,7 @@ const TABLE_COLUMNS = [
|
|
|
201
205
|
name: "package",
|
|
202
206
|
header: "Package",
|
|
203
207
|
cap: PACKAGE_NAME_COLUMN_CAP,
|
|
208
|
+
wrap: true,
|
|
204
209
|
cell: row => ({ value: row.package, decorated: row.packageDecorated }),
|
|
205
210
|
},
|
|
206
211
|
{ name: "version", header: "Version", cell: row => ({ value: dash(row.version) }) },
|
|
@@ -344,7 +349,9 @@ function printColumnTable(columns, rows, widths, options) {
|
|
|
344
349
|
console.log(outputRow);
|
|
345
350
|
}
|
|
346
351
|
else {
|
|
347
|
-
|
|
352
|
+
const wrappedCells = cells.map((cell, i) => columns[i].wrap
|
|
353
|
+
? wrapCell(cell, widths[i]).join("\n") : cell);
|
|
354
|
+
console.log(renderRow(wrappedCells, widths));
|
|
348
355
|
}
|
|
349
356
|
}
|
|
350
357
|
if (options?.totalsRow) {
|
|
@@ -387,7 +394,7 @@ function findingToTableRow(finding, plan, skippedKeys) {
|
|
|
387
394
|
const ownFixVersion = finding.validatedFirstFixedVersion ?? finding.firstFixedVersion;
|
|
388
395
|
const fixVersion = planTarget ?? ownFixVersion ?? null;
|
|
389
396
|
return {
|
|
390
|
-
package: finding.pkg
|
|
397
|
+
package: formatPackageName(finding.pkg),
|
|
391
398
|
version: finding.pkg.version,
|
|
392
399
|
severity: finding.severity,
|
|
393
400
|
relationship: formatRelLabel(finding),
|
|
@@ -420,6 +427,8 @@ function formatTargetDisplay(finding, fixVersion, isSkipped) {
|
|
|
420
427
|
}
|
|
421
428
|
if (hasMaliciousAdvisory(finding.vulnerabilities))
|
|
422
429
|
return chalk.yellow("⚠ Malicious");
|
|
430
|
+
if (finding.advisoryBoundaryUnreadable)
|
|
431
|
+
return chalk.yellow("⚠ unreadable advisory data");
|
|
423
432
|
return chalk.yellow("⚠ no fix");
|
|
424
433
|
}
|
|
425
434
|
function fixTargetContext(target) {
|
|
@@ -483,7 +492,7 @@ export function printTable(findings, threshold, skippedKeys, plan) {
|
|
|
483
492
|
if (findings.length > 0) {
|
|
484
493
|
console.log("");
|
|
485
494
|
console.log(chalk.bold("Prioritization signals (heuristic)"));
|
|
486
|
-
console.log(chalk.gray("Triage hints only
|
|
495
|
+
console.log(chalk.gray("Triage hints only: not exploitability or runtime reachability proofs."));
|
|
487
496
|
for (const finding of findings) {
|
|
488
497
|
const values = formatContextualSignalValues(computeContextualSignals(finding));
|
|
489
498
|
console.log(chalk.gray(` ${finding.pkg.name}@${finding.pkg.version} ${values}`));
|
|
@@ -511,7 +520,7 @@ export function printTable(findings, threshold, skippedKeys, plan) {
|
|
|
511
520
|
}
|
|
512
521
|
}
|
|
513
522
|
if (skippedKeys && skippedKeys.size > 0 && findings.some(f => skippedKeys.has(`${f.pkg.name}@${f.pkg.version}`))) {
|
|
514
|
-
console.log(chalk.gray("⊘ Advisory hint only
|
|
523
|
+
console.log(chalk.gray("⊘ Advisory hint only: no automated fix command could be generated. Run --report to view detailed skip reasons."));
|
|
515
524
|
}
|
|
516
525
|
if (threshold) {
|
|
517
526
|
console.log(chalk.gray("Tip: use --all to include low findings, or --min-severity high to focus only on urgent issues."));
|
|
@@ -698,7 +707,7 @@ export function printCompactOutput(findings, scanInput, options) {
|
|
|
698
707
|
usageContext = chalk.green(` (no direct import found)`);
|
|
699
708
|
}
|
|
700
709
|
}
|
|
701
|
-
console.log(`${formatSeverityLabel(sevLabel)} ${chalk.whiteBright(finding.pkg
|
|
710
|
+
console.log(`${formatSeverityLabel(sevLabel)} ${chalk.whiteBright(formatPackageName(finding.pkg))}@${finding.pkg.version}`);
|
|
702
711
|
console.log(` ${typeLabel}${usageContext}`);
|
|
703
712
|
console.log(` ${chalk.gray(formatContextualSignalsLine(computeContextualSignals(finding)))}`);
|
|
704
713
|
if (finding.epssScores && finding.epssScores.length > 0) {
|
|
@@ -728,9 +737,15 @@ export function printCompactOutput(findings, scanInput, options) {
|
|
|
728
737
|
console.log(` ${chalk.red(`⚠ Malicious: ${action}`)}`);
|
|
729
738
|
}
|
|
730
739
|
}
|
|
740
|
+
else if (finding.advisoryBoundaryUnreadable) {
|
|
741
|
+
console.log(` ${chalk.gray("Fix: unreadable advisory data; the fix is inconclusive")}`);
|
|
742
|
+
}
|
|
731
743
|
else if (finding.recommendedNpmTransitiveRemediation?.kind === "update-parent-within-range") {
|
|
732
744
|
console.log(` ${chalk.gray(`Fix: run \`npm install\` - ${finding.recommendedNpmTransitiveRemediation.package} already permits a safe version`)}`);
|
|
733
745
|
}
|
|
746
|
+
else if (finding.recommendedParentUpgrade && finding.parentUpgradeBlockers?.length) {
|
|
747
|
+
console.log(` ${chalk.gray(`Fix: ${formatParentUpgradeBlockedReason(finding)}`)}`);
|
|
748
|
+
}
|
|
734
749
|
else if (finding.recommendedParentUpgrade) {
|
|
735
750
|
console.log(` ${chalk.gray(`Fix: upgrade ${finding.recommendedParentUpgrade.package} to ${finding.recommendedParentUpgrade.targetVersion}`)}`);
|
|
736
751
|
}
|
|
@@ -743,8 +758,8 @@ export function printCompactOutput(findings, scanInput, options) {
|
|
|
743
758
|
else {
|
|
744
759
|
const parent = getPrimaryParent(finding);
|
|
745
760
|
action = parent
|
|
746
|
-
? `Upgrade ${parent}
|
|
747
|
-
: `No dependency path found
|
|
761
|
+
? `Upgrade ${parent}: check for release resolving ${finding.pkg.name} to ${displayFixVersion}+`
|
|
762
|
+
: `No dependency path found: inspect lockfile to identify which package pulls in ${finding.pkg.name}`;
|
|
748
763
|
}
|
|
749
764
|
console.log(` ${chalk.gray(`Fix: ${action}`)}`);
|
|
750
765
|
}
|
|
@@ -757,7 +772,7 @@ export function printCompactOutput(findings, scanInput, options) {
|
|
|
757
772
|
const parent = getPrimaryParent(finding);
|
|
758
773
|
action = parent
|
|
759
774
|
? `Upgrade ${parent} to resolve ${finding.pkg.name}`
|
|
760
|
-
: `No dependency path found
|
|
775
|
+
: `No dependency path found: inspect lockfile to identify which package pulls in ${finding.pkg.name}`;
|
|
761
776
|
}
|
|
762
777
|
console.log(` ${chalk.gray(`Fix: ${action}`)}`);
|
|
763
778
|
}
|