Interview Prep/DevSecOps/Supply Chain Security

How do you sign container images in GitHub Actions without managing private keys?

IntermediateScenarioSupply Chain Security
Answer

Situation read → Keyless signing with Sigstore uses the workflow's OIDC identity and a short-lived certificate from Fulcio.

What I'd do →

  1. Grant the job id-token: write and packages: write.
  2. Install cosign (sigstore/cosign-installer) and sign by digest:
cosign sign --yes ghcr.io/example-org/app@sha256:<digest>
  1. Record the signature in the Rekor transparency log (automatic).
  2. Verify with identity constraints:
cosign verify ghcr.io/example-org/app@sha256:<digest> \
  --certificate-identity-regexp 'https://github.com/example-org/app/.github/workflows/release.yml@.*' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Why → No long-lived key means no key to steal.

Interview tip → Sign the digest, never the tag.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply Chain Security