Image Scanning and Supply Chain Security: CVEs, Signing, and Trusted Registries

Container image scanning with Trivy, Grype and Docker Scout, plus SBOMs, provenance and Cosign signing for a safer supply chain.

Executive Summary: An image is only as trustworthy as everything that went into it: the base image, the OS packages, the language dependencies and the build system. Supply chain security for containers rests on four habits. Scan images for known vulnerabilities in CI and on a schedule, and triage results by fixability and exposure rather than raw counts. Generate an SBOM and provenance for every image so you know what it contains and how it was built. Sign images and verify signatures before deployment. And pull only from registries and publishers you trust, through a registry you control.
Isometric container under a magnifying glass with a CVE warning, a signed seal and a verified tick on a blue platform

A scanner reports 412 vulnerabilities in a production image, 37 of them critical. The team spends a week arguing about whether any of them matter, upgrades the base image, and gets the count down to 180. Three months later, a new critical CVE in a widely used library is announced, and nobody can say which of 60 services contain it, because nobody knows what is in their images. Both situations are supply chain problems: too much in the image, and too little information about it.

Software supply chain security covers everything between source code and a running container: dependencies, base images, build systems and registries. Image scanning compares the packages in an image against databases of known vulnerabilities, identified by CVE numbers. Signing attaches a cryptographic signature to an image so you can verify who built it and that it has not been altered.

Scanning images for CVEs

Scanners inventory OS packages (from dpkg, apk or rpm databases) and language packages (from lockfiles and installed metadata), then match versions against vulnerability feeds. Popular options:

Tool Type Notes
Trivy (Aqua Security) Open source CLI Images, filesystems, IaC and secrets; easy to run in any CI
Grype (Anchore) Open source CLI Pairs with Syft for SBOM generation
Docker Scout Docker’s service, in early access Built into Docker Desktop and the CLI; recommends base image updates
Snyk Container Commercial Developer-focused remediation advice
Registry scanning Built into ECR, Artifact Registry, ACR, Harbor Scans on push without CI changes
# Fail the CI job on fixable high or critical vulnerabilities
trivy image --severity HIGH,CRITICAL --ignore-unfixed --exit-code 1 \
  ghcr.io/acme/billing-api:${GIT_SHA}

Triage, do not just count

A raw CVE count is a poor measure of risk. Prioritize with four questions:

  1. Is a fix available? Fixable vulnerabilities are actionable today; unfixed ones are tracked. --ignore-unfixed keeps CI gates actionable.
  2. How severe is it, really? CVSS severity is a starting point. The CISA Known Exploited Vulnerabilities catalog and EPSS exploit-probability scores show which ones attackers actually use.
  3. Is the vulnerable code reachable? A vulnerability in an image-parsing library does not matter much to a service that never parses images, though it still matters if an attacker gains code execution.
  4. Is it exposed? An internet-facing API deserves faster patching than an internal batch job.

The single most effective way to reduce findings is to ship less: multi-stage builds and a minimal base image often remove most findings at once, because most CVEs live in packages the application never uses. The second most effective is rebuilding regularly, so base image patches actually reach production.

Scan more than once

A clean scan at build time only means no known vulnerabilities on that day. New CVEs are published constantly against software that has not changed. Scan images in CI, and rescan deployed images on a schedule, daily or weekly, against current databases. Registry scanning features and Docker Scout are useful here because they track images after they are pushed.

SBOMs and provenance: knowing what you shipped

A Software Bill of Materials (SBOM) lists every package and version in an image, in a standard format such as SPDX or CycloneDX. When the next widely used library has a critical vulnerability, an SBOM per image turns “which services are affected?” from a week of investigation into a query.

Provenance records how an image was built: from which source repository and commit, by which builder, with which parameters. It is the basis of the SLSA framework’s levels of build integrity.

Docker Buildx can attach both to an image as attestations stored alongside it in the registry:

docker buildx build \
  --sbom=true \
  --provenance=mode=max \
  -t ghcr.io/acme/billing-api:${GIT_SHA} --push .

docker buildx imagetools inspect ghcr.io/acme/billing-api:${GIT_SHA} --format "{{ json .SBOM }}"

Since Buildx 0.10, released in January 2023, a minimal provenance attestation is added by default when pushing. Syft is a good standalone alternative for generating SBOMs from any image.

Signing images

Tags can be moved and registries can be compromised. A signature lets the deployer verify that an image was produced by your build pipeline and has not changed since. Sigstore’s Cosign has become the standard tool, and its 2.0 release in February 2023 made keyless signing the default:

# In CI, using the CI provider's OIDC identity instead of a long-lived key
cosign sign ghcr.io/acme/billing-api@sha256:4f2c9d...

# At deploy time, verify the signer identity and issuer
cosign verify ghcr.io/acme/billing-api@sha256:4f2c9d... \
  --certificate-identity-regexp 'https://github.com/acme/billing-api/.*' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Keyless signing uses a short-lived certificate tied to the workflow’s identity and records the signature in a public transparency log, so there is no signing key to protect or leak. Always sign and verify by digest, not tag. Verification only helps if something enforces it: a deploy script that refuses unsigned images, or an admission controller in Kubernetes that enforces policy at deploy time. Docker’s older Content Trust feature, based on Notary v1, still exists but has seen little adoption compared with Sigstore.

Trusted sources and registries

  • Prefer Docker Official Images and Verified Publisher images over random community images with similar names. Typosquatted images containing cryptocurrency miners are found on public registries regularly.
  • Mirror base images into your own registry, such as ECR, Artifact Registry or Harbor, and build only from there. This gives you a controlled point to scan, avoids Docker Hub rate limits, and keeps builds working if an upstream image disappears.
  • Pin by digest and let Renovate or Dependabot propose updates, so changes to base images are reviewed like code.
  • Restrict who can push to production repositories; only the CI pipeline should.

Frequently Asked Questions

What is container image scanning?

It is the process of inventorying the OS and language packages inside an image and matching their versions against vulnerability databases to find known CVEs. Tools such as Trivy, Grype and Docker Scout do this in CI or on registries.

How should I handle hundreds of CVEs in an image?

First reduce them by using a minimal base image, multi-stage builds and a fresh rebuild. Then prioritize what remains by fix availability, known exploitation, reachability and exposure, and gate CI only on fixable high and critical findings.

What is an SBOM for a Docker image?

A Software Bill of Materials lists every package and version inside an image in a standard format such as SPDX or CycloneDX. It lets you quickly find which images contain a vulnerable component when a new CVE is announced.

How do I sign a Docker image?

Use Sigstore Cosign. In CI, cosign sign with keyless mode signs the image digest using the pipeline’s OIDC identity. Before deployment, cosign verify checks the signature against the expected identity and issuer.

Know it, check it, prove it

Supply chain security comes down to knowing what is in every image, checking it continuously against new vulnerabilities, and proving where it came from before it runs. Scanners, SBOMs, provenance and signatures each cover one part, and none of them is much work to add to a pipeline. Start with scanning and minimal images, then add attestations and signature verification as your deployment process matures. The official documentation is worth keeping open: the Docker Scout documentation and the SLSA supply chain framework. Related reading on this site: Docker CI/CD.

Originally posted on 19 September 2023 and post last modified on 19 September 2023

Container Security DevOps Docker Supply Chain Security

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *