From 9c3ac4fb6413964a5557c69320783618a6a2b15a Mon Sep 17 00:00:00 2001 From: CloudLab Works <325058966+cloudlabworks@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:22:08 -0800 Subject: [PATCH] ci: attest release builds and publish a GitHub Release with provenance The build job now records a GitHub artifact attestation (Sigstore-signed SLSA build provenance) for the sdist and wheel it built. After the PyPI upload, a github-release job verifies the bundle against both files with gh attestation verify and creates a GitHub Release carrying the files and oak_events-.intoto.jsonl. Takes effect at the next version tag. --- .github/workflows/release.yml | 63 ++++++++++++++++++++++++++++++++++- CHANGELOG.md | 10 ++++++ SECURITY.md | 15 +++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0cca762..117968e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,10 @@ jobs: build: name: build sdist and wheel runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + attestations: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 @@ -20,10 +24,27 @@ jobs: run: | python -m pip install --require-hashes -r requirements/release.txt python -m build --no-isolation + - name: Attest build provenance + id: attest + uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 + with: + subject-path: dist/* + - name: Name provenance bundle + env: + BUNDLE: ${{ steps.attest.outputs.bundle-path }} + run: | + set -euo pipefail + version="${GITHUB_REF_NAME#v}" + mkdir provenance + jq -c . "$BUNDLE" > "provenance/oak_events-${version}.intoto.jsonl" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: dist path: dist/ + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: provenance + path: provenance/ publish: name: publish to PyPI @@ -37,4 +58,44 @@ jobs: with: name: dist path: dist/ - - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1 \ No newline at end of file + - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1 + + github-release: + name: GitHub release with provenance + needs: publish + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: dist + path: dist/ + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: provenance + path: provenance/ + - name: Verify provenance and create GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + version="${GITHUB_REF_NAME#v}" + bundle="provenance/oak_events-${version}.intoto.jsonl" + for f in dist/*; do + gh attestation verify "$f" \ + --bundle "$bundle" \ + --repo "$GITHUB_REPOSITORY" \ + --signer-workflow "${GITHUB_REPOSITORY}/.github/workflows/release.yml" + done + awk -v head="## [${version}]" 'index($0, head) == 1 {p = 1; next} p && /^## / {exit} p' CHANGELOG.md > notes.md + test -s notes.md || echo "See CHANGELOG.md." > notes.md + gh release create "$GITHUB_REF_NAME" \ + --repo "$GITHUB_REPOSITORY" \ + --verify-tag \ + --title "oak-events ${version}" \ + --notes-file notes.md \ + dist/* "$bundle" diff --git a/CHANGELOG.md b/CHANGELOG.md index a7f5667..b45261f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ All notable changes to this project are documented here. The format follows ## [Unreleased] +### Added + +- Signed releases: the `release` workflow records a GitHub artifact + attestation (Sigstore-signed SLSA build provenance) for the sdist and + wheel in the job that builds them, and after the PyPI upload creates a + GitHub Release with both files and the provenance bundle + `oak_events-.intoto.jsonl`. Verify a download with + `gh attestation verify --repo cloudlabworks/oak-events`. PyPI's own + PEP 740 attestations are unchanged. + ## [0.1.2] - 2026-11-02 ### Added diff --git a/SECURITY.md b/SECURITY.md index 01a26f2..755f5ab 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -29,6 +29,21 @@ Anything that breaks the privacy model described in the README, for example: the events directory, or touching the camera, - event files being created with permissions broader than the owner. +## Verifying a release + +From the release after 0.1.2, each version tag builds the sdist and wheel +once, records build provenance for them through Sigstore, publishes them to +PyPI and attaches the same files and `oak_events-.intoto.jsonl` to +the GitHub Release. To check a downloaded file: + +```bash +gh attestation verify oak_events--py3-none-any.whl --repo cloudlabworks/oak-events +``` + +Add `--bundle oak_events-.intoto.jsonl` to verify against the bundle +from the release instead of the GitHub attestations API. PyPI also serves PEP +740 publish attestations for every file it hosts. + ## Supported versions Only the latest release receives fixes while the project is pre-1.0.