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
|
@@ -112,6 +112,7 @@ export function buildSuggestedFixCommandPlan(findings, scanInput, options) {
|
|
|
112
112
|
targetVersion: directTarget,
|
|
113
113
|
scannedVersions: finding.validatedTargetScannedVersions ?? null,
|
|
114
114
|
knownVulnerableVersions: finding.validatedTargetKnownVulnerableVersions ?? null,
|
|
115
|
+
advisoryVersion: finding.firstFixedVersion ?? null,
|
|
115
116
|
kind: "direct",
|
|
116
117
|
urgent,
|
|
117
118
|
severity: finding.severity,
|
|
@@ -474,7 +475,19 @@ export function findFixTargetForFinding(plan, finding) {
|
|
|
474
475
|
item.targetVersion === finding.chainResolution.targetVersion);
|
|
475
476
|
}
|
|
476
477
|
const directTarget = finding.validatedFirstFixedVersion ?? finding.firstFixedVersion;
|
|
477
|
-
|
|
478
|
+
if (item.package !== finding.pkg.name)
|
|
479
|
+
return false;
|
|
480
|
+
if (item.targetVersion === directTarget)
|
|
481
|
+
return true;
|
|
482
|
+
// Mirrors the recommendedParentUpgrade branch above: a command targeting a
|
|
483
|
+
// higher version also satisfies a lower-version fix. This is the merged case,
|
|
484
|
+
// where a package is both a direct finding and the parent of other findings,
|
|
485
|
+
// so the plan installs a higher version than this finding alone requires.
|
|
486
|
+
// Targets are unique per package name, so this cannot select a different package.
|
|
487
|
+
return (!!directTarget &&
|
|
488
|
+
looksLikeVersion(item.targetVersion) &&
|
|
489
|
+
looksLikeVersion(directTarget) &&
|
|
490
|
+
compareVersions(item.targetVersion, directTarget) >= 0);
|
|
478
491
|
});
|
|
479
492
|
return target ?? null;
|
|
480
493
|
}
|
|
@@ -555,9 +568,22 @@ function upsertTarget(targetsByPackage, next) {
|
|
|
555
568
|
: existing.confidence ?? next.confidence,
|
|
556
569
|
};
|
|
557
570
|
if (looksLikeVersion(existing.targetVersion) && looksLikeVersion(next.targetVersion)) {
|
|
558
|
-
|
|
571
|
+
const comparison = compareVersions(next.targetVersion, existing.targetVersion);
|
|
572
|
+
if (comparison > 0) {
|
|
559
573
|
merged.targetVersion = next.targetVersion;
|
|
560
574
|
merged.currentVersion = next.currentVersion ?? merged.currentVersion;
|
|
575
|
+
// An explicit command is built for one specific version (a chain-resolution
|
|
576
|
+
// command, say). Once the merge raises the target, a command built for the
|
|
577
|
+
// lower version would hand the user a version the scan already found still
|
|
578
|
+
// vulnerable, so it must not survive. Clearing it falls through to buildTargetCommand
|
|
579
|
+
// deriving the command from targetVersion.
|
|
580
|
+
merged.command = next.command ?? undefined;
|
|
581
|
+
// The adjustment note narrates one specific version ("using lowest known
|
|
582
|
+
// non-vulnerable version 4.20.0"). It belongs to whichever target won the
|
|
583
|
+
// comparison, so inheriting the loser's leaves a note contradicting the
|
|
584
|
+
// Target column it is printed beside.
|
|
585
|
+
merged.adjustmentNote = next.adjustmentNote ?? null;
|
|
586
|
+
merged.advisoryVersion = next.advisoryVersion ?? existing.advisoryVersion ?? null;
|
|
561
587
|
// Keep the reason from the higher-severity finding so the most critical issue is visible
|
|
562
588
|
// in the context column. Only update the reason if next has strictly higher severity.
|
|
563
589
|
if (severityOrder[next.severity] > severityOrder[existing.severity]) {
|
|
@@ -567,6 +593,13 @@ function upsertTarget(targetsByPackage, next) {
|
|
|
567
593
|
merged.knownVulnerableVersions = next.knownVulnerableVersions ?? merged.knownVulnerableVersions ?? null;
|
|
568
594
|
merged.fixVersionPublishedAt = next.fixVersionPublishedAt ?? merged.fixVersionPublishedAt ?? null;
|
|
569
595
|
}
|
|
596
|
+
else if (comparison < 0) {
|
|
597
|
+
// Mirror case: the existing target wins, so a command or note built for the
|
|
598
|
+
// lower incoming version is equally stale and must not be inherited.
|
|
599
|
+
merged.command = existing.command ?? undefined;
|
|
600
|
+
merged.adjustmentNote = existing.adjustmentNote ?? null;
|
|
601
|
+
merged.advisoryVersion = existing.advisoryVersion ?? next.advisoryVersion ?? null;
|
|
602
|
+
}
|
|
570
603
|
targetsByPackage.set(next.package, merged);
|
|
571
604
|
return;
|
|
572
605
|
}
|
|
@@ -661,21 +694,29 @@ function buildSections(targets, packageManager) {
|
|
|
661
694
|
key: `${entry.kind}:${entry.severity}`,
|
|
662
695
|
kind: entry.kind,
|
|
663
696
|
severity: entry.severity,
|
|
664
|
-
title: buildSectionTitle(entry.kind, entry.severity),
|
|
697
|
+
title: buildSectionTitle(entry.kind, entry.severity, sectionTargets),
|
|
665
698
|
command: buildCommandForTargets(sectionTargets, packageManager),
|
|
666
699
|
targets: sectionTargets,
|
|
667
700
|
});
|
|
668
701
|
}
|
|
669
702
|
return groups;
|
|
670
703
|
}
|
|
671
|
-
function buildSectionTitle(kind, severity) {
|
|
704
|
+
function buildSectionTitle(kind, severity, targets = []) {
|
|
672
705
|
const severityTitle = severity === "unknown"
|
|
673
706
|
? "Unknown severity"
|
|
674
707
|
: `${capitalize(severity)} severity`;
|
|
708
|
+
// Every other kind names the table it produces, and the renderer picks the table
|
|
709
|
+
// from the target kinds. An urgent section can hold either kind, so a fixed
|
|
710
|
+
// "fix commands" title described a direct-fix table in one project and a
|
|
711
|
+
// parent-upgrade table in another. Name what the reader will actually see.
|
|
675
712
|
if (kind === "urgent") {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
713
|
+
const hasDirect = targets.some(target => target.kind === "direct");
|
|
714
|
+
const hasParent = targets.some(target => target.kind === "parent-upgrade" || target.kind === "parent-update");
|
|
715
|
+
if (hasDirect && !hasParent)
|
|
716
|
+
return `${severityTitle} direct fixes`;
|
|
717
|
+
if (hasParent && !hasDirect)
|
|
718
|
+
return `${severityTitle} parent upgrades`;
|
|
719
|
+
return `${severityTitle} fix commands`;
|
|
679
720
|
}
|
|
680
721
|
if (kind === "direct") {
|
|
681
722
|
return `${severityTitle} direct fixes`;
|
|
@@ -119,7 +119,9 @@ export async function resolvePublishedFixVersion(packageName, fixedVersionHint)
|
|
|
119
119
|
}
|
|
120
120
|
const publishedVersions = Object.keys(packument.versions ?? {})
|
|
121
121
|
.filter(looksLikeVersion)
|
|
122
|
+
.filter(version => !isPreReleaseVersion(version))
|
|
122
123
|
.sort(compareVersions);
|
|
124
|
+
const fixedVersionHintIsPreRelease = isPreReleaseVersion(fixedVersionHint);
|
|
123
125
|
if (publishedVersions.includes(fixedVersionHint)) {
|
|
124
126
|
return {
|
|
125
127
|
resolvedVersion: fixedVersionHint,
|
|
@@ -135,7 +137,9 @@ export async function resolvePublishedFixVersion(packageName, fixedVersionHint)
|
|
|
135
137
|
if (nearestPublishedVersion) {
|
|
136
138
|
return {
|
|
137
139
|
resolvedVersion: nearestPublishedVersion,
|
|
138
|
-
note:
|
|
140
|
+
note: fixedVersionHintIsPreRelease
|
|
141
|
+
? `Advisory fixed-version hint ${fixedVersionHint} is a pre-release; using nearest published non-pre-release version ${nearestPublishedVersion}.`
|
|
142
|
+
: `Advisory fixed-version hint ${fixedVersionHint} is not published on npm for ${packageName}; using nearest published version ${nearestPublishedVersion}.`,
|
|
139
143
|
verified: true,
|
|
140
144
|
candidatesChecked: 0,
|
|
141
145
|
candidatesKnownVulnerable: 0,
|
|
@@ -145,7 +149,9 @@ export async function resolvePublishedFixVersion(packageName, fixedVersionHint)
|
|
|
145
149
|
}
|
|
146
150
|
return {
|
|
147
151
|
resolvedVersion: null,
|
|
148
|
-
note:
|
|
152
|
+
note: fixedVersionHintIsPreRelease
|
|
153
|
+
? `Advisory fixed-version hint ${fixedVersionHint} is a pre-release, and no published non-pre-release version >= ${fixedVersionHint} was found for ${packageName}.`
|
|
154
|
+
: `Advisory fixed-version hint ${fixedVersionHint} is not published on npm for ${packageName}, and no published version >= ${fixedVersionHint} was found.`,
|
|
149
155
|
verified: true,
|
|
150
156
|
candidatesChecked: 0,
|
|
151
157
|
candidatesKnownVulnerable: 0,
|
|
@@ -48,6 +48,7 @@ export function aggregateMultiFolderCompleteness(results) {
|
|
|
48
48
|
return { complete: deduped.size === 0, diagnostics: [...deduped.values()] };
|
|
49
49
|
}
|
|
50
50
|
export function shouldFailForIncompleteScan(completeness, policy) {
|
|
51
|
+
// only "error" triggers a non-zero exit; "warn" (the default) still surfaces the diagnostic but lets the scan succeed
|
|
51
52
|
if (policy !== "error") {
|
|
52
53
|
return false;
|
|
53
54
|
}
|