cve-lite-cli 1.0.4 → 1.0.5

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,5 +1,5 @@
1
1
  <div align="center">
2
- <img src="./assets/logo-with-title.png" alt="CVE Lite CLI" width="320"/>
2
+ <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/logo-with-title.png" alt="CVE Lite CLI" width="320"/>
3
3
 
4
4
  <h1>CVE Lite CLI</h1>
5
5
  <p>Fast, developer-friendly vulnerability scanning for JavaScript and TypeScript projects.</p>
@@ -65,6 +65,9 @@ cve-lite /path/to/project --json
65
65
 
66
66
  # SARIF output
67
67
  cve-lite /path/to/project --sarif --output reports/scan.sarif
68
+
69
+ # Use a custom advisory endpoint
70
+ cve-lite /path/to/project --osv-url https://security.company.internal/osv
68
71
  ```
69
72
 
70
73
  ## What it looks like
@@ -96,16 +99,16 @@ cve-lite .
96
99
  ```
97
100
 
98
101
  <p align="center">
99
- <img src="./assets/default-output.png" alt="CVE Lite CLI default output screenshot" width="900"/>
102
+ <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/default-output.png" alt="CVE Lite CLI default output screenshot" width="900"/>
100
103
  </p>
101
104
 
102
105
  Verbose examples:
103
106
 
104
107
  <p align="center">
105
- <img src="./assets/verbose-output-1.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
106
- <img src="./assets/verbose-output-2.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
107
- <img src="./assets/verbose-output-3.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
108
- <img src="./assets/verbose-output-4.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
108
+ <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/verbose-output-1.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
109
+ <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/verbose-output-2.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
110
+ <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/verbose-output-3.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
111
+ <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/verbose-output-4.png" alt="CVE Lite CLI verbose output screenshot" width="900"/>
109
112
  </p>
110
113
 
111
114
  ## Why this tool exists
@@ -136,6 +139,7 @@ The project emphasizes:
136
139
  - direct vs transitive visibility
137
140
  - top-priority fixes and a suggested remediation plan
138
141
  - JSON and SARIF output for automation
142
+ - configurable advisory endpoint support via `--osv-url` for internal proxies or mirrors
139
143
  - a small, reviewable runtime footprint
140
144
 
141
145
  That narrow scope is deliberate. CVE Lite CLI is not trying to be a full application security platform or a broad multi-surface scanner. It is trying to be a lightweight, understandable, developer-first tool for teams that want practical vulnerability scanning without extra cost or complexity.
@@ -154,13 +158,29 @@ Its role is narrower and workflow-focused:
154
158
 
155
159
  This section is here to make the scope clear. CVE Lite CLI aims to complement the broader security ecosystem by being a practical, low-friction option for JS/TS dependency checks close to release time.
156
160
 
161
+ ## Network behavior and privacy
162
+
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.
164
+
165
+ It does not require a hosted account, cloud dashboard, or source code upload.
166
+
167
+ For the full explanation, see [Network Behavior and Privacy](./docs/network-and-privacy.md).
168
+
169
+ ### Planned support for stricter environments
170
+
171
+ Support for stricter network-controlled environments is planned on the roadmap, including:
172
+
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
176
+
157
177
  ## How it works
158
178
 
159
179
  ### Architectural Philosophy
160
180
  CVE Lite CLI is designed as a **local-first, metadata-only** scanner. Unlike traditional SaaS security platforms that require code uploads or heavy agent installations, this tool operates directly within the developer's environment. It focuses on the "moment of release"—providing a high-speed, low-noise assessment of the dependency tree by analyzing resolved versions in project lockfiles.
161
181
 
162
182
  <p align="center">
163
- <img src="./assets/diagram.png" alt="CVE Lite CLI Workflow" width="800"/>
183
+ <img src="https://github.com/sonukapoor/cve-lite-cli/blob/main/assets/diagram.png" alt="CVE Lite CLI Workflow" width="800"/>
164
184
  </p>
165
185
 
166
186
  ### Workflow Specifications
@@ -174,22 +194,16 @@ CVE Lite CLI is designed as a **local-first, metadata-only** scanner. Unlike tra
174
194
 
175
195
  - **fast, low-friction workflow**
176
196
  Run it locally against a project without adopting a large security platform.
177
-
178
197
  - **practical remediation guidance**
179
198
  It does not stop at raw advisory output. It highlights top-priority fixes and suggests a fix plan.
180
-
181
199
  - **direct vs transitive visibility**
182
200
  The output makes it easier to see whether the risk comes from something you installed directly or from a nested package.
183
-
184
201
  - **developer-first**
185
202
  It is optimized for developers working with npm, pnpm, and Yarn lockfiles.
186
-
187
203
  - **budget-friendly**
188
204
  It is intended for developers and teams who want useful security checks without paying for a large commercial product.
189
-
190
205
  - **local-first**
191
206
  It reads your project locally and uses package/version matching against OSV advisories.
192
-
193
207
  - **release-focused**
194
208
  It is especially useful before a release, in CI, or during final dependency cleanup.
195
209
 
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ export class OsvAdvisorySource {
2
+ baseUrl;
3
+ constructor(baseUrl = "https://api.osv.dev") {
4
+ this.baseUrl = baseUrl;
5
+ }
6
+ async queryBatch(packages) {
7
+ try {
8
+ const response = await fetch(`${this.baseUrl}/v1/querybatch`, {
9
+ method: "POST",
10
+ headers: {
11
+ "Content-Type": "application/json",
12
+ },
13
+ body: JSON.stringify({
14
+ queries: packages.map(p => ({
15
+ package: {
16
+ ecosystem: p.ecosystem,
17
+ name: p.name,
18
+ },
19
+ version: p.version,
20
+ })),
21
+ }),
22
+ });
23
+ if (!response.ok) {
24
+ throw new Error(`OSV batch query failed: ${response.status} ${response.statusText}`);
25
+ }
26
+ const data = await response.json();
27
+ return data.results.map((r, i) => ({
28
+ package: packages[i].name,
29
+ version: packages[i].version,
30
+ vulnerabilities: r.vulns || [],
31
+ }));
32
+ }
33
+ catch (error) {
34
+ const message = error instanceof Error ? error.message : String(error);
35
+ throw new Error(`OSV batch query failed for ${this.baseUrl}: ${message}`);
36
+ }
37
+ }
38
+ async getVuln(id) {
39
+ try {
40
+ const response = await fetch(`${this.baseUrl}/v1/vulns/${encodeURIComponent(id)}`);
41
+ if (!response.ok) {
42
+ throw new Error(`OSV vuln fetch failed for ${id}: ${response.status} ${response.statusText}`);
43
+ }
44
+ return response.json();
45
+ }
46
+ catch (error) {
47
+ const message = error instanceof Error ? error.message : String(error);
48
+ throw new Error(`OSV vuln fetch failed for ${id} via ${this.baseUrl}: ${message}`);
49
+ }
50
+ }
51
+ }
package/dist/cli/args.js CHANGED
@@ -56,6 +56,14 @@ export function parseArgs(argv) {
56
56
  options.cacheDir = arg.slice("--cache-dir=".length);
57
57
  continue;
58
58
  }
59
+ if (arg === "--osv-url") {
60
+ options.osvUrl = argv[++i];
61
+ continue;
62
+ }
63
+ if (arg.startsWith("--osv-url=")) {
64
+ options.osvUrl = arg.slice("--osv-url=".length);
65
+ continue;
66
+ }
59
67
  if (arg === "--search-depth") {
60
68
  options.searchDepth = argv[++i] ?? options.searchDepth;
61
69
  continue;
package/dist/cli/help.js CHANGED
@@ -26,6 +26,7 @@ export function printHelp() {
26
26
  "",
27
27
  "Options:",
28
28
  " --json Print JSON output",
29
+ " --osv-url <url> Use a custom OSV-compatible advisory endpoint",
29
30
  " --verbose Show detailed output with fix plan, paths, and full table",
30
31
  " --prod-only Exclude dev dependencies where available",
31
32
  " --fail-on <severity> Exit non-zero at or above severity (default: critical)",
package/dist/index.js CHANGED
@@ -22,6 +22,27 @@ async function main() {
22
22
  if (!options.json) {
23
23
  printBanner();
24
24
  }
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)})`);
34
+ }
35
+ else {
36
+ console.log(`${chalk.gray("Advisory source:")} OSV (${chalk.cyan("https://api.osv.dev")})`);
37
+ }
38
+ if (options.osvUrl) {
39
+ try {
40
+ new URL(options.osvUrl);
41
+ }
42
+ catch {
43
+ throw new Error(`Invalid value for --osv-url: ${options.osvUrl}`);
44
+ }
45
+ }
25
46
  const scanInput = loadPackages(projectPath, !!options.prodOnly, searchDepth);
26
47
  const packages = scanInput.packages;
27
48
  logInfo(`Parsed ${packages.length} package${packages.length === 1 ? "" : "s"} from ${scanInput.source}${scanInput.filePath ? ` (${path.relative(projectPath, scanInput.filePath) || path.basename(scanInput.filePath)})` : ""}`, options);
@@ -35,7 +56,7 @@ async function main() {
35
56
  logWarn(buildNoPackagesMessage(projectPath), options);
36
57
  process.exit(0);
37
58
  }
38
- const findings = await scanPackages(packages, batchSize, !!options.offline, options.cacheDir, options);
59
+ const findings = await scanPackages(packages, batchSize, options);
39
60
  const sorted = findings.sort((a, b) => severityOrder[b.severity] - severityOrder[a.severity]);
40
61
  const coverage = buildCoverageNotes(scanInput, !!options.offline);
41
62
  const minSeverity = normalizeSeverity(options.minSeverity || "medium");
package/dist/scanner.js CHANGED
@@ -1,11 +1,17 @@
1
1
  import { chunk, unique } from "./utils/array.js";
2
2
  import { compareVersions, looksLikeVersion } from "./utils/version.js";
3
- import { osvQueryBatch, osvGetVuln } from "./osv/api.js";
4
3
  import { loadCache, saveCache } from "./osv/cache.js";
5
4
  import { maxSeverity } from "./osv/severity.js";
6
5
  import { createSpinner } from "./output/spinner.js";
7
- export async function scanPackages(packages, batchSize, offline, cacheDirOverride, options) {
6
+ import { OsvAdvisorySource } from "./advisory/osv-advisory-source.js";
7
+ export function createAdvisorySource(options) {
8
+ return new OsvAdvisorySource(options?.osvUrl);
9
+ }
10
+ export async function scanPackages(packages, batchSize, options) {
11
+ const offline = !!options.offline;
12
+ const cacheDirOverride = options.cacheDir;
8
13
  const spinner = createSpinner("Scanning dependencies against OSV...", options);
14
+ const advisorySource = createAdvisorySource({ osvUrl: options.osvUrl });
9
15
  try {
10
16
  const chunks = chunk(packages, batchSize);
11
17
  const results = [];
@@ -13,12 +19,12 @@ export async function scanPackages(packages, batchSize, offline, cacheDirOverrid
13
19
  for (let i = 0; i < chunks.length; i++) {
14
20
  spinner.update(`Scanning OSV batch ${i + 1}/${chunks.length}...`);
15
21
  const chunkItems = chunks[i];
16
- const batchResponse = await osvQueryBatch(chunkItems);
17
- const rows = batchResponse.results ?? [];
22
+ const advisoryResult = await advisorySource.queryBatch(chunkItems);
23
+ const rows = advisoryResult ?? [];
18
24
  for (let j = 0; j < chunkItems.length; j++) {
19
25
  const pkg = chunkItems[j];
20
26
  const row = rows[j];
21
- const vulnIds = (row?.vulns ?? []).map(v => v.id).filter(Boolean);
27
+ const vulnIds = (row?.vulnerabilities ?? []).map(v => v.id).filter(Boolean);
22
28
  if (vulnIds.length > 0) {
23
29
  results.push({ pkg, vulnIds });
24
30
  }
@@ -45,7 +51,7 @@ export async function scanPackages(packages, batchSize, offline, cacheDirOverrid
45
51
  continue;
46
52
  }
47
53
  try {
48
- const detail = await osvGetVuln(id);
54
+ const detail = await advisorySource.getVuln(id);
49
55
  vulnMap.set(id, detail);
50
56
  cache.entries[id] = detail;
51
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cve-lite-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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": {