How do you sign container images and verify them at deploy time?
IntermediateProductionSupply Chain and Pipeline Security
Answer
Sign by digest with cosign; keyless signing uses the CI job's OIDC identity and records the signature in the Rekor transparency log. At deploy time an admission controller (Kyverno, Sigstore policy-controller, Ratify/Gatekeeper) verifies the signature and the expected signer identity before pods are admitted.
cosign sign --yes ghcr.io/acme/shop-api@sha256:abc123...
cosign verify ghcr.io/acme/shop-api@sha256:abc123... \
--certificate-identity-regexp 'https://github.com/acme/shop-api/.github/workflows/release.yml@refs/heads/main' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com
Always sign the digest, never a mutable tag.
More on Supply Chain and Pipeline Security
What is a software supply chain attack, and where does the pipeline fit?BeginnerWhat is an SBOM and why do you generate one in CI?BeginnerWhat is SLSA and which level should a typical team aim for?IntermediateHow do you verify provenance before deploying?AdvancedHow do you scan images and dependencies in the pipeline without drowning in noise?IntermediateHow do you prevent dependency confusion and typosquatting in build pipelines?Advanced