Chainguard Comparison

Collects CVE posture data comparing Hummingbird and Chainguard container images and surfaces the results in the Hummingbird dashboard under the Competitive tab.

Features

  • Fetches Hummingbird CVE data from the catalog API — the same source used by images.redhat.com, updated hourly by the scan pipeline
  • Scans Chainguard images with Grype (the only available source for Chainguard CVE data)
  • Stores results, including the individual CVE IDs found by each side, in PostgreSQL for trend tracking and historical comparison
  • Dashboard shows per-image CVE counts, severity breakdowns (C/H/M/L), delta (HB minus CG), 30-day trend charts, aggregate summary stats, and a per-image CVE ID diff drawer
  • Runs every 6 hours as a Kubernetes CronJob

Prerequisites

  • Access to the Hummingbird cluster (PostgreSQL, image pull credentials)
  • The chainguard_comparison package from competitive-tools installed in the container image

Deployment

The tool is deployed as a Kubernetes CronJob. The container image is built by Konflux from chainguard-comparison/Containerfile.

Environment variables

Variable Required Description
DATABASE_URL Yes PostgreSQL connection string, e.g. postgresql://user:pass@host/db
GRYPE_TIMEOUT No Per-image Grype scan timeout in seconds (default: 300)
SENTRY_DSN No Sentry DSN for error reporting

How it works

  1. Discovery — lists Hummingbird images from the catalog API and Chainguard images via the OCI distribution API
  2. Matching — pairs images by name using the alias map in competitive-tools (e.g. nodejs ↔ node, postgresql ↔ postgres). Each pair also captures the catalog’s own real image name and stream for the chosen Hummingbird tag (e.g. real name valkey, stream 9.0) alongside the “common” display name/parsed version used for comparison (e.g. redis, 9) — the two can disagree, either because the display name is a cross-vendor alias or because the parsed version doesn’t match the catalog’s own stream label. Both are stored (see schema below) so the dashboard can match HUM tickets against the catalog’s real identity instead of the display name (see hummingbird-dashboard.md)
  3. HB collection — calls GET /v1/images/{name}/vulnerabilities/{tag} on the catalog API; no image pull or local scan required. The catalog API’s own scan is Grype-based too, without --by-cve, so its vulnerabilities[].id can also be a raw GHSA/Go vulnerability DB ID
  4. CG collection — pulls each Chainguard image and runs grype locally with --by-cve; Chainguard has no publicly accessible pre-scanned CVE feed. --by-cve reports a CVE ID instead of the native GHSA/Go vulnerability DB ID wherever grype’s own local vulnerability DB has that cross-reference, with no added network call
  5. Alias resolution — every non-CVE ID collected from either side (cg_comparison.__main__._resolve_non_cve_ids) is looked up in one batched call to grype db search vuln against grype’s already-downloaded local database, which checks every data provider’s record for that ID, not just the one that produced a live scan match – this finds cross-references --by-cve’s own live match misses. An ID with no known CVE anywhere in the database is stored as-is
  6. Storage — writes both sides to the chainguard_scans table in PostgreSQL

Dashboard

The /competitive page in hummingbird-dashboard shows:

  • Summary cards: total images compared, count worse/better/same
  • Sortable table with per-image CVE counts and delta
  • Inline severity breakdown: Critical / High / Medium / Low
  • Per-image 30-day trend chart (click trend on any row)
  • Filter box for quick image lookup
  • A per-image CVE diff drawer (click the Delta value on any row) listing every CVE ID that differs between the two scans:
    • + — a CVE ID reported only by Hummingbird’s scan
    • - — a CVE ID reported only by Chainguard’s scan
    • This is a scan result difference, not a confirmed determination of whether either side is actually affected
    • CVE IDs both sides report are shared and excluded from the diff
    • Each CVE ID links to its Red Hat CVE page; when a HUM Jira ticket tracks it, the ticket is shown and linked alongside it (HUM-5678/CVE-2026-1234)
    • If a scan predates the cve_ids column, the drawer shows a notice instead of a misleading empty diff

Database schema

CREATE TABLE chainguard_scans (
    id          SERIAL PRIMARY KEY,
    collected_at TIMESTAMPTZ NOT NULL,
    source      TEXT NOT NULL,        -- 'hummingbird' or 'chainguard'
    image_name  TEXT NOT NULL,
    tag         TEXT NOT NULL DEFAULT 'latest',
    image_ref   TEXT,
    total_cves  INTEGER NOT NULL DEFAULT 0,
    critical    INTEGER NOT NULL DEFAULT 0,
    high        INTEGER NOT NULL DEFAULT 0,
    medium      INTEGER NOT NULL DEFAULT 0,
    low         INTEGER NOT NULL DEFAULT 0,
    negligible  INTEGER NOT NULL DEFAULT 0,
    unknown     INTEGER NOT NULL DEFAULT 0,
    cve_ids     JSONB NOT NULL DEFAULT '[]'::jsonb,  -- distinct CVE IDs found in this scan
    catalog_image_name TEXT,  -- real Hummingbird image name, e.g. "valkey" (image_name may be a display alias, e.g. "redis")
    catalog_stream     TEXT   -- real catalog stream, e.g. "9.0" (tag may be a parsed, less precise version)
);

The table is created by the Alembic migration b4e7f8a1c3d5_add_chainguard_scans.py; cve_ids was added later by 9c4f7e21ab36_add_cve_ids_to_chainguard_scans.py, and catalog_image_name / catalog_stream by d3f6a8b1c2e4_add_catalog_identity_to_chainguard_scans.py. Scans collected before the cve_ids migration shipped have an empty cve_ids array even though total_cves is nonzero — the dashboard detects this case and shows a “check back after the next collection run” notice instead of a false empty diff. Scans collected before catalog_image_name / catalog_stream existed have both as NULL; the dashboard’s HUM ticket matching falls back to image_name / tag (the display name/parsed version) in that case, matching its pre-migration behavior exactly.

Development

cd chainguard-comparison
pip install -e ".[dev]"
python -m pytest tests/

To run the collector locally against a development database:

export DATABASE_URL=postgresql://postgres:dev@localhost:5432/events
python -m cg_comparison

License

GPL-3.0-or-later