Interview Prep/DevSecOps/Supply chain: signing, SBOM and dependencies

Keyless `cosign verify` fails: `none of the expected identities matched what was in the certificate`

IntermediateTroubleshootingSupply chain: signing, SBOM and dependencies
Answer

Likely causes → --certificate-identity does not exactly match the Fulcio cert SAN, which for GitHub Actions is the workflow ref, e.g. https://github.com/acme/api/.github/workflows/release.yml@refs/tags/v1.4.0, or the issuer is wrong.

Diagnose →

cosign verify ghcr.io/acme/api@sha256:... \
  --certificate-identity-regexp '.*' --certificate-oidc-issuer-regexp '.*' -o json \
  | jq -r '.[0].optional | {Issuer, Subject}'

Fix → Use the real values, with a constrained regexp for tags:

cosign verify ghcr.io/acme/api@sha256:... \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  --certificate-identity-regexp '^https://github.com/acme/api/.github/workflows/release.yml@refs/tags/v.*$'

Prevent → Keep the identity in one policy file used by CI verification and the admission controller. Never ship the .* debug regexps.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Supply chain: signing, SBOM and dependencies