cve-lite-cli 1.16.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/README.md +41 -9
- package/dist/cli/help.js +1 -1
- package/dist/index.js +1 -1
- package/dist/output/formatters.js +17 -0
- package/dist/output/html-reporter.js +7 -2
- package/dist/output/printers.js +51 -12
- package/dist/output/sarif.js +1 -0
- package/dist/parsers/index.js +31 -2
- package/dist/utils/chalk.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
|
|
26
26
|
<table>
|
|
27
27
|
<tr>
|
|
28
|
-
<td align="center" width="33%"><p
|
|
29
|
-
<td align="center" width="33%"><p
|
|
30
|
-
<td align="center" width="33%"><p
|
|
28
|
+
<td align="center" width="33%"><p>๐</p><strong>OWASP Incubator Project</strong><br/><sub>Peer-reviewed by the org behind the OWASP Top 10 โ<br/>the security standard followed by millions of developers</sub></td>
|
|
29
|
+
<td align="center" width="33%"><p>๐ฏ</p><strong>Remediation-first</strong><br/><sub>Validated fix commands + parent-aware<br/>transitive guidance โ not just CVE IDs</sub></td>
|
|
30
|
+
<td align="center" width="33%"><p>๐</p><strong>Runs locally</strong><br/><sub>Nothing leaves your machine โ not your<br/>code, not your dependency tree</sub></td>
|
|
31
31
|
</tr>
|
|
32
32
|
</table>
|
|
33
33
|
|
|
@@ -47,6 +47,23 @@
|
|
|
47
47
|
|
|
48
48
|
---
|
|
49
49
|
|
|
50
|
+
<div align="center">
|
|
51
|
+
|
|
52
|
+
**Package Managers**
|
|
53
|
+
|
|
54
|
+
<table border="0" cellspacing="0" cellpadding="12">
|
|
55
|
+
<tr>
|
|
56
|
+
<td align="center"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/npm/npm-original-wordmark.svg" width="48" height="48" alt="npm"/><br/><sub><b>npm</b></sub></td>
|
|
57
|
+
<td align="center"><img src="https://cdn.simpleicons.org/pnpm" width="48" height="48" alt="pnpm"/><br/><sub><b>pnpm</b></sub></td>
|
|
58
|
+
<td align="center"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/yarn/yarn-original.svg" width="48" height="48" alt="Yarn"/><br/><sub><b>Yarn</b></sub></td>
|
|
59
|
+
<td align="center"><img src="https://cdn.simpleicons.org/bun" width="48" height="48" alt="Bun"/><br/><sub><b>Bun</b></sub></td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
50
67
|
## The problem with how security scanning works today
|
|
51
68
|
|
|
52
69
|
Most security tooling is designed around pipelines, not people.
|
|
@@ -160,6 +177,8 @@ For full CI patterns including offline workflows, git hooks, and scripted automa
|
|
|
160
177
|
|
|
161
178
|
## How it compares
|
|
162
179
|
|
|
180
|
+
No other free tool combines all of the following: lockfile scanning across npm, pnpm, Yarn, and Bun; parent-aware transitive remediation that tells you which package to upgrade (not just which one is vulnerable); fix version validation before suggesting an upgrade; and a fully offline advisory DB for restricted environments.
|
|
181
|
+
|
|
163
182
|
| Capability | CVE Lite CLI | npm audit | OSV-Scanner | Snyk CLI | Socket CLI |
|
|
164
183
|
|---|:---:|:---:|:---:|:---:|:---:|
|
|
165
184
|
| JS/TS lockfile scanning | โ
| โ
| โ
| โ
| โ
|
|
|
@@ -178,6 +197,9 @@ For full CI patterns including offline workflows, git hooks, and scripted automa
|
|
|
178
197
|
|
|
179
198
|
The transitive parent guidance is a key difference: CVE Lite CLI avoids recommending direct installs for packages that are only present transitively. For npm lockfiles, it can identify when `npm update <parent>` is enough to re-resolve a known non-vulnerable child within the current parent range, and when the parent package itself needs an upgrade.
|
|
180
199
|
|
|
200
|
+
### About Socket CLI
|
|
201
|
+
Socket provides deep supply-chain analysis (malware, typosquatting, maintainer risk) but requires a paid account for full features. CVE Lite CLI remains one of the few fully free, offline, and account-free options with strong transitive analysis.
|
|
202
|
+
|
|
181
203
|
For detailed per-tool analysis, see [Comparison with other tools](https://owasp.org/cve-lite-cli/docs/comparison).
|
|
182
204
|
|
|
183
205
|
## Real-world validation
|
|
@@ -187,14 +209,22 @@ CVE Lite CLI has been evaluated against real open-source projects to verify that
|
|
|
187
209
|
- [OWASP Juice Shop](https://owasp.org/cve-lite-cli/docs/case-studies/owasp-juice-shop) โ scanning a deliberately vulnerable application with known dependency issues
|
|
188
210
|
- [NestJS](https://owasp.org/cve-lite-cli/docs/case-studies/nestjs) โ working through a real transitive dependency remediation sequence across a widely-used Node.js framework
|
|
189
211
|
- [Analog](https://owasp.org/cve-lite-cli/docs/case-studies/analog) โ scanning a modern pnpm v9 Angular monorepo (3,367 packages) with unexpected toolchain vulnerabilities
|
|
212
|
+
- [Ghost](https://owasp.org/cve-lite-cli/docs/case-studies/ghost) โ 26 vulnerable packages across 4,447 resolved in a professionally maintained CMS โ every one transitive, including a critical XSS in the library responsible for making user content safe
|
|
190
213
|
|
|
191
214
|
These are not demos. They are documented scans against real codebases with real findings, recorded before and after applying fix commands.
|
|
192
215
|
|
|
193
216
|
If you maintain an open-source JavaScript or TypeScript project and want CVE Lite CLI evaluated on it, open an issue and share the repository. Strong candidates may be turned into future public case studies.
|
|
194
217
|
|
|
218
|
+
## Press
|
|
219
|
+
|
|
220
|
+
- **[CVE Lite CLI: Open-source dependency vulnerability scanner](https://www.helpnetsecurity.com/2026/05/20/cve-lite-cli-open-source-dependency-vulnerability-scanner/)** โ Help Net Security, May 2026
|
|
221
|
+
- **[Review of CVE Lite CLI](https://developmentcurated.com/testing-and-security/review-of-cve-lite-cli/)** โ Development Curated (Sebastian Raiffen, IT Security Consultant), April 2026
|
|
222
|
+
|
|
195
223
|
## Recognized by OWASP
|
|
196
224
|
|
|
197
|
-
|
|
225
|
+
OWASP (Open Web Application Security Project) is the globally recognized nonprofit behind the security standards followed by millions of developers worldwide โ most notably the [OWASP Top 10](https://owasp.org/www-project-top-ten/), the most widely cited web application security reference in the industry. Organizations from startups to Fortune 500 companies use OWASP guidelines as the foundation of their security programs.
|
|
226
|
+
|
|
227
|
+
CVE Lite CLI is an [OWASP Incubator Project](https://owasp.org/cve-lite-cli) โ reviewed and accepted by the OWASP community as a vendor-neutral, open source security tool. Being part of OWASP means:
|
|
198
228
|
|
|
199
229
|
- **Peer-reviewed** by security professionals
|
|
200
230
|
- **Community-driven** development and governance
|
|
@@ -365,12 +395,14 @@ See the [Offline Advisory DB guide](https://owasp.org/cve-lite-cli/docs/offline-
|
|
|
365
395
|
|
|
366
396
|
## Who uses it
|
|
367
397
|
|
|
368
|
-
CVE Lite CLI is a
|
|
398
|
+
CVE Lite CLI is the only free, OWASP-recognized vulnerability scanner purpose-built for JavaScript and TypeScript that combines validated fix commands, parent-aware transitive remediation, and offline scanning in a single lightweight CLI.
|
|
399
|
+
|
|
400
|
+
It is a good fit for:
|
|
369
401
|
|
|
370
|
-
- **Independent developers and OSS maintainers** โ quick pre-release check without any platform overhead
|
|
371
|
-
- **Startups and small teams** โ lightweight CI gate at no cost
|
|
372
|
-
- **Consultants** โ
|
|
373
|
-
- **Enterprise teams with restricted networks** โ offline advisory DB
|
|
402
|
+
- **Independent developers and OSS maintainers** โ quick pre-release check without any platform overhead or cost
|
|
403
|
+
- **Startups and small teams** โ lightweight CI gate at no cost, with fix commands ready to run immediately
|
|
404
|
+
- **Consultants** โ scan a client project in seconds and hand over a concrete, copy-and-run remediation plan
|
|
405
|
+
- **Enterprise teams with restricted networks** โ offline advisory DB removes the need for runtime outbound calls during scans
|
|
374
406
|
- **Teams running npm, pnpm, Yarn, and Bun** โ unified scanning across all four package managers in one tool
|
|
375
407
|
|
|
376
408
|
See the [CI and Workflow Integration guide](https://owasp.org/cve-lite-cli/docs/ci-integration) for concrete patterns across these scenarios.
|
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
|
|
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
|
}
|
|
@@ -221,3 +235,6 @@ export function sortFindingsForOutput(findings) {
|
|
|
221
235
|
return a.pkg.name.localeCompare(b.pkg.name);
|
|
222
236
|
});
|
|
223
237
|
}
|
|
238
|
+
export function countUniqueAdvisories(findings) {
|
|
239
|
+
return new Set(findings.flatMap(f => f.vulnerabilities.map(v => v.id))).size;
|
|
240
|
+
}
|
|
@@ -28,6 +28,7 @@ export function renderHtmlReport(data) {
|
|
|
28
28
|
if (sev in counts)
|
|
29
29
|
counts[sev]++;
|
|
30
30
|
}
|
|
31
|
+
const totalCVEs = new Set(data.findings.flatMap(f => f.vulnerabilities.map(v => v.id))).size;
|
|
31
32
|
const noticesHtml = renderNotices(data.notes, data.warnings);
|
|
32
33
|
const fixPlanHtml = renderFixPlan(data.suggestedFixCommands);
|
|
33
34
|
const findingRowsHtml = data.findings.map(renderFindingRow).join("\n");
|
|
@@ -211,7 +212,8 @@ button.header-link:hover{color:#58a6ff;border-color:#58a6ff}
|
|
|
211
212
|
<div class="sev-card high"><span class="count">${counts.high}</span><span class="label">High</span></div>
|
|
212
213
|
<div class="sev-card medium"><span class="count">${counts.medium}</span><span class="label">Medium</span></div>
|
|
213
214
|
<div class="sev-card low"><span class="count">${counts.low}</span><span class="label">Low</span></div>
|
|
214
|
-
<div class="sev-card total"><span class="count">${data.findings.length}</span><span class="label">
|
|
215
|
+
<div class="sev-card total"><span class="count">${data.findings.length}</span><span class="label">Packages</span></div>
|
|
216
|
+
<div class="sev-card total"><span class="count">${totalCVEs}</span><span class="label">CVEs</span></div>
|
|
215
217
|
</div>
|
|
216
218
|
|
|
217
219
|
${fixPlanHtml}
|
|
@@ -388,11 +390,14 @@ function renderFindingRow(finding, idx) {
|
|
|
388
390
|
const cveLinks = finding.cves.length > 0
|
|
389
391
|
? finding.cves.map(advisoryLink).join(", ")
|
|
390
392
|
: finding.vulnerabilities.map(v => advisoryLink(v.id)).join(", ");
|
|
393
|
+
const isMalicious = finding.vulnerabilities.some(v => v.id.startsWith("MAL-"));
|
|
391
394
|
const fixHtml = finding.validatedFirstFixedVersion
|
|
392
395
|
? `<span class="fix-hint">${escapeHtml(finding.validatedFirstFixedVersion)}</span>`
|
|
393
396
|
: finding.firstFixedVersion
|
|
394
397
|
? `<span class="fix-hint">${escapeHtml(finding.firstFixedVersion)}</span>`
|
|
395
|
-
:
|
|
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>`;
|
|
396
401
|
const depPathHtml = finding.dependencyPaths.length > 0
|
|
397
402
|
? finding.dependencyPaths[0].map((node, i, arr) => {
|
|
398
403
|
const isLast = i === arr.length - 1;
|
package/dist/output/printers.js
CHANGED
|
@@ -2,7 +2,7 @@ import { chalk, stripAnsi } from "../utils/chalk.js";
|
|
|
2
2
|
import { buildSuggestedFixCommandPlan } from "../remediation/fix-commands.js";
|
|
3
3
|
import { isMajorVersionBump } from "../utils/version.js";
|
|
4
4
|
import { getPrimaryParent } from "../utils/finding.js";
|
|
5
|
-
import { formatSeverityLabel, formatRelationshipLabel } from "./formatters.js";
|
|
5
|
+
import { countUniqueAdvisories, formatSeverityLabel, formatRelationshipLabel } from "./formatters.js";
|
|
6
6
|
export function printSummary(findings, packageCount, scanInput) {
|
|
7
7
|
if (findings.length === 0) {
|
|
8
8
|
if (scanInput.mode === "manifest-fallback") {
|
|
@@ -13,6 +13,9 @@ export function printSummary(findings, packageCount, scanInput) {
|
|
|
13
13
|
}
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
+
const totalCVEs = countUniqueAdvisories(findings);
|
|
17
|
+
const pkgLabel = findings.length === 1 ? "package" : "packages";
|
|
18
|
+
const cveLabel = totalCVEs === 1 ? "CVE" : "CVEs";
|
|
16
19
|
const counts = {
|
|
17
20
|
critical: findings.filter(f => f.severity === "critical").length,
|
|
18
21
|
high: findings.filter(f => f.severity === "high").length,
|
|
@@ -20,7 +23,7 @@ export function printSummary(findings, packageCount, scanInput) {
|
|
|
20
23
|
low: findings.filter(f => f.severity === "low").length,
|
|
21
24
|
unknown: findings.filter(f => f.severity === "unknown").length
|
|
22
25
|
};
|
|
23
|
-
console.log(chalk.redBright(`โ Found ${findings.length}
|
|
26
|
+
console.log(chalk.redBright(`โ Found ${findings.length} ${pkgLabel} (${totalCVEs} ${cveLabel}) with known OSV matches from ${scanInput.source}`));
|
|
24
27
|
console.log(renderSeverityTable(counts));
|
|
25
28
|
}
|
|
26
29
|
export function printActionSummary(findings) {
|
|
@@ -29,7 +32,7 @@ export function printActionSummary(findings) {
|
|
|
29
32
|
const direct = findings.filter(f => f.relationship === "direct").length;
|
|
30
33
|
const transitive = findings.filter(f => f.relationship === "transitive").length;
|
|
31
34
|
const unknown = findings.filter(f => f.relationship === "unknown").length;
|
|
32
|
-
const uniqueAdvisories =
|
|
35
|
+
const uniqueAdvisories = countUniqueAdvisories(findings);
|
|
33
36
|
const fixable = findings.filter(f => Boolean(f.firstFixedVersion)).length;
|
|
34
37
|
console.log("");
|
|
35
38
|
console.log(chalk.bold.cyan("Quick take"));
|
|
@@ -38,7 +41,7 @@ export function printActionSummary(findings) {
|
|
|
38
41
|
if (unknown > 0) {
|
|
39
42
|
console.log(`- ${chalk.magenta(String(unknown))} package${unknown === 1 ? "" : "s"} could not be clearly classified as direct or transitive.`);
|
|
40
43
|
}
|
|
41
|
-
console.log(`- ${chalk.blueBright(String(uniqueAdvisories))}
|
|
44
|
+
console.log(`- ${chalk.blueBright(String(uniqueAdvisories))} CVE${uniqueAdvisories === 1 ? "" : "s"} matched overall.`);
|
|
42
45
|
console.log(`- ${chalk.blue(String(fixable))} package${fixable === 1 ? "" : "s"} include a fixed-version hint from OSV.`);
|
|
43
46
|
}
|
|
44
47
|
export function printSuggestedFixCommands(findings, scanInput, options) {
|
|
@@ -149,7 +152,8 @@ export function printTable(findings, threshold) {
|
|
|
149
152
|
f.severity,
|
|
150
153
|
f.relationship,
|
|
151
154
|
usageText,
|
|
152
|
-
f.
|
|
155
|
+
(f.validatedFirstFixedVersion ?? f.firstFixedVersion) ??
|
|
156
|
+
(f.vulnerabilities.some(v => v.id.startsWith("MAL-")) ? chalk.yellow("โ Malicious") : chalk.yellow("โ no fix")),
|
|
153
157
|
f.vulnerabilities.map(v => v.id).join(", ")
|
|
154
158
|
];
|
|
155
159
|
});
|
|
@@ -182,8 +186,19 @@ export function printTable(findings, threshold) {
|
|
|
182
186
|
console.log(renderRow(decorated, widths));
|
|
183
187
|
}
|
|
184
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
|
+
}
|
|
185
200
|
if (threshold) {
|
|
186
|
-
console.log(chalk.gray("Tip: use --all to include low
|
|
201
|
+
console.log(chalk.gray("Tip: use --all to include low findings, or --min-severity high to focus only on urgent issues."));
|
|
187
202
|
}
|
|
188
203
|
}
|
|
189
204
|
export function printFinalStatus(findings) {
|
|
@@ -260,9 +275,9 @@ export function printCompactOutput(findings, scanInput, options) {
|
|
|
260
275
|
console.log("โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ");
|
|
261
276
|
console.log(chalk.bold("๐ฆ Vulnerabilities found"));
|
|
262
277
|
console.log("โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n");
|
|
263
|
-
// Get top 3 critical/high issues
|
|
278
|
+
// Get top 3 critical/high issues plus all unknown (malicious) findings
|
|
264
279
|
const urgentFindings = findings
|
|
265
|
-
.filter(f => f.severity === "critical" || f.severity === "high")
|
|
280
|
+
.filter(f => f.severity === "critical" || f.severity === "high" || f.severity === "unknown")
|
|
266
281
|
.slice(0, 3);
|
|
267
282
|
for (const finding of urgentFindings) {
|
|
268
283
|
const sevLabel = finding.severity.toUpperCase().padEnd(8);
|
|
@@ -282,21 +297,29 @@ export function printCompactOutput(findings, scanInput, options) {
|
|
|
282
297
|
}
|
|
283
298
|
console.log(`${formatSeverityLabel(sevLabel)} ${chalk.whiteBright(finding.pkg.name)}@${finding.pkg.version}`);
|
|
284
299
|
console.log(` ${typeLabel}${usageContext}`);
|
|
285
|
-
|
|
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") {
|
|
286
308
|
console.log(` ${chalk.gray(`Fix: update ${finding.recommendedNpmTransitiveRemediation.package} within its current dependency range`)}`);
|
|
287
309
|
}
|
|
288
310
|
else if (finding.recommendedParentUpgrade) {
|
|
289
311
|
console.log(` ${chalk.gray(`Fix: upgrade ${finding.recommendedParentUpgrade.package} to ${finding.recommendedParentUpgrade.targetVersion}`)}`);
|
|
290
312
|
}
|
|
291
313
|
else if (finding.firstFixedVersion) {
|
|
314
|
+
const displayFixVersion = finding.validatedFirstFixedVersion ?? finding.firstFixedVersion;
|
|
292
315
|
let action;
|
|
293
316
|
if (finding.relationship === "direct") {
|
|
294
|
-
action = `upgrade to ${
|
|
317
|
+
action = `upgrade to ${displayFixVersion}`;
|
|
295
318
|
}
|
|
296
319
|
else {
|
|
297
320
|
const parent = getPrimaryParent(finding);
|
|
298
321
|
action = parent
|
|
299
|
-
? `Upgrade ${parent} โ check for release resolving ${finding.pkg.name} to ${
|
|
322
|
+
? `Upgrade ${parent} โ check for release resolving ${finding.pkg.name} to ${displayFixVersion}+`
|
|
300
323
|
: `No dependency path found โ inspect lockfile to identify which package pulls in ${finding.pkg.name}`;
|
|
301
324
|
}
|
|
302
325
|
console.log(` ${chalk.gray(`Fix: ${action}`)}`);
|
|
@@ -367,11 +390,27 @@ export function printCompactOutput(findings, scanInput, options) {
|
|
|
367
390
|
parts.push(chalk.green(`${counts.low} low`));
|
|
368
391
|
if (counts.unknown > 0)
|
|
369
392
|
parts.push(chalk.gray(`${counts.unknown} unknown`));
|
|
370
|
-
|
|
393
|
+
const compactCVEs = countUniqueAdvisories(findings);
|
|
394
|
+
const compactPkgLabel = findings.length === 1 ? "package" : "packages";
|
|
395
|
+
const compactCveLabel = compactCVEs === 1 ? "CVE" : "CVEs";
|
|
396
|
+
console.log(`${chalk.whiteBright(String(findings.length))} ${compactPkgLabel}` +
|
|
397
|
+
chalk.gray(" ยท ") +
|
|
398
|
+
`${chalk.whiteBright(String(compactCVEs))} ${compactCveLabel}`);
|
|
371
399
|
console.log(parts.join(chalk.gray(" ยท ")));
|
|
372
400
|
console.log(`${chalk.cyan(String(direct))} ${chalk.white("direct")}` +
|
|
373
401
|
`${chalk.gray(" ยท ")}` +
|
|
374
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
|
+
}
|
|
375
414
|
if (options?.all) {
|
|
376
415
|
printTable(findings, null);
|
|
377
416
|
}
|
package/dist/output/sarif.js
CHANGED
|
@@ -7,6 +7,7 @@ import { severityToSarifLevel } from "../utils/severity.js";
|
|
|
7
7
|
const SARIF_RULE_NAME = "VulnerableDependency";
|
|
8
8
|
const LOCKFILE_NAMES = {
|
|
9
9
|
"package-lock": "package-lock.json",
|
|
10
|
+
"npm-shrinkwrap": "npm-shrinkwrap.json",
|
|
10
11
|
"pnpm-lock": "pnpm-lock.yaml",
|
|
11
12
|
"yarn-lock": "yarn.lock",
|
|
12
13
|
"bun-lock": "bun.lockb",
|
package/dist/parsers/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { loadFromPnpmLock } from "./pnpm-lock.js";
|
|
|
8
8
|
import { loadFromYarnLock } from "./yarn-lock.js";
|
|
9
9
|
export function loadPackages(projectRoot, prodOnly, maxDepth) {
|
|
10
10
|
const rootBunLock = path.join(projectRoot, "bun.lock");
|
|
11
|
+
const rootShrinkwrap = path.join(projectRoot, "npm-shrinkwrap.json");
|
|
11
12
|
const rootPackageLock = path.join(projectRoot, "package-lock.json");
|
|
12
13
|
const rootPnpmLock = path.join(projectRoot, "pnpm-lock.yaml");
|
|
13
14
|
const rootYarnLock = path.join(projectRoot, "yarn.lock");
|
|
@@ -25,6 +26,20 @@ export function loadPackages(projectRoot, prodOnly, maxDepth) {
|
|
|
25
26
|
skippedDependencies: []
|
|
26
27
|
};
|
|
27
28
|
}
|
|
29
|
+
if (fs.existsSync(rootShrinkwrap)) {
|
|
30
|
+
return {
|
|
31
|
+
mode: "resolved-lockfile",
|
|
32
|
+
source: "npm-shrinkwrap",
|
|
33
|
+
filePath: rootShrinkwrap,
|
|
34
|
+
packages: loadFromPackageLock(rootShrinkwrap, prodOnly),
|
|
35
|
+
notes: [
|
|
36
|
+
"Scanned resolved dependency versions from npm-shrinkwrap.json.",
|
|
37
|
+
"Dependency paths are derived from lockfile package locations."
|
|
38
|
+
],
|
|
39
|
+
warnings: [],
|
|
40
|
+
skippedDependencies: []
|
|
41
|
+
};
|
|
42
|
+
}
|
|
28
43
|
if (fs.existsSync(rootPackageLock)) {
|
|
29
44
|
return {
|
|
30
45
|
mode: "resolved-lockfile",
|
|
@@ -67,7 +82,7 @@ export function loadPackages(projectRoot, prodOnly, maxDepth) {
|
|
|
67
82
|
skippedDependencies: []
|
|
68
83
|
};
|
|
69
84
|
}
|
|
70
|
-
const discoveredLockfiles = findFiles(projectRoot, ["bun.lock", "package-lock.json", "pnpm-lock.yaml", "yarn.lock"], maxDepth);
|
|
85
|
+
const discoveredLockfiles = findFiles(projectRoot, ["bun.lock", "npm-shrinkwrap.json", "package-lock.json", "pnpm-lock.yaml", "yarn.lock"], maxDepth);
|
|
71
86
|
if (discoveredLockfiles.length > 0) {
|
|
72
87
|
const selected = chooseBestLockfile(discoveredLockfiles);
|
|
73
88
|
const selectedName = path.basename(selected);
|
|
@@ -85,6 +100,20 @@ export function loadPackages(projectRoot, prodOnly, maxDepth) {
|
|
|
85
100
|
skippedDependencies: []
|
|
86
101
|
};
|
|
87
102
|
}
|
|
103
|
+
if (selectedName === "npm-shrinkwrap.json") {
|
|
104
|
+
return {
|
|
105
|
+
mode: "resolved-lockfile",
|
|
106
|
+
source: "npm-shrinkwrap",
|
|
107
|
+
filePath: selected,
|
|
108
|
+
packages: loadFromPackageLock(selected, prodOnly),
|
|
109
|
+
notes: [
|
|
110
|
+
`Scanned resolved dependency versions from ${relativeOrName(projectRoot, selected)}.`,
|
|
111
|
+
"Dependency paths are derived from lockfile package locations."
|
|
112
|
+
],
|
|
113
|
+
warnings: ["No supported lockfile was found at the repo root, so a nested lockfile was used instead."],
|
|
114
|
+
skippedDependencies: []
|
|
115
|
+
};
|
|
116
|
+
}
|
|
88
117
|
if (selectedName === "package-lock.json") {
|
|
89
118
|
return {
|
|
90
119
|
mode: "resolved-lockfile",
|
|
@@ -166,7 +195,7 @@ export function loadPackages(projectRoot, prodOnly, maxDepth) {
|
|
|
166
195
|
export function buildNoPackagesMessage(projectRoot) {
|
|
167
196
|
return [
|
|
168
197
|
"No scannable packages were found.",
|
|
169
|
-
"Supported inputs: bun.lock, package-lock.json, pnpm-lock.yaml, yarn.lock, or package.json with exact pinned versions.",
|
|
198
|
+
"Supported inputs: bun.lock, npm-shrinkwrap.json, package-lock.json, pnpm-lock.yaml, yarn.lock, or package.json with exact pinned versions.",
|
|
170
199
|
`Searched under: ${projectRoot}`
|
|
171
200
|
].join(" ");
|
|
172
201
|
}
|
package/dist/utils/chalk.js
CHANGED
|
@@ -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
|
}),
|