Sub topic 2
How Sigstore Signs and Records Attestations Without Long-Lived Keys
Assume you know GitHub Actions jobs, basic hashes and signatures, and how to use the GitHub CLI. This chapter shows how keyless signing connects to build provenance and verification.
Sigstore keyless signing
Sigstore lets a workflow sign an attestation without storing a private signing key. GitHub Actions first requests an OpenID Connect (OIDC) identity token. The token describes the repository, workflow, commit, and run.
Fulcio, Sigstore's certificate authority, checks that token and issues a short-lived signing certificate. The workflow uses that certificate to sign the attestation. Rekor, Sigstore's transparency log, records the signed information so others can inspect its signing event.
The attestation identifies the built artifact by its cryptographic digest. A verifier can therefore check both the signature and the exact file that was signed.
Generating build provenance
GitHub's actions/attest-build-provenance action creates and signs an in-toto provenance attestation. The job needs permission to request an OIDC token and write attestations.
name: build
on:
push:
tags: ["v*"]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Build
run: make build # Writes dist/app
- name: Attest build provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: dist/appThe subject-path value tells the action which artifact the attestation describes. The build must produce that file before the attestation step runs.
Verifying an artifact
A consumer can use the GitHub CLI to verify the file, its digest, and the attestation's identity:
gh attestation verify dist/app --repo OWNER/REPO
gh attestation verify dist/app \
--repo OWNER/REPO \
--signer-workflow OWNER/REPO/.github/workflows/build.ymlThe first command accepts attestations from the specified repository. The second also requires the named workflow to have signed the attestation. These checks turn provenance into a trust policy instead of treating every valid signature as equally trusted.
Exercise
Why should verification use an artifact digest rather than only its filename?
Show answer
A digest identifies the exact bytes that were built and signed, so replacing the file causes verification to fail.