cve-lite-cli 1.34.0 → 1.36.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 +34 -0
- package/dist/cli/advisories-init.js +13 -0
- package/dist/cli/advisories-sync.js +30 -0
- package/dist/cli/config-command.js +15 -0
- package/dist/cli/config.js +29 -0
- package/dist/cli/help.js +4 -4
- package/dist/cli/overrides.js +10 -1
- package/dist/constants.js +52 -0
- package/dist/index.js +25 -719
- package/dist/osv/cache.js +19 -12
- package/dist/output/cyclonedx.js +12 -0
- package/dist/output/html-reporter.js +73 -38
- 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 +460 -288
- package/dist/output/sarif.js +17 -1
- package/dist/output/sbom-dependency-edges.js +29 -19
- 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 +132 -147
- package/dist/parsers/multi-package.js +5 -6
- package/dist/parsers/pnpm-lock-graph.js +94 -0
- package/dist/parsers/pnpm-lock.js +5 -5
- package/dist/parsers/yarn-lock-graph.js +148 -0
- package/dist/parsers/yarn-lock.js +3 -3
- package/dist/remediation/fix-commands.js +76 -20
- package/dist/scan/completeness.js +1 -1
- package/dist/scan/single-scan.js +643 -0
- package/dist/scanner.js +29 -8
- package/dist/utils/file.js +11 -14
- package/dist/utils/network.js +4 -0
- package/dist/utils/version.js +10 -0
- package/package.json +2 -1
- package/scripts/pr-scan-delta.mjs +315 -0
package/dist/osv/cache.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import { CACHE_TTL_MS } from "../constants.js";
|
|
5
5
|
function createEmptyCache() {
|
|
6
|
-
return { version:
|
|
6
|
+
return { version: 6, createdAt: new Date().toISOString(), entries: {}, queryEntries: {}, npmVersionEntries: {}, npmAdvisoryEntries: {} };
|
|
7
7
|
}
|
|
8
8
|
// v4 stores detail records as { vuln, cachedAt }. v1-v3 stored the OsvVuln (or
|
|
9
9
|
// null for a known-empty lookup) directly, with no timestamp. Legacy records are
|
|
@@ -53,12 +53,15 @@ export function loadCache(cacheDirOverride, debugLog) {
|
|
|
53
53
|
debugLog?.("Cache load failed", { path: filePath, reason: "invalid root object" });
|
|
54
54
|
return createEmptyCache();
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
// Compare cumulatively rather than listing each version. An explicit list has to
|
|
57
|
+
// be extended at every bump, and missing one silently discards that whole section
|
|
58
|
+
// of the cache instead of failing.
|
|
59
|
+
const version = typeof parsed.version === "number" ? parsed.version : 0;
|
|
57
60
|
const rawEntries = parsed.entries;
|
|
58
|
-
// Detail records: v4
|
|
61
|
+
// Detail records: v4 onward already carry { vuln, cachedAt }; v1-v3 stored the record
|
|
59
62
|
// directly and are wrapped (and backdated) so the TTL applies uniformly.
|
|
60
|
-
const entries = version
|
|
61
|
-
// Query records: v2 stored string[]; v3
|
|
63
|
+
const entries = version >= 4 ? readDetailEntries(rawEntries) : wrapLegacyDetailEntries(rawEntries);
|
|
64
|
+
// Query records: v2 stored string[]; v3 onward store { vulnIds, cachedAt }; v1/unknown had none.
|
|
62
65
|
const queryEntries = {};
|
|
63
66
|
if (version === 2) {
|
|
64
67
|
const rawQuery = parsed.queryEntries;
|
|
@@ -67,7 +70,7 @@ export function loadCache(cacheDirOverride, debugLog) {
|
|
|
67
70
|
queryEntries[key] = { vulnIds: Array.isArray(vulnIds) ? vulnIds : [], cachedAt: epoch };
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
else if (version
|
|
73
|
+
else if (version >= 3) {
|
|
71
74
|
const rawQuery = parsed.queryEntries;
|
|
72
75
|
for (const [key, value] of Object.entries(rawQuery ?? {})) {
|
|
73
76
|
if (value && typeof value === "object" && "vulnIds" in value && "cachedAt" in value) {
|
|
@@ -77,7 +80,7 @@ export function loadCache(cacheDirOverride, debugLog) {
|
|
|
77
80
|
}
|
|
78
81
|
// npm publish-date records exist from v3 onward.
|
|
79
82
|
const npmVersionEntries = {};
|
|
80
|
-
if (version
|
|
83
|
+
if (version >= 3) {
|
|
81
84
|
const rawNpmVersions = parsed.npmVersionEntries;
|
|
82
85
|
for (const [key, value] of Object.entries(rawNpmVersions ?? {})) {
|
|
83
86
|
if (value && typeof value === "object" && "publishedAt" in value && "cachedAt" in value) {
|
|
@@ -85,18 +88,22 @@ export function loadCache(cacheDirOverride, debugLog) {
|
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
// npm advisory entries exist from v5 onward.
|
|
91
|
+
// npm advisory entries exist from v5 onward, but v5 stored ids only. Those
|
|
92
|
+
// records cannot be reused: the advisory detail they refer to lives in the npm
|
|
93
|
+
// registry namespace, so a later scan reading a v5 record had ids it could not
|
|
94
|
+
// resolve and silently dropped them from the findings. v6 stores the advisories
|
|
95
|
+
// themselves; v5 records are discarded so the next scan refetches them.
|
|
89
96
|
const npmAdvisoryEntries = {};
|
|
90
|
-
if (version
|
|
97
|
+
if (version >= 6) {
|
|
91
98
|
const raw = parsed.npmAdvisoryEntries;
|
|
92
99
|
for (const [key, value] of Object.entries(raw ?? {})) {
|
|
93
|
-
if (value && typeof value === "object" && "
|
|
100
|
+
if (value && typeof value === "object" && "vulns" in value && "cachedAt" in value) {
|
|
94
101
|
npmAdvisoryEntries[key] = value;
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
const loaded = {
|
|
99
|
-
version:
|
|
106
|
+
version: 6,
|
|
100
107
|
createdAt: String(parsed.createdAt ?? new Date().toISOString()),
|
|
101
108
|
entries,
|
|
102
109
|
queryEntries,
|
|
@@ -107,7 +114,7 @@ export function loadCache(cacheDirOverride, debugLog) {
|
|
|
107
114
|
path: filePath,
|
|
108
115
|
queryEntries: Object.keys(loaded.queryEntries).length,
|
|
109
116
|
detailEntries: Object.keys(loaded.entries).length,
|
|
110
|
-
...(version ===
|
|
117
|
+
...(version === 6 ? {} : { migratedFrom: version || "unknown" }),
|
|
111
118
|
});
|
|
112
119
|
return loaded;
|
|
113
120
|
}
|
package/dist/output/cyclonedx.js
CHANGED
|
@@ -38,6 +38,17 @@ export function buildCycloneDxBom(allPackages, findings, projectMeta, version, p
|
|
|
38
38
|
for (const [cveId, { finding, affects }] of vulnMap) {
|
|
39
39
|
const runnableFixCommand = plan ? findSuggestedCommandForFinding(plan, finding) : null;
|
|
40
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);
|
|
41
52
|
vulnerabilities.push({
|
|
42
53
|
id: cveId,
|
|
43
54
|
source: {
|
|
@@ -47,6 +58,7 @@ export function buildCycloneDxBom(allPackages, findings, projectMeta, version, p
|
|
|
47
58
|
ratings: [{ severity: finding.severity, method: "other" }],
|
|
48
59
|
affects,
|
|
49
60
|
recommendation,
|
|
61
|
+
...(properties.length > 0 ? { properties } : {}),
|
|
50
62
|
});
|
|
51
63
|
}
|
|
52
64
|
const metadata = {
|
|
@@ -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}
|
|
@@ -337,19 +339,23 @@ ${duplicatePackagesHtml}
|
|
|
337
339
|
<thead>
|
|
338
340
|
<tr>
|
|
339
341
|
<th style="width:32px"></th>
|
|
340
|
-
<th onclick="sortBy('package')">Package <span class="sort-arrow">↕</span></th>
|
|
341
|
-
<th>
|
|
342
|
-
<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>
|
|
343
351
|
<th title="Exploit Prediction Scoring System - likelihood of exploitation in the next 30 days, relative to all CVEs (FIRST.org)">EPSS</th>
|
|
344
352
|
<th>EPSS Priority</th>
|
|
345
|
-
<th
|
|
346
|
-
<th>Root</th>
|
|
347
|
-
<th>CVE / Advisory</th>
|
|
353
|
+
<th>IDs</th>
|
|
348
354
|
</tr>
|
|
349
355
|
</thead>
|
|
350
356
|
<tbody id="findings-tbody">
|
|
351
357
|
${findingRowsHtml}
|
|
352
|
-
<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>
|
|
353
359
|
</tbody>
|
|
354
360
|
</table>
|
|
355
361
|
${renderPriorityLegendHtml(data.findings)}
|
|
@@ -434,8 +440,11 @@ function applyFilters() {
|
|
|
434
440
|
function sortBy(col) {
|
|
435
441
|
if (sortCol === col) { sortAsc = !sortAsc; } else { sortCol = col; sortAsc = col === 'package'; }
|
|
436
442
|
document.querySelectorAll('.findings-table thead th').forEach(th => th.classList.remove('sorted'));
|
|
437
|
-
|
|
438
|
-
|
|
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');
|
|
439
448
|
|
|
440
449
|
const tbody = document.getElementById('findings-tbody');
|
|
441
450
|
const indexedFindings = reportData.findings.map((f, i) => ({ f, i }));
|
|
@@ -568,6 +577,27 @@ function renderPriorityColumnHtml(priority) {
|
|
|
568
577
|
const cssClass = priority.replace(/_/g, "-");
|
|
569
578
|
return `<span class="priority-badge ${escapeHtml(cssClass)}">${escapeHtml(label)}</span>`;
|
|
570
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
|
+
}
|
|
571
601
|
export function renderFindingRow(finding, idx, skippedKeys) {
|
|
572
602
|
const cveLinks = finding.cves.length > 0
|
|
573
603
|
? finding.cves.map(advisoryLink).join(", ")
|
|
@@ -588,12 +618,7 @@ export function renderFindingRow(finding, idx, skippedKeys) {
|
|
|
588
618
|
: isMalicious
|
|
589
619
|
? `<span class="fix-hint none" title="Malicious code advisory — remove this package">⚠ Malicious</span>`
|
|
590
620
|
: `<span class="fix-hint none" title="No known fix — consider replacing this package">⚠ No fix</span>`;
|
|
591
|
-
const
|
|
592
|
-
? finding.dependencyPaths[0].map((node, i, arr) => {
|
|
593
|
-
const isLast = i === arr.length - 1;
|
|
594
|
-
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>'}`;
|
|
595
|
-
}).join("")
|
|
596
|
-
: `<span class="dep-node">${escapeHtml(finding.package)}</span>`;
|
|
621
|
+
const depPaths = renderDependencyPathsHtml(finding);
|
|
597
622
|
const description = finding.vulnerabilities[0]?.summary ?? "";
|
|
598
623
|
const runnable = finding.runnableFixCommand ?? null;
|
|
599
624
|
const recommendedActionHtml = runnable
|
|
@@ -610,27 +635,47 @@ export function renderFindingRow(finding, idx, skippedKeys) {
|
|
|
610
635
|
: `<span class="root-dep-none">-</span>`;
|
|
611
636
|
const epssHtml = renderEpssColumnHtml(finding.epssScores);
|
|
612
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>`;
|
|
613
654
|
return `<tr id="row-${idx}" data-skipped="${isSkipped ? '1' : '0'}" onclick="toggleRow(${idx})">
|
|
614
655
|
<td><span class="expand-icon" id="icon-${idx}">▶</span></td>
|
|
615
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>
|
|
616
|
-
<td>${fixHtml}</td>
|
|
617
657
|
<td><span class="sev-badge ${escapeHtml(finding.severity)}">${escapeHtml(finding.severity)}</span></td>
|
|
618
|
-
<td>${epssHtml}</td>
|
|
619
|
-
<td>${priorityHtml}</td>
|
|
620
658
|
<td>${renderRelBadge(finding)}</td>
|
|
621
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>
|
|
622
667
|
<td>${cveLinks}</td>
|
|
623
668
|
</tr>
|
|
624
669
|
<tr id="detail-${idx}" class="detail-row">
|
|
625
|
-
<td colspan="
|
|
670
|
+
<td colspan="13">
|
|
626
671
|
<div class="expanded-inner">
|
|
627
672
|
<div class="detail-col" style="max-width:320px">
|
|
628
673
|
<h4>Description</h4>
|
|
629
674
|
<p>${escapeHtml(description)}</p>
|
|
630
675
|
</div>
|
|
631
676
|
<div class="detail-col" style="max-width:320px">
|
|
632
|
-
<h4
|
|
633
|
-
|
|
677
|
+
<h4>${depPaths.heading}</h4>
|
|
678
|
+
${depPaths.html}
|
|
634
679
|
</div>
|
|
635
680
|
${contextColHtml}
|
|
636
681
|
<div class="detail-col">
|
|
@@ -831,9 +876,9 @@ export function renderFixPlan(plan) {
|
|
|
831
876
|
const statsHtml = t.scannedVersions != null
|
|
832
877
|
? ` <span class="fix-target-stats">${t.scannedVersions} scanned${t.knownVulnerableVersions != null ? ` · ${t.knownVulnerableVersions} still vulnerable` : ""}</span>`
|
|
833
878
|
: "";
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
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.
|
|
837
882
|
const cooldownHtml = t.cooldownWarning
|
|
838
883
|
? ` <span class="fix-target-note">${escapeHtml(formatCooldownWarning(t.cooldownWarning))}</span>`
|
|
839
884
|
: "";
|
|
@@ -843,24 +888,14 @@ export function renderFixPlan(plan) {
|
|
|
843
888
|
const coverageHtml = t.coverage === "partial"
|
|
844
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>`
|
|
845
890
|
: "";
|
|
846
|
-
|
|
847
|
-
? (() => {
|
|
848
|
-
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)}`);
|
|
849
|
-
const safe = escapeHtml(t.chainSafeVersion);
|
|
850
|
-
const proofText = hops.length > 0
|
|
851
|
-
? `resolves via ${hops.join(" -> ")} -> ${safe} (safe)`
|
|
852
|
-
: `resolves to ${safe} (safe)`;
|
|
853
|
-
return ` <span class="chain-proof">${proofText}</span>`;
|
|
854
|
-
})()
|
|
855
|
-
: "";
|
|
856
|
-
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>`;
|
|
857
892
|
}).join("\n");
|
|
858
893
|
const targetsHtml = section.targets.length > 0
|
|
859
894
|
? `<div class="fix-targets-list">${targetRows}</div>`
|
|
860
895
|
: "";
|
|
861
896
|
return `
|
|
862
897
|
<div class="fix-cmd">
|
|
863
|
-
<span class="cmd-text">${escapeHtml(
|
|
898
|
+
<span class="cmd-text">${escapeHtml(section.command)}</span>
|
|
864
899
|
<span class="cmd-meta">${escapeHtml(section.title)}</span>
|
|
865
900
|
<button class="copy-btn" data-cmd="${escapeHtml(section.command)}">Copy</button>
|
|
866
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
|
];
|