cve-lite-cli 1.0.6 → 1.1.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 CHANGED
@@ -1,3 +1,9 @@
1
+
2
+ [![npm version](https://img.shields.io/npm/v/cve-lite-cli)](https://www.npmjs.com/package/cve-lite-cli)
3
+ [![npm downloads](https://img.shields.io/npm/dm/cve-lite-cli)](https://www.npmjs.com/package/cve-lite-cli)
4
+ [![CI](https://img.shields.io/github/actions/workflow/status/sonukapoor/cve-lite-cli/ci.yml?branch=main)](https://github.com/sonukapoor/cve-lite-cli/actions)
5
+ [![License](https://img.shields.io/github/license/sonukapoor/cve-lite-cli)](https://github.com/sonukapoor/cve-lite-cli/blob/main/LICENSE)
6
+
1
7
  <div align="center">
2
8
  <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/logo-with-title.png" alt="CVE Lite CLI" width="320"/>
3
9
 
@@ -21,6 +27,29 @@
21
27
 
22
28
  **CVE Lite CLI** helps developers scan their projects for known package vulnerabilities without signing up for an expensive platform. It is built for the moment right before release, when you want a clear answer, a practical fix plan, and a tool you can actually afford to use.
23
29
 
30
+ ## New: Offline advisory DB support
31
+
32
+ CVE Lite CLI now supports a local advisory database workflow for teams that cannot allow runtime outbound advisory API calls.
33
+
34
+ That means you can:
35
+
36
+ - sync advisory data ahead of time
37
+ - scan projects fully offline
38
+ - use the tool in restricted, enterprise, or air-gapped environments more easily
39
+
40
+ Example offline workflow:
41
+
42
+ ```bash
43
+ # Build the local advisory database
44
+ cve-lite advisories sync
45
+
46
+ # Scan using the default local advisory DB
47
+ cve-lite /path/to/project --offline
48
+
49
+ # Or scan using a specific local advisory DB file
50
+ cve-lite /path/to/project --offline-db /path/to/advisories.db
51
+ ```
52
+
24
53
  ## Quick start
25
54
 
26
55
  Install globally:
@@ -68,6 +97,15 @@ cve-lite /path/to/project --sarif --output reports/scan.sarif
68
97
 
69
98
  # Use a custom advisory endpoint
70
99
  cve-lite /path/to/project --osv-url https://security.company.internal/osv
100
+
101
+ # Build the local advisory DB for offline scans
102
+ cve-lite advisories sync
103
+
104
+ # Scan with zero runtime advisory API calls
105
+ cve-lite /path/to/project --offline
106
+
107
+ # Use a specific local advisory DB file
108
+ cve-lite /path/to/project --offline-db /path/to/advisories.db
71
109
  ```
72
110
 
73
111
  ## What it looks like
@@ -139,6 +177,7 @@ The project emphasizes:
139
177
  - direct vs transitive visibility
140
178
  - top-priority fixes and a suggested remediation plan
141
179
  - JSON and SARIF output for automation
180
+ - offline scanning through a local advisory database
142
181
  - configurable advisory endpoint support via `--osv-url` for internal proxies or mirrors
143
182
  - a small, reviewable runtime footprint
144
183
 
@@ -160,19 +199,73 @@ This section is here to make the scope clear. CVE Lite CLI aims to complement th
160
199
 
161
200
  ## Network behavior and privacy
162
201
 
163
- CVE Lite CLI is a local-first scanner. It parses dependency information locally, uses local caching to reduce repeated lookups, and in standard mode queries OSV for advisory data needed for matching.
202
+ CVE Lite CLI is a local-first scanner. It parses dependency information locally, uses local caching to reduce repeated lookups, and in standard mode queries OSV for advisory data needed for matching. It also now supports a local advisory database workflow for offline scans with zero runtime advisory API calls.
164
203
 
165
204
  It does not require a hosted account, cloud dashboard, or source code upload.
166
205
 
167
206
  For the full explanation, see [Network Behavior and Privacy](https://github.com/sonukapoor/cve-lite-cli/blob/main/src/docs/network-and-privacy.md).
168
207
 
169
- ### Planned support for stricter environments
208
+ ### Offline workflow
209
+
210
+ For teams in controlled or restricted environments, the intended model is:
211
+
212
+ 1. sync advisory data into a local database
213
+ 2. distribute that database as needed
214
+ 3. scan projects using the local DB instead of runtime OSV API calls
215
+
216
+ Sync the local advisory database:
217
+
218
+ ```bash
219
+ cve-lite advisories sync
220
+ ```
221
+
222
+ Write the advisory database to a specific path:
223
+
224
+ ```bash
225
+ cve-lite advisories sync --output /path/to/advisories.db
226
+ ```
227
+
228
+ Scan using the default local advisory DB:
229
+
230
+ ```bash
231
+ cve-lite . --offline
232
+ ```
233
+
234
+ Scan using an explicit local advisory DB file:
235
+
236
+ ```bash
237
+ cve-lite . --offline-db /path/to/advisories.db
238
+ ```
239
+
240
+ Keep the local advisory DB fresh with a scheduled job when needed. For example, teams can run a cron job, CI job, or other scheduler to refresh the advisory DB periodically:
241
+
242
+ ```bash
243
+ cve-lite advisories sync --output /path/to/advisories.db
244
+ ```
245
+
246
+ That helps ensure offline scans continue using current advisory data without requiring developers to remember to refresh the DB manually every time.
247
+
248
+ Standard online mode remains available when you want live OSV-backed scans:
249
+
250
+ ```bash
251
+ cve-lite . --osv-url https://security.company.internal/osv
252
+ ```
253
+
254
+ ### Advisory DB freshness
255
+
256
+ The local advisory DB is only as current as the last successful sync.
170
257
 
171
- Support for stricter network-controlled environments is planned on the roadmap, including:
258
+ For now, the recommended model is:
172
259
 
173
- - offline scanning mode with zero outbound calls
174
- - custom advisory endpoint support for internal mirrors or proxies
175
- - local advisory database input for controlled or air-gapped workflows
260
+ - sync the advisory DB on a schedule using cron, CI, or another automation system
261
+ - distribute the refreshed DB where needed
262
+ - run offline scans against that updated DB
263
+
264
+ A future improvement is to add built-in advisory DB freshness metadata, such as:
265
+
266
+ - last sync timestamp reporting
267
+ - a TTL-style warning when the DB is older than a recommended threshold
268
+ - clearer CLI guidance when a local advisory DB should be refreshed
176
269
 
177
270
  ## Detecting malicious package incidents
178
271
 
@@ -203,6 +296,7 @@ CVE Lite CLI is designed as a **local-first, metadata-only** scanner. Unlike tra
203
296
  * **Lockfile-Driven Accuracy:** By parsing `package-lock.json`, `pnpm-lock.yaml`, or `yarn.lock`, the tool avoids the "it works on my machine" discrepancy. It scans the *exact* dependency tree that will be deployed.
204
297
  * **Intelligent Triage:** The Analysis engine utilizes the lockfile's graph structure to distinguish between dependencies you manage directly and those brought in by third-party packages (transitive). This allows for a "Fix the Root" strategy rather than chasing individual nested vulnerabilities.
205
298
  * **Performance Optimization:** A local TTL (Time-To-Live) cache stores advisory results. This ensures that subsequent scans—common in iterative development or CI/CD retry loops—are near-instant and respect external API rate limits.
299
+ * **Offline-Capable Advisory Flow:** Advisory data can be synced into a local SQLite database and reused for offline scans with zero runtime advisory API calls.
206
300
  * **Standards-Based Output:** Results are natively available in **SARIF (Static Analysis Results Interchange Format)** and **JSON**, ensuring compatibility with modern DevSecOps dashboards and IDE integrations.
207
301
 
208
302
  ## What makes it stand out
@@ -219,6 +313,8 @@ CVE Lite CLI is designed as a **local-first, metadata-only** scanner. Unlike tra
219
313
  It is intended for developers and teams who want useful security checks without paying for a large commercial product.
220
314
  - **local-first**
221
315
  It reads your project locally and uses package/version matching against OSV advisories.
316
+ - **offline-capable**
317
+ It can sync and scan against a local advisory database for zero-runtime-network workflows.
222
318
  - **release-focused**
223
319
  It is especially useful before a release, in CI, or during final dependency cleanup.
224
320
 
@@ -283,15 +379,26 @@ cve-lite /path/to/project --sarif --output reports/scan.sarif
283
379
 
284
380
  The CLI can be used in CI/CD pipelines and can fail builds based on severity thresholds.
285
381
 
286
- ### 9. Local cache
382
+ ### 9. Offline advisory DB support
383
+
384
+ The CLI can sync the official OSV npm advisory dump into a local SQLite advisory database and scan against it later with zero runtime advisory API calls.
385
+
386
+ That makes it more practical for:
387
+
388
+ - enterprise environments
389
+ - restricted CI systems
390
+ - air-gapped workflows
391
+ - teams that want explicit local advisory control
392
+
393
+ ### 10. Local cache
287
394
 
288
395
  It caches advisory detail results locally so repeated scans are faster and make fewer repeated requests.
289
396
 
290
- ### 10. Clear final scan status
397
+ ### 11. Clear final scan status
291
398
 
292
399
  At the end of each run, CVE Lite CLI prints a short final status line so users immediately know whether the scan was clean or whether they should start with the priority fixes above.
293
400
 
294
- ### 11. Small runtime footprint
401
+ ### 12. Small runtime footprint
295
402
 
296
403
  This project intentionally keeps runtime dependencies minimal to reduce attack surface and keep the tool easier to review.
297
404
 
@@ -302,6 +409,8 @@ CVE Lite CLI is intentionally designed with a very small dependency surface.
302
409
  **Runtime dependencies**
303
410
  - `yaml`
304
411
  - `yarn-lockfile`
412
+ - `better-sqlite3`
413
+ - `fflate`
305
414
 
306
415
  **Development dependencies**
307
416
  - `@types/node`
@@ -320,6 +429,7 @@ CVE Lite CLI is a good fit for:
320
429
  - teams that want a lightweight dependency scan in CI
321
430
  - developers who want a second opinion alongside other tools
322
431
  - OSS maintainers who need a practical scan before publishing
432
+ - teams that need offline or controlled-network dependency scanning
323
433
 
324
434
  ## Supported workflows
325
435
 
@@ -327,6 +437,13 @@ CVE Lite CLI is a good fit for:
327
437
 
328
438
  Run it before a release, during dependency cleanup, or after a major package upgrade.
329
439
 
440
+ For offline-capable local workflows:
441
+
442
+ ```bash
443
+ cve-lite advisories sync
444
+ cve-lite . --offline
445
+ ```
446
+
330
447
  ### CI/CD
331
448
 
332
449
  This repository also uses CVE Lite CLI in its own GitHub Actions workflow to scan itself as part of CI. See [`self-scan.yml`](https://github.com/sonukapoor/cve-lite-cli/blob/main/.github/workflows/self-scan.yml).
@@ -353,6 +470,13 @@ Use JSON output for custom reporting:
353
470
  cve-lite . --json > cve-lite-report.json
354
471
  ```
355
472
 
473
+ Use an offline local advisory DB in controlled environments:
474
+
475
+ ```bash
476
+ cve-lite advisories sync --output ./.cache/advisories.db
477
+ cve-lite . --offline-db ./.cache/advisories.db --json > cve-lite-report.json
478
+ ```
479
+
356
480
  ## Comparison with other tools
357
481
 
358
482
  CVE Lite CLI is not trying to be everything for everyone. It is designed to be one of the easiest and most actionable vulnerability scanners for JavaScript and TypeScript developers who want fast release-time checks without the cost and complexity of a full security platform.
@@ -370,6 +494,7 @@ Compared with other tools in this space, CVE Lite CLI focuses on:
370
494
  - support for **npm**, **pnpm**, and **Yarn** lockfiles
371
495
  - **SARIF** and **JSON** output for CI and automation
372
496
  - a **lightweight**, **security-conscious** dependency footprint
497
+ - **offline local advisory DB support** for controlled environments
373
498
  - a **developer-friendly** option for teams that want useful **CVE scanning without paying for a larger commercial product**
374
499
 
375
500
  ### At a glance
@@ -445,6 +570,7 @@ To keep the project honest, here is what it does **not** do in the current versi
445
570
  - it does not scan container images, binaries, secrets, or IaC
446
571
  - it does not replace a full application security program
447
572
  - it is currently focused on JS/TS dependency scanning
573
+ - local advisory sync performance will need continued optimization as the advisory dataset grows
448
574
 
449
575
  ## Positioning
450
576
 
@@ -465,6 +591,7 @@ CVE Lite CLI is evolving from a vulnerability scanner into a comprehensive remed
465
591
  * **Official GitHub Action:** Create a dedicated Action for one-line setup in CI/CD pipelines.
466
592
  * **Expanded Lockfile Support:** Introduce parsers for emerging JS/TS ecosystems, including `bun.lockb`.
467
593
  * **IDE Integration:** Develop a lightweight extension to highlight vulnerable packages directly within the code editor.
594
+ * **Workflow Integration Guidance:** Expand official workflow patterns for local scripts, hooks, CI, and offline developer adoption.
468
595
 
469
596
  ### Phase 3: Maturity & Compliance (Long-Term)
470
597
  * **Standardized SBOM Support:** Add the ability to export findings as an **SBOM (Software Bill of Materials)** in CycloneDX or SPDX formats.
@@ -0,0 +1,21 @@
1
+ export class LocalAdvisorySource {
2
+ db;
3
+ constructor(db) {
4
+ this.db = db;
5
+ }
6
+ queryBatch(packages) {
7
+ const results = packages.map(pkg => ({
8
+ package: pkg.name,
9
+ version: pkg.version,
10
+ vulnerabilities: this.db.findMatchingVulnerabilityIds(pkg).map(id => ({ id })),
11
+ }));
12
+ return Promise.resolve(results);
13
+ }
14
+ getVuln(id) {
15
+ const vuln = this.db.getVulnerability(id);
16
+ if (!vuln) {
17
+ return Promise.reject(new Error(`Local advisory database lookup failed for ${id}`));
18
+ }
19
+ return Promise.resolve(vuln);
20
+ }
21
+ }
@@ -0,0 +1,188 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import Database from "better-sqlite3";
4
+ import { compareVersions, looksLikeVersion } from "../utils/version.js";
5
+ const SCHEMA_SQL = `
6
+ CREATE TABLE IF NOT EXISTS advisories (
7
+ id TEXT PRIMARY KEY,
8
+ modified_at TEXT,
9
+ aliases_json TEXT NOT NULL,
10
+ summary TEXT,
11
+ osv_json TEXT NOT NULL
12
+ );
13
+
14
+ CREATE TABLE IF NOT EXISTS advisory_packages (
15
+ advisory_id TEXT NOT NULL,
16
+ ecosystem TEXT NOT NULL,
17
+ package_name TEXT NOT NULL,
18
+ introduced TEXT,
19
+ fixed TEXT,
20
+ last_affected TEXT,
21
+ FOREIGN KEY (advisory_id) REFERENCES advisories(id) ON DELETE CASCADE
22
+ );
23
+
24
+ CREATE INDEX IF NOT EXISTS idx_advisory_packages_lookup
25
+ ON advisory_packages (ecosystem, package_name);
26
+
27
+ CREATE INDEX IF NOT EXISTS idx_advisory_packages_advisory
28
+ ON advisory_packages (advisory_id);
29
+ `;
30
+ export class LocalAdvisoryDatabase {
31
+ dbPath;
32
+ db;
33
+ constructor(dbPath, options) {
34
+ this.dbPath = dbPath;
35
+ const readonly = !!options?.readonly;
36
+ if (!readonly) {
37
+ fs.mkdirSync(path.dirname(dbPath), { recursive: true });
38
+ }
39
+ this.db = new Database(dbPath, readonly ? { readonly: true, fileMustExist: true } : undefined);
40
+ this.db.pragma("foreign_keys = ON");
41
+ this.db.exec(SCHEMA_SQL);
42
+ }
43
+ close() {
44
+ this.db.close();
45
+ }
46
+ upsertVulnerability(vuln) {
47
+ const advisoryRows = deriveAdvisoryPackageRows(vuln);
48
+ const advisoryJson = JSON.stringify(vuln);
49
+ const aliasesJson = JSON.stringify(vuln.aliases ?? []);
50
+ const upsertAdvisory = this.db.prepare(`
51
+ INSERT INTO advisories (id, modified_at, aliases_json, summary, osv_json)
52
+ VALUES (@id, @modified_at, @aliases_json, @summary, @osv_json)
53
+ ON CONFLICT(id) DO UPDATE SET
54
+ modified_at = excluded.modified_at,
55
+ aliases_json = excluded.aliases_json,
56
+ summary = excluded.summary,
57
+ osv_json = excluded.osv_json
58
+ `);
59
+ const deleteRanges = this.db.prepare(`
60
+ DELETE FROM advisory_packages
61
+ WHERE advisory_id = ?
62
+ `);
63
+ const insertRange = this.db.prepare(`
64
+ INSERT INTO advisory_packages (
65
+ advisory_id,
66
+ ecosystem,
67
+ package_name,
68
+ introduced,
69
+ fixed,
70
+ last_affected
71
+ ) VALUES (
72
+ @advisory_id,
73
+ @ecosystem,
74
+ @package_name,
75
+ @introduced,
76
+ @fixed,
77
+ @last_affected
78
+ )
79
+ `);
80
+ const transaction = this.db.transaction(() => {
81
+ upsertAdvisory.run({
82
+ id: vuln.id,
83
+ modified_at: null,
84
+ aliases_json: aliasesJson,
85
+ summary: vuln.summary ?? null,
86
+ osv_json: advisoryJson,
87
+ });
88
+ deleteRanges.run(vuln.id);
89
+ for (const row of advisoryRows) {
90
+ insertRange.run(row);
91
+ }
92
+ });
93
+ transaction();
94
+ }
95
+ getVulnerability(id) {
96
+ const row = this.db.prepare(`
97
+ SELECT osv_json
98
+ FROM advisories
99
+ WHERE id = ?
100
+ `).get(id);
101
+ if (!row)
102
+ return null;
103
+ return JSON.parse(row.osv_json);
104
+ }
105
+ findMatchingVulnerabilityIds(pkg) {
106
+ if (!looksLikeVersion(pkg.version)) {
107
+ return [];
108
+ }
109
+ const rows = this.db.prepare(`
110
+ SELECT advisory_id, introduced, fixed, last_affected
111
+ FROM advisory_packages
112
+ WHERE ecosystem = ? AND package_name = ?
113
+ `).all(pkg.ecosystem, pkg.name);
114
+ const ids = new Set();
115
+ for (const row of rows) {
116
+ if (versionMatchesRange(pkg.version, row)) {
117
+ ids.add(row.advisory_id);
118
+ }
119
+ }
120
+ return [...ids];
121
+ }
122
+ }
123
+ function versionMatchesRange(version, row) {
124
+ const introduced = row.introduced;
125
+ const fixed = row.fixed;
126
+ const lastAffected = row.last_affected;
127
+ if (introduced && introduced !== "0" && compareVersions(version, introduced) < 0) {
128
+ return false;
129
+ }
130
+ if (fixed && compareVersions(version, fixed) >= 0) {
131
+ return false;
132
+ }
133
+ if (lastAffected && compareVersions(version, lastAffected) > 0) {
134
+ return false;
135
+ }
136
+ return true;
137
+ }
138
+ function deriveAdvisoryPackageRows(vuln) {
139
+ const rows = [];
140
+ for (const affected of vuln.affected ?? []) {
141
+ const ecosystem = affected.package?.ecosystem;
142
+ const packageName = affected.package?.name;
143
+ if (!ecosystem || !packageName) {
144
+ continue;
145
+ }
146
+ for (const range of affected.ranges ?? []) {
147
+ const events = range.events ?? [];
148
+ let introduced = null;
149
+ for (const event of events) {
150
+ if (event.introduced) {
151
+ introduced = event.introduced;
152
+ }
153
+ if (event.fixed || event.last_affected) {
154
+ rows.push({
155
+ advisory_id: vuln.id,
156
+ ecosystem,
157
+ package_name: packageName,
158
+ introduced,
159
+ fixed: event.fixed ?? null,
160
+ last_affected: event.last_affected ?? null,
161
+ });
162
+ introduced = null;
163
+ }
164
+ }
165
+ if (events.length === 0) {
166
+ rows.push({
167
+ advisory_id: vuln.id,
168
+ ecosystem,
169
+ package_name: packageName,
170
+ introduced: null,
171
+ fixed: null,
172
+ last_affected: null,
173
+ });
174
+ }
175
+ else if (introduced !== null) {
176
+ rows.push({
177
+ advisory_id: vuln.id,
178
+ ecosystem,
179
+ package_name: packageName,
180
+ introduced,
181
+ fixed: null,
182
+ last_affected: null,
183
+ });
184
+ }
185
+ }
186
+ }
187
+ return rows;
188
+ }
@@ -0,0 +1,165 @@
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import { unzipSync } from "fflate";
5
+ import { LocalAdvisoryDatabase } from "./local-db.js";
6
+ const DEFAULT_OSV_NPM_DUMP_URL = "https://storage.googleapis.com/osv-vulnerabilities/npm/all.zip";
7
+ export function getDefaultAdvisoryDbPath(outputPath) {
8
+ if (outputPath) {
9
+ return path.resolve(outputPath);
10
+ }
11
+ if (process.platform === "win32") {
12
+ const appData = process.env.LOCALAPPDATA ?? path.join(os.homedir(), "AppData", "Local");
13
+ return path.join(appData, "cve-lite", "advisories.db");
14
+ }
15
+ return path.join(os.homedir(), ".cache", "cve-lite", "advisories.db");
16
+ }
17
+ export async function syncOsvAdvisories(options = {}) {
18
+ const fetchImpl = options.fetchImpl ?? fetch;
19
+ const onProgress = options.onProgress;
20
+ const sourceUrl = options.sourceUrl ?? DEFAULT_OSV_NPM_DUMP_URL;
21
+ const dbPath = getDefaultAdvisoryDbPath(options.outputPath);
22
+ onProgress?.({
23
+ phase: "init",
24
+ sourceUrl,
25
+ dbPath,
26
+ message: `Sync initiated. Downloading advisory dump from ${sourceUrl}`,
27
+ });
28
+ fs.mkdirSync(path.dirname(dbPath), { recursive: true });
29
+ if (fs.existsSync(dbPath)) {
30
+ fs.rmSync(dbPath, { force: true });
31
+ }
32
+ const response = await fetchImpl(sourceUrl);
33
+ if (!response.ok) {
34
+ throw new Error(`OSV dump download failed: ${response.status} ${response.statusText}`);
35
+ }
36
+ const totalBytesHeader = response.headers.get("content-length");
37
+ const totalBytes = totalBytesHeader ? Number(totalBytesHeader) : null;
38
+ const zippedBytes = await readResponseBytes(response, (bytesReceived) => {
39
+ onProgress?.({
40
+ phase: "download",
41
+ bytesReceived,
42
+ totalBytes,
43
+ message: totalBytes && totalBytes > 0
44
+ ? `Downloading advisory dump: ${formatBytes(bytesReceived)} / ${formatBytes(totalBytes)}`
45
+ : `Downloading advisory dump: ${formatBytes(bytesReceived)}`,
46
+ });
47
+ });
48
+ onProgress?.({
49
+ phase: "download-complete",
50
+ bytesReceived: zippedBytes.byteLength,
51
+ totalBytes,
52
+ message: totalBytes && totalBytes > 0
53
+ ? `Download complete: ${formatBytes(zippedBytes.byteLength)} / ${formatBytes(totalBytes)}`
54
+ : `Download complete: ${formatBytes(zippedBytes.byteLength)}`,
55
+ });
56
+ await yieldToEventLoop();
57
+ const archiveEntries = unzipSync(zippedBytes);
58
+ const advisoryEntries = Object.keys(archiveEntries).filter(entryName => entryName.endsWith(".json"));
59
+ onProgress?.({
60
+ phase: "extract",
61
+ totalEntries: Object.keys(archiveEntries).length,
62
+ advisoryEntries: advisoryEntries.length,
63
+ message: `Archive loaded. Processing ${advisoryEntries.length} advisory record${advisoryEntries.length === 1 ? "" : "s"}`,
64
+ });
65
+ await yieldToEventLoop();
66
+ const db = new LocalAdvisoryDatabase(dbPath);
67
+ try {
68
+ let advisoryCount = 0;
69
+ const progressInterval = 250;
70
+ for (const [entryName, bytes] of Object.entries(archiveEntries)) {
71
+ if (!entryName.endsWith(".json")) {
72
+ continue;
73
+ }
74
+ const text = Buffer.from(bytes).toString("utf8");
75
+ const vuln = JSON.parse(text);
76
+ if (!vuln.id) {
77
+ continue;
78
+ }
79
+ db.upsertVulnerability(vuln);
80
+ advisoryCount += 1;
81
+ if (advisoryCount === 1 ||
82
+ advisoryCount % progressInterval === 0 ||
83
+ advisoryCount === advisoryEntries.length) {
84
+ onProgress?.({
85
+ phase: "ingest",
86
+ processedAdvisories: advisoryCount,
87
+ totalAdvisories: advisoryEntries.length,
88
+ message: `Processing advisory records: ${advisoryCount} / ${advisoryEntries.length}`,
89
+ });
90
+ await yieldToEventLoop();
91
+ }
92
+ }
93
+ onProgress?.({
94
+ phase: "complete",
95
+ advisoryCount,
96
+ dbPath,
97
+ message: `Sync complete. Stored ${advisoryCount} advisory record${advisoryCount === 1 ? "" : "s"} in ${dbPath}`,
98
+ });
99
+ return { advisoryCount, dbPath, sourceUrl };
100
+ }
101
+ catch (error) {
102
+ try {
103
+ db.close();
104
+ }
105
+ finally {
106
+ if (fs.existsSync(dbPath)) {
107
+ fs.rmSync(dbPath, { force: true });
108
+ }
109
+ }
110
+ throw error;
111
+ }
112
+ finally {
113
+ try {
114
+ db.close();
115
+ }
116
+ catch {
117
+ // ignore close errors during sync cleanup
118
+ }
119
+ }
120
+ }
121
+ async function readResponseBytes(response, onChunk) {
122
+ if (!response.body) {
123
+ const bytes = new Uint8Array(await response.arrayBuffer());
124
+ onChunk(bytes.byteLength);
125
+ return bytes;
126
+ }
127
+ const reader = response.body.getReader();
128
+ const chunks = [];
129
+ let bytesReceived = 0;
130
+ while (true) {
131
+ const { done, value } = await reader.read();
132
+ if (done) {
133
+ break;
134
+ }
135
+ if (value) {
136
+ chunks.push(value);
137
+ bytesReceived += value.byteLength;
138
+ onChunk(bytesReceived);
139
+ }
140
+ }
141
+ const combined = new Uint8Array(bytesReceived);
142
+ let offset = 0;
143
+ for (const chunk of chunks) {
144
+ combined.set(chunk, offset);
145
+ offset += chunk.byteLength;
146
+ }
147
+ return combined;
148
+ }
149
+ function formatBytes(bytes) {
150
+ if (bytes < 1024)
151
+ return `${bytes} B`;
152
+ const units = ["KB", "MB", "GB"];
153
+ let value = bytes / 1024;
154
+ let unitIndex = 0;
155
+ while (value >= 1024 && unitIndex < units.length - 1) {
156
+ value /= 1024;
157
+ unitIndex += 1;
158
+ }
159
+ return `${value.toFixed(value >= 10 ? 0 : 1)} ${units[unitIndex]}`;
160
+ }
161
+ async function yieldToEventLoop() {
162
+ await new Promise(resolve => {
163
+ setImmediate(resolve);
164
+ });
165
+ }
package/dist/cli/args.js CHANGED
@@ -5,6 +5,27 @@ export function parseArgs(argv) {
5
5
  searchDepth: "4",
6
6
  minSeverity: "medium"
7
7
  };
8
+ if (argv[0] === "advisories" && argv[1] === "sync") {
9
+ for (let i = 2; i < argv.length; i++) {
10
+ const arg = argv[i];
11
+ if (arg === "-h" || arg === "--help") {
12
+ options.help = true;
13
+ continue;
14
+ }
15
+ if (arg === "--output") {
16
+ options.output = argv[++i];
17
+ continue;
18
+ }
19
+ if (arg.startsWith("--output=")) {
20
+ options.output = arg.slice("--output=".length);
21
+ continue;
22
+ }
23
+ if (arg.startsWith("-"))
24
+ throw new Error(`Unknown option: ${arg}`);
25
+ throw new Error(`Unexpected argument: ${arg}`);
26
+ }
27
+ return { command: "advisories-sync", options };
28
+ }
8
29
  let projectArg;
9
30
  for (let i = 0; i < argv.length; i++) {
10
31
  const arg = argv[i];
@@ -28,6 +49,14 @@ export function parseArgs(argv) {
28
49
  options.offline = true;
29
50
  continue;
30
51
  }
52
+ if (arg === "--offline-db") {
53
+ options.offlineDb = argv[++i];
54
+ continue;
55
+ }
56
+ if (arg.startsWith("--offline-db=")) {
57
+ options.offlineDb = arg.slice("--offline-db=".length);
58
+ continue;
59
+ }
31
60
  if (arg === "--all") {
32
61
  options.all = true;
33
62
  continue;
@@ -64,6 +93,14 @@ export function parseArgs(argv) {
64
93
  options.osvUrl = arg.slice("--osv-url=".length);
65
94
  continue;
66
95
  }
96
+ if (arg === "--output") {
97
+ options.output = argv[++i];
98
+ continue;
99
+ }
100
+ if (arg.startsWith("--output=")) {
101
+ options.output = arg.slice("--output=".length);
102
+ continue;
103
+ }
67
104
  if (arg === "--search-depth") {
68
105
  options.searchDepth = argv[++i] ?? options.searchDepth;
69
106
  continue;
@@ -88,5 +125,5 @@ export function parseArgs(argv) {
88
125
  }
89
126
  throw new Error(`Unexpected argument: ${arg}`);
90
127
  }
91
- return { options, projectArg };
128
+ return { command: "scan", options, projectArg };
92
129
  }
package/dist/cli/help.js CHANGED
@@ -23,19 +23,25 @@ export function printHelp() {
23
23
  "",
24
24
  "Usage:",
25
25
  " cve-lite [projectPath] [options]",
26
+ " cve-lite advisories sync [options]",
26
27
  "",
27
- "Options:",
28
+ "Scan options:",
28
29
  " --json Print JSON output",
29
- " --osv-url <url> Use a custom OSV-compatible advisory endpoint",
30
+ " --osv-url <url> Use a custom OSV-compatible advisory endpoint",
30
31
  " --verbose Show detailed output with fix plan, paths, and full table",
31
32
  " --prod-only Exclude dev dependencies where available",
32
33
  " --fail-on <severity> Exit non-zero at or above severity (default: critical)",
33
34
  " --batch-size <number> OSV batch size (default: 100)",
34
- " --offline Use cached vulnerability details only",
35
+ " --offline Scan using the local advisory database",
36
+ " --offline-db <path> Use a specific local advisory database file",
35
37
  " --cache-dir <path> Override cache directory",
36
38
  " --search-depth <number> Recursive search depth (default: 4)",
37
39
  " --all Show all findings in the main table",
38
40
  " --min-severity <level> Minimum severity shown in table (default: medium)",
41
+ "",
42
+ "Advisory sync options:",
43
+ " --output <path> Write the local advisory database to this path",
44
+ "",
39
45
  " -h, --help Show this help message"
40
46
  ];
41
47
  console.log(lines.join("\n"));
package/dist/index.js CHANGED
@@ -4,13 +4,15 @@ import process from "node:process";
4
4
  import { parseArgs } from "./cli/args.js";
5
5
  import { printBanner, printHelp } from "./cli/help.js";
6
6
  import { loadPackages, buildNoPackagesMessage } from "./parsers/index.js";
7
- import { scanPackages, buildCoverageNotes } from "./scanner.js";
7
+ import { scanPackages, buildCoverageNotes, createAdvisorySource } from "./scanner.js";
8
+ import { syncOsvAdvisories } from "./advisory/osv-sync.js";
8
9
  import { normalizeSeverity } from "./osv/severity.js";
9
10
  import { severityOrder } from "./constants.js";
10
11
  import { chalk } from "./utils/chalk.js";
12
+ import { createSpinner } from "./output/spinner.js";
11
13
  import { logInfo, logWarn, printCacheSummary, serializeFinding } from "./output/formatters.js";
12
14
  import { printSummary, printActionSummary, printPriorityFixes, printFixPlan, printCoverage, printSkippedDependencies, printGroupSummary, printTable, printPathHints, printFinalStatus, printCompactOutput } from "./output/printers.js";
13
- const { options, projectArg } = parseArgs(process.argv.slice(2));
15
+ const { command, options, projectArg } = parseArgs(process.argv.slice(2));
14
16
  if (options.help) {
15
17
  printHelp();
16
18
  process.exit(0);
@@ -22,18 +24,34 @@ async function main() {
22
24
  if (!options.json) {
23
25
  printBanner();
24
26
  }
25
- if (options.offline) {
26
- console.log(chalk.gray("Offline mode:") + " " + chalk.yellow("enabled") + " " + chalk.gray("(no external calls will be made)"));
27
- throw new Error("Offline mode is not implemented yet. External calls are disabled.");
28
- }
29
- if (options.offline && options.osvUrl) {
30
- throw new Error("--offline cannot be used with --osv-url");
31
- }
32
- if (options.osvUrl) {
33
- console.log(`${chalk.gray("Advisory source:")} custom OSV endpoint (${chalk.cyan(options.osvUrl)})`);
27
+ if (command === "advisories-sync") {
28
+ const spinner = createSpinner("Preparing advisory sync...", options);
29
+ const usePlainProgressLogs = !process.stdout.isTTY || !!options.json;
30
+ const result = await syncOsvAdvisories({
31
+ outputPath: options.output,
32
+ onProgress: event => {
33
+ if (event.phase === "complete") {
34
+ return;
35
+ }
36
+ if (usePlainProgressLogs) {
37
+ console.log(event.message);
38
+ return;
39
+ }
40
+ spinner.update(event.message);
41
+ },
42
+ });
43
+ if (usePlainProgressLogs) {
44
+ console.log(`Advisory sync complete (${result.advisoryCount} records)`);
45
+ }
46
+ else {
47
+ spinner.succeed(`Advisory sync complete (${result.advisoryCount} records)`);
48
+ }
49
+ console.log(`${chalk.gray("Advisory database:")} synced ${result.advisoryCount} record${result.advisoryCount === 1 ? "" : "s"} to ${chalk.cyan(result.dbPath)}`);
50
+ process.exit(0);
51
+ return;
34
52
  }
35
- else {
36
- console.log(`${chalk.gray("Advisory source:")} OSV (${chalk.cyan("https://api.osv.dev")})`);
53
+ if ((options.offline || options.offlineDb) && options.osvUrl) {
54
+ throw new Error("--offline/--offline-db cannot be used with --osv-url");
37
55
  }
38
56
  if (options.osvUrl) {
39
57
  try {
@@ -43,6 +61,26 @@ async function main() {
43
61
  throw new Error(`Invalid value for --osv-url: ${options.osvUrl}`);
44
62
  }
45
63
  }
64
+ let advisorySourceLine;
65
+ try {
66
+ const advisorySource = createAdvisorySource({
67
+ osvUrl: options.osvUrl,
68
+ offline: options.offline,
69
+ offlineDb: options.offlineDb,
70
+ });
71
+ advisorySourceLine = advisorySource.sourceLabel;
72
+ advisorySource.cleanup();
73
+ }
74
+ catch (error) {
75
+ if (options.offline || options.offlineDb) {
76
+ throw new Error(`Offline advisory database is not available: ${error instanceof Error ? error.message : String(error)}`);
77
+ }
78
+ throw error;
79
+ }
80
+ if (options.offline || options.offlineDb) {
81
+ console.log(chalk.gray("Offline mode:") + " " + chalk.yellow("enabled") + " " + chalk.gray("(no external advisory calls will be made)"));
82
+ }
83
+ console.log(`${chalk.gray("Advisory source:")} ${formatAdvisorySourceLine(advisorySourceLine)}`);
46
84
  const scanInput = loadPackages(projectPath, !!options.prodOnly, searchDepth);
47
85
  const packages = scanInput.packages;
48
86
  logInfo(`Parsed ${packages.length} package${packages.length === 1 ? "" : "s"} from ${scanInput.source}${scanInput.filePath ? ` (${path.relative(projectPath, scanInput.filePath) || path.basename(scanInput.filePath)})` : ""}`, options);
@@ -55,10 +93,11 @@ async function main() {
55
93
  if (packages.length === 0) {
56
94
  logWarn(buildNoPackagesMessage(projectPath), options);
57
95
  process.exit(0);
96
+ return;
58
97
  }
59
98
  const findings = await scanPackages(packages, batchSize, options);
60
99
  const sorted = findings.sort((a, b) => severityOrder[b.severity] - severityOrder[a.severity]);
61
- const coverage = buildCoverageNotes(scanInput, !!options.offline);
100
+ const coverage = buildCoverageNotes(scanInput, !!options.offline || !!options.offlineDb);
62
101
  const minSeverity = normalizeSeverity(options.minSeverity || "medium");
63
102
  const tableFindings = options.all ? sorted : sorted.filter(f => severityOrder[f.severity] >= severityOrder[minSeverity]);
64
103
  if (options.json) {
@@ -103,8 +142,16 @@ async function main() {
103
142
  const failLevel = normalizeSeverity(options.failOn);
104
143
  const shouldFail = sorted.some(f => severityOrder[f.severity] >= severityOrder[failLevel]);
105
144
  process.exit(shouldFail ? 1 : 0);
145
+ return;
106
146
  }
107
147
  main().catch((error) => {
108
148
  console.error(chalk.red(`Error: ${error instanceof Error ? error.message : String(error)}`));
109
149
  process.exit(1);
110
150
  });
151
+ function formatAdvisorySourceLine(sourceLabel) {
152
+ const match = sourceLabel.match(/^(.*) \((.*)\)$/);
153
+ if (!match) {
154
+ return sourceLabel;
155
+ }
156
+ return `${match[1]} (${chalk.cyan(match[2])})`;
157
+ }
package/dist/osv/cache.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import os from "node:os";
4
+ function createEmptyCache() {
5
+ return { version: 2, createdAt: new Date().toISOString(), entries: {}, queryEntries: {} };
6
+ }
4
7
  export function getCacheFilePath(cacheDirOverride) {
5
8
  const baseDir = cacheDirOverride
6
9
  ? path.resolve(cacheDirOverride)
@@ -11,18 +14,23 @@ export function getCacheFilePath(cacheDirOverride) {
11
14
  export function loadCache(cacheDirOverride) {
12
15
  const filePath = getCacheFilePath(cacheDirOverride);
13
16
  if (!fs.existsSync(filePath)) {
14
- return { version: 1, createdAt: new Date().toISOString(), entries: {} };
17
+ return createEmptyCache();
15
18
  }
16
19
  try {
17
20
  const parsed = JSON.parse(fs.readFileSync(filePath, "utf8"));
18
- if (parsed.version === 1 && parsed.entries) {
19
- return parsed;
21
+ if (parsed.entries && typeof parsed.entries === "object") {
22
+ return {
23
+ version: 2,
24
+ createdAt: parsed.createdAt ?? new Date().toISOString(),
25
+ entries: parsed.entries,
26
+ queryEntries: parsed.queryEntries && typeof parsed.queryEntries === "object" ? parsed.queryEntries : {},
27
+ };
20
28
  }
21
29
  }
22
30
  catch (_error) {
23
31
  // ignore corrupt cache
24
32
  }
25
- return { version: 1, createdAt: new Date().toISOString(), entries: {} };
33
+ return createEmptyCache();
26
34
  }
27
35
  export function saveCache(cache, cacheDirOverride) {
28
36
  const filePath = getCacheFilePath(cacheDirOverride);
@@ -113,10 +113,11 @@ export function printCacheSummary(cacheDirOverride, options) {
113
113
  const cache = loadCache(cacheDirOverride);
114
114
  const advisoryCount = Object.entries(cache.entries).filter(([, value]) => Boolean(value)).length;
115
115
  const emptyCount = Object.entries(cache.entries).filter(([, value]) => value === null).length;
116
+ const packageQueryCount = Object.keys(cache.queryEntries).length;
116
117
  const totalCount = advisoryCount + emptyCount;
117
- if (totalCount === 0)
118
+ if (totalCount === 0 && packageQueryCount === 0)
118
119
  return;
119
- console.log(chalk.gray(`Cache: ${advisoryCount} advisory detail record${advisoryCount === 1 ? "" : "s"}`) +
120
+ console.log(chalk.gray(`Cache: ${packageQueryCount} package match record${packageQueryCount === 1 ? "" : "s"}, ${advisoryCount} advisory detail record${advisoryCount === 1 ? "" : "s"}`) +
120
121
  (emptyCount > 0
121
122
  ? chalk.gray(`, ${emptyCount} empty lookup${emptyCount === 1 ? "" : "s"}`)
122
123
  : ""));
@@ -26,6 +26,7 @@ export function createSpinner(initialMessage, options) {
26
26
  return {
27
27
  update(message) {
28
28
  currentMessage = message;
29
+ render();
29
30
  },
30
31
  succeed(message) {
31
32
  clearLine();
package/dist/scanner.js CHANGED
@@ -4,19 +4,63 @@ import { loadCache, saveCache } from "./osv/cache.js";
4
4
  import { maxSeverity } from "./osv/severity.js";
5
5
  import { createSpinner } from "./output/spinner.js";
6
6
  import { OsvAdvisorySource } from "./advisory/osv-advisory-source.js";
7
+ import { LocalAdvisorySource } from "./advisory/local-advisory-source.js";
8
+ import { LocalAdvisoryDatabase } from "./advisory/local-db.js";
9
+ import { getDefaultAdvisoryDbPath } from "./advisory/osv-sync.js";
7
10
  import { resolveRecommendedParentUpgrade } from "./remediation/parent-upgrade.js";
8
11
  export function createAdvisorySource(options) {
9
- return new OsvAdvisorySource(options?.osvUrl);
12
+ const offline = !!options?.offline || !!options?.offlineDb;
13
+ if (offline) {
14
+ const dbPath = getDefaultAdvisoryDbPath(options?.offlineDb);
15
+ const db = new LocalAdvisoryDatabase(dbPath, { readonly: true });
16
+ return {
17
+ advisorySource: new LocalAdvisorySource(db),
18
+ offline: true,
19
+ sourceLabel: `local advisory database (${dbPath})`,
20
+ cleanup: () => db.close(),
21
+ };
22
+ }
23
+ return {
24
+ advisorySource: new OsvAdvisorySource(options?.osvUrl),
25
+ offline: false,
26
+ sourceLabel: options?.osvUrl
27
+ ? `custom OSV endpoint (${options.osvUrl})`
28
+ : "OSV (https://api.osv.dev)",
29
+ cleanup: () => { },
30
+ };
31
+ }
32
+ function getPackageCacheKey(pkg) {
33
+ return `${pkg.ecosystem}:${pkg.name}@${pkg.version}`;
10
34
  }
11
35
  export async function scanPackages(packages, batchSize, options) {
12
- const offline = !!options.offline;
36
+ const sourceContext = createAdvisorySource({
37
+ osvUrl: options.osvUrl,
38
+ offline: options.offline,
39
+ offlineDb: options.offlineDb,
40
+ });
41
+ const offline = sourceContext.offline;
13
42
  const cacheDirOverride = options.cacheDir;
14
- const spinner = createSpinner("Scanning dependencies against OSV...", options);
15
- const advisorySource = createAdvisorySource({ osvUrl: options.osvUrl });
43
+ const spinner = createSpinner(offline
44
+ ? "Scanning dependencies against the local advisory database..."
45
+ : "Scanning dependencies against OSV...", options);
46
+ const advisorySource = sourceContext.advisorySource;
47
+ const cache = loadCache(cacheDirOverride);
16
48
  try {
17
- const chunks = chunk(packages, batchSize);
18
49
  const results = [];
50
+ const uncachedPackages = [];
19
51
  if (!offline) {
52
+ for (const pkg of packages) {
53
+ const cacheKey = getPackageCacheKey(pkg);
54
+ if (cacheKey in cache.queryEntries) {
55
+ const vulnIds = cache.queryEntries[cacheKey] ?? [];
56
+ if (vulnIds.length > 0) {
57
+ results.push({ pkg, vulnIds });
58
+ }
59
+ continue;
60
+ }
61
+ uncachedPackages.push(pkg);
62
+ }
63
+ const chunks = chunk(uncachedPackages, batchSize);
20
64
  for (let i = 0; i < chunks.length; i++) {
21
65
  spinner.update(`Scanning OSV batch ${i + 1}/${chunks.length}...`);
22
66
  const chunkItems = chunks[i];
@@ -26,17 +70,32 @@ export async function scanPackages(packages, batchSize, options) {
26
70
  const pkg = chunkItems[j];
27
71
  const row = rows[j];
28
72
  const vulnIds = (row?.vulnerabilities ?? []).map(v => v.id).filter(Boolean);
73
+ cache.queryEntries[getPackageCacheKey(pkg)] = vulnIds;
29
74
  if (vulnIds.length > 0) {
30
75
  results.push({ pkg, vulnIds });
31
76
  }
32
77
  }
33
78
  }
34
- spinner.succeed(`Queried OSV in ${chunks.length} batch${chunks.length === 1 ? "" : "es"}`);
79
+ if (chunks.length === 0) {
80
+ spinner.succeed("Loaded package matches from cache");
81
+ }
82
+ else {
83
+ spinner.succeed(`Queried OSV in ${chunks.length} batch${chunks.length === 1 ? "" : "es"}`);
84
+ }
35
85
  }
36
86
  else {
37
- spinner.succeed("Offline mode enabled; package matching was skipped");
87
+ const advisoryResult = await advisorySource.queryBatch(packages);
88
+ const rows = advisoryResult ?? [];
89
+ for (let i = 0; i < packages.length; i++) {
90
+ const pkg = packages[i];
91
+ const row = rows[i];
92
+ const vulnIds = (row?.vulnerabilities ?? []).map(v => v.id).filter(Boolean);
93
+ if (vulnIds.length > 0) {
94
+ results.push({ pkg, vulnIds });
95
+ }
96
+ }
97
+ spinner.succeed("Loaded package matches from the local advisory database");
38
98
  }
39
- const cache = loadCache(cacheDirOverride);
40
99
  const idSet = new Set(results.flatMap(r => r.vulnIds));
41
100
  const vulnMap = new Map();
42
101
  if (idSet.size > 0 && !offline) {
@@ -46,9 +105,11 @@ export async function scanPackages(packages, batchSize, options) {
46
105
  for (let i = 0; i < ids.length; i++) {
47
106
  const id = ids[i];
48
107
  detailSpinner.update(`Fetching vulnerability details ${i + 1}/${ids.length}...`);
49
- const cached = cache.entries[id];
50
- if (cached) {
51
- vulnMap.set(id, cached);
108
+ if (id in cache.entries) {
109
+ const cached = cache.entries[id];
110
+ if (cached) {
111
+ vulnMap.set(id, cached);
112
+ }
52
113
  continue;
53
114
  }
54
115
  try {
@@ -67,6 +128,28 @@ export async function scanPackages(packages, batchSize, options) {
67
128
  throw error;
68
129
  }
69
130
  }
131
+ else if (idSet.size > 0 && offline) {
132
+ const ids = [...idSet];
133
+ const detailSpinner = createSpinner("Loading local advisory details...", options);
134
+ try {
135
+ for (let i = 0; i < ids.length; i++) {
136
+ const id = ids[i];
137
+ detailSpinner.update(`Loading local advisory details ${i + 1}/${ids.length}...`);
138
+ try {
139
+ const detail = await advisorySource.getVuln(id);
140
+ vulnMap.set(id, detail);
141
+ }
142
+ catch {
143
+ // ignore missing local records so scans remain resilient to partial DB state
144
+ }
145
+ }
146
+ detailSpinner.succeed(`Loaded ${ids.length} local advisory detail record${ids.length === 1 ? "" : "s"}`);
147
+ }
148
+ catch (error) {
149
+ detailSpinner.fail("Failed while loading local advisory details");
150
+ throw error;
151
+ }
152
+ }
70
153
  if (!offline && idSet.size > 0) {
71
154
  saveCache(cache, cacheDirOverride);
72
155
  }
@@ -106,6 +189,9 @@ export async function scanPackages(packages, batchSize, options) {
106
189
  spinner.fail("Scan failed");
107
190
  throw error;
108
191
  }
192
+ finally {
193
+ sourceContext.cleanup();
194
+ }
109
195
  }
110
196
  function classifyRelationship(paths) {
111
197
  if (paths.length === 0)
@@ -144,7 +230,7 @@ export function buildCoverageNotes(scanInput, offline) {
144
230
  notes.push("Manifest fallback is limited to direct dependencies pinned to exact versions. It does not resolve transitive dependencies from package.json alone.");
145
231
  }
146
232
  if (offline) {
147
- notes.push("Offline mode only uses cached vulnerability details.");
233
+ notes.push("Offline mode uses the local advisory database and does not make outbound advisory API calls.");
148
234
  }
149
235
  return notes;
150
236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cve-lite-cli",
3
- "version": "1.0.6",
3
+ "version": "1.1.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": {
@@ -9,14 +9,22 @@
9
9
  "scripts": {
10
10
  "build": "tsc -p tsconfig.json",
11
11
  "dev": "tsx src/index.ts .",
12
- "start": "node dist/index.js ."
12
+ "start": "node dist/index.js .",
13
+ "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --passWithNoTests",
14
+ "test:watch": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --watch --passWithNoTests"
13
15
  },
14
16
  "dependencies": {
17
+ "better-sqlite3": "^12.8.0",
18
+ "fflate": "^0.8.2",
15
19
  "yaml": "^2.7.1",
16
20
  "yarn-lockfile": "^1.1.0"
17
21
  },
18
22
  "devDependencies": {
23
+ "@types/better-sqlite3": "^7.6.13",
24
+ "@types/jest": "^30.0.0",
19
25
  "@types/node": "^24.0.0",
26
+ "jest": "^30.3.0",
27
+ "ts-jest": "^29.4.9",
20
28
  "tsx": "^4.19.2",
21
29
  "typescript": "^5.8.2"
22
30
  },