cve-lite-cli 1.18.1 → 1.18.2
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 +4 -1
- package/dist/advisory/local-advisory-source.js +1 -1
- package/dist/advisory/osv-advisory-source.js +83 -13
- package/dist/cli/args.js +4 -0
- package/dist/cli/help.js +1 -0
- package/dist/index.js +68 -4
- package/dist/learn/keypress.js +50 -0
- package/dist/learn/runner.js +96 -0
- package/dist/learn/scenario.js +47 -0
- package/dist/learn/session.js +36 -0
- package/dist/learn/types.js +1 -0
- package/dist/osv/cache.js +46 -7
- package/dist/output/debug.js +38 -0
- package/dist/output/finding-display.js +30 -0
- package/dist/output/multi-folder-html-reporter.js +323 -0
- package/dist/output/multi-folder-printer.js +46 -0
- package/dist/output/printers.js +4 -4
- package/dist/output/sarif.js +3 -9
- package/dist/output/spinner.js +1 -1
- package/dist/parsers/multi-package.js +58 -0
- package/dist/parsers/pnpm-lock.js +4 -0
- package/dist/remediation/fix-commands.js +36 -4
- package/dist/remediation/npm-registry.js +44 -1
- package/dist/remediation/parent-upgrade.js +14 -8
- package/dist/scan/multi-folder-scan.js +97 -0
- package/dist/scanner.js +94 -16
- package/dist/utils/fix-runner.js +6 -2
- package/dist/utils/network.js +7 -0
- package/package.json +1 -1
package/dist/utils/fix-runner.js
CHANGED
|
@@ -14,7 +14,9 @@ export function buildFixCommandParts(packageManager, targets) {
|
|
|
14
14
|
}
|
|
15
15
|
return ["yarn", "add", ...targets.map(target => `${target.package}@${target.targetVersion}`)];
|
|
16
16
|
}
|
|
17
|
-
export async function runInstallCommand(command, args, cwd) {
|
|
17
|
+
export async function runInstallCommand(command, args, cwd, debugLog) {
|
|
18
|
+
const commandLine = [command, ...args].join(" ");
|
|
19
|
+
debugLog?.("Fix command", { command: commandLine, cwd });
|
|
18
20
|
return await new Promise(resolve => {
|
|
19
21
|
const child = spawn(command, args, {
|
|
20
22
|
cwd,
|
|
@@ -23,9 +25,11 @@ export async function runInstallCommand(command, args, cwd) {
|
|
|
23
25
|
child.stdout.on("data", () => { });
|
|
24
26
|
child.stderr.on("data", () => { });
|
|
25
27
|
child.on("error", error => {
|
|
28
|
+
debugLog?.("Fix command finished", { command: commandLine, exitCode: null, error: error.message });
|
|
26
29
|
resolve({ status: null, error });
|
|
27
30
|
});
|
|
28
31
|
child.on("close", code => {
|
|
32
|
+
debugLog?.("Fix command finished", { command: commandLine, exitCode: code });
|
|
29
33
|
resolve({ status: code, error: null });
|
|
30
34
|
});
|
|
31
35
|
});
|
|
@@ -74,7 +78,7 @@ export async function applyFixesIfRequested(params) {
|
|
|
74
78
|
const target = directTargets[i];
|
|
75
79
|
const commandParts = buildFixCommandParts(params.plan.packageManager, [target]);
|
|
76
80
|
spinner.update(`Applying direct fix ${i + 1}/${total}: ${commandParts.join(" ")}`);
|
|
77
|
-
const run = await runInstallCommand(commandParts[0], commandParts.slice(1), params.projectPath);
|
|
81
|
+
const run = await runInstallCommand(commandParts[0], commandParts.slice(1), params.projectPath, params.debugLog);
|
|
78
82
|
if (run.error) {
|
|
79
83
|
spinner.fail("Failed to apply fixes");
|
|
80
84
|
throw new Error(`Failed to apply fixes: ${run.error.message}${fixHint}`);
|
package/dist/utils/network.js
CHANGED
|
@@ -45,6 +45,13 @@ export function serverAdvisoryRequestHint() {
|
|
|
45
45
|
...OFFLINE_FALLBACK_LINES,
|
|
46
46
|
];
|
|
47
47
|
}
|
|
48
|
+
export function offlineDbSyncHint(offlineDb) {
|
|
49
|
+
const lines = ["To build it, run: cve-lite advisories sync"];
|
|
50
|
+
if (offlineDb) {
|
|
51
|
+
lines.push(`Or to save it to the requested path: cve-lite advisories sync --output ${offlineDb}`);
|
|
52
|
+
}
|
|
53
|
+
return lines;
|
|
54
|
+
}
|
|
48
55
|
const SSL_ERROR_CODES = new Set([
|
|
49
56
|
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
50
57
|
"CERT_UNTRUSTED",
|