From eb4b13445231e38952911c4f1a5b3b71a5d3a201 Mon Sep 17 00:00:00 2001 From: Distronode Date: Thu, 5 Nov 2026 23:45:40 -0500 Subject: [PATCH] release: attest build provenance for the standalone archives The release job now runs actions/attest on dist/release/*.tar.gz before it creates the GitHub Release. That produces SLSA build provenance, signed through Sigstore with the workflow's identity and stored with the repository, so anyone can check that an archive came from this workflow and its release tag with gh attestation verify calnode__linux_amd64.tar.gz --repo Calnode/calnode \ --signer-workflow Calnode/calnode/.github/workflows/docker-publish.yml \ --source-ref refs/tags/v The Sigstore bundle is also copied into dist/release as calnode_.sigstore.json, so `gh release create ... dist/release/*` attaches it beside the archives and checksums.txt. On a dry run the name comes from the branch, with any slash replaced, since a slash would name a directory. The release job gains id-token: write (to get the Sigstore signing certificate) and attestations: write (to store the attestation). It only runs on version tags and on the dry-run dispatch. The attestation runs on the dry run too, so the step is exercised before a real tag depends on it. A dry run's attestation records its branch, not a release tag, so the --source-ref check does not accept it. DEPLOY.md's standalone-binary section says how to verify, and the CHANGELOG has an Added entry. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docker-publish.yml | 35 +++++++++++++++++++++++++++- CHANGELOG.md | 7 ++++++ DEPLOY.md | 19 +++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 52beaf75..65880116 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -292,7 +292,9 @@ jobs: needs: build runs-on: ubuntu-latest permissions: - contents: write + contents: write # create the GitHub Release + id-token: write # Sigstore signing certificate for the attestation below + attestations: write # store that attestation with the repository steps: - uses: actions/checkout@v7 @@ -321,6 +323,37 @@ jobs: echo "have_notes=false" >> "$GITHUB_OUTPUT" fi + # Signed SLSA build provenance for the release archives, so anyone can + # check that an archive was built by this workflow from its release tag + # (DEPLOY.md has the full command): + # gh attestation verify calnode__linux_amd64.tar.gz --repo Calnode/calnode \ + # --signer-workflow Calnode/calnode/.github/workflows/docker-publish.yml \ + # --source-ref refs/tags/v + # The attestation is stored with the repository, and the bundle is also + # attached to the release as calnode_.sigstore.json, so it can + # be checked from the file (`--bundle`) as well as through the API. This + # runs on the dry run too, so the step is exercised before a real tag + # needs it; a dry run's attestation names its branch, not a release tag, + # so the --source-ref check above never accepts it. + - name: Attest build provenance for the archives + id: attest + uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 + with: + subject-path: dist/release/*.tar.gz + + - name: Add the attestation bundle to the release files + env: + BUNDLE: ${{ steps.attest.outputs.bundle-path }} + run: | + set -euo pipefail + test -s "$BUNDLE" + # On a tag this is the version (v0.14.0 gives 0.14.0). A dry run from + # a branch such as ci/foo gets calnode_ci-foo.sigstore.json: a slash + # here would name a directory that does not exist. + name="${GITHUB_REF_NAME#v}" + cp "$BUNDLE" "dist/release/calnode_${name//\//-}.sigstore.json" + ls -l dist/release + # Preinstalled gh CLI + GITHUB_TOKEN (no third-party action — keeps the # supply-chain surface small). - name: Create GitHub Release diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fab0761..16ac1b3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,13 @@ exact tag (`ghcr.io/calnode/calnode:0.1.0`) if you need stability between upgrad then to English. Dates and times in the admin follow that locale. Public booking pages and emails still use the existing 11-locale booker catalogs; the LiveKit room stays English. +- **Release archives carry signed build provenance.** The release job now creates a + [GitHub artifact attestation](https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations) + (SLSA build provenance, signed through Sigstore) for the standalone `.tar.gz` + archives, and attaches the bundle to the release as `calnode_.sigstore.json`. + `gh attestation verify` checks that an archive was built by `docker-publish.yml` + in this repository from its release tag; the full command is in + [DEPLOY.md](DEPLOY.md#standalone-binary). ### Changed diff --git a/DEPLOY.md b/DEPLOY.md index 6ea0f5b6..561b8777 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -49,6 +49,25 @@ The archive does **not** include Litestream or the container entrypoint. Setting the binary directly; configure Litestream separately or use another SQLite-aware backup method. The email, calendar and other integration settings below still apply. +Releases also carry `calnode_.sigstore.json`, a signed +[build provenance](https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations) +attestation for the archives. To check that an archive was built by this +repository's release workflow from the release tag, with the +[GitHub CLI](https://cli.github.com/): + +```bash +gh attestation verify "calnode_${version}_linux_amd64.tar.gz" --repo Calnode/calnode \ + --signer-workflow Calnode/calnode/.github/workflows/docker-publish.yml \ + --source-ref "refs/tags/v${version}" +``` + +To check against the downloaded bundle instead of GitHub's attestation API, add +`--bundle "calnode_${version}.sigstore.json"`. Without `--signer-workflow` and +`--source-ref`, the command only checks that the archive was built by a workflow in +this repository, which also matches the release workflow's dry runs. + +Releases published before this was added have checksums only. + --- ## 1. Configuration (environment variables)