Sub topic 7
Rekor and the signature transparency log
This chapter assumes you can sign and verify an image with Cosign using a key pair, and that you have seen keyless signing with OIDC and Fulcio certificates. You should know what a digest is and basic public-key ideas such as a signature and a public key. Here you will learn what Rekor records, why keyless verification depends on it, and how to inspect and troubleshoot it.
Why keyless signing needs a log
A keyless signature uses a Fulcio certificate that is valid for about ten minutes. After that, the certificate has expired and the signing key is thrown away. If a verifier only checked "is this certificate valid now?", every keyless signature would fail minutes after it was made.
The verifier needs a different question: "Was this signature made while the certificate was valid?" Rekor answers it. Rekor is a public, append-only transparency log run by the Sigstore project. When Cosign signs, it submits a record to Rekor. Rekor returns a signed timestamp showing when it accepted that record. A verifier compares that time with the certificate's validity window.
Rekor also gives you a second benefit that applies to key-based signing too. Every signature gets a public record, so a signer can look for signatures made with their identity or key that they did not make themselves.
What a Rekor entry contains
Rekor stores metadata about a signing event. It does not store the image. A typical entry for a Cosign signature holds:
- The hash of the signed payload (the JSON that names the image digest).
- The signature itself.
- The public key or the Fulcio certificate used to verify it.
- An integrated time, which is when Rekor accepted the entry.
- A log index and a log ID that identify the entry and the log.
Rekor supports several entry types. Cosign signatures typically use the hashedrekord type. Attestations use the intoto type, and you will meet them later in this tutorial.
Because the certificate is in the entry, the entry also records the signer's identity (for example an email address or a workflow URL) and the OIDC issuer. This is why the log is useful for auditing.
How the log stays trustworthy
Rekor is built on a Merkle tree. A Merkle tree is a structure where each leaf is a hash of an entry and each parent node is a hash of its children. The single hash at the top is the root hash. Changing any entry changes every hash on the path to the root.
Two properties follow from this design:
- Inclusion proof. A short list of hashes proves that a given entry is part of the tree with a given root.
- Consistency proof. A short list of hashes proves that a newer tree contains the older tree unchanged, so nothing was rewritten or removed.
Rekor signs its tree head, which includes the root hash and tree size. Rekor also returns a signed entry timestamp (SET) for each new entry. The SET is Rekor's signature over the entry's key fields. Cosign stores the SET with the signature in the registry, so verification can work without contacting Rekor.
The following diagram shows what happens when you sign and then verify.
What Cosign checks during verification
When you run cosign verify on a keyless signature, Cosign does the following:
- Reads the signature, the certificate and the Rekor bundle from the registry.
- Checks that the certificate chains to the Fulcio root.
- Checks the certificate identity and issuer against the flags you passed.
- Checks the signature over the payload using the certificate's public key.
- Checks the SET using Rekor's public key.
- Checks that the integrated time falls inside the certificate's validity window.
Step 5 is why an attacker cannot simply claim a signature was made earlier. They would need Rekor to sign a timestamp it never issued.
Note what the log does not prove. A Rekor entry shows that someone with a valid identity signed something at a given time. It does not show that the image is safe, and it does not show that the signer is trustworthy. You still decide which identities you accept.
Inspecting entries with the rekor-cli
Rekor has a command-line tool, rekor-cli. You can search by the artifact hash, by public key, or by email. The examples below use the public instance at rekor.sigstore.dev.
# Find entries for a payload hash
rekor-cli search --sha sha256:<payload-hash>
# Show one entry by its UUID
rekor-cli get --uuid <entry-uuid> --format json
# Show the entry at a given log index
rekor-cli get --log-index 123456789 --format jsonYou can also inspect the Rekor bundle that Cosign saved with the signature. The cosign verify command prints JSON, and each element has an optional.Bundle field when a log entry exists.
cosign verify \
--certificate-identity [email protected] \
--certificate-oidc-issuer https://accounts.google.com \
"$IMAGE" | jq '.[0].optional.Bundle.Payload'The output includes integratedTime, logIndex and logID. You can convert the integrated time to a date with date -d @<seconds> on Linux.
Monitoring for unexpected signatures
A public log lets you watch for signatures that claim your identity. Suppose your CI workflow is the only thing that should sign images for ghcr.io/OWNER/REPO. If the log shows a signature for that workflow identity that your pipeline did not create, something is wrong. Maybe a token was stolen, or the workflow file was changed.
Sigstore provides a Rekor monitor, and you can also script this yourself. A simple approach is to search by identity and compare the result against your build records.
rekor-cli search --email [email protected]Searching by email only matches certificates whose subject alternative name is an email address. For a GitHub Actions workflow, the identity is a URL, and Rekor's index supports searching by that value in newer versions. Check what your version of rekor-cli supports before relying on it.
Public log, private data
Everything you send to the public Rekor instance is visible to anyone. This has consequences:
- Your email address or workflow URL appears in the certificate, so it becomes public.
- The names of your repositories and branches appear if they are in the workflow identity.
- The image digest appears in the payload that was hashed. The hash does not reveal the image name, but anyone who knows the digest can look it up.
For private projects this may be unacceptable. You have three options:
- Use key-based signing and skip the log with
--tlog-upload=false. You lose the public record. - Run a private Rekor instance and a private Fulcio instance, and point Cosign at them.
- Accept the exposure, and use identities that do not reveal sensitive names.
Common errors
The table below lists problems that come up around Rekor, with a likely cause for each.
| Symptom | Likely cause | What to do |
|---|---|---|
| `no matching signatures: ... tlog entry not found` or missing bundle | The signature was made with `--tlog-upload=false`, or the Rekor upload failed | Re-sign with log upload on, or verify with `--insecure-ignore-tlog` only if you accept the risk |
| `certificate ... expired` during verify | The signature has no Rekor bundle, so Cosign checks the certificate against the current time | Re-sign with log upload on |
| Timeout or 5xx when signing | The Rekor service is slow or unavailable | Retry with backoff. Sign again, since a failed upload leaves no valid bundle |
| Signature verifies on one machine but not another | Old Cosign version or outdated trusted root | Update Cosign and refresh the trust root with `cosign initialize` |
| Verify works only with `--insecure-ignore-tlog` | The Rekor public key or trust root does not match the signature's log | Check which Rekor instance signed, and use the right trust root |
The flag --insecure-ignore-tlog turns off the log check. For keyless signatures that removes the proof that the certificate was valid at signing time. Use it only for debugging.
Summary of key points
- Fulcio certificates expire in minutes, so a verifier needs proof of when the signature was made. Rekor supplies that proof.
- A Rekor entry holds the payload hash, signature, certificate or public key, and a timestamp. It does not hold the image.
- A Merkle tree gives inclusion and consistency proofs, so the log cannot be quietly rewritten.
- The signed entry timestamp lets Cosign verify offline against Rekor's public key.
- The public log leaks identity and repository names. Plan for that before you choose keyless signing.
Exercise
A teammate signs an image keylessly with --tlog-upload=false. Ten minutes later, cosign verify with the correct identity and issuer fails with a certificate error. Explain why it fails and give two ways to fix it.
Show answer
Fulcio certificates are valid for only about ten minutes. Without a Rekor entry there is no signed timestamp proving the signature was made inside that window, so Cosign sees an expired certificate and rejects it. Fix it by signing again with log upload enabled so the signature carries a Rekor bundle. Alternatively, use a key-based signature, which has no short-lived certificate. Running a private Rekor instance also works if the public log is unacceptable. Using --insecure-ignore-tlog would pass verification but removes the timing proof, so it is not a real fix.
Exercise
Your build pipeline is the only thing that should sign ghcr.io/OWNER/REPO. Name one way to use Rekor to detect a stolen CI token being used to sign a malicious image, and one limit of that approach.
Show answer
Search or monitor Rekor for entries whose certificate identity matches your workflow, then compare each entry's payload digest and time with your build records. An entry with no matching build is suspicious. The limit is that this detects misuse after the fact. It does not stop the signature from being created, so you still need a verification policy that pins the identity and, where possible, the branch.