cve-lite-cli 1.21.0 → 1.22.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
@@ -173,7 +173,7 @@ CVE Lite CLI fits at every stage of the development workflow, not just CI.
173
173
 
174
174
  CVE Lite CLI scans its own dependencies in CI. See [`self-scan.yml`](https://github.com/OWASP/cve-lite-cli/blob/main/.github/workflows/self-scan.yml).
175
175
 
176
- For full CI patterns including offline workflows, git hooks, and scripted automation, see the [CI and Workflow Integration guide](https://owasp.org/cve-lite-cli/docs/ci-integration).
176
+ For full CI patterns including offline workflows, git hooks, and scripted automation, see the [CI and Workflow Integration guide](https://owasp.org/cve-lite-cli/docs/workflow-integration).
177
177
 
178
178
  ## How it compares
179
179
 
@@ -187,9 +187,13 @@ No other free tool combines all of the following: lockfile scanning across npm,
187
187
  | Free to use | ✅ | ✅ | ✅ | ❌ | ❌ |
188
188
  | Usage-aware reachability scanning | ✅ | ❌ | ❌ | ✅ | ⚠️ |
189
189
  | Direct vs transitive visibility | ✅ | ⚠️ | ✅ | ✅ | ✅ |
190
+ | Dev vs runtime dependency labelling | ✅ | ⚠️ | ❌ | ⚠️ | ❌ |
190
191
  | Copy-and-run fix commands | ✅ | ❌ | ❌ | ✅ | ⚠️ |
191
192
  | Transitive parent update guidance | ✅ | ❌ | ⚠️ | ⚠️ | ⚠️ |
192
193
  | Suggested remediation plan | ✅ | ❌ | ⚠️ | ✅ | ⚠️ |
194
+ | Ratcheting mode (baseline suppression) | ✅ | ❌ | ❌ | ⚠️ | ❌ |
195
+ | Interactive HTML report | ✅ | ❌ | ❌ | ✅ | ❌ |
196
+ | SARIF / GitHub Code Scanning output | ✅ | ❌ | ✅ | ✅ | ❌ |
193
197
  | JSON output | ✅ | ✅ | ✅ | ✅ | ✅ |
194
198
  | Offline/local advisory DB | ✅ | ❌ | ⚠️ | ❌ | ❌ |
195
199
 
@@ -428,7 +432,7 @@ It is a good fit for:
428
432
  - **Enterprise teams with restricted networks** — offline advisory DB removes the need for runtime outbound calls during scans
429
433
  - **Teams running npm, pnpm, Yarn, and Bun** — unified scanning across all four package managers in one tool
430
434
 
431
- See the [CI and Workflow Integration guide](https://owasp.org/cve-lite-cli/docs/ci-integration) for concrete patterns across these scenarios.
435
+ See the [CI and Workflow Integration guide](https://owasp.org/cve-lite-cli/docs/workflow-integration) for concrete patterns across these scenarios.
432
436
 
433
437
  Using CVE Lite CLI at your company or in your projects? [Share your use case in the community thread](https://github.com/OWASP/cve-lite-cli/discussions/481) - we'd love to hear about it.
434
438
 
@@ -27,6 +27,10 @@ export function formatRelationshipLabel(value) {
27
27
  return chalk.yellow(value);
28
28
  return chalk.gray(value);
29
29
  }
30
+ export function formatRelLabel(finding) {
31
+ const base = finding.relationship;
32
+ return finding.pkg.dev === true ? `${base} · dev` : base;
33
+ }
30
34
  export function formatAdvisorySourceLine(sourceLabel) {
31
35
  const match = sourceLabel.match(/^(.*) \((.*)\)$/);
32
36
  if (!match) {
@@ -187,6 +191,7 @@ export function serializeFinding(finding, plan) {
187
191
  version: finding.pkg.version,
188
192
  severity: finding.severity,
189
193
  relationship: finding.relationship,
194
+ dev: finding.pkg.dev ?? false,
190
195
  firstFixedVersion: finding.firstFixedVersion,
191
196
  validatedFirstFixedVersion: finding.validatedFirstFixedVersion ?? null,
192
197
  fixVersionValidationNote: finding.fixVersionValidationNote ?? null,
@@ -102,6 +102,7 @@ button.header-link:hover{color:#58a6ff;border-color:#58a6ff}
102
102
  .rel-badge.direct{color:#3fb950;background:#3fb95022}
103
103
  .rel-badge.transitive{color:#e3b341;background:#e3b34122}
104
104
  .rel-badge.unknown{color:#8b949e;background:#8b949e22}
105
+ .rel-badge.dev{color:#a371f7;background:#6e40c922;border:1px solid #6e40c955}
105
106
  .cve-link{font-size:11px;color:#58a6ff;font-family:monospace;text-decoration:none;border-bottom:1px dotted #58a6ff66}
106
107
  .cve-link:hover{color:#79c0ff}
107
108
  .fix-hint{font-size:11px;color:#3fb950;font-family:monospace}
@@ -394,6 +395,12 @@ function advisoryLink(id) {
394
395
  }
395
396
  return `<a class="cve-link" href="https://osv.dev/vulnerability/${escapeHtml(id)}" target="_blank">${escapeHtml(id)}</a>`;
396
397
  }
398
+ function renderRelBadge(finding) {
399
+ if (finding.dev) {
400
+ return `<span class="rel-badge dev">${escapeHtml(finding.relationship)} · dev</span>`;
401
+ }
402
+ return `<span class="rel-badge ${escapeHtml(finding.relationship)}">${escapeHtml(finding.relationship)}</span>`;
403
+ }
397
404
  export function renderFindingRow(finding, idx, skippedKeys) {
398
405
  const cveLinks = finding.cves.length > 0
399
406
  ? finding.cves.map(advisoryLink).join(", ")
@@ -432,7 +439,7 @@ export function renderFindingRow(finding, idx, skippedKeys) {
432
439
  <td><div class="pkg-name">${escapeHtml(finding.package)}</div><div class="pkg-version">${escapeHtml(finding.version)}</div></td>
433
440
  <td>${fixHtml}</td>
434
441
  <td><span class="sev-badge ${escapeHtml(finding.severity)}">${escapeHtml(finding.severity)}</span></td>
435
- <td><span class="rel-badge ${escapeHtml(finding.relationship)}">${escapeHtml(finding.relationship)}</span></td>
442
+ <td>${renderRelBadge(finding)}</td>
436
443
  <td>${cveLinks}</td>
437
444
  </tr>
438
445
  <tr id="detail-${idx}" class="detail-row">
@@ -2,7 +2,7 @@ import { chalk, stripAnsi } from "../utils/chalk.js";
2
2
  import { buildSuggestedFixCommandPlan } from "../remediation/fix-commands.js";
3
3
  import { isMajorVersionBump } from "../utils/version.js";
4
4
  import { getPrimaryParent } from "../utils/finding.js";
5
- import { countUniqueAdvisories, formatSeverityLabel, formatRelationshipLabel } from "./formatters.js";
5
+ import { countUniqueAdvisories, formatSeverityLabel, formatRelationshipLabel, formatRelLabel } from "./formatters.js";
6
6
  import { pluralize } from "../utils/string.js";
7
7
  import { selectFindingsForCompact } from "./finding-display.js";
8
8
  import { MAL_PRIVATE_REGISTRY_COMPACT_MESSAGE, MAL_PRIVATE_REGISTRY_LEGEND_MESSAGE } from "../constants.js";
@@ -178,7 +178,7 @@ export function printTable(findings, threshold, skippedKeys) {
178
178
  f.pkg.name,
179
179
  f.pkg.version,
180
180
  f.severity,
181
- f.relationship,
181
+ formatRelLabel(f),
182
182
  usageText,
183
183
  fixedDisplay,
184
184
  f.vulnerabilities.map(v => v.id).join(", ")
@@ -316,9 +316,9 @@ export function printCompactOutput(findings, scanInput, options) {
316
316
  for (const finding of urgentFindings) {
317
317
  const sevLabel = finding.severity.toUpperCase().padEnd(8);
318
318
  const typeLabel = finding.relationship === "direct"
319
- ? "Direct dependency"
319
+ ? `Direct dependency${finding.pkg.dev === true ? " · dev" : ""}`
320
320
  : finding.relationship === "transitive"
321
- ? "Transitive dependency"
321
+ ? `Transitive dependency${finding.pkg.dev === true ? " · dev" : ""}`
322
322
  : "Unknown dependency";
323
323
  let usageContext = "";
324
324
  if (finding.usage) {
@@ -120,12 +120,14 @@ export function loadFromBunLock(filePath, prodOnly) {
120
120
  const dev = devNames.has(pkgName) && !prodNames.has(pkgName);
121
121
  if (prodOnly && dev)
122
122
  continue;
123
+ const resolvedUrl = typeof entry[1] === "string" && entry[1] !== "" ? entry[1] : undefined;
123
124
  upsertPackage(map, {
124
125
  name,
125
126
  version,
126
127
  ecosystem: "npm",
127
128
  dev,
128
129
  paths: [],
130
+ resolvedUrl,
129
131
  });
130
132
  }
131
133
  collectBunPaths(rootDepNames, childDepsByPackageName, map, packageNameToVersion);
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import YAML from "yaml";
3
3
  import { looksLikeVersion, normalizeRawVersion } from "../utils/version.js";
4
- import { upsertPackage } from "./utils.js";
4
+ import { upsertPackage, markDevPackages } from "./utils.js";
5
5
  import { uniquePathArrays } from "../utils/array.js";
6
6
  const MAX_PATHS_PER_PACKAGE = 5;
7
7
  const MAX_PATH_DEPTH = 10;
@@ -54,7 +54,8 @@ function loadLegacy(parsed, prodOnly) {
54
54
  const dev = !!meta?.dev;
55
55
  if (prodOnly && dev)
56
56
  continue;
57
- upsertPackage(map, { name: ref.name, version: ref.version, ecosystem: "npm", dev, paths: [] });
57
+ const resolvedUrl = meta?.resolution?.tarball;
58
+ upsertPackage(map, { name: ref.name, version: ref.version, ecosystem: "npm", dev, paths: [], resolvedUrl });
58
59
  }
59
60
  const rootDeps = [];
60
61
  for (const importer of Object.values(importers)) {
@@ -91,6 +92,16 @@ function loadV9(parsed, prodOnly) {
91
92
  const importers = parsed?.importers ?? {};
92
93
  const graph = new Map();
93
94
  const map = new Map();
95
+ const packagesMetaSection = parsed?.packages ?? {};
96
+ const resolutionUrls = new Map();
97
+ for (const [key, pkgMeta] of Object.entries(packagesMetaSection)) {
98
+ const ref = parsePnpmPackageKeyV9(String(key));
99
+ if (!ref)
100
+ continue;
101
+ const tarball = pkgMeta?.resolution?.tarball;
102
+ if (tarball)
103
+ resolutionUrls.set(ref.key, tarball);
104
+ }
94
105
  for (const [key, meta] of Object.entries(snapshotsSection)) {
95
106
  const ref = parsePnpmPackageKeyV9(String(key));
96
107
  if (!ref)
@@ -109,9 +120,10 @@ function loadV9(parsed, prodOnly) {
109
120
  const dev = !!meta?.dev;
110
121
  if (prodOnly && dev)
111
122
  continue;
112
- upsertPackage(map, { name: ref.name, version: ref.version, ecosystem: "npm", dev, paths: [] });
123
+ upsertPackage(map, { name: ref.name, version: ref.version, ecosystem: "npm", dev, paths: [], resolvedUrl: resolutionUrls.get(ref.key) });
113
124
  }
114
125
  const rootDeps = [];
126
+ const devDepNames = new Set();
115
127
  for (const importer of Object.values(importers)) {
116
128
  for (const depSectionName of ["dependencies", "optionalDependencies", "devDependencies"]) {
117
129
  if (prodOnly && depSectionName === "devDependencies")
@@ -120,6 +132,9 @@ function loadV9(parsed, prodOnly) {
120
132
  if (!depSection || typeof depSection !== "object")
121
133
  continue;
122
134
  for (const [depName, depRef] of Object.entries(depSection)) {
135
+ if (depSectionName === "devDependencies") {
136
+ devDepNames.add(String(depName));
137
+ }
123
138
  const resolved = normalizePnpmDepRefV9(String(depName), depRef);
124
139
  if (resolved) {
125
140
  rootDeps.push(resolved);
@@ -139,6 +154,7 @@ function loadV9(parsed, prodOnly) {
139
154
  }
140
155
  }
141
156
  collectPnpmPaths(rootDeps, graph, map, parsePnpmPackageKeyV9);
157
+ markDevPackages(map, devDepNames);
142
158
  return [...map.values()];
143
159
  }
144
160
  function collectPnpmPaths(rootDeps, graph, map, parsePackageKey) {
@@ -1,4 +1,19 @@
1
1
  import { uniquePathArrays } from "../utils/array.js";
2
+ export function markDevPackages(map, devDepNames) {
3
+ if (devDepNames.size === 0)
4
+ return;
5
+ for (const pkg of map.values()) {
6
+ const paths = pkg.paths ?? [];
7
+ if (paths.length === 0)
8
+ continue;
9
+ // A package is dev only if every known path starts from a devDependency root.
10
+ // path[1] is the root dep name (path[0] is always "project").
11
+ const allPathsFromDev = paths.every(p => p.length >= 2 && devDepNames.has(p[1]));
12
+ if (allPathsFromDev) {
13
+ pkg.dev = true;
14
+ }
15
+ }
16
+ }
2
17
  export function upsertPackage(map, candidate) {
3
18
  const key = `${candidate.name}@${candidate.version}`;
4
19
  const existing = map.get(key);
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  import { parse as parseYarnLock } from "yarn-lockfile";
4
4
  import { uniquePathArrays } from "../utils/array.js";
5
5
  import { normalizeRawVersion } from "../utils/version.js";
6
- import { upsertPackage } from "./utils.js";
6
+ import { upsertPackage, markDevPackages } from "./utils.js";
7
7
  const MAX_PATHS_PER_PACKAGE = 5;
8
8
  const MAX_PATH_DEPTH = 10;
9
9
  export function buildYarnWorkspaceMap(filePath) {
@@ -117,8 +117,9 @@ function loadRootDepKeys(filePath, selectorToKey, map) {
117
117
  rootPkg = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8"));
118
118
  }
119
119
  catch {
120
- return [];
120
+ return { keys: [], devDepNames: new Set() };
121
121
  }
122
+ const devDepNames = new Set(Object.keys(rootPkg.devDependencies ?? {}));
122
123
  const rootDepKeys = [];
123
124
  for (const depSection of ["dependencies", "optionalDependencies", "devDependencies"]) {
124
125
  const deps = rootPkg[depSection];
@@ -142,7 +143,7 @@ function loadRootDepKeys(filePath, selectorToKey, map) {
142
143
  }
143
144
  }
144
145
  }
145
- return rootDepKeys;
146
+ return { keys: rootDepKeys, devDepNames };
146
147
  }
147
148
  function parseBerryDependencies(block) {
148
149
  const dependencies = {};
@@ -212,8 +213,9 @@ function loadFromYarnBerryLock(content, filePath) {
212
213
  }
213
214
  graph.set(canonicalKey, [...depKeys]);
214
215
  }
215
- const rootDepKeys = loadRootDepKeys(filePath, selectorToKey, map);
216
+ const { keys: rootDepKeys, devDepNames } = loadRootDepKeys(filePath, selectorToKey, map);
216
217
  collectYarnPaths(rootDepKeys, graph, map);
218
+ markDevPackages(map, devDepNames);
217
219
  return [...map.values()];
218
220
  }
219
221
  function loadFromYarnClassicLock(parsed, filePath) {
@@ -234,7 +236,7 @@ function loadFromYarnClassicLock(parsed, filePath) {
234
236
  for (const selector of selectors) {
235
237
  selectorToKey.set(selector, canonicalKey);
236
238
  }
237
- upsertPackage(map, { name, version, ecosystem: "npm", paths: [] });
239
+ upsertPackage(map, { name, version, ecosystem: "npm", paths: [], resolvedUrl: meta?.resolved });
238
240
  }
239
241
  for (const [selectorKey, meta] of Object.entries(parsed.object)) {
240
242
  const version = meta?.version;
@@ -258,8 +260,9 @@ function loadFromYarnClassicLock(parsed, filePath) {
258
260
  }
259
261
  graph.set(canonicalKey, [...depKeys]);
260
262
  }
261
- const rootDepKeys = loadRootDepKeys(filePath, selectorToKey, map);
263
+ const { keys: rootDepKeys, devDepNames } = loadRootDepKeys(filePath, selectorToKey, map);
262
264
  collectYarnPaths(rootDepKeys, graph, map);
265
+ markDevPackages(map, devDepNames);
263
266
  return [...map.values()];
264
267
  }
265
268
  export function loadFromYarnLock(filePath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cve-lite-cli",
3
- "version": "1.21.0",
3
+ "version": "1.22.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": {