Interview Prep/CI/CD/Supply Chain and Pipeline Security

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.

All CI/CD questions

More on Supply Chain and Pipeline Security