cve-lite-cli 1.17.0 → 1.17.1

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/help.js CHANGED
@@ -31,7 +31,7 @@ export function printHelp() {
31
31
  " cve-lite install-skill",
32
32
  "",
33
33
  "Scan options:",
34
- " --json Print JSON output",
34
+ " --json Save scan results to a timestamped JSON file",
35
35
  " --report [dir] Generate an HTML report in [dir] (default: ./cve-report)",
36
36
  " --sarif Write SARIF 2.1.0 output to a timestamped .sarif file",
37
37
  " --cdx Write CycloneDX 1.4 SBOM to a timestamped .cdx.json file",
package/dist/index.js CHANGED
@@ -302,7 +302,7 @@ async function scanProject(params) {
302
302
  const minSeverity = normalizeSeverity(params.options.minSeverity || "medium");
303
303
  const tableFindings = params.options.all
304
304
  ? sorted
305
- : sorted.filter(f => severityOrder[f.severity] >= severityOrder[minSeverity]);
305
+ : sorted.filter(f => severityOrder[f.severity] >= severityOrder[minSeverity] || f.severity === "unknown");
306
306
  const suggestedFixCommands = buildSuggestedFixCommandPlan(sorted, params.scanInput, { offline });
307
307
  return {
308
308
  sorted,
@@ -26,7 +26,16 @@ export function formatRelationshipLabel(value) {
26
26
  return chalk.yellow(value);
27
27
  return chalk.gray(value);
28
28
  }
29
+ // MAL-* is the OSV prefix for malicious code advisories
30
+ function isMaliciousAdvisory(finding) {
31
+ return finding.vulnerabilities.some(v => v.id.startsWith("MAL-"));
32
+ }
29
33
  export function getRecommendedAction(finding) {
34
+ if (isMaliciousAdvisory(finding)) {
35
+ return finding.relationship === "direct"
36
+ ? "This package has a malicious code advisory. Remove it from your dependencies."
37
+ : "This package has a malicious code advisory. Upgrade or remove the parent package that pulls it in.";
38
+ }
30
39
  // Prefer the registry-validated target over the raw advisory hint when
31
40
  // available — they can disagree (the hint may not be published on npm or
32
41
  // may itself be vulnerable), and the validated target is what the fix
@@ -128,6 +137,11 @@ export function summarizeNextAction(finding) {
128
137
  // Prefer the registry-validated target over the raw advisory hint so this
129
138
  // line agrees with the fix-command table. See getRecommendedAction.
130
139
  const directTarget = finding.validatedFirstFixedVersion ?? finding.firstFixedVersion;
140
+ if (isMaliciousAdvisory(finding)) {
141
+ return finding.relationship === "direct"
142
+ ? "This package has a malicious code advisory. Remove it from your dependencies."
143
+ : "This package has a malicious code advisory. Upgrade or remove the parent package that pulls it in.";
144
+ }
131
145
  if (finding.relationship === "direct" && directTarget) {
132
146
  return `Upgrade ${finding.pkg.name} toward ${directTarget}.`;
133
147
  }
@@ -390,11 +390,14 @@ function renderFindingRow(finding, idx) {
390
390
  const cveLinks = finding.cves.length > 0
391
391
  ? finding.cves.map(advisoryLink).join(", ")
392
392
  : finding.vulnerabilities.map(v => advisoryLink(v.id)).join(", ");
393
+ const isMalicious = finding.vulnerabilities.some(v => v.id.startsWith("MAL-"));
393
394
  const fixHtml = finding.validatedFirstFixedVersion
394
395
  ? `<span class="fix-hint">${escapeHtml(finding.validatedFirstFixedVersion)}</span>`
395
396
  : finding.firstFixedVersion
396
397
  ? `<span class="fix-hint">${escapeHtml(finding.firstFixedVersion)}</span>`
397
- : `<span class="fix-hint none" title="No known fix — consider replacing this package">⚠ No fix</span>`;
398
+ : isMalicious
399
+ ? `<span class="fix-hint none" title="Malicious code advisory — remove this package">⚠ Malicious</span>`
400
+ : `<span class="fix-hint none" title="No known fix — consider replacing this package">⚠ No fix</span>`;
398
401
  const depPathHtml = finding.dependencyPaths.length > 0
399
402
  ? finding.dependencyPaths[0].map((node, i, arr) => {
400
403
  const isLast = i === arr.length - 1;
@@ -152,7 +152,8 @@ export function printTable(findings, threshold) {
152
152
  f.severity,
153
153
  f.relationship,
154
154
  usageText,
155
- f.firstFixedVersion ?? chalk.yellow("⚠ no fix"),
155
+ (f.validatedFirstFixedVersion ?? f.firstFixedVersion) ??
156
+ (f.vulnerabilities.some(v => v.id.startsWith("MAL-")) ? chalk.yellow("⚠ Malicious") : chalk.yellow("⚠ no fix")),
156
157
  f.vulnerabilities.map(v => v.id).join(", ")
157
158
  ];
158
159
  });
@@ -185,8 +186,19 @@ export function printTable(findings, threshold) {
185
186
  console.log(renderRow(decorated, widths));
186
187
  }
187
188
  console.log(line("└", "┴", "┘"));
189
+ const maliciousFindings = findings.filter(f => f.vulnerabilities.some(v => v.id.startsWith("MAL-")));
190
+ if (maliciousFindings.length > 0) {
191
+ console.log("");
192
+ console.log(chalk.bold.red("⚠ Malicious package advisory:"));
193
+ for (const f of maliciousFindings) {
194
+ const action = f.relationship === "direct"
195
+ ? "Remove it from your dependencies immediately."
196
+ : "Upgrade or remove the parent package that pulls it in.";
197
+ console.log(chalk.red(` · ${f.pkg.name}@${f.pkg.version} — ${action}`));
198
+ }
199
+ }
188
200
  if (threshold) {
189
- console.log(chalk.gray("Tip: use --all to include low/unknown findings, or --min-severity high to focus only on urgent issues."));
201
+ console.log(chalk.gray("Tip: use --all to include low findings, or --min-severity high to focus only on urgent issues."));
190
202
  }
191
203
  }
192
204
  export function printFinalStatus(findings) {
@@ -263,9 +275,9 @@ export function printCompactOutput(findings, scanInput, options) {
263
275
  console.log("────────────────────────────────");
264
276
  console.log(chalk.bold("📦 Vulnerabilities found"));
265
277
  console.log("────────────────────────────────\n");
266
- // Get top 3 critical/high issues
278
+ // Get top 3 critical/high issues plus all unknown (malicious) findings
267
279
  const urgentFindings = findings
268
- .filter(f => f.severity === "critical" || f.severity === "high")
280
+ .filter(f => f.severity === "critical" || f.severity === "high" || f.severity === "unknown")
269
281
  .slice(0, 3);
270
282
  for (const finding of urgentFindings) {
271
283
  const sevLabel = finding.severity.toUpperCase().padEnd(8);
@@ -285,21 +297,29 @@ export function printCompactOutput(findings, scanInput, options) {
285
297
  }
286
298
  console.log(`${formatSeverityLabel(sevLabel)} ${chalk.whiteBright(finding.pkg.name)}@${finding.pkg.version}`);
287
299
  console.log(` ${typeLabel}${usageContext}`);
288
- if (finding.recommendedNpmTransitiveRemediation?.kind === "update-parent-within-range") {
300
+ const isMalicious = finding.vulnerabilities.some(v => v.id.startsWith("MAL-"));
301
+ if (isMalicious) {
302
+ const action = finding.relationship === "direct"
303
+ ? "Remove this package from your dependencies immediately."
304
+ : "Upgrade or remove the parent package that pulls it in.";
305
+ console.log(` ${chalk.red(`⚠ Malicious: ${action}`)}`);
306
+ }
307
+ else if (finding.recommendedNpmTransitiveRemediation?.kind === "update-parent-within-range") {
289
308
  console.log(` ${chalk.gray(`Fix: update ${finding.recommendedNpmTransitiveRemediation.package} within its current dependency range`)}`);
290
309
  }
291
310
  else if (finding.recommendedParentUpgrade) {
292
311
  console.log(` ${chalk.gray(`Fix: upgrade ${finding.recommendedParentUpgrade.package} to ${finding.recommendedParentUpgrade.targetVersion}`)}`);
293
312
  }
294
313
  else if (finding.firstFixedVersion) {
314
+ const displayFixVersion = finding.validatedFirstFixedVersion ?? finding.firstFixedVersion;
295
315
  let action;
296
316
  if (finding.relationship === "direct") {
297
- action = `upgrade to ${finding.firstFixedVersion}`;
317
+ action = `upgrade to ${displayFixVersion}`;
298
318
  }
299
319
  else {
300
320
  const parent = getPrimaryParent(finding);
301
321
  action = parent
302
- ? `Upgrade ${parent} — check for release resolving ${finding.pkg.name} to ${finding.firstFixedVersion}+`
322
+ ? `Upgrade ${parent} — check for release resolving ${finding.pkg.name} to ${displayFixVersion}+`
303
323
  : `No dependency path found — inspect lockfile to identify which package pulls in ${finding.pkg.name}`;
304
324
  }
305
325
  console.log(` ${chalk.gray(`Fix: ${action}`)}`);
@@ -380,6 +400,17 @@ export function printCompactOutput(findings, scanInput, options) {
380
400
  console.log(`${chalk.cyan(String(direct))} ${chalk.white("direct")}` +
381
401
  `${chalk.gray(" · ")}` +
382
402
  `${chalk.cyan(String(transitive))} ${chalk.white("transitive")}`);
403
+ const maliciousCompact = findings.filter(f => f.vulnerabilities.some(v => v.id.startsWith("MAL-")));
404
+ if (maliciousCompact.length > 0 && !options?.all) {
405
+ console.log("");
406
+ console.log(chalk.bold.red("⚠ Malicious package advisory:"));
407
+ for (const f of maliciousCompact) {
408
+ const action = f.relationship === "direct"
409
+ ? "Remove it from your dependencies immediately."
410
+ : "Upgrade or remove the parent package that pulls it in.";
411
+ console.log(chalk.red(` · ${f.pkg.name}@${f.pkg.version} — ${action}`));
412
+ }
413
+ }
383
414
  if (options?.all) {
384
415
  printTable(findings, null);
385
416
  }
@@ -27,6 +27,7 @@ export const chalk = {
27
27
  green: (text) => paint(ansi.bold + ansi.green, text),
28
28
  magenta: (text) => paint(ansi.bold + ansi.magenta, text),
29
29
  blue: (text) => paint(ansi.bold + ansi.blue, text),
30
+ red: (text) => paint(ansi.bold + ansi.red, text),
30
31
  yellow: (text) => paint(ansi.bold + ansi.yellow, text),
31
32
  whiteBright: (text) => paint(ansi.bold + ansi.whiteBright, text)
32
33
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cve-lite-cli",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "description": "Developer-friendly CLI for scanning JS/TS projects for dependency vulnerabilities using local lockfiles and OSV",
5
5
  "type": "module",
6
6
  "bin": {