Skip to content

Use cached vuln data in getVulnsAtRef#69

Merged
andrew merged 3 commits intomainfrom
fix-vulns-log-performance
Jan 31, 2026
Merged

Use cached vuln data in getVulnsAtRef#69
andrew merged 3 commits intomainfrom
fix-vulns-log-performance

Conversation

@andrew
Copy link
Contributor

@andrew andrew commented Jan 31, 2026

Two performance fixes for commands that were hitting the network unnecessarily:

vulns log/exposure - The getVulnsAtRef function was hitting the OSV API for every commit it checked, even though we have synced vulnerability data. Now uses cached data via scanCached. Times on octobox (5236 commits):

  • vulns log: 14.5s -> 0.5s
  • vulns exposure --all-time: 70s -> 2.5s

sbom - Was hitting ecosyste.ms for all dependencies including github-actions and docker (which can't be enriched). Also had a PURL version mismatch between cache keys and lookups. Now:

  • Skips enrichment for ecosystems without registries
  • Uses versionless PURLs consistently for cache keys
  • Time: ~21s -> ~0.3s

The getVulnsAtRef function was hitting the OSV API for every commit
it checked, making vulns log and vulns exposure commands very slow
(14s and 70s respectively).

Now it uses the already-synced vulnerability data from the database
via scanCached, reducing times to ~0.5s and ~2.5s.
Use versionless PURLs consistently for cache keys. The cache stores
packages by versionless PURL (pkg:gem/rails) but lookups were using
versioned PURLs (pkg:gem/rails@8.1.2), causing cache misses.

Now uses purl.MakePURLString to construct versionless cache keys
while keeping versioned PURLs in the SBOM output.

SBOM generation now uses cached license data properly, dropping from
~21s to ~0.5s on subsequent runs.
@andrew andrew force-pushed the fix-vulns-log-performance branch from 713bb5b to ecb5a9e Compare January 31, 2026 07:44
- purl v0.1.4: Map github-actions to githubactions PURL type
- manifests v0.3.1: Generate correct PURLs for GitHub Actions

Fixes #70
@andrew andrew merged commit e28d460 into main Jan 31, 2026
4 checks passed
@andrew andrew deleted the fix-vulns-log-performance branch January 31, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant