cve-lite-cli 1.33.0 → 1.35.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 +6 -3
- package/dist/advisory/local-db.js +31 -2
- package/dist/advisory/osv-advisory-source.js +3 -0
- package/dist/cli/advisories-init.js +13 -0
- package/dist/cli/advisories-sync.js +30 -0
- package/dist/cli/args.js +41 -2
- package/dist/cli/config-command.js +15 -0
- package/dist/cli/config.js +29 -0
- package/dist/cli/help.js +7 -5
- package/dist/cli/overrides.js +10 -1
- package/dist/cli/validate.js +6 -2
- package/dist/constants.js +52 -0
- package/dist/index.js +25 -719
- package/dist/output/cyclonedx.js +28 -24
- package/dist/output/formatters.js +13 -0
- package/dist/output/html-reporter.js +81 -40
- package/dist/output/multi-folder-html-reporter.js +16 -10
- package/dist/output/multi-folder-printer.js +1 -1
- package/dist/output/override-findings-sarif.js +1 -0
- package/dist/output/printers.js +436 -271
- package/dist/output/sarif.js +17 -1
- package/dist/output/sbom-dependency-edges.js +86 -0
- package/dist/output/sbom-file.js +27 -0
- package/dist/output/spdx.js +293 -0
- package/dist/output/write-outputs.js +18 -3
- package/dist/overrides/admitted-scan.js +158 -0
- package/dist/overrides/api.js +16 -0
- package/dist/overrides/context-builder.js +4 -0
- package/dist/overrides/context.js +8 -1
- package/dist/overrides/detectors/index.js +2 -0
- package/dist/overrides/detectors/oa010-vulnerable-floor.js +123 -0
- package/dist/overrides/parsing/registry.js +53 -0
- package/dist/parsers/bun-lock-graph.js +182 -0
- package/dist/parsers/bun-lock.js +93 -132
- package/dist/parsers/index.js +75 -149
- package/dist/parsers/multi-package.js +5 -6
- package/dist/parsers/package-lock.js +11 -1
- package/dist/parsers/pnpm-lock-graph.js +94 -0
- package/dist/parsers/pnpm-lock.js +5 -5
- package/dist/parsers/utils.js +3 -0
- package/dist/parsers/yarn-lock-graph.js +148 -0
- package/dist/parsers/yarn-lock.js +3 -3
- package/dist/remediation/fix-commands.js +48 -7
- package/dist/remediation/npm-registry.js +8 -2
- package/dist/scan/completeness.js +1 -0
- package/dist/scan/single-scan.js +643 -0
- package/dist/scanner.js +62 -7
- package/dist/types.js +1 -1
- package/dist/utils/file.js +11 -14
- package/dist/utils/purl.js +10 -0
- package/dist/utils/sbom-format.js +12 -0
- package/dist/utils/version.js +84 -10
- package/package.json +2 -2
package/dist/output/cyclonedx.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
1
|
import { randomUUID } from "node:crypto";
|
|
4
2
|
import { findSuggestedCommandForFinding } from "../remediation/fix-commands.js";
|
|
5
3
|
import { getRecommendedAction } from "./formatters.js";
|
|
6
4
|
import { getCliVersion } from "../utils/version-info.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
5
|
+
import { buildPurl } from "../utils/purl.js";
|
|
6
|
+
import { sbomTimestamp, writeSbomFile } from "./sbom-file.js";
|
|
7
|
+
export { buildPurl };
|
|
11
8
|
export function buildCycloneDxBom(allPackages, findings, projectMeta, version, plan = null) {
|
|
12
9
|
const components = allPackages.map(pkg => {
|
|
13
10
|
const purl = buildPurl(pkg.name, pkg.version);
|
|
@@ -41,6 +38,17 @@ export function buildCycloneDxBom(allPackages, findings, projectMeta, version, p
|
|
|
41
38
|
for (const [cveId, { finding, affects }] of vulnMap) {
|
|
42
39
|
const runnableFixCommand = plan ? findSuggestedCommandForFinding(plan, finding) : null;
|
|
43
40
|
const recommendation = runnableFixCommand ?? getRecommendedAction(finding);
|
|
41
|
+
const properties = [];
|
|
42
|
+
const addProperty = (name, value) => {
|
|
43
|
+
if (value === null || value === undefined)
|
|
44
|
+
return;
|
|
45
|
+
properties.push({ name: `cve-lite:${name}`, value: String(value) });
|
|
46
|
+
};
|
|
47
|
+
addProperty("advisory-fix-version", finding.firstFixedVersion);
|
|
48
|
+
addProperty("recommended-fix-version", finding.validatedFirstFixedVersion ?? finding.firstFixedVersion);
|
|
49
|
+
addProperty("fix-version-published-at", finding.fixVersionPublishedAt);
|
|
50
|
+
addProperty("versions-scanned", finding.validatedTargetScannedVersions);
|
|
51
|
+
addProperty("versions-still-vulnerable", finding.validatedTargetKnownVulnerableVersions);
|
|
44
52
|
vulnerabilities.push({
|
|
45
53
|
id: cveId,
|
|
46
54
|
source: {
|
|
@@ -50,13 +58,21 @@ export function buildCycloneDxBom(allPackages, findings, projectMeta, version, p
|
|
|
50
58
|
ratings: [{ severity: finding.severity, method: "other" }],
|
|
51
59
|
affects,
|
|
52
60
|
recommendation,
|
|
61
|
+
...(properties.length > 0 ? { properties } : {}),
|
|
53
62
|
});
|
|
54
63
|
}
|
|
55
64
|
const metadata = {
|
|
56
65
|
timestamp: new Date().toISOString(),
|
|
57
|
-
tools:
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
tools: {
|
|
67
|
+
components: [
|
|
68
|
+
{
|
|
69
|
+
type: "application",
|
|
70
|
+
name: "CVE Lite CLI",
|
|
71
|
+
version,
|
|
72
|
+
publisher: "OWASP",
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
60
76
|
};
|
|
61
77
|
if (projectMeta && projectMeta.name) {
|
|
62
78
|
const metaComponent = {
|
|
@@ -70,7 +86,7 @@ export function buildCycloneDxBom(allPackages, findings, projectMeta, version, p
|
|
|
70
86
|
}
|
|
71
87
|
return {
|
|
72
88
|
bomFormat: "CycloneDX",
|
|
73
|
-
specVersion: "1.
|
|
89
|
+
specVersion: "1.6",
|
|
74
90
|
version: 1,
|
|
75
91
|
serialNumber: `urn:uuid:${randomUUID()}`,
|
|
76
92
|
metadata,
|
|
@@ -79,19 +95,7 @@ export function buildCycloneDxBom(allPackages, findings, projectMeta, version, p
|
|
|
79
95
|
};
|
|
80
96
|
}
|
|
81
97
|
export function writeCycloneDxReport(allPackages, findings, plan, projectMeta) {
|
|
82
|
-
const
|
|
83
|
-
const filename = `cve-lite-scan-${ts}.cdx.json`;
|
|
84
|
-
const outputPath = path.join(process.cwd(), filename);
|
|
98
|
+
const filename = `cve-lite-scan-${sbomTimestamp()}.cdx.json`;
|
|
85
99
|
const bom = buildCycloneDxBom(allPackages, findings, projectMeta, getCliVersion(), plan);
|
|
86
|
-
|
|
87
|
-
fs.writeFileSync(outputPath, JSON.stringify(bom, null, 2));
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
90
|
-
try {
|
|
91
|
-
fs.rmSync(outputPath, { force: true });
|
|
92
|
-
}
|
|
93
|
-
catch { /* best-effort cleanup */ }
|
|
94
|
-
throw new Error(`Failed to write CycloneDX report to ${outputPath}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
95
|
-
}
|
|
96
|
-
return filename;
|
|
100
|
+
return writeSbomFile(filename, bom, "CycloneDX report");
|
|
97
101
|
}
|
|
@@ -303,3 +303,16 @@ export function sortFindingsForOutput(findings) {
|
|
|
303
303
|
export function countUniqueAdvisories(findings) {
|
|
304
304
|
return new Set(findings.flatMap(f => f.vulnerabilities.map(v => v.id))).size;
|
|
305
305
|
}
|
|
306
|
+
export function countProdFindings(findings) {
|
|
307
|
+
const devFlagAvailable = findings.some(f => f.pkg.dev !== undefined);
|
|
308
|
+
if (!devFlagAvailable)
|
|
309
|
+
return null;
|
|
310
|
+
const devTotal = findings.filter(f => f.pkg.dev === true).length;
|
|
311
|
+
if (devTotal === 0)
|
|
312
|
+
return null;
|
|
313
|
+
return {
|
|
314
|
+
prodTotal: findings.length - devTotal,
|
|
315
|
+
devTotal,
|
|
316
|
+
total: findings.length,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
import { serializeFinding, summarizeNextAction, summarizeRisk,
|
|
4
|
+
import { serializeFinding, summarizeNextAction, summarizeRisk, formatCooldownWarning } from "./formatters.js";
|
|
5
5
|
import { loadLogoDataUri } from "./logos.js";
|
|
6
6
|
import { isBreakingUpgrade } from "../utils/version.js";
|
|
7
7
|
import { pluralize } from "../utils/string.js";
|
|
@@ -157,6 +157,9 @@ button.header-link:hover{color:var(--link);border-color:var(--link)}
|
|
|
157
157
|
.detail-col h4.detail-subheading{margin-top:14px}
|
|
158
158
|
.detail-col p{font-size:12px;color:var(--text-2);line-height:1.6}
|
|
159
159
|
.dep-path{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
|
|
160
|
+
.dep-path+.dep-path{margin-top:16px;padding-top:12px;border-top:1px solid var(--border-sub)}
|
|
161
|
+
.dep-step{display:inline-flex;align-items:center;gap:6px}
|
|
162
|
+
.scan-count{font-size:0.82rem;color:var(--text-2);font-variant-numeric:tabular-nums}
|
|
160
163
|
.dep-node{font-size:11px;font-family:monospace;background:var(--surface);border:1px solid var(--border);border-radius:4px;padding:2px 8px;color:var(--text)}
|
|
161
164
|
.dep-node.vulnerable{border-color:#f85149;color:#f85149}
|
|
162
165
|
.dep-arrow{color:var(--text-2);font-size:11px}
|
|
@@ -183,7 +186,6 @@ button.header-link:hover{color:var(--link);border-color:var(--link)}
|
|
|
183
186
|
.fix-target-stats{color:var(--text-3);font-size:10px}
|
|
184
187
|
.fix-target-note{color:var(--text-3);font-style:italic;font-size:10px}
|
|
185
188
|
.fix-target-coverage{flex-basis:100%;color:var(--text-3);font-size:10px;line-height:1.45}
|
|
186
|
-
.chain-proof{font-size:0.78rem;color:var(--text-2);margin-left:6px;font-family:monospace}
|
|
187
189
|
.completeness-banner{margin:16px 32px;background:#e3b34111;border:1px solid #e3b34144;border-radius:8px;padding:14px 18px;display:flex;gap:14px;align-items:flex-start}
|
|
188
190
|
.completeness-banner-icon{font-size:22px;flex-shrink:0;line-height:1}
|
|
189
191
|
.completeness-banner-body strong{font-size:13px;color:var(--text);display:block;margin-bottom:4px}
|
|
@@ -220,10 +222,11 @@ button.header-link:hover{color:var(--link);border-color:var(--link)}
|
|
|
220
222
|
.priority-none{font-size:11px;color:var(--text-3)}
|
|
221
223
|
.epss-val{font-size:11px;color:var(--text-2);font-family:monospace;white-space:nowrap;cursor:help;border-bottom:1px dotted var(--text-3)}
|
|
222
224
|
.epss-val.hot{color:#a371f7;border-bottom-color:#a371f7}
|
|
223
|
-
.priority-legend{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:14px 18px;margin:0
|
|
225
|
+
.priority-legend{background:var(--surface);border:1px solid var(--border);border-radius:8px;padding:14px 18px;margin:16px 0 24px}
|
|
224
226
|
.priority-legend h4{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.4px;color:var(--text-2);margin-bottom:12px}
|
|
225
227
|
.priority-legend-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:10px}
|
|
226
|
-
.priority-legend-item{display:flex;align-items:flex-start;gap:10px;font-size:12px;color:var(--text-2);line-height:1.5}
|
|
228
|
+
.priority-legend-item{display:flex;align-items:flex-start;gap:10px;font-size:12px;color:var(--text-2);line-height:1.5}
|
|
229
|
+
.sev-dev-note{text-align:center;font-size:12px;color:var(--text-2);margin:-12px 0 16px;padding:0 32px}`;
|
|
227
230
|
export function renderHtmlReport(data) {
|
|
228
231
|
const projectName = path.basename(data.projectPath);
|
|
229
232
|
const scanDate = new Date(data.scannedAt).toLocaleString();
|
|
@@ -234,6 +237,10 @@ export function renderHtmlReport(data) {
|
|
|
234
237
|
counts[sev]++;
|
|
235
238
|
}
|
|
236
239
|
const totalCVEs = new Set(data.findings.flatMap(f => f.vulnerabilities.map(v => v.id))).size;
|
|
240
|
+
const devTotal = data.findings.filter(f => f.dev === true).length;
|
|
241
|
+
const devNoteHtml = devTotal > 0
|
|
242
|
+
? `<div class="sev-dev-note">${data.findings.length - devTotal} of ${data.findings.length} findings in prod dependencies</div>`
|
|
243
|
+
: "";
|
|
237
244
|
const noticesHtml = renderNotices(data.notes, data.warnings);
|
|
238
245
|
const completenessBannerHtml = renderCompletenessBanner(data.completeness);
|
|
239
246
|
const fixPlanHtml = renderFixPlan(data.suggestedFixCommands);
|
|
@@ -307,6 +314,7 @@ ${REPORT_STYLES}
|
|
|
307
314
|
<div class="sev-card total"><span class="count">${data.findings.length}</span><span class="label">Packages</span></div>
|
|
308
315
|
<div class="sev-card total"><span class="count">${totalCVEs}</span><span class="label">CVEs</span></div>
|
|
309
316
|
</div>
|
|
317
|
+
${devNoteHtml}
|
|
310
318
|
|
|
311
319
|
${completenessBannerHtml}
|
|
312
320
|
${fixPlanHtml}
|
|
@@ -331,19 +339,23 @@ ${duplicatePackagesHtml}
|
|
|
331
339
|
<thead>
|
|
332
340
|
<tr>
|
|
333
341
|
<th style="width:32px"></th>
|
|
334
|
-
<th onclick="sortBy('package')">Package <span class="sort-arrow">↕</span></th>
|
|
335
|
-
<th>
|
|
336
|
-
<th onclick="sortBy('
|
|
342
|
+
<th data-sort="package" onclick="sortBy('package')">Package <span class="sort-arrow">↕</span></th>
|
|
343
|
+
<th data-sort="severity" onclick="sortBy('severity')" class="sorted">Severity <span class="sort-arrow" style="color:var(--link)">↓</span></th>
|
|
344
|
+
<th data-sort="relationship" onclick="sortBy('relationship')" style="min-width:130px">Type <span class="sort-arrow">↕</span></th>
|
|
345
|
+
<th>Root</th>
|
|
346
|
+
<th title="The fixed version the advisory itself suggested">Advisory</th>
|
|
347
|
+
<th title="The version we recommend after checking the advisory hint against the registry">Target</th>
|
|
348
|
+
<th title="When the recommended version was published to the registry">Published</th>
|
|
349
|
+
<th title="How many published versions above the installed one were checked">Scanned</th>
|
|
350
|
+
<th title="How many of those scanned versions were still known vulnerable">Still vulnerable</th>
|
|
337
351
|
<th title="Exploit Prediction Scoring System - likelihood of exploitation in the next 30 days, relative to all CVEs (FIRST.org)">EPSS</th>
|
|
338
352
|
<th>EPSS Priority</th>
|
|
339
|
-
<th
|
|
340
|
-
<th>Root</th>
|
|
341
|
-
<th>CVE / Advisory</th>
|
|
353
|
+
<th>IDs</th>
|
|
342
354
|
</tr>
|
|
343
355
|
</thead>
|
|
344
356
|
<tbody id="findings-tbody">
|
|
345
357
|
${findingRowsHtml}
|
|
346
|
-
<tr id="no-results-row" style="display:none"><td colspan="
|
|
358
|
+
<tr id="no-results-row" style="display:none"><td colspan="13" class="no-results">No findings match your search.</td></tr>
|
|
347
359
|
</tbody>
|
|
348
360
|
</table>
|
|
349
361
|
${renderPriorityLegendHtml(data.findings)}
|
|
@@ -428,8 +440,11 @@ function applyFilters() {
|
|
|
428
440
|
function sortBy(col) {
|
|
429
441
|
if (sortCol === col) { sortAsc = !sortAsc; } else { sortCol = col; sortAsc = col === 'package'; }
|
|
430
442
|
document.querySelectorAll('.findings-table thead th').forEach(th => th.classList.remove('sorted'));
|
|
431
|
-
|
|
432
|
-
|
|
443
|
+
// Selected by data-sort rather than column position. The previous hardcoded
|
|
444
|
+
// index map had 'relationship' pointing at the wrong header, and any column
|
|
445
|
+
// added to the table silently shifted the other two.
|
|
446
|
+
const sortedTh = document.querySelector('.findings-table thead th[data-sort="' + col + '"]');
|
|
447
|
+
if (sortedTh) sortedTh.classList.add('sorted');
|
|
433
448
|
|
|
434
449
|
const tbody = document.getElementById('findings-tbody');
|
|
435
450
|
const indexedFindings = reportData.findings.map((f, i) => ({ f, i }));
|
|
@@ -562,6 +577,27 @@ function renderPriorityColumnHtml(priority) {
|
|
|
562
577
|
const cssClass = priority.replace(/_/g, "-");
|
|
563
578
|
return `<span class="priority-badge ${escapeHtml(cssClass)}">${escapeHtml(label)}</span>`;
|
|
564
579
|
}
|
|
580
|
+
export function renderDependencyPathChain(path, fallbackPkg) {
|
|
581
|
+
if (path.length === 0) {
|
|
582
|
+
return fallbackPkg ? `<span class="dep-node">${escapeHtml(fallbackPkg)}</span>` : "";
|
|
583
|
+
}
|
|
584
|
+
return path.map((node, i, arr) => {
|
|
585
|
+
const isLast = i === arr.length - 1;
|
|
586
|
+
return `<span class="dep-step"><a href="https://www.npmjs.com/package/${encodeURIComponent(node)}" target="_blank" rel="noopener noreferrer" class="dep-node${isLast ? " vulnerable" : ""}">${escapeHtml(node)}</a>${isLast ? "" : '<span class="dep-arrow">→</span>'}</span>`;
|
|
587
|
+
}).join("");
|
|
588
|
+
}
|
|
589
|
+
export const MAX_PATHS_PER_PACKAGE = 5;
|
|
590
|
+
export function renderDependencyPathsHtml(finding) {
|
|
591
|
+
const count = finding.dependencyPaths.length;
|
|
592
|
+
const heading = count >= MAX_PATHS_PER_PACKAGE
|
|
593
|
+
? "Known dependency paths (first 5 shown)"
|
|
594
|
+
: pluralize(Math.max(1, count), "Dependency path", "Known dependency paths");
|
|
595
|
+
const paths = count > 0 ? finding.dependencyPaths : [[]];
|
|
596
|
+
const html = paths
|
|
597
|
+
.map(path => `<div class="dep-path">${renderDependencyPathChain(path, finding.package)}</div>`)
|
|
598
|
+
.join("\n ");
|
|
599
|
+
return { heading, html };
|
|
600
|
+
}
|
|
565
601
|
export function renderFindingRow(finding, idx, skippedKeys) {
|
|
566
602
|
const cveLinks = finding.cves.length > 0
|
|
567
603
|
? finding.cves.map(advisoryLink).join(", ")
|
|
@@ -582,12 +618,7 @@ export function renderFindingRow(finding, idx, skippedKeys) {
|
|
|
582
618
|
: isMalicious
|
|
583
619
|
? `<span class="fix-hint none" title="Malicious code advisory — remove this package">⚠ Malicious</span>`
|
|
584
620
|
: `<span class="fix-hint none" title="No known fix — consider replacing this package">⚠ No fix</span>`;
|
|
585
|
-
const
|
|
586
|
-
? finding.dependencyPaths[0].map((node, i, arr) => {
|
|
587
|
-
const isLast = i === arr.length - 1;
|
|
588
|
-
return `<a href="https://www.npmjs.com/package/${encodeURIComponent(node)}" target="_blank" rel="noopener noreferrer" class="dep-node${isLast ? " vulnerable" : ""}">${escapeHtml(node)}</a>${isLast ? "" : '<span class="dep-arrow">→</span>'}`;
|
|
589
|
-
}).join("")
|
|
590
|
-
: `<span class="dep-node">${escapeHtml(finding.package)}</span>`;
|
|
621
|
+
const depPaths = renderDependencyPathsHtml(finding);
|
|
591
622
|
const description = finding.vulnerabilities[0]?.summary ?? "";
|
|
592
623
|
const runnable = finding.runnableFixCommand ?? null;
|
|
593
624
|
const recommendedActionHtml = runnable
|
|
@@ -604,27 +635,47 @@ export function renderFindingRow(finding, idx, skippedKeys) {
|
|
|
604
635
|
: `<span class="root-dep-none">-</span>`;
|
|
605
636
|
const epssHtml = renderEpssColumnHtml(finding.epssScores);
|
|
606
637
|
const priorityHtml = renderPriorityColumnHtml(finding.prioritySignal);
|
|
638
|
+
// Advisory is what OSV suggested; Fixed is what we recommend after
|
|
639
|
+
// validating it against the registry. They differ whenever the advisory's hint
|
|
640
|
+
// turned out to be vulnerable itself, and showing both is what lets a reader
|
|
641
|
+
// see the adjustment without a prose note.
|
|
642
|
+
const advisoryHtml = finding.firstFixedVersion
|
|
643
|
+
? `<span class="advisory-version">${escapeHtml(finding.firstFixedVersion)}</span>`
|
|
644
|
+
: `<span class="root-dep-none">-</span>`;
|
|
645
|
+
const scannedHtml = finding.validatedTargetScannedVersions != null
|
|
646
|
+
? `<span class="scan-count">${finding.validatedTargetScannedVersions}</span>`
|
|
647
|
+
: `<span class="root-dep-none">-</span>`;
|
|
648
|
+
const stillVulnerableHtml = finding.validatedTargetKnownVulnerableVersions != null
|
|
649
|
+
? `<span class="scan-count">${finding.validatedTargetKnownVulnerableVersions}</span>`
|
|
650
|
+
: `<span class="root-dep-none">-</span>`;
|
|
651
|
+
const publishedHtml = finding.fixVersionPublishedAt
|
|
652
|
+
? `<span class="published-date">${escapeHtml(finding.fixVersionPublishedAt.slice(0, 10))}</span>`
|
|
653
|
+
: `<span class="root-dep-none">-</span>`;
|
|
607
654
|
return `<tr id="row-${idx}" data-skipped="${isSkipped ? '1' : '0'}" onclick="toggleRow(${idx})">
|
|
608
655
|
<td><span class="expand-icon" id="icon-${idx}">▶</span></td>
|
|
609
656
|
<td><div class="pkg-name"><a href="https://www.npmjs.com/package/${encodeURIComponent(finding.package)}" target="_blank" rel="noopener noreferrer">${escapeHtml(finding.package)}</a></div><div class="pkg-version">${escapeHtml(finding.version)}</div></td>
|
|
610
|
-
<td>${fixHtml}</td>
|
|
611
657
|
<td><span class="sev-badge ${escapeHtml(finding.severity)}">${escapeHtml(finding.severity)}</span></td>
|
|
612
|
-
<td>${epssHtml}</td>
|
|
613
|
-
<td>${priorityHtml}</td>
|
|
614
658
|
<td>${renderRelBadge(finding)}</td>
|
|
615
659
|
<td>${rootDepsHtml}</td>
|
|
660
|
+
<td>${advisoryHtml}</td>
|
|
661
|
+
<td>${fixHtml}</td>
|
|
662
|
+
<td>${publishedHtml}</td>
|
|
663
|
+
<td>${scannedHtml}</td>
|
|
664
|
+
<td>${stillVulnerableHtml}</td>
|
|
665
|
+
<td>${epssHtml}</td>
|
|
666
|
+
<td>${priorityHtml}</td>
|
|
616
667
|
<td>${cveLinks}</td>
|
|
617
668
|
</tr>
|
|
618
669
|
<tr id="detail-${idx}" class="detail-row">
|
|
619
|
-
<td colspan="
|
|
670
|
+
<td colspan="13">
|
|
620
671
|
<div class="expanded-inner">
|
|
621
672
|
<div class="detail-col" style="max-width:320px">
|
|
622
673
|
<h4>Description</h4>
|
|
623
674
|
<p>${escapeHtml(description)}</p>
|
|
624
675
|
</div>
|
|
625
676
|
<div class="detail-col" style="max-width:320px">
|
|
626
|
-
<h4
|
|
627
|
-
|
|
677
|
+
<h4>${depPaths.heading}</h4>
|
|
678
|
+
${depPaths.html}
|
|
628
679
|
</div>
|
|
629
680
|
${contextColHtml}
|
|
630
681
|
<div class="detail-col">
|
|
@@ -825,9 +876,9 @@ export function renderFixPlan(plan) {
|
|
|
825
876
|
const statsHtml = t.scannedVersions != null
|
|
826
877
|
? ` <span class="fix-target-stats">${t.scannedVersions} scanned${t.knownVulnerableVersions != null ? ` · ${t.knownVulnerableVersions} still vulnerable` : ""}</span>`
|
|
827
878
|
: "";
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
879
|
+
// The adjustment note is gone in favour of the Advisory / Fixed / Versions
|
|
880
|
+
// scanned columns, which carry the same four facts without a sentence that
|
|
881
|
+
// can go stale against the row it sits beside.
|
|
831
882
|
const cooldownHtml = t.cooldownWarning
|
|
832
883
|
? ` <span class="fix-target-note">${escapeHtml(formatCooldownWarning(t.cooldownWarning))}</span>`
|
|
833
884
|
: "";
|
|
@@ -837,24 +888,14 @@ export function renderFixPlan(plan) {
|
|
|
837
888
|
const coverageHtml = t.coverage === "partial"
|
|
838
889
|
? ` <span class="fix-target-coverage">Path-specific remediation. Run this command, then rescan; ${t.remainingPaths?.length ?? 0} other known ${pluralize(t.remainingPaths?.length ?? 0, "path")} may still need separate parent upgrades.</span>`
|
|
839
890
|
: "";
|
|
840
|
-
|
|
841
|
-
? (() => {
|
|
842
|
-
const hops = t.chainProof.map(h => `<a href="https://www.npmjs.com/package/${encodeURIComponent(h.name)}" target="_blank" rel="noopener noreferrer">${escapeHtml(h.name)}</a>@${escapeHtml(h.version)}`);
|
|
843
|
-
const safe = escapeHtml(t.chainSafeVersion);
|
|
844
|
-
const proofText = hops.length > 0
|
|
845
|
-
? `resolves via ${hops.join(" -> ")} -> ${safe} (safe)`
|
|
846
|
-
: `resolves to ${safe} (safe)`;
|
|
847
|
-
return ` <span class="chain-proof">${proofText}</span>`;
|
|
848
|
-
})()
|
|
849
|
-
: "";
|
|
850
|
-
return `<div class="fix-target-row">${versionHtml}${breakBadge}${statsHtml}${noteHtml}${cooldownHtml}${unverifiedHtml}${coverageHtml}${chainProofHtml}</div>`;
|
|
891
|
+
return `<div class="fix-target-row">${versionHtml}${breakBadge}${statsHtml}${cooldownHtml}${unverifiedHtml}${coverageHtml}</div>`;
|
|
851
892
|
}).join("\n");
|
|
852
893
|
const targetsHtml = section.targets.length > 0
|
|
853
894
|
? `<div class="fix-targets-list">${targetRows}</div>`
|
|
854
895
|
: "";
|
|
855
896
|
return `
|
|
856
897
|
<div class="fix-cmd">
|
|
857
|
-
<span class="cmd-text">${escapeHtml(
|
|
898
|
+
<span class="cmd-text">${escapeHtml(section.command)}</span>
|
|
858
899
|
<span class="cmd-meta">${escapeHtml(section.title)}</span>
|
|
859
900
|
<button class="copy-btn" data-cmd="${escapeHtml(section.command)}">Copy</button>
|
|
860
901
|
</div>${targetsHtml}`;
|
|
@@ -79,7 +79,7 @@ function renderFolderSection(result, folderIdx, idxOffset, serialized, projectRo
|
|
|
79
79
|
? renderLicenseFindingsHtml(result.licenseFindings, { limitedToDirectOnly: result.licenseLimitedToDirectOnly })
|
|
80
80
|
: "";
|
|
81
81
|
const emptyRow = result.sorted.length === 0
|
|
82
|
-
? `<tr><td colspan="
|
|
82
|
+
? `<tr><td colspan="13" style="text-align:center;padding:24px;color:#8b949e">No findings</td></tr>`
|
|
83
83
|
: "";
|
|
84
84
|
return `
|
|
85
85
|
<details class="folder-section"${isOpen ? " open" : ""}>
|
|
@@ -111,19 +111,23 @@ function renderFolderSection(result, folderIdx, idxOffset, serialized, projectRo
|
|
|
111
111
|
<thead>
|
|
112
112
|
<tr>
|
|
113
113
|
<th style="width:32px"></th>
|
|
114
|
-
<th onclick="sortBy('package',${fi})">Package <span class="sort-arrow">↕</span></th>
|
|
115
|
-
<th>
|
|
116
|
-
<th onclick="sortBy('
|
|
114
|
+
<th data-sort="package" onclick="sortBy('package',${fi})">Package <span class="sort-arrow">↕</span></th>
|
|
115
|
+
<th data-sort="severity" onclick="sortBy('severity',${fi})" class="sorted">Severity <span class="sort-arrow" style="color:#58a6ff">↓</span></th>
|
|
116
|
+
<th data-sort="relationship" onclick="sortBy('relationship',${fi})">Type <span class="sort-arrow">↕</span></th>
|
|
117
|
+
<th>Root</th>
|
|
118
|
+
<th title="The fixed version the advisory itself suggested">Advisory</th>
|
|
119
|
+
<th title="The version we recommend after checking the advisory hint against the registry">Target</th>
|
|
120
|
+
<th title="When the recommended version was published to the registry">Published</th>
|
|
121
|
+
<th title="How many published versions above the installed one were checked">Scanned</th>
|
|
122
|
+
<th title="How many of those scanned versions were still known vulnerable">Still vulnerable</th>
|
|
117
123
|
<th title="Exploit Prediction Scoring System - likelihood of exploitation in the next 30 days, relative to all CVEs (FIRST.org)">EPSS</th>
|
|
118
124
|
<th>EPSS Priority</th>
|
|
119
|
-
<th
|
|
120
|
-
<th>Root</th>
|
|
121
|
-
<th>CVE / Advisory</th>
|
|
125
|
+
<th>IDs</th>
|
|
122
126
|
</tr>
|
|
123
127
|
</thead>
|
|
124
128
|
<tbody id="findings-tbody-${fi}" data-offset="${idxOffset}">
|
|
125
129
|
${emptyRow}${findingRowsHtml}
|
|
126
|
-
<tr id="no-results-row-${fi}" style="display:none"><td colspan="
|
|
130
|
+
<tr id="no-results-row-${fi}" style="display:none"><td colspan="13" class="no-results">No findings match your search.</td></tr>
|
|
127
131
|
</tbody>
|
|
128
132
|
</table>
|
|
129
133
|
</div>
|
|
@@ -329,8 +333,10 @@ function sortBy(col, fi) {
|
|
|
329
333
|
const table = document.getElementById('findings-table-' + fi);
|
|
330
334
|
if (table) {
|
|
331
335
|
table.querySelectorAll('thead th').forEach(th => th.classList.remove('sorted'));
|
|
332
|
-
|
|
333
|
-
|
|
336
|
+
// Selected by data-sort rather than column position, so adding a column cannot
|
|
337
|
+
// silently highlight the wrong header.
|
|
338
|
+
const sortedTh = table.querySelector('thead th[data-sort="' + col + '"]');
|
|
339
|
+
if (sortedTh) sortedTh.classList.add('sorted');
|
|
334
340
|
}
|
|
335
341
|
|
|
336
342
|
const tbody = document.getElementById('findings-tbody-' + fi);
|
|
@@ -23,7 +23,7 @@ export function printMultiFolderResults(results, options) {
|
|
|
23
23
|
}
|
|
24
24
|
if (result.sorted.length > 0) {
|
|
25
25
|
if (result.tableFindings.length > 0) {
|
|
26
|
-
printTable(result.tableFindings, options.all ? null : result.minSeverity);
|
|
26
|
+
printTable(result.tableFindings, options.all ? null : result.minSeverity, undefined, result.suggestedFixCommands);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
logInfo(`No findings met the table threshold of ${result.minSeverity}. Re-run with --all to show everything.`, options);
|
|
@@ -11,6 +11,7 @@ const OA_RULES = [
|
|
|
11
11
|
{ id: "OA007", name: "FrozenLatest", shortDescription: "\"latest\" tag has moved", helpUri: "https://github.com/OWASP/cve-lite-cli/blob/main/docs/rules/OA007.md" },
|
|
12
12
|
{ id: "OA008", name: "MaterializedVulnerable", shortDescription: "Vulnerable copy still on disk", helpUri: "https://github.com/OWASP/cve-lite-cli/blob/main/docs/rules/OA008.md" },
|
|
13
13
|
{ id: "OA009", name: "StaleFloor", shortDescription: "Override floor already met by all parent declarations", helpUri: "https://github.com/OWASP/cve-lite-cli/blob/main/docs/rules/OA009.md" },
|
|
14
|
+
{ id: "OA010", name: "VulnerableFloor", shortDescription: "Override floor admits a known-vulnerable version", helpUri: "https://github.com/OWASP/cve-lite-cli/blob/main/docs/rules/OA010.md" },
|
|
14
15
|
{ id: "PD001", name: "OverrideOnlyPhantom", shortDescription: "Package imported in source but only present via override pin - declare it as a dependency", helpUri: "https://github.com/OWASP/cve-lite-cli/blob/main/docs/rules/PD001.md" },
|
|
15
16
|
{ id: "PD002", name: "TransitiveOnlyPhantom", shortDescription: "Package imported in source but only present as a transitive dependency - declare it explicitly", helpUri: "https://github.com/OWASP/cve-lite-cli/blob/main/docs/rules/PD002.md" },
|
|
16
17
|
];
|