Signing and verifying images

Advanced · 9 min

Signatures prove who built an image digest. How Sigstore keyless signing works, what a real cosign signature contains, and how to verify before you deploy.

Before thisManifests, indexes and multi-platform imagesScanning images for vulnerabilities

Chainguard · 9 min

Signing and verifying images

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by ChainguardReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • A digest proves you got the bytes you asked for. It says nothing about who produced them. A signature binds an identity to a digest.
  • Always sign and verify digests, not tags. A tag can be moved to unsigned content after the signature was made.
  • Sigstore's keyless flow swaps a long-lived key for an OIDC identity: Fulcio issues a certificate valid for about ten minutes, and Rekor's public log records the signature so it can be checked later.
  • Verifying means checking two things you choose in advance: the expected identity, such as a CI workflow or a service account, and the OIDC issuer that vouched for it.
  • Cosign v3 stores signatures as OCI 1.1 referrers in the new bundle format by default. Older signatures sit under a tag named sha256-<digest>.sig.
  • Attestations, signed SBOM and provenance statements, use the same machinery, so you can verify how an image was built as well as who built it.
  • Docker Content Trust and Notary v1 are retired: notary.docker.io shuts down on 8 December 2026. Use Sigstore cosign or Notation instead.

A digest is not a name

DevOps’ registries lesson ended on a problem. Deploying by digest guarantees you get exactly the bytes you asked for. It doesn’t tell you whether those are the bytes your build produced. Anyone with push access to the registry, including someone who stole a CI token, can push a new image and hand you its digest.

A signature closes that gap. It is a statement, made with a private key, that says “this identity vouches for this digest”. Think of a sealed shipping container: the seal number (the digest) proves the contents weren’t swapped, and the signed manifest proves which shipper sealed it.

Sign digests, not tags

A tag is a pointer that moves, as image names, tags and digests explains. Sign a tag and someone can repoint it at unsigned content. Cosign resolves a tag to a digest before signing, and the signed payload names the digest. Your deploy should do the same: resolve the tag once, verify that digest, deploy that digest.

Keyless signing with Sigstore

Managing a signing key is the hard part of signing. It has to live somewhere CI can use it, and if it leaks, every signature is suspect. Sigstore’s keyless mode avoids storing a key:

  1. The signer, usually a CI job, gets an OIDC identity token from its platform: GitHub Actions, GitLab, Google Cloud.
  2. It generates a throwaway key pair and sends the public key and token to Fulcio, Sigstore’s certificate authority. Fulcio issues a certificate binding the key to the identity in the token, valid for about ten minutes.
  3. It signs the image digest and records the signature in Rekor, a public append-only transparency log.
  4. The private key is discarded.

A verifier later checks the certificate chain to Sigstore’s root, that the identity and issuer are the ones it expects, and that Rekor recorded the signature while the certificate was valid. The short lifetime is fine because the log proves when the signature happened.

A real signature, taken apart

Kubernetes signs its release images this way. I fetched the signature for registry.k8s.io/pause:3.10 with plain HTTP requests to the registry. The image’s index digest is sha256:ee6521f2..., and the signature lives under the tag sha256-ee6521f2....sig, the scheme older cosign versions use. That tag points at a small manifest with one layer.

The layer is the signed payload:

{"critical":{"identity":{"docker-reference":"registry.k8s.io/pause"},
 "image":{"docker-manifest-digest":"sha256:ee6521f290b2168b6e0935a181d4cff9be1ac3f505666ef0e3c98fae8199917a"},
 "type":"cosign container image signature"},
 "optional":{"org.kubernetes.kpromo.version":"kpromo-v4.0.4-483-gf08f0f2"}}

The layer’s annotations carry the signature and the Fulcio certificate. Decoded with openssl x509:

issuer=O=sigstore.dev, CN=sigstore-intermediate
notBefore=May 23 21:35:28 2024 GMT
notAfter=May 23 21:45:28 2024 GMT
X509v3 Subject Alternative Name: critical
    email:krel-trust@k8s-releng-prod.iam.gserviceaccount.com
1.3.6.1.4.1.57264.1.1: https://accounts.google.com

Ten minutes of validity, an identity (a Google service account used by Kubernetes release engineering) and the OIDC issuer that vouched for it. The annotation also named Rekor log entry 96410323. I fetched that entry from Rekor’s public API: its recorded hash is a0297626..., the digest of the payload layer above.

Verifying

cosign verify does all of that checking, and you supply the expected identity and issuer:

cosign verify registry.k8s.io/pause:3.10 \
  --certificate-identity krel-trust@k8s-releng-prod.iam.gserviceaccount.com \
  --certificate-oidc-issuer https://accounts.google.com

For images your own GitHub Actions workflow signs, pin the workflow, not just the platform:

cosign verify registry.example.com/api@sha256:3f1c... \
  --certificate-identity-regexp '^https://github.com/acme/api/\.github/workflows/release\.yml@refs/heads/main$' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

The issuer alone proves only “some GitHub workflow somewhere”. The identity proves “our release workflow on main”.

Signing in CI

In GitHub Actions the job needs permissions: id-token: write to get the OIDC token, the same mechanism as deploying from Actions with OIDC. After pushing, sign the digest the build reported:

cosign sign --yes registry.example.com/api@${DIGEST}

Cosign v3, released in 2025 and at 3.1.6 now, turned on its newer behaviour by default. Its changelog lists the standardised Sigstore bundle format and container signatures “stored as an OCI Image 1.1 referring artifact”. New signatures attach to the image through the registry’s referrers API instead of a .sig tag, so expect both layouts in the wild.

Attestations

A signature says who. An attestation is a signed statement about something else: an SBOM, or SLSA provenance recording the builder, source repository and commit. BuildKit can generate both at build time (docker buildx build --sbom=true --provenance=mode=max), and cosign attest and cosign verify-attestation sign and check them. A deploy policy can then demand more than a valid signature: “built by our CI, from our repository’s main branch”.

Enforcing it

Verification that nobody runs protects nothing. Put cosign verify in the deploy job before the image is used, and fail the job if it doesn’t pass. On Kubernetes, admission controllers such as Kyverno or Sigstore’s policy-controller can refuse unsigned images cluster-wide.

One retirement to know about. Docker Content Trust, the DOCKER_CONTENT_TRUST=1 and docker trust commands built on Notary v1, is being retired: Docker’s docs say notary.docker.io shuts down on 8 December 2026 and point to Sigstore cosign and Notation, the CNCF Notary Project’s newer signer, as replacements. Old guides that teach DCT are teaching a dead end.

About the video

The embed is all of Chainguard’s “Who Built My Base Image? Keyless Signing for Container Images”, April 2026, 9 minutes 28 seconds. Its description says it gives an overview of keyless signing for container images and demonstrates automated signature verification in CI/CD pipelines. It has no chapters, so I judged it from the description and title. Chainguard sells signed base images and co-founded Sigstore, so expect their images as the example. It doesn’t take a signature apart or cover cosign v3’s storage change, which the lesson adds. English is confirmed by YouTube’s “English (US) original” audio flag. The 2022 video in deeper adds cluster-side enforcement with Kyverno, using an older cosign.

What was run: the registry.k8s.io/pause:3.10 signature manifest and payload were fetched from the registry with Python, the Fulcio certificate was decoded with openssl x509, and the matching entry was fetched from Rekor’s public API. cosign itself was not installed or run. The cosign v3 changes are from its changelog and the DCT retirement from Docker’s documentation, checked 2026-11-28.

Where this fits

That completes container security. The last group runs containers for real: resource limits for memory, CPU and PIDs.

Check yourself

  1. 01Your pipeline verifies myapp:1.4.2 with cosign, then deploys myapp:1.4.2. What could go wrong, and how do you fix it?

    The tag could be moved between verification and pull, so you deploy something you didn't verify. Resolve the tag to a digest, verify the digest, and deploy by that digest.

  2. 02A deploy script runs cosign verify with --certificate-identity-regexp '.*' and --certificate-oidc-issuer https://token.actions.githubusercontent.com. Why is that a weak check?

    Any GitHub Actions workflow in any repository can obtain a certificate from that issuer. Without pinning the identity to your repository's workflow, an attacker's workflow signature would pass.

  3. 03Keyless certificates expire after about ten minutes. Why can you still verify a signature made last year?

    The signature was recorded in Rekor's transparency log while the certificate was valid, and the log entry proves the signing time. Verification checks the certificate was valid at that recorded time.

  4. 04What does a signed SLSA provenance attestation let a deploy policy check that a plain signature doesn't?

    How the image was built: which builder and workflow, from which repository and commit. A policy can then require images built by your CI from your main branch, not just signed by someone trusted.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark