cve-lite-cli 1.37.0 → 1.38.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 +20 -1
- package/dist/cli/args.js +120 -103
- package/dist/cli/flags.js +39 -0
- package/dist/cli/help.js +6 -3
- package/dist/cli/overrides.js +25 -19
- package/dist/cli/validate.js +31 -9
- package/dist/index.js +6 -1
- package/dist/output/compact-truncation.js +35 -0
- package/dist/output/formatters.js +10 -2
- package/dist/output/html-reporter.js +24 -12
- package/dist/output/multi-folder-html-reporter.js +26 -7
- package/dist/output/override-findings-html.js +24 -3
- package/dist/output/override-findings-json.js +5 -2
- package/dist/output/override-findings-sarif.js +1 -0
- package/dist/output/override-findings-terminal.js +21 -1
- package/dist/output/printers.js +34 -21
- package/dist/output/sarif.js +54 -3
- package/dist/output/scan-json.js +74 -0
- package/dist/output/skipped-override-rules.js +41 -0
- package/dist/output/write-outputs.js +16 -28
- package/dist/overrides/admitted-scan.js +12 -1
- package/dist/overrides/api.js +75 -21
- package/dist/overrides/context-builder.js +17 -2
- package/dist/overrides/detectors/index.js +2 -0
- package/dist/overrides/detectors/oa008-materialized.js +72 -13
- package/dist/overrides/detectors/oa009-stale-floor.js +12 -15
- package/dist/overrides/detectors/oa010-vulnerable-floor.js +5 -1
- package/dist/overrides/detectors/oa011-exceeds-range.js +128 -0
- package/dist/overrides/detectors/pd001-override-only-phantom.js +5 -4
- package/dist/overrides/detectors/pd002-transitive-only-phantom.js +5 -4
- package/dist/overrides/detectors/phantom-utils.js +29 -0
- package/dist/overrides/parsing/registry.js +79 -10
- package/dist/scan/multi-folder-scan.js +65 -51
- package/dist/scan/override-audit.js +49 -0
- package/dist/scan/single-scan.js +108 -33
- package/dist/scanner.js +8 -4
- package/dist/skills/content.js +4 -2
- package/dist/usage/scanner.js +219 -28
- package/dist/utils/contextual-signals.js +193 -0
- package/dist/utils/finding.js +5 -0
- package/dist/utils/package-json.js +66 -14
- package/dist/utils/severity.js +22 -0
- package/dist/utils/update-check.js +2 -1
- package/dist/utils/version.js +33 -19
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import os from "node:os";
|
|
|
4
4
|
import { chalk, stripAnsi } from "./chalk.js";
|
|
5
5
|
import { getCliVersion } from "./version-info.js";
|
|
6
6
|
const NPM_REGISTRY_URL = "https://registry.npmjs.org/cve-lite-cli/latest";
|
|
7
|
+
const NPM_INSTALL_COMMAND = "npm install -g cve-lite-cli";
|
|
7
8
|
const CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
8
9
|
const BOX_INNER_WIDTH = 50;
|
|
9
10
|
export function isNewer(latest, current) {
|
|
@@ -75,7 +76,7 @@ function renderBox(current, latest) {
|
|
|
75
76
|
const empty = chalk.yellow("│") + " ".repeat(BOX_INNER_WIDTH) + chalk.yellow("│");
|
|
76
77
|
const bottom = chalk.yellow("╰" + "─".repeat(BOX_INNER_WIDTH) + "╯");
|
|
77
78
|
const line1 = ` ${chalk.bold.yellow("Update available!")} ${chalk.gray(current)} ${chalk.yellow("→")} ${chalk.green(latest)}`;
|
|
78
|
-
const line2 = ` ${chalk.white("Run:
|
|
79
|
+
const line2 = ` ${chalk.white("Run: " + NPM_INSTALL_COMMAND)}`;
|
|
79
80
|
const padLine = (content) => {
|
|
80
81
|
const visual = stripAnsi(content).length;
|
|
81
82
|
return chalk.yellow("│") + content + " ".repeat(Math.max(0, BOX_INNER_WIDTH - visual)) + chalk.yellow("│");
|
package/dist/utils/version.js
CHANGED
|
@@ -225,29 +225,43 @@ export function isValidRange(input) {
|
|
|
225
225
|
/**
|
|
226
226
|
* Does `version` satisfy `range`?
|
|
227
227
|
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
* path, and it survived here because the old implementation ran the version
|
|
232
|
-
* through `coerceVersion` first, which strips the pre-release tag and made the
|
|
233
|
-
* beta compare equal to the release.
|
|
234
|
-
*
|
|
235
|
-
* Messy inputs (`v1.2.3`, `2.0`) fall back to `coerceVersion`, which is kept
|
|
236
|
-
* for exactly that: lockfiles and manifests carry version strings semver will
|
|
237
|
-
* not parse.
|
|
228
|
+
* Delegates normalization and comparison to `positionAgainstRange` so
|
|
229
|
+
* prerelease handling and coercion stay on one path. Uninterpretable input
|
|
230
|
+
* returns false because `positionAgainstRange` returns null.
|
|
238
231
|
*/
|
|
239
232
|
export function satisfiesRange(version, range) {
|
|
233
|
+
return positionAgainstRange(version, range) === "satisfies";
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Classify a concrete version relative to the complete set represented by a
|
|
237
|
+
* semver range. "outside" covers gaps in compound/union ranges: for example,
|
|
238
|
+
* 2.0.0 is neither globally below nor globally above `1.x || 3.x`.
|
|
239
|
+
*
|
|
240
|
+
* Returns null when either input cannot be interpreted as semver. Callers that
|
|
241
|
+
* already validate their inputs can treat null conservatively as "outside".
|
|
242
|
+
*/
|
|
243
|
+
export function positionAgainstRange(version, range) {
|
|
240
244
|
if (!version || !range)
|
|
241
|
-
return
|
|
245
|
+
return null;
|
|
242
246
|
const parsed = semver.parse(version.trim(), { loose: true });
|
|
243
247
|
const normalizedVersion = parsed ? parsed.version : coerceVersion(version);
|
|
244
|
-
if (!normalizedVersion)
|
|
245
|
-
return false;
|
|
246
248
|
const trimmedRange = range.trim();
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
249
|
+
// validRange only GUARDS here. Its normalized output is computed without
|
|
250
|
+
// includePrerelease, which rewrites prerelease bounds and would silently
|
|
251
|
+
// change the classification below, so the comparisons take the raw range.
|
|
252
|
+
if (!normalizedVersion || !semver.validRange(trimmedRange, { loose: true }))
|
|
253
|
+
return null;
|
|
254
|
+
const options = { loose: true, includePrerelease: true };
|
|
255
|
+
try {
|
|
256
|
+
if (semver.satisfies(normalizedVersion, trimmedRange, options))
|
|
257
|
+
return "satisfies";
|
|
258
|
+
if (semver.ltr(normalizedVersion, trimmedRange, options))
|
|
259
|
+
return "below";
|
|
260
|
+
if (semver.gtr(normalizedVersion, trimmedRange, options))
|
|
261
|
+
return "above";
|
|
262
|
+
return "outside";
|
|
263
|
+
}
|
|
264
|
+
catch {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
253
267
|
}
|