Interview Prep/DevSecOps/Tool Internals and Comparisons

How does Trivy get its vulnerability data, and how do you run it air-gapped?

AdvancedConceptTool Internals and Comparisons
Answer

Trivy does not query NVD at scan time. It downloads a prebuilt database (trivy-db, an OCI artifact on ghcr.io/aquasecurity, rebuilt every few hours from distro advisories, GitHub advisories and NVD) into its cache, plus a separate Java DB for JAR identification. Scanning is a local lookup of detected packages against that DB.

For air-gapped or rate-limited environments, mirror the DB into an internal registry and point Trivy at it:

trivy image --download-db-only --db-repository registry.internal/trivy-db
trivy image --skip-db-update --skip-java-db-update --offline-scan app:1.4.2

In CI we cache the DB directory between jobs, which also avoids GHCR rate limits (TOOMANYREQUESTS).

All DevSecOps questions

More on Tool Internals and Comparisons