Russian version: README.ru.md
cve-db builds a local SQLite database with CVE data for offline lookups and batch processing.
The database combines three sources:
- NVD for CVE metadata, CVSS, CPE, vendor, and product
- EPSS for exploitation probability
- CISA KEV for known exploited vulnerabilities
The published OCI image is based on scratch and contains one file:
/opt/db/cve.db
This is useful when you need:
- one offline SQLite file for Python tools, shell scripts, CI, and containers
- a small OCI artifact that can be copied into another image
- a reproducible daily snapshot with build provenance
Install dependencies:
pip install -r requirements.txtBuild the database for the first time:
export NIST_API=your_api_key
python -m cve_db.sync init --db-path ./dist/cve.dbUpdate an existing database:
python -m cve_db.sync update --db-path ./dist/cve.dbShow status:
python -m cve_db.sync status --db-path ./dist/cve.db- Open the request form: https://nvd.nist.gov/developers/request-an-api-key
- Fill in
Organization Name,Email Address, andOrganization Type. - Scroll to the end of the Terms of Use and confirm agreement.
- Submit the form.
- Open the email from NVD and follow the activation link.
- Export the key before running sync:
export NIST_API=your_api_keyGeneral NVD developer documentation: https://nvd.nist.gov/developers/start-here
from cve_db import db_nist_check, db_epss_check
nvd = db_nist_check("CVE-2021-44228", db_path="/opt/db/cve.db")
epss = db_epss_check("CVE-2021-44228", db_path="/opt/db/cve.db")
print(nvd["cvss_baseScore"])
print(nvd["cvss_severity"])
print(nvd["cisa_kev"])
print(epss["epss"])sqlite3 /opt/db/cve.db \
"SELECT cve_id, priority, cvss_base_score, epss
FROM cve_priority
WHERE priority IN ('Priority 1+', 'Priority 1')
ORDER BY epss DESC
LIMIT 20;"Copy the DB into another image:
FROM ghcr.io/drybalka-s/cve-db:v1 AS cve-db
FROM your-app:latest
COPY --from=cve-db /opt/db/cve.db /opt/db/cve.dbUse v1 in runtime workloads. Use dated tags for pinning and rollback.
The OCI image uses two tags:
v1as the moving compatibility tagv1-YYYY-MM-DDas the immutable daily snapshot tag
The release workflow:
- Pulls the current
v1image if it exists. - Extracts
/opt/db/cve.db. - Runs
update, oriniton the first release. - Builds a new
scratchimage. - Pushes
v1andv1-YYYY-MM-DD. - Publishes a provenance attestation.
- Deletes old dated tags older than 14 days.
Workflow files:
Required repository secrets:
NIST_APIfor faster NVD syncGHCR_CLEANUP_TOKENfor deleting old GHCR package versions
Verify the moving tag:
gh attestation verify oci://ghcr.io/drybalka-s/cve-db:v1 -R drybalka-s/cve-dbVerify a dated snapshot:
gh attestation verify oci://ghcr.io/drybalka-s/cve-db:v1-2026-04-27 -R drybalka-s/cve-dbVerify by digest:
gh attestation verify \
oci://ghcr.io/drybalka-s/cve-db@sha256:IMAGE_DIGEST \
-R drybalka-s/cve-dbThe cve_priority view calculates priority from CVSS, EPSS, and KEV status.
Priority 1+: in CISA KEV or CVSS v4 vector contains/E:A/Priority 1: CVSS >= 6.0 and EPSS >= 0.5Priority 2: CVSS >= 6.0 and EPSS < 0.5Priority 3: CVSS < 6.0 and EPSS >= 0.5Priority 4: CVSS < 6.0 and EPSS < 0.5