STK-95Default Open source
Use cosign to sign release images and their bill of materials
Sign every release image and its CycloneDX bill of materials with cosign in CI. The bill comes from the Trivy that already scans the image.
Review by
2027-04-30
How to do it
The Trivy you already run for scans also writes SPDX and CycloneDX files, so the bill needs no new tool. cosign 1.0 came out on 28 July 2021, and 3.1.4 shipped on 20 October 2026. It belongs to Sigstore, an OpenSSF project, and its repository had about 6,400 stars in October 2026. Keyless signing uses the CI job's identity, so no private key can leak. Each signature goes into Sigstore's public log, which shows the repository name. Private projects sign with a key held in their secrets store instead. Pin cosign by digest, as the Trivy rule does. What to publish is in Publish what is in each release. Verify before each deploy, as Build releases only in CI and verify them before deploy says. Choose something else when your registry already signs with Notation from the Notary Project, and keep one signer for every image.
Examples
Shell example
IMAGE=registry.example.com/shop@sha256:0000000000000000000000000000000000000000000000000000000000000000
trivy image --format cyclonedx --output sbom.cdx.json "$IMAGE"
cosign sign --yes "$IMAGE"
cosign attest --yes --type cyclonedx --predicate sbom.cdx.json "$IMAGE"
Shell example 2
cosign verify \
--certificate-identity-regexp '^https://github.com/example/shop/' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
"$IMAGE"
How to check
Each release image has a CycloneDX attestation. cosign verify with the expected CI identity passes, and it fails for an image pushed from a laptop.
Sources
Related rules
- ENG-42 Make release tags and files immutable in Engineering
- STK-61 Use Trivy to scan images and dependencies in Software choices
- APS-75 Publish what is in each release in Application security
- ENG-11 Build releases only in CI and verify them before deploy in Engineering
- TDD-6 List the licences of the code and every dependency in Technical due diligence
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/sbom-and-signing">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.