Skip to content

feat(release): ship SBOM, build provenance and digests, and pin every action to a commit SHA - #838

Merged
sumithr merged 9 commits into
mainfrom
feat/issue-518-sbom-provenance-pins
Oct 4, 2026
Merged

sumithr merged 9 commits into
mainfrom
feat/issue-518-sbom-provenance-pins

Conversation

@sumithr

@sumithr sumithr commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

Every release can now be traced to reviewed source, immutable workflow dependencies, declared build inputs, an SBOM, artifact digests and signed build provenance, and publishing is gated on all of it. Every GitHub Action in every workflow is pinned to a full commit SHA with a version comment.

Related issue

Closes #518

Changes

  • Action pins (all 10 workflows): every uses: is @<40-hex SHA> # vX.Y.Z, each SHA verified against its tag and in the same major as before. tests/test_workflow_expression_lint.py::test_actions_pinned_to_commit_sha rejects tags, branches and short SHAs. Dependabot's existing github-actions entry moves SHA and comment together.
  • Workflow lint: actionlint as a pinned pre-commit hook (actionlint-py, with the pinned shellcheck-py bundled in the hook env so local and CI run the same shellcheck) plus a lint.yml job running the same hook. release-please.yml's release-PR number check is rewritten as an explicit if (SC2015).
  • Release pipeline (.github/workflows/release.yml), job by job:
    • build (contents: read): installs build tools from the hashed lock .github/release/requirements.txt (--require-hashes --only-binary ':all:'), builds wheel and sdist with --no-isolation, records build-info.json (source commit/ref, workflow run, runner, Python, every build-tool version, package digests) and exposes its SHA-256 as a job output.
    • sbom (contents: read): checks the packages against that output, installs the wheel by its recorded digest plus the committed hashed runtime lock .github/release/runtime-requirements.txt (--require-hashes --no-deps --only-binary ':all:'), runs pip check, generates a CycloneDX SBOM, and uploads only sbom.cdx.json.
    • attest (id-token, attestations: write): re-checks build-info.json against the build job's output, takes only sbom.cdx.json from the sbom artifact, writes SHA256SUMS, runs scripts/release_evidence.py verify --commit (exact allowed file set, digests, SBOM, build info), and only then attests build provenance for every listed file and the SBOM; exposes the SHA-256 of SHA256SUMS.
    • verify (attestations: read): gh attestation verify on every file, pinned to this signer workflow, source digest and ref, self-hosted runners denied.
    • publish (OIDC trusted publishing only, no token) and release-assets: tag push only; each re-checks the downloaded files against the attest job's SHA256SUMS digest before uploading.
    • A workflow_dispatch dry run builds, attests and verifies without publishing.
  • scripts/release_evidence.py: record / sums / verify; tests in tests/test_release_evidence.py use a real cyclonedx-py capture and cover missing, extra, tampered and malformed evidence.
  • Runtime lock: .github/release/runtime-requirements.txt (generated by the command in its header); tests/test_release_runtime_lock.py fails if a direct pyproject.toml requirement is no longer satisfied by its pin; a new runtime-lock job in lint.yml installs the lock plus the built wheel and runs pip check on every PR (catches transitive breaks).
  • Docs: .github/SECURITY.md "Verifying a release" (download, sha256sum --check, release_evidence.py verify, gh attestation verify pinned to the release tag, signer workflow and GitHub-hosted runners) and docs/DEVELOPMENT.md "Release supply chain".

Drift from the issue text (recorded on #518): Dependabot already covered github-actions, so the AC is met by the pins themselves; PyPI already receives PEP 740 attestations from pypa/gh-action-pypi-publish, so the gap was GitHub-side provenance + SBOM + a pre-publish gate; first-party actions/* are pinned too; the wheel reproduces byte for byte locally, the sdist does not.

How it was verified

  • CI on the final head (e831505a): all 30 checks green, including actionlint (now with pinned shellcheck), the runtime-lock job, install-smoke, pip-audit and the pytest matrix; mutation gate run 37202314459 green (0 survivors). test_workflow_expression_lint.py, test_release_evidence.py, test_release_runtime_lock.py green; pre-push full suite green at 100% coverage.
  • Local end-to-end of the final job graph (macOS stand-in for ubuntu): hashed build, hashed SBOM install (pip check clean, 29 components, passes actions/attest's bomFormat && serialNumber && specVersion rule), record, sums, verify. Attack simulations, each rejected: a tampered wheel in the SBOM job's packages (hash mismatch), a poisoned sbom artifact carrying a replacement wheel and matching build-info.json plus an extra file (ignored; signed bytes are the build job's), a re-uploaded packages artifact (build-info anchor mismatch), extra/hidden/nested files and a rewritten SHA256SUMS at publish (rejected). The new runtime-lock job's commands fail on a lock missing a transitive dependency.
  • pip download --only-binary ':all:' --platform manylinux2014_x86_64 --python-version 3.13 succeeds for every pin in both locks.
  • Review: sumo-qa per-file review of every changed file and /code-review high on the whole diff, then on each fix delta (7 rounds). Fixed along the way: an SBOM attest would have rejected (missing serialNumber, release-blocking), branch dry runs passing documented verification (now pinned to the release tag), unhashed installs and unverified artifacts on the signing path, verify running after signing, publish uploading unverified bytes, an actionlint hook that depended on whatever shellcheck was on PATH, and doc overclaims.

Only a real run can confirm (first workflow_dispatch dry run after merge, or the next tag): the attest steps and gh attestation verify against real attestations, PyPI trusted publishing with needs: verify, gh release upload onto the release-please release, and the hashed installs on the ubuntu runner. Main's release.yml has no workflow_dispatch, so the branch version cannot be dry-run before merge. A dry run mints real attestations for a non-tag build; the documented verify commands reject them because they pin the tag ref.

Your call before relying on it: the new runtime-lock and actionlint jobs are not required checks in the Protect-main ruleset, so a red run would not block a merge.

Not changed, noted for later: the publish and release-assets digest check is duplicated bash rather than a shared release_evidence.py subcommand; a removed dependency would leave stale pins in the runtime lock until it is regenerated; whether Dependabot regenerates the runtime lock or bumps pins individually is unproven (the runtime-lock job catches a bad bump).

Checklist

  • PR title follows Conventional Commits
  • Tests pass locally (pytest) and lint/type checks are green (pre-commit run --all-files, python -m mypy)
  • Added or updated tests covering the change
  • Updated the relevant docs in this same PR
  • No breaking changes (or they are called out above)

… action to a commit SHA

Every release now carries sbom.cdx.json (CycloneDX), build-info.json
(source commit, workflow run, runner, Python, exact build-tool versions,
package digests) and SHA256SUMS next to the wheel and sdist, with
GitHub build-provenance attestations for every file and an SBOM
attestation for each package. A verify job gates publishing:
scripts/release_evidence.py fails on a missing, unlisted or mismatched
file, an SBOM that does not describe the built version, or build info for
another commit, and gh attestation verify fails on a missing or foreign
attestation. The release files are attached to the GitHub release.

The release build installs a hashed lock (.github/release/requirements.txt)
and builds with --no-isolation, so the lock is the complete set of build
inputs; Dependabot watches it. workflow_dispatch gives a dry run that
builds, attests and verifies without publishing. PyPI trusted publishing
stays OIDC-only.

Every uses: is pinned to a full commit SHA with a version comment,
enforced by a pytest lint; Dependabot's existing github-actions entry
moves both. actionlint runs as a pinned pre-commit hook with a lint.yml
mirror. SECURITY.md documents the consumer verification commands.

Closes #518
…alls unhashed deps

- Drop --output-reproducible so cyclonedx-py emits the serialNumber that
  actions/attest requires; the gate now rejects an SBOM without a urn:uuid
  serialNumber, and the fixture is a fresh real capture carrying one.
- Move both attestations into an attest job holding the signing
  permissions; the build job, which installs the wheel's dependencies
  from PyPI for the SBOM, keeps contents: read only.
- Upload one release-files artifact; publish takes the verified wheel and
  sdist from it. Drop the unused artifact-metadata permission.
- SECURITY.md: pin --source-ref to the release tag, attestation subjects
  are the files SHA256SUMS lists, the SBOM is one Linux/CPython 3.13
  resolution.
- release_evidence.py: null nested sections give a named error, not a
  traceback.
- Tests: pin-lint reject cases carry a valid version comment and the
  other-package case keeps the real version, so each fails on the rule
  it names.
…n only after the gate

The build job now builds from the hashed lock, records build-info.json
(the package digests) and uploads a packages artifact without ever
installing anything unhashed. A separate sbom job with contents: read
installs the wheel into a throwaway venv and uploads only sbom.cdx.json.
The attest job assembles the build job's packages with the SBOM, writes
SHA256SUMS (new `sums` subcommand, split out of `record`), runs
release_evidence.py verify before either attestation is signed, then
uploads release-files; the verify job keeps gh attestation verify before
publish.

The SBOM serialNumber check is now a presence check (non-empty string),
matching actions/attest. SECURITY.md's SBOM verify command gains
--signer-workflow and --deny-self-hosted-runners.
…nly the SBOM from the sbom job

The build job publishes the SHA-256 of build-info.json as a job output and
the attest job checks the downloaded file against it before writing the sums,
so a re-uploaded packages artifact cannot bring its own build-info. The sbom
artifact is downloaded into its own directory and only sbom.cdx.json is
copied into dist/. verify rejects any file outside the fixed release set.
SECURITY.md states that the SBOM comes from an unhashed install and is not a
tamper-proof inventory.
…before publishing

The attest job publishes the SHA-256 of SHA256SUMS as a job output; publish
and release-assets check SHA256SUMS against it, check every file against
SHA256SUMS and fail on any file it does not list, so a release-files artifact
replaced after attest never reaches PyPI or the release. Digest outputs are
computed into a variable under pipefail and fail the step when empty.
The SBOM job installed the wheel's dependencies from PyPI without hashes.
It now checks build-info.json against the build job's digest, installs
.github/release/runtime-requirements.txt (uv pip compile of pyproject.toml,
Linux / CPython 3.13) and the wheel with --require-hashes --no-deps, runs
pip check, then cyclonedx-py. tests/test_release_runtime_lock.py fails when
a pyproject.toml dependency is no longer satisfied by its pin in the lock.
…untime lock in CI

Install both hashed release locks with --only-binary :all:, so a pin
without a Linux cp313 wheel fails instead of building an sdist with an
unhashed build backend. A lint.yml job installs the runtime lock and the
built wheel with --no-deps on the release platform and runs pip check,
catching a broken transitive constraint before a tag. SECURITY.md notes
the SBOM is an inventory of the locked set, not a malware check.
…lease check it flags

The actionlint hook env had no shellcheck, so local runs skipped the
shellcheck integration that CI (ubuntu-latest) applies, and SC2015 in
release-please.yml passed locally but failed CI. The hook now carries the
same shellcheck-py pin as the shellcheck hook, and the release PR number
check is an explicit if/then.

Also replace the SECURITY.md verification example's VERSION=0.73.0, which
predates the release evidence files, with a placeholder.
@sumithr

sumithr commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

Merge-readiness evidence, head e831505a

CI: all 30 checks green on e831505a190c859592358440502fe6c79e0504ae, including the new actionlint (workflow lint) and runtime lock installs on the release platform jobs, install-smoke (pip and uvx on 3 OSes, plugin-dir handshake), pip-audit, CodeQL, mypy, and pytest on ubuntu/macOS/Windows, py3.10 to py3.14.

Mutation gate: triggered (tests/**). Run 37202314459: every module at or above baseline, 0 survivors, strict gate passed.

Per-file review (sumo-qa reviewing_before_merge, each changed file's full content vs origin/main): SAFE for release.yml, release_evidence.py, both test modules, dependabot.yml, requirements.in, SECURITY.md, DEVELOPMENT.md; every action pin in the 8 pin-only workflows resolved against its tag through the GitHub API. The one blocker it found (actionlint red on release-please.yml SC2015, because the hook used whatever shellcheck was on PATH) is fixed in e831505a: the hook now bundles the pinned shellcheck-py, and the line is an explicit if. Generated locks and the captured SBOM fixture were skipped as generated.

/code-review (high): whole diff, then every fix delta (7 rounds). Fixed along the way: an SBOM that actions/attest would reject (missing serialNumber, release-blocking), branch dry runs passing the documented verification (now pinned to the tag), unhashed installs and unverified artifacts on the signing path, verify running after signing, publish uploading unverified bytes, a poisoned sbom artifact able to replace the signed wheel (build-info anchored through a job output, sbom-only copy, fixed allowed file set), the SBOM job's unhashed dependency install (now a committed hashed runtime lock, --only-binary ':all:', pip check), and doc overclaims.

Behavioural verification (step 4.7):

# behaviour observed met
1 every action pinned to a full SHA with a version comment 58 uses: lines, 8 action@tag pairs, each SHA equals its tag (annotated tag peeled); checker flags 41 unpinned lines on main yes
2 Dependabot updates the pins github-actions at / plus pip at /.github/release yes (regeneration of the runtime lock only observable after merge)
3 validated SBOM for wheel+sdist from hashed locks release.yml step scripts run verbatim: hashed build, hashed SBOM install, pip check clean, CycloneDX 1.6 with serialNumber, 29 components = the runtime lock for Linux/CPython 3.13, schema VALID; tampered wheel fails the hash install yes
4 evidence identifies commit, workflow, runner, Python, build tools, digests build-info.json: source commit/ref, workflow, runner, Python 3.13.13, 40 build packages, both digests; SHA256SUMS agrees yes
5 verification fails on missing/mismatched evidence verify gate rejects tampered wheel, extra file, missing SBOM, no serialNumber, wrong commit, edited build-info; publish/release-assets checks reject tampered wheel, re-summed SHA256SUMS, extra/hidden files, missing SBOM yes
6 PyPI publishing OIDC-only, gated on verify needs: [attest, verify], tag push only, id-token: write only, no password/token input yes
7 SECURITY.md commands run as written sha256sum --check, shasum -a 256 --check, release_evidence.py verify pass on a release-shaped set and fail on a tampered wheel; gh attestation verify needs a real attested release yes (attestation step: row 9)
8 existing release, install-smoke, dependency-audit workflows green CI on this head: install-smoke, pip-audit, tests all green yes (release workflow: row 9)
9 live release run (attest, gh attestation verify, PyPI publish, release upload) not runnable before merge: main's release.yml has no workflow_dispatch deferred to a dry run after merge (your call)

Platform caveat: the step scripts ran on macOS with a GNU-sha256sum shim; every pin's Linux cp313 wheel was proven with pip download --only-binary ':all:'.

Acceptance criteria (#518): 1-7 met. 8: install-smoke and dependency-audit green; the release workflow itself is proven only by the first dry run after merge.

Your call: the new actionlint and runtime-lock jobs are not required checks in the Protect-main ruleset.

Review threads: 0.

@sumithr
sumithr merged commit df310e6 into main Oct 4, 2026
31 checks passed
@sumithr
sumithr deleted the feat/issue-518-sbom-provenance-pins branch October 4, 2026 12:47
sumithr added a commit that referenced this pull request Oct 4, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.74.0](v0.73.1...v0.74.0)
(2026-10-04)


### Features

* **installer:** save the MCP tool profile once for every launch path
([#836](#836))
([b9215a8](b9215a8))
* **release:** ship SBOM, build provenance and digests, and pin every
action to a commit SHA
([#838](#838))
([df310e6](df310e6))


### Miscellaneous Chores

* **evals:** grade a judge reply only when its verdict is unambiguous,
retry once, and keep the reply
([#839](#839))
([237ea59](237ea59))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task]: Add release SBOM, build provenance, and immutable GitHub Actions pins

1 participant