cve-lite-cli 1.26.0 → 1.28.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 +147 -398
- package/dist/advisory/osv-advisory-source.js +5 -3
- package/dist/cli/advisories-init.js +24 -0
- package/dist/cli/args.js +36 -0
- package/dist/cli/help.js +9 -5
- package/dist/cli/overrides.js +20 -16
- package/dist/constants.js +1 -0
- package/dist/index.js +61 -39
- package/dist/maintenance/dm001-maintenance-risk.js +63 -0
- package/dist/maintenance/types.js +1 -0
- package/dist/osv/cache.js +49 -50
- package/dist/output/debug.js +2 -1
- package/dist/output/formatters.js +17 -3
- package/dist/output/html-reporter.js +156 -102
- package/dist/output/logos.js +1 -1
- package/dist/output/maintenance-findings-html.js +56 -0
- package/dist/output/maintenance-findings-json.js +3 -0
- package/dist/output/maintenance-terminal.js +80 -0
- package/dist/output/override-findings-html.js +24 -28
- package/dist/output/override-findings-sarif.js +34 -24
- package/dist/output/override-findings-terminal.js +19 -2
- package/dist/output/printers.js +19 -6
- package/dist/output/sarif.js +14 -6
- package/dist/output/spinner.js +5 -0
- package/dist/output/write-outputs.js +3 -1
- package/dist/overrides/context-builder.js +29 -0
- package/dist/overrides/detectors/index.js +6 -0
- package/dist/overrides/detectors/oa009-stale-floor.js +80 -0
- package/dist/overrides/detectors/pd001-override-only-phantom.js +32 -0
- package/dist/overrides/detectors/pd002-transitive-only-phantom.js +34 -0
- package/dist/overrides/detectors/phantom-utils.js +21 -0
- package/dist/overrides/fixer.js +21 -1
- package/dist/remediation/cooldown.js +74 -0
- package/dist/remediation/fix-commands.js +42 -2
- package/dist/remediation/npm-registry.js +11 -0
- package/dist/remediation/parent-upgrade.js +114 -18
- package/dist/scan/multi-folder-scan.js +35 -10
- package/dist/scanner.js +86 -22
- package/dist/usage/scanner.js +60 -1
- package/dist/utils/network.js +77 -0
- package/dist/utils/sarif.js +4 -0
- package/dist/utils/severity.js +6 -0
- package/package.json +2 -1
package/dist/scanner.js
CHANGED
|
@@ -18,6 +18,8 @@ import { buildPnpmWorkspaceMap } from "./parsers/pnpm-lock.js";
|
|
|
18
18
|
import { buildNpmWorkspaceMap } from "./parsers/package-lock.js";
|
|
19
19
|
import { buildBunWorkspaceMap } from "./parsers/bun-lock.js";
|
|
20
20
|
import { pluralize } from "./utils/string.js";
|
|
21
|
+
import { extractErrorMessage } from "./utils/network.js";
|
|
22
|
+
import { logWarn } from "./output/formatters.js";
|
|
21
23
|
export function createAdvisorySource(options) {
|
|
22
24
|
const offline = !!options?.offline || !!options?.offlineDb;
|
|
23
25
|
if (offline) {
|
|
@@ -33,7 +35,7 @@ export function createAdvisorySource(options) {
|
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
return {
|
|
36
|
-
advisorySource: new OsvAdvisorySource(options?.osvUrl, options?.debugLog),
|
|
38
|
+
advisorySource: new OsvAdvisorySource(options?.osvUrl, options?.debugLog, options?.fetchImpl),
|
|
37
39
|
offline: false,
|
|
38
40
|
sourceLabel: options?.osvUrl
|
|
39
41
|
? `custom OSV endpoint (${options.osvUrl})`
|
|
@@ -57,13 +59,22 @@ function inferPackageManagerForChain(source) {
|
|
|
57
59
|
return "bun";
|
|
58
60
|
return null;
|
|
59
61
|
}
|
|
60
|
-
|
|
62
|
+
function isTransientFailure(error) {
|
|
63
|
+
if (!(error instanceof Error))
|
|
64
|
+
return true;
|
|
65
|
+
const msg = error.message;
|
|
66
|
+
if (msg.includes(" 404 ") || msg.includes(" 410 "))
|
|
67
|
+
return false;
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
export async function scanPackages(packages, batchSize, options, context, debugLog, fetchImpl) {
|
|
61
71
|
const log = debugLog ?? (() => { });
|
|
62
72
|
const sourceContext = createAdvisorySource({
|
|
63
73
|
osvUrl: options.osvUrl,
|
|
64
74
|
offline: options.offline,
|
|
65
75
|
offlineDb: options.offlineDb,
|
|
66
76
|
debugLog: log,
|
|
77
|
+
fetchImpl,
|
|
67
78
|
});
|
|
68
79
|
const offline = sourceContext.offline;
|
|
69
80
|
const cacheDirOverride = options.cacheDir;
|
|
@@ -151,42 +162,57 @@ export async function scanPackages(packages, batchSize, options, context, debugL
|
|
|
151
162
|
}
|
|
152
163
|
const idSet = new Set(results.flatMap(r => r.vulnIds));
|
|
153
164
|
const vulnMap = new Map();
|
|
165
|
+
const transientDetailIds = new Set();
|
|
166
|
+
const offlineMissingDetailIds = new Set();
|
|
154
167
|
if (idSet.size > 0 && !offline) {
|
|
155
168
|
const ids = [...idSet];
|
|
156
169
|
const detailSpinner = createSpinner("Fetching vulnerability details...", options);
|
|
157
170
|
try {
|
|
158
|
-
|
|
159
|
-
// 30-minute staleness check applied earlier in this function), detail records have no
|
|
160
|
-
// expiry — they are considered valid for the lifetime of the cache file. The check below
|
|
161
|
-
// is therefore a simple presence check, not a staleness check. This is intentional and
|
|
162
|
-
// matches the original behaviour. Fetches run concurrently because there is no ordering
|
|
163
|
-
// dependency between CVE ID detail requests.
|
|
171
|
+
const nowMs = Date.now();
|
|
164
172
|
const uncachedIds = [];
|
|
165
173
|
for (const id of ids) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (cached)
|
|
169
|
-
vulnMap.set(id, cached);
|
|
174
|
+
const cached = cache.entries[id];
|
|
175
|
+
if (cached && !isEntryStale(cached, nowMs)) {
|
|
176
|
+
if (cached.vuln) {
|
|
177
|
+
vulnMap.set(id, cached.vuln);
|
|
178
|
+
}
|
|
170
179
|
}
|
|
171
180
|
else {
|
|
172
181
|
uncachedIds.push(id);
|
|
173
182
|
}
|
|
174
183
|
}
|
|
175
|
-
// Fetch all uncached IDs concurrently
|
|
176
184
|
if (uncachedIds.length > 0) {
|
|
177
185
|
detailSpinner.update(`Fetching ${uncachedIds.length} vulnerability details...`);
|
|
186
|
+
const cachedAt = new Date().toISOString();
|
|
178
187
|
await runWithConcurrency(uncachedIds, 10, async (id) => {
|
|
179
188
|
try {
|
|
180
189
|
const detail = await advisorySource.getVuln(id);
|
|
181
190
|
vulnMap.set(id, detail);
|
|
182
|
-
cache.entries[id] = detail;
|
|
191
|
+
cache.entries[id] = { vuln: detail, cachedAt };
|
|
183
192
|
}
|
|
184
|
-
catch {
|
|
185
|
-
|
|
193
|
+
catch (error) {
|
|
194
|
+
if (isTransientFailure(error)) {
|
|
195
|
+
transientDetailIds.add(id);
|
|
196
|
+
log("OSV detail transient failure", {
|
|
197
|
+
advisoryId: id,
|
|
198
|
+
error: extractErrorMessage(error),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
cache.entries[id] = { vuln: null, cachedAt };
|
|
203
|
+
log("OSV detail confirmed missing", { advisoryId: id });
|
|
204
|
+
}
|
|
186
205
|
}
|
|
187
206
|
});
|
|
188
207
|
}
|
|
189
|
-
|
|
208
|
+
const successCount = ids.filter(id => vulnMap.has(id)).length;
|
|
209
|
+
const failureCount = ids.length - successCount;
|
|
210
|
+
if (failureCount > 0) {
|
|
211
|
+
detailSpinner.warn(`Loaded ${successCount}/${ids.length} vulnerability detail ${pluralize(ids.length, "record")} (${failureCount} ${pluralize(failureCount, "failure")})`);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
detailSpinner.succeed(`Loaded ${ids.length} vulnerability detail ${pluralize(ids.length, "record")}`);
|
|
215
|
+
}
|
|
190
216
|
}
|
|
191
217
|
catch (error) {
|
|
192
218
|
detailSpinner.fail("Failed while fetching vulnerability details");
|
|
@@ -203,10 +229,17 @@ export async function scanPackages(packages, batchSize, options, context, debugL
|
|
|
203
229
|
vulnMap.set(id, detail);
|
|
204
230
|
}
|
|
205
231
|
catch {
|
|
206
|
-
|
|
232
|
+
offlineMissingDetailIds.add(id);
|
|
207
233
|
}
|
|
208
234
|
});
|
|
209
|
-
|
|
235
|
+
const successCount = ids.filter(id => vulnMap.has(id)).length;
|
|
236
|
+
const failureCount = ids.length - successCount;
|
|
237
|
+
if (failureCount > 0) {
|
|
238
|
+
detailSpinner.warn(`Loaded ${successCount}/${ids.length} local advisory detail ${pluralize(ids.length, "record")} (${failureCount} ${pluralize(failureCount, "missing")})`);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
detailSpinner.succeed(`Loaded ${ids.length} local advisory detail ${pluralize(ids.length, "record")}`);
|
|
242
|
+
}
|
|
210
243
|
}
|
|
211
244
|
catch (error) {
|
|
212
245
|
detailSpinner.fail("Failed while loading local advisory details");
|
|
@@ -220,6 +253,7 @@ export async function scanPackages(packages, batchSize, options, context, debugL
|
|
|
220
253
|
const vulnerabilities = result.vulnIds
|
|
221
254
|
.map(id => vulnMap.get(id))
|
|
222
255
|
.filter((v) => Boolean(v));
|
|
256
|
+
const unresolvedIds = result.vulnIds.filter(id => !vulnMap.has(id));
|
|
223
257
|
const severity = maxSeverity(vulnerabilities);
|
|
224
258
|
const cveAliases = unique(vulnerabilities.flatMap(v => (v.aliases ?? []).filter(a => a.startsWith("CVE-"))));
|
|
225
259
|
const dependencyPaths = result.pkg.paths ?? [];
|
|
@@ -240,8 +274,28 @@ export async function scanPackages(packages, batchSize, options, context, debugL
|
|
|
240
274
|
validatedTargetKnownVulnerableVersions: null,
|
|
241
275
|
recommendedParentUpgrade: undefined,
|
|
242
276
|
recommendedNpmTransitiveRemediation: undefined,
|
|
277
|
+
...(unresolvedIds.length > 0 ? { unresolvedAdvisoryIds: unresolvedIds } : {}),
|
|
243
278
|
};
|
|
244
279
|
});
|
|
280
|
+
const unresolvedDetailIds = idSet.size > 0
|
|
281
|
+
? [...idSet].filter(id => !vulnMap.has(id))
|
|
282
|
+
: [];
|
|
283
|
+
if (unresolvedDetailIds.length > 0) {
|
|
284
|
+
const transientCount = unresolvedDetailIds.filter(id => transientDetailIds.has(id)).length;
|
|
285
|
+
const offlineCount = unresolvedDetailIds.filter(id => offlineMissingDetailIds.has(id)).length;
|
|
286
|
+
const otherCount = unresolvedDetailIds.length - transientCount - offlineCount;
|
|
287
|
+
const parts = [];
|
|
288
|
+
if (transientCount > 0) {
|
|
289
|
+
parts.push(`${transientCount} from transient failures — re-run to retry`);
|
|
290
|
+
}
|
|
291
|
+
if (offlineCount > 0) {
|
|
292
|
+
parts.push(`${offlineCount} missing from local advisory database — refresh to sync`);
|
|
293
|
+
}
|
|
294
|
+
if (otherCount > 0) {
|
|
295
|
+
parts.push(`${otherCount} could not be resolved`);
|
|
296
|
+
}
|
|
297
|
+
logWarn(`⚠ ${unresolvedDetailIds.length} advisory detail ${pluralize(unresolvedDetailIds.length, "lookup")} missing from findings. ${parts.join("; ")}.`, { json: options.json });
|
|
298
|
+
}
|
|
245
299
|
for (const finding of findings) {
|
|
246
300
|
if (finding.vulnerabilities.some(v => v.id.startsWith("MAL-"))) {
|
|
247
301
|
if (isGitSource(finding.pkg)) {
|
|
@@ -395,7 +449,7 @@ export async function scanPackages(packages, batchSize, options, context, debugL
|
|
|
395
449
|
targetVersion: finding.recommendedNpmTransitiveRemediation.targetVersion ?? "",
|
|
396
450
|
viaPath: finding.recommendedNpmTransitiveRemediation.viaPath,
|
|
397
451
|
vulnerablePackage: finding.pkg.name,
|
|
398
|
-
confidence: "
|
|
452
|
+
confidence: "verified",
|
|
399
453
|
reason: finding.recommendedNpmTransitiveRemediation.reason,
|
|
400
454
|
};
|
|
401
455
|
continue;
|
|
@@ -432,7 +486,12 @@ export async function scanPackages(packages, batchSize, options, context, debugL
|
|
|
432
486
|
parentUpgradeCache.set(remediationCacheKey, finding.recommendedParentUpgrade ?? null);
|
|
433
487
|
}
|
|
434
488
|
}
|
|
435
|
-
catch {
|
|
489
|
+
catch (error) {
|
|
490
|
+
log("Remediation failed", {
|
|
491
|
+
package: finding.pkg.name,
|
|
492
|
+
version: finding.pkg.version,
|
|
493
|
+
error: error instanceof Error ? error.message : String(error),
|
|
494
|
+
});
|
|
436
495
|
finding.recommendedNpmTransitiveRemediation = undefined;
|
|
437
496
|
finding.recommendedParentUpgrade = undefined;
|
|
438
497
|
}
|
|
@@ -448,7 +507,12 @@ export async function scanPackages(packages, batchSize, options, context, debugL
|
|
|
448
507
|
try {
|
|
449
508
|
finding.chainResolution = await resolveChainFix(finding, installedVersions, chainPm, { offline });
|
|
450
509
|
}
|
|
451
|
-
catch {
|
|
510
|
+
catch (error) {
|
|
511
|
+
log("Chain resolution failed", {
|
|
512
|
+
package: finding.pkg.name,
|
|
513
|
+
version: finding.pkg.version,
|
|
514
|
+
error: error instanceof Error ? error.message : String(error),
|
|
515
|
+
});
|
|
452
516
|
finding.chainResolution = null;
|
|
453
517
|
}
|
|
454
518
|
}));
|
package/dist/usage/scanner.js
CHANGED
|
@@ -3,6 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
// Shared with lockfile scanning in utils/file.ts; additions affect both code paths.
|
|
4
4
|
import { EXCLUDED_DIRS } from "../constants.js";
|
|
5
5
|
const ALLOWED_EXTS = new Set([".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"]);
|
|
6
|
+
const MAX_FILES_TO_SCAN = 5000;
|
|
6
7
|
// Matches:
|
|
7
8
|
// import { foo } from 'pkg'
|
|
8
9
|
// import * as foo from "pkg"
|
|
@@ -30,7 +31,6 @@ export function scanProjectForPackageUsage(projectPath, packagesToLookFor) {
|
|
|
30
31
|
return results;
|
|
31
32
|
}
|
|
32
33
|
// Cap at 5000 files to prevent performance issues on massive projects
|
|
33
|
-
const MAX_FILES_TO_SCAN = 5000;
|
|
34
34
|
let scannedCount = 0;
|
|
35
35
|
function walk(dir) {
|
|
36
36
|
if (scannedCount >= MAX_FILES_TO_SCAN)
|
|
@@ -98,3 +98,62 @@ export function scanProjectForPackageUsage(projectPath, packagesToLookFor) {
|
|
|
98
98
|
walk(projectPath);
|
|
99
99
|
return results;
|
|
100
100
|
}
|
|
101
|
+
export function scanAllImports(projectPath) {
|
|
102
|
+
const results = new Map();
|
|
103
|
+
let scannedCount = 0;
|
|
104
|
+
function walk(dir) {
|
|
105
|
+
if (scannedCount >= MAX_FILES_TO_SCAN)
|
|
106
|
+
return;
|
|
107
|
+
let entries;
|
|
108
|
+
try {
|
|
109
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
for (const entry of entries) {
|
|
115
|
+
if (scannedCount >= MAX_FILES_TO_SCAN)
|
|
116
|
+
return;
|
|
117
|
+
const fullPath = path.join(dir, entry.name);
|
|
118
|
+
if (entry.isDirectory()) {
|
|
119
|
+
if (!EXCLUDED_DIRS.has(entry.name) && !entry.name.startsWith(".")) {
|
|
120
|
+
walk(fullPath);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else if (entry.isFile()) {
|
|
124
|
+
const ext = path.extname(entry.name);
|
|
125
|
+
if (ALLOWED_EXTS.has(ext)) {
|
|
126
|
+
scanFile(fullPath);
|
|
127
|
+
scannedCount++;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function scanFile(filePath) {
|
|
133
|
+
let content;
|
|
134
|
+
try {
|
|
135
|
+
content = fs.readFileSync(filePath, "utf8");
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (!content.includes("import") && !content.includes("require") && !content.includes("export"))
|
|
141
|
+
return;
|
|
142
|
+
const matches = content.matchAll(IMPORT_REQUIRE_REGEX);
|
|
143
|
+
const relPath = path.relative(projectPath, filePath);
|
|
144
|
+
for (const match of matches) {
|
|
145
|
+
const importPath = match[1] || match[2] || match[3] || match[4];
|
|
146
|
+
if (!importPath)
|
|
147
|
+
continue;
|
|
148
|
+
const bare = getBareModuleName(importPath);
|
|
149
|
+
if (!bare)
|
|
150
|
+
continue;
|
|
151
|
+
const existing = results.get(bare) ?? [];
|
|
152
|
+
if (!existing.includes(relPath))
|
|
153
|
+
existing.push(relPath);
|
|
154
|
+
results.set(bare, existing);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
walk(projectPath);
|
|
158
|
+
return results;
|
|
159
|
+
}
|
package/dist/utils/network.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import https from "node:https";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { rootCertificates } from "node:tls";
|
|
1
4
|
export function extractErrorMessage(error) {
|
|
2
5
|
if (!(error instanceof Error))
|
|
3
6
|
return String(error);
|
|
@@ -140,3 +143,77 @@ export function isLikelyBlockedAdvisoryRequestError(message) {
|
|
|
140
143
|
}
|
|
141
144
|
return /^(401|403|407|408|451)\b/.test(finalCause);
|
|
142
145
|
}
|
|
146
|
+
export function getNetworkErrorHint(error, errorMessage) {
|
|
147
|
+
if (isSslCertificateError(error))
|
|
148
|
+
return sslCertificateErrorHint();
|
|
149
|
+
if (isRateLimitError(errorMessage))
|
|
150
|
+
return rateLimitAdvisoryRequestHint();
|
|
151
|
+
if (isServerError(errorMessage))
|
|
152
|
+
return serverAdvisoryRequestHint();
|
|
153
|
+
if (isLikelyBlockedAdvisoryRequestError(errorMessage))
|
|
154
|
+
return blockedAdvisoryRequestHint();
|
|
155
|
+
return fetchErrorCaCertHint();
|
|
156
|
+
}
|
|
157
|
+
export function createCertAwareFetch(caCertPath) {
|
|
158
|
+
// Lazily create the agent on first use so that callers can be wired up before
|
|
159
|
+
// the cert path is validated. validateOptions() in index.ts catches invalid
|
|
160
|
+
// paths before any actual request is made.
|
|
161
|
+
let agent;
|
|
162
|
+
function getAgent() {
|
|
163
|
+
if (!agent) {
|
|
164
|
+
const ca = fs.readFileSync(caCertPath);
|
|
165
|
+
agent = new https.Agent({ ca: [...rootCertificates, ca] });
|
|
166
|
+
}
|
|
167
|
+
return agent;
|
|
168
|
+
}
|
|
169
|
+
return async (input, init) => {
|
|
170
|
+
const url = typeof input === "string"
|
|
171
|
+
? input
|
|
172
|
+
: input instanceof URL
|
|
173
|
+
? input.href
|
|
174
|
+
: input.url;
|
|
175
|
+
if (!url.startsWith("https://")) {
|
|
176
|
+
return fetch(input, init);
|
|
177
|
+
}
|
|
178
|
+
return new Promise((resolve, reject) => {
|
|
179
|
+
const parsed = new URL(url);
|
|
180
|
+
const method = (init?.method ?? "GET").toUpperCase();
|
|
181
|
+
const rawHeaders = init?.headers;
|
|
182
|
+
const headers = rawHeaders
|
|
183
|
+
? Object.fromEntries(new Headers(rawHeaders).entries())
|
|
184
|
+
: {};
|
|
185
|
+
const reqOptions = {
|
|
186
|
+
hostname: parsed.hostname,
|
|
187
|
+
port: parsed.port ? parseInt(parsed.port, 10) : 443,
|
|
188
|
+
path: parsed.pathname + parsed.search,
|
|
189
|
+
method,
|
|
190
|
+
headers,
|
|
191
|
+
agent: getAgent(),
|
|
192
|
+
};
|
|
193
|
+
const req = https.request(reqOptions, res => {
|
|
194
|
+
const chunks = [];
|
|
195
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
196
|
+
res.on("end", () => {
|
|
197
|
+
const body = Buffer.concat(chunks);
|
|
198
|
+
const responseHeaders = {};
|
|
199
|
+
for (const [key, val] of Object.entries(res.headers)) {
|
|
200
|
+
if (val !== undefined) {
|
|
201
|
+
responseHeaders[key] = Array.isArray(val) ? val.join(", ") : val;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
resolve(new Response(body, {
|
|
205
|
+
status: res.statusCode ?? 200,
|
|
206
|
+
statusText: res.statusMessage ?? "",
|
|
207
|
+
headers: responseHeaders,
|
|
208
|
+
}));
|
|
209
|
+
});
|
|
210
|
+
res.on("error", reject);
|
|
211
|
+
});
|
|
212
|
+
req.on("error", reject);
|
|
213
|
+
if (init?.body != null) {
|
|
214
|
+
req.write(init.body);
|
|
215
|
+
}
|
|
216
|
+
req.end();
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
}
|
package/dist/utils/severity.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { chalk } from "./chalk.js";
|
|
2
|
+
import { severityOrder } from "../constants.js";
|
|
3
|
+
import { normalizeSeverity } from "../osv/severity.js";
|
|
2
4
|
export const SEVERITY_ORDER = ["critical", "high", "medium", "low", "unknown", "none"];
|
|
5
|
+
export function reachesFailOn(findings, failOn) {
|
|
6
|
+
const failLevel = normalizeSeverity(failOn);
|
|
7
|
+
return findings.some((f) => severityOrder[f.severity] >= severityOrder[failLevel]);
|
|
8
|
+
}
|
|
3
9
|
export function formatSeverityLabel(severity) {
|
|
4
10
|
const lower = severity.toLowerCase();
|
|
5
11
|
if (lower === "critical")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cve-lite-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "Developer-friendly CLI for scanning JS/TS projects for dependency vulnerabilities using local lockfiles and OSV",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"lint:tests": "node scripts/check-test-hygiene.mjs",
|
|
16
16
|
"pretest": "node scripts/check-test-hygiene.mjs",
|
|
17
17
|
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --passWithNoTests",
|
|
18
|
+
"build:fixture-db": "node scripts/build-fixture-db.mjs",
|
|
18
19
|
"test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch --passWithNoTests"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|