Sub topic 5
How Sigstore signs and records attestations without long-lived keys
This chapter assumes you know what an in-toto provenance attestation is, that a GitHub Actions job can request an OIDC token, and the basics of hashes and digital signatures. It covers what happens between "the job has an OIDC token" and "a signed attestation exists that anyone can verify."
The problem with long-lived signing keys
A traditional signing setup stores a private key as a CI secret. That key can leak, and it stays valid until someone revokes it. A leaked key lets an attacker sign anything as you. Rotating keys and distributing public keys to every consumer is also hard to keep up.
Sigstore avoids this by never giving the workflow a durable key. The workflow creates a key pair, uses it once, and discards it. Trust comes from a short-lived certificate that ties the public key to the workflow's identity.
The three components
| Component | Role |
|---|---|
| Fulcio | A certificate authority. It checks an OIDC token and issues a certificate that expires after about ten minutes. |
| Rekor | A transparency log. It is an append-only record of signed entries that anyone can query. |
| Trust root | The public keys and certificates that verifiers use to check Fulcio and Rekor. |
GitHub runs its own Sigstore instance for private repositories. Public repositories use the public-good Sigstore instance. The signing steps are the same in both cases.
The signing flow
- The job generates an ephemeral key pair in memory.
- The job requests an OIDC token from GitHub. This is why the workflow needs
id-token: write. - The job sends Fulcio the token, the public key, and a proof that it holds the private key.
- Fulcio validates the token and issues a short-lived certificate. The certificate names the workflow identity, such as the repository, the workflow file, and the ref.
- The job signs the attestation with the private key, then discards the key.
- The signed attestation and certificate are recorded in a transparency log. The log returns a signed timestamp proof.
- The attestation is stored so consumers can fetch it later.
Why an expired certificate still verifies
The certificate lasts only minutes, so it is expired by the time a consumer checks it. That is expected. The verifier does not ask whether the certificate is valid now. It asks whether the signature was made while the certificate was valid.
The transparency log answers that question. Its signed timestamp proves the entry existed inside the certificate's validity window. If an attacker later obtained the private key, any signature they made would carry a timestamp outside the window and would fail.
What the certificate says
The certificate carries identity fields taken from the OIDC token. The ones you will use when you verify are:
- The repository that ran the workflow.
- The workflow file path and the ref that triggered it.
- The runner environment, which separates GitHub-hosted runners from self-hosted ones.
- The issuer, which is GitHub's token service.
This is the link between the attestation and the build. A consumer does not check "was this signed by key X." They check "was this signed by the workflow build.yml in repository OWNER/REPO."
Common errors
- Missing
id-token: write. The job cannot request an OIDC token, so signing fails. Set the permission on the job that attests. - Missing
attestations: write. The signature succeeds but the action cannot store the attestation. - Expecting the signer to be a person. The signer is a workflow identity. No individual's key or account is involved.
- Trusting any valid signature. A valid Sigstore signature only proves some workflow signed the data. Verification must also check which identity signed it. The verification chapter covers how.
What you gain and what you do not
You gain no secret to leak, no key rotation, and a public record of every signing event. You do not gain proof that the build was safe. The certificate states which workflow ran. It does not state that the workflow's code was trustworthy.
Exercise
A consumer checks an attestation six months after it was signed. The Fulcio certificate expired within minutes of being issued. Why can the signature still be trusted, and what would a verifier need to look at to confirm it?
Show answer
The verifier checks that the signature was made while the certificate was valid, not that the certificate is valid today. The Rekor signed timestamp and inclusion proof show the entry was recorded inside the certificate's validity window. The verifier also checks the certificate chains to the Sigstore trust root and that its identity fields match the expected repository and workflow.
Exercise
A workflow step that attests a build fails with an error saying it cannot get an OIDC token. Which permission is most likely missing, and at which level should you set it?
Show answer
The id-token: write permission is missing. Set it in the permissions block of the job that runs the attestation step.