Repository navigation
ci: sign releases with build provenance and an attested SBOM - #78
Merged
Merged
Conversation
The release workflow now writes a CycloneDX SBOM of the module (cyclonedx-gomod v1.12.0, pinned through the Go checksum database), adds it to checksums.txt and the release, and attests build provenance and the SBOM for every archive (actions/attest-build-provenance v4.2.2 and actions/attest-sbom v4.1.0, SHA-pinned, subject-checksums). Keyless: Sigstore signs with the job's OIDC token. Permissions move to the job (contents, id-token, attestations write); the workflow grants nothing at the top level. README shows how to verify a download. P5c of the program.
- F1: the build job (tests, builds, SBOM tool) has contents: read only and hands the files over as an artifact; a publish job that runs no build or test code holds id-token/attestations and attests and publishes, so build-time code can't mint the signing token. - F2: the SBOM includes the Go standard library (-std). - F5: actions/attest v4.2.2 directly for both attestations (the wrappers pulled two inner versions; attest-sbom is deprecated). - F4: the SBOM is attested for the six archives, not for itself. - F6: a tag that isn't v<semver> fails the build before anything is made. - F7/A2: README verification pins the release workflow and tag, and shows the macOS checksum command.
- V1/V6: publish refuses unless checksums.txt lists, and the artifact holds, exactly the seven expected files for the version, so a compromised build job can't add a file to be attested and published. - A1: the tag check is strict semver (no leading zeros), so v01.2.3 no longer gives the SBOM a pseudo-version. - V2/V3/V5: README and TECHNICAL say what each check proves: checksums are integrity only; --signer-workflow/--source-ref trust release.yml at the tagged commit, so they are as strong as v* tag protection. - V7: the artifact is kept seven days, so publish can be re-run alone. - V8/V9: no review IDs in comments; no redundant storage-record input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
From the next release on, every codeshot release asset can be checked for where it came from:
codeshot_<version>.cdx.json, is published with the release, listed inchecksums.txt, and attested for the same archives.This is P5c of the program. Only
.github/workflows/release.ymland the docs change.How
go run github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.12.0 mod -licenses -json. It is pinned through the Go checksum database, so no third-party action is added. The tag checkout gives it the version. There is one SBOM for the module, because all six builds share its dependencies.actions/attestv4.2.2, SHA-pinned, in a separatepublishjob (see Changes since review): provenance overchecksums.txt(every archive and the SBOM), then the SBOM for the six archives.permissions: {}).buildgetscontents: read;publishgetscontents: write(create the release),id-token: write(the OIDC token Sigstore signs with) andattestations: write.sign-blobwith a Sigstore bundle: it duplicates the attestation's own Sigstore signature and adds a cosign install.Measured (base
b76efecvs9936ae1)v0.5.0-simthat was never pushed.version=0.5.0-sim, matching the SBOM path the attest step reads.codeshot_0.5.0-sim.cdx.jsonare written, and all seven are inchecksums.txt.sha256sum -cpasses.github.com/inth3shadows/codeshot v0.5.0-sim, with 14 dependency components.codeshot 0.5.0-sim.--depth 1clone atv0.4.0, which is what the release job checks out, gives the SBOM the versionv0.4.0.persist-credentialsandGH_TOKENlines (the diff touches neither), and the test, cross-compile and archive steps.Changes since review (2026-11-19)
Round 1 (
/code-review+ a code-reviewer agent on9936ae1; the agent read both actions' source at the pinned SHAs), fixed inbc60614:id-token/attestations: writeto the job that also runs the tests,apt-getand the SBOM tool with its dependencies, any of which could mint the OIDC token and attest arbitrary files as built by this repo. Nowbuildhascontents: readonly and uploads the files as a one-day artifact;publish, which runs no build or test code, downloads them, checkschecksums.txt, attests and publishes.-std), which is compiled into every binary, so scanners see Go stdlib advisories. 15 components now, includingstd(go1.26.5).actions/attestv4.2.2 directly (1e69f48acb82d1966a394da916b4c1698aa569d6) for both attestations:attest-build-provenanceandattest-sbomare wrappers around it, pulled in two inner versions, andattest-sbomis deprecated (it printed a warning every run). No storage record (create-storage-record: false), so noartifact-metadatapermission.v<semver>(v0.5,v0.5.0rc1) fails the build before anything is made; it would have named the archives one way and given the SBOM a pseudo-version.--signer-workflow .../release.ymland--source-ref refs/tags/<tag>, so only the release workflow's attestation for that tag passes, and showsshasum -a 256 -cfor macOS.go run tool@versionis pinned by the Go checksum database.v0.5.0-rc.1, never pushed):v0.5andv0.5.0rc1refused (exit 1);v0.5.0-rc.1builds,sha256sum -c7/7 OK, SBOM versionv0.5.0-rc.1withstd. CI 5/5, zizmor passes the two-job workflow.Round 2 (verify on
bc60614): every round-1 fix held, checked against the actions' source at the pinned SHAs. Fixed in35af16f:publishattested whateverchecksums.txtlisted, so a compromised build job could add a file and have it attested and uploaded. It now refuses unlesschecksums.txtlists, and the artifact holds, exactly the seven expected files for the version. Tested on a scratch layout: the good set passes; an extra file (listed or not), a missing SBOM, swapped bytes and a wrong version are refused. A compromised build can still change the bytes of those seven files, which no signing step can detect.v01.2.3andv1.2.3-01passed the first check and gave the SBOM a pseudo-version. Tested: v0.5.0, v1.2.3, v0.5.0-rc.1, v1.2.3-alpha.beta.1, v1.0.0-0 and v1.0.0-x-y pass; v01.2.3, v1.02.3, v1.2.3-01, v1.2.3-rc.01, v0.5, v0.5.0rc1, v1.2.3+meta, v1.2.3-, v1.2.3-.., v1.2.3.4 and v1.2.3-rc_1 are refused.checksums.txtisn't signed);--signer-workflowand--source-reftrustrelease.ymlat the tagged commit, so they are as strong as the protection onv*tags. The workflow header and TECHNICAL now include--source-ref.publishcan be re-run on its own; review IDs and a redundantcreate-storage-recordinput are gone.35af16f, zizmor included.Known limits
gh attestation verifyon an archive and on the SBOM predicate. If that fails, it needs a fix-forward release.https://cyclonedx.org/bom) is whatattest-sbomis expected to use for CycloneDX. It is not yet checked against a real attestation.release.ymlat the tagged commit; protectingv*tags with a repository ruleset (not part of this PR) would stop anyone with push access from re-pointing a tag at an edited workflow.