Sub topic 5
How Sigstore signs and records attestations without long-lived keys
This chapter assumes you know the following:
- How a GitHub Actions job gets its OIDC token. The workflow identity chapter covers this.
- What an in-toto attestation contains.
- The basics of public-key signatures and hashes.
Here you will follow one signing operation from start to finish. You will see what the signature, the certificate and the log entry each prove. You will also see how a verifier checks them later, when the signing key no longer exists.
The problem with long-lived signing keys
Traditional artifact signing uses a private key that you create once and keep for years. That causes three problems:
- Storage. The key must live somewhere the build can read it, usually as a CI secret. Anyone who reads that secret can sign as you.
- Rotation and revocation. If the key leaks, you must tell every consumer to stop trusting it. Consumers then need a way to learn about the revocation.
- Identity. A bare public key says nothing about who holds it. Consumers need an out-of-band way to learn that "this key belongs to project X".
Sigstore's keyless model removes the stored key. The signer creates a key pair for a single signing operation, gets a short-lived certificate that ties the public key to a verified identity, signs, and discards the private key. The identity comes from the workflow's OIDC token instead of a key you manage.
"Keyless" is shorthand. Keys still exist, but they are ephemeral, which means they live for seconds and never leave the runner.
The components
Sigstore uses several services. GitHub's attestation action and the GitHub CLI call them for you.
| Component | Role | What it proves |
|---|---|---|
| OIDC provider (GitHub Actions) | Issues a signed token describing the running workflow | The job runs in a specific repository, workflow, and ref |
| Fulcio | Certificate authority. Exchanges an OIDC token and a public key for a short-lived X.509 certificate | This public key was held by this workflow identity at this time |
| Rekor | Append-only transparency log | A signed record existed at a specific time, and the log can be audited |
| Trusted root (distributed with TUF) | Signed bundle of the CA certificates and log keys that verifiers trust | Which Fulcio and Rekor instances a verifier should accept |
TUF stands for The Update Framework. It is a secure way to distribute the trusted root, so a verifier does not have to trust whatever network response it receives.
Step by step: one signing operation
The sequence below is what actions/attest-build-provenance triggers.
- Generate a key pair. The runner creates a fresh key pair in memory. The private key is never written to a secret store.
- Request an OIDC token. The job asks GitHub for an ID token. This works only if the workflow grants
id-token: write. The token is signed by GitHub and its claims include the repository, the workflow file path, the ref, the commit SHA and the triggering event. - Request a certificate from Fulcio. The runner sends the token and the public key. It also sends a signature over a value from the token, which proves it holds the matching private key. Fulcio validates the token against GitHub's published signing keys and checks that it has not expired.
- Receive a short-lived certificate. Fulcio issues an X.509 certificate that is valid for about ten minutes. It binds the public key to the identity from the token.
- Sign. The runner signs the attestation payload with the private key.
- Record. The signed bundle goes to the transparency log, which returns proof that the entry was recorded and when.
- Discard. The private key is dropped when the job ends. Nothing remains that an attacker could steal later.
What the certificate contains
The certificate is the central piece. Fulcio copies identity data from the OIDC token into it:
- The subject alternative name (SAN) is a URI that names the workflow and its ref. For example:
https://github.com/OWNER/REPO/.github/workflows/build.yml@refs/tags/v1.2.0. - The issuer extension records the OIDC issuer, which for GitHub Actions is
https://token.actions.githubusercontent.com. - Further extensions record the source repository, the source commit digest, the trigger event, and whether the runner was GitHub-hosted or self-hosted.
This is why gh attestation verify --repo and --signer-workflow can work. They compare their arguments against fields in a certificate that Fulcio issued after validating the token. The signer cannot choose these values, because Fulcio takes them from the token.
You can see the certificate fields yourself. This command verifies an artifact and prints the certificate claims from the JSON output:
gh attestation verify dist/app --repo OWNER/REPO --format json \
| jq '.[0].verificationResult.signature.certificate'The output includes the issuer, the SAN, the repository and the commit digest. Treat the exact JSON field names as part of a CLI output format that can change between versions. Pin your CLI version if you parse this output in scripts.
Why a ten-minute certificate still verifies a year later
A natural question is how a verifier accepts a certificate that expired long ago. The answer is that expiry is checked against the time of signing, not the time of verification.
The verifier needs proof that the signature was made while the certificate was valid. That proof comes from a trusted timestamp, which is the integrated time in the Rekor entry or a signed timestamp from a timestamp authority. The log or authority is trusted for the time, and the signature must lie inside the certificate's validity window.
The full verification logic can be summarized like this:
- Check that the certificate chains to a Fulcio CA in the trusted root.
- Check that the signature over the attestation verifies with the certificate's public key.
- Check that the trusted timestamp falls inside the certificate's validity window.
- Check the inclusion proof, where the log provides one, against the log's public key.
- Check that the attestation's subject digest matches the artifact you hold.
- Check the identity policy, such as the repository, owner or signer workflow.
Steps 1 to 5 are about integrity. Step 6 is about trust, and it is the one only you can supply. The signature proves that some workflow made the claim. Your policy decides whether you accept that workflow.
The transparency log
The log has two jobs.
Timestamping. The log gives an independent time for the signature. Without it, an attacker who stole a private key after the fact could claim any signing time.
Detection. The log is append-only and publicly auditable. Anyone can monitor it. If someone obtains a certificate for your workflow identity and signs something you did not build, the entry appears in the log. A monitor can search the log by identity and alert on unexpected entries. Short certificate lifetimes limit the exposure, and the log makes misuse visible.
The log does not stop a bad signature from being created. It makes one discoverable.
GitHub-specific behavior
GitHub runs two Sigstore setups, and which one you use depends on repository visibility.
| Repository type | Sigstore instance | Transparency log |
|---|---|---|
| Public | Public-good Sigstore (Fulcio and Rekor operated for the community) | Entries are public |
| Private or internal (GitHub Enterprise Cloud) | GitHub's own Sigstore instance | No public log entry. A signed timestamp from GitHub's timestamp authority supplies the time |
Two consequences follow.
- Public entries are public. For a public repository, the repository name, workflow path, ref and commit SHA appear in a log that anyone can read. This is normally fine for open source. Keep it in mind if a repository name is sensitive.
- Verification differs by instance.
gh attestation verifyselects the right trusted root based on the attestation bundle. If you verify with another tool, such as a generic Sigstore client, you must configure it for the correct instance.
For offline or air-gapped verification, download the bundle and the trusted root ahead of time:
# Save attestations for an artifact next to it
gh attestation download dist/app --repo OWNER/REPO
# Fetch the current trusted root so verification can run offline
gh attestation trusted-root > trusted_root.jsonlAfter downloading, you can verify with the --bundle and --custom-trusted-root flags. Refresh the trusted root regularly, because the Sigstore operators rotate their keys.
Common errors and gotchas
- Missing
id-token: write. The signing step fails when it asks for an OIDC token. Add the permission to the job, not only to the workflow header if the job overrides permissions. - Fork pull requests. Workflows from forks run with a read-only token and no OIDC access by default. They cannot sign attestations, and that is intended.
- Trusting the issuer alone. A certificate from Fulcio for the GitHub issuer only says "some GitHub workflow". Any repository on GitHub can get one. Always pin the repository, owner or signer workflow.
- Mutable names. The SAN includes a ref such as
refs/heads/main. A branch name is mutable, and a tag can be moved. The commit digest in the certificate is the stable value to compare when you need precision. - Stale trusted root. An old copy of the root fails verification after the operators rotate keys. Fetch a fresh one.
- Self-hosted runners. The certificate records the runner environment. A self-hosted runner can still sign, but the trust you place in it is the trust you place in its operator.
- Compromised workflow. Keyless signing attests that the workflow ran, not that the workflow was benign. If an attacker can change the workflow or inject steps into it, they can obtain a valid signature.
How the pieces map to verification
When you later run gh attestation verify dist/app --repo OWNER/REPO, each part of the command maps to a part of the signing flow:
- The file's SHA-256 digest is matched against the attestation's subject.
- The signature is checked with the public key from the certificate.
- The certificate is checked against the trusted root, and its validity window is compared with the trusted timestamp.
--repois compared against the repository recorded in the certificate.--signer-workflowis compared against the workflow path in the SAN.
If any of these fail, the command exits with a non-zero status. That exit code is what you use for policy gates in scripts and pipelines.
Exercise
A teammate says: "The Fulcio certificate expired ten minutes after the build, so attestations older than that can no longer be verified." Explain why this is wrong and name the evidence that makes late verification possible.
Show answer
Verifiers check the certificate's validity against the time of signing, not the time of verification. A trusted timestamp, either the integrated time in the Rekor entry or a signed timestamp from a timestamp authority, shows the signature was made while the certificate was valid. If that timestamp falls inside the roughly ten-minute window and the certificate chains to the trusted Fulcio root, the attestation verifies years later.
Exercise
You verify an artifact with gh attestation verify dist/app --owner OWNER and it passes. Your security lead asks what stops a different workflow in another repository you own from producing a passing attestation for a tampered binary. What does the command not check here, and which flag would narrow it?
Show answer
With only --owner, the command accepts any attestation signed by a workflow identity in that organization or account, so a different repository's workflow would also pass. Add --repo OWNER/REPO to require the specific repository, and --signer-workflow OWNER/REPO/.github/workflows/build.yml to require the specific signing workflow.