Sigstore Integration
Earn 25 points (50 with Pro) in two steps
- ① Read through the lesson — each section gets a ✓ as you scroll through it.
- ② When every section has a ✓, tap Complete lesson.
0 of 10 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Module: Configure and Use Supply Chain Security
Section: Artifact Attestations
Lesson Title: Sigstore Integration
Introduction: The Trust Problem in Modern Software Delivery
In the modern software development lifecycle, we move code from a developer’s workstation to a build server, through various testing environments, and eventually into production. Throughout this journey, the code is packaged into artifacts—container images, binaries, or language-specific packages like JARs or NPM modules. The fundamental question that haunts security engineers is: "How do I know that this specific artifact is the one produced by my trusted build system, and not an imposter injected by an attacker?"
Traditionally, we relied on GPG keys to sign artifacts. While effective in theory, GPG management is notoriously difficult. Developers often struggle with key rotation, secure key storage, and the complexity of managing a web of trust. If a developer loses their private key, the entire chain of trust breaks. If a key is stolen, an attacker can sign malicious code that looks perfectly legitimate to your infrastructure.
Sigstore emerges as a solution to these challenges by modernizing how we sign and verify software. It allows developers to sign artifacts using OpenID Connect (OIDC) identities—like an email address or a GitHub account—instead of managing long-lived cryptographic keys. By integrating Sigstore into your supply chain, you create verifiable "attestations" that prove who built your artifact, how it was built, and that it hasn't been tampered with since. This lesson explores how to integrate Sigstore into your workflows to build a secure, verifiable software supply chain.
Not read yet
Understanding the Core Components of Sigstore
To understand how to integrate Sigstore, you must first understand the three core components that make it work: Cosign, Fulcio, and Rekor. Each piece serves a specific role in ensuring that your software remains authentic.
- Cosign: This is the command-line tool you will interact with most. It handles the signing, verification, and storage of signatures. Cosign allows you to sign container images, blobs, and other files, and it stores those signatures in the same registry where you store your container images.
- Fulcio: This is a Certificate Authority (CA) that issues short-lived certificates based on OIDC identities. When you initiate a signing process, Cosign talks to Fulcio. You authenticate with your identity provider (like Google, GitHub, or Microsoft), and Fulcio issues a certificate that is valid for only a few minutes, tied specifically to your identity.
- Rekor: This is a transparency log. When you sign an artifact, the signature and the certificate are recorded in Rekor. This creates an immutable, public, or private audit trail. Because the log is tamper-proof, anyone can verify that a signature was created at a specific time by a specific person, preventing "split-view" attacks where an attacker shows different signatures to different users.
Callout: Key-based vs. Identity-based Signing
Traditional signing requires you to manage long-lived GPG keys. If you lose the private key, you lose the ability to sign. If the key is leaked, you have to perform an expensive revocation process. Sigstore shifts this to identity-based signing. You don't manage keys; you authenticate with an identity provider. The "key" is ephemeral, created for the signing event and discarded immediately after. This eliminates the burden of key management and rotation.
Not read yet
Setting Up Your Environment for Sigstore
Before you can integrate Sigstore into your CI/CD pipelines, you need to set up your local development environment. The process is straightforward, requiring only the installation of the cosign binary.
- Download the Binary: Visit the official Sigstore releases page or use your package manager (like
brewon macOS orapton Linux) to installcosign. - Verify the Installation: Once installed, run
cosign versionto ensure the tool is correctly configured. - Authentication: Cosign will use your browser to authenticate with an OIDC provider. When you run a signing command, it will open a local server to handle the OAuth flow, allowing you to sign using your existing developer credentials.
Practical Example: Signing a Container Image
Let’s look at how to sign a container image stored in a registry. Imagine you have an image tagged myapp:v1.0.0 and you want to sign it using your GitHub identity.
# Authenticate and sign the image
cosign sign myregistry.com/myapp@sha256:abcdef123456...
When you run this command, Cosign will:
- Initiate an OIDC flow in your browser.
- Request a short-lived certificate from Fulcio based on your identity.
- Sign the digest of your image.
- Upload the signature and the certificate as a new artifact in the container registry alongside your image.
Note: Always sign by the digest (the
sha256hash) rather than the tag. Tags are mutable and can be changed to point to a different image, which undermines the security of your signature.
Not read yet
Advanced Attestations: Beyond Simple Signatures
A signature proves that an entity signed a piece of data. However, in a supply chain, you often need more context. This is where "attestations" come in. An attestation is a signed statement about an artifact, usually formatted as an In-toto statement.
Think of an attestation as a metadata envelope. Inside, you can include information such as:
- The build platform used (e.g., GitHub Actions, Tekton).
- The source code commit hash that generated the artifact.
- The vulnerability scan results for the artifact.
- The software bill of materials (SBOM) generated during the build.
Creating an Attestation
You can create an attestation using the cosign attest command. For instance, if you want to attach an SBOM to your container image, you would first generate the SBOM file and then attest to it.
# Generate an SBOM using syft
syft myregistry.com/myapp:v1.0.0 -o spdx-json > bom.json
# Attest the image with the SBOM
cosign attest --predicate bom.json --type spdx myregistry.com/myapp@sha256:abcdef...
By doing this, you are cryptographically linking the SBOM to the container image. When someone verifies the image, they can also verify the SBOM, ensuring that the components listed in the SBOM are indeed what is inside the image.
Not read yet
Integrating Sigstore into CI/CD Pipelines
The true power of Sigstore is realized when it is automated within your CI/CD pipelines. Manual signing is prone to human error and is not scalable. To automate this, you need to use "Keyless" signing with identity tokens provided by your CI platform.
GitHub Actions Example
GitHub Actions provides an OIDC token that can be used to authenticate with Fulcio. You don't need to store any secrets in your repository settings.
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for Sigstore
contents: read
steps:
- name: Build and Push
run: |
docker build -t myregistry.com/myapp:latest .
docker push myregistry.com/myapp:latest
- name: Install Cosign
uses: sigstore/[email protected]
- name: Sign the image
run: |
cosign sign --yes myregistry.com/myapp@${{ needs.build.outputs.digest }}
In this pipeline:
- The
id-token: writepermission allows the runner to request a token from GitHub. - Cosign uses this token to authenticate with Fulcio.
- The signature is generated automatically without any manual intervention.
Warning: Be cautious with the
permissionsblock in your YAML files. Only grant theid-token: writepermission to the specific jobs that require signing. If you grant it globally, you increase the surface area for a potential compromise.
Not read yet
Verification: Ensuring Artifact Integrity
Signing is only half the battle. If your deployment environment doesn't verify the signatures, you aren't actually protected. You must configure your production systems (like Kubernetes) to reject any container image that lacks a valid signature.
Verifying with Cosign
You can verify an image manually using the cosign verify command.
cosign verify --certificate-identity-regexp ".*@github.com" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
myregistry.com/myapp@sha256:abcdef...
The --certificate-identity-regexp flag is critical. It ensures that you are only accepting signatures from a specific identity (e.g., your official GitHub repository). Without this check, anyone with a GitHub account could sign an image, and Cosign would consider it "verified" because the signature itself is valid.
Enforcing Policy in Kubernetes
To enforce this at scale in Kubernetes, you should use a policy engine like Kyverno or Policy Controller. These tools can intercept requests to the API server and block any pod creation that refers to an unsigned image.
# Example Kyverno policy snippet
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: check-image-signature
spec:
validationFailureAction: Enforce
rules:
- name: verify-signature
match:
resources:
kinds:
- Pod
verifyImages:
- imageReferences:
- "myregistry.com/myapp:*"
attestors:
- entries:
- keys:
publicKeys: |-
-----BEGIN PUBLIC KEY-----
...
Not read yet
Best Practices for Sigstore Usage
To maximize the benefits of Sigstore while minimizing risk, follow these industry-standard practices:
- Use Short-Lived Certificates: Always prefer keyless signing over long-lived keys. If you must use keys, treat them with the same sensitivity as root certificates—store them in a Hardware Security Module (HSM) or a secure cloud key management service (KMS).
- Verify Identities Strictly: When verifying, always specify the expected OIDC issuer and the expected identity (the email or GitHub subject). Do not just verify that the signature is "valid"; verify that it comes from your trusted build system.
- Automate Everything: Manual signing is the enemy of consistency. Ensure that every artifact produced by your CI pipeline is signed automatically. If an artifact is not signed, treat it as untrusted.
- Rotate CI/CD Identities: If you use service accounts to perform signing, ensure these accounts are rotated regularly. Treat your CI/CD service account as a high-privileged entity.
- Monitor the Rekor Log: If you are using public Rekor, be aware that your build metadata is public. If your build process contains sensitive information (e.g., internal paths, private repository names), consider using a private instance of Rekor.
Callout: The "Keyless" Misconception
"Keyless" does not mean no keys are used. It means you don't have to manage them. Under the hood, Fulcio generates a temporary key pair for the signing operation, uses it to sign your artifact, and then immediately destroys the private key. You are left with a signature and a certificate that proves your identity, without the burden of storing a permanent private key.
Not read yet
Common Pitfalls and How to Avoid Them
Even with the best intentions, teams often run into specific hurdles when implementing Sigstore. Here are the most common mistakes:
- Trusting "Any" Identity: As mentioned, a common mistake is running
cosign verifywithout specifying the identity. If you don't check who signed the image, you are vulnerable to any user who can get a valid signature from Fulcio. Always use the--certificate-identityflag. - Ignoring Rekor: Some teams skip the transparency log to save time or avoid complexity. However, the log is what provides the non-repudiation and auditability that makes Sigstore truly secure. Always ensure your signatures are recorded in a transparency log.
- Mixing Tags and Digests: If you sign
myapp:latest, you are signing a moving target. If an attacker pushes a newlatestimage, your signature will not apply to that new image, but your verification logic might become confused. Always work with image digests (sha256). - Hardcoding Secrets: Never embed signing keys in your CI/CD scripts. Use OIDC-based authentication provided by your cloud provider or CI platform.
- Lack of Policy Enforcement: Signing artifacts is useless if your deployment environment doesn't check those signatures. A common failure mode is spending weeks implementing signing and then forgetting to configure the admission controller in Kubernetes to actually reject unsigned images.
Not read yet
Quick Reference Table: Sigstore Components
| Component | Role | Security Benefit |
|---|---|---|
| Cosign | CLI Tool | Standardizes signing/verification workflows. |
| Fulcio | CA | Issues short-lived, identity-bound certificates. |
| Rekor | Transparency Log | Provides an immutable audit trail for all signatures. |
| OIDC | Identity Provider | Eliminates the need for long-lived static keys. |
| In-toto | Metadata Standard | Enables structured, verifiable supply chain attestations. |
Frequently Asked Questions (FAQ)
Q: Can I use Sigstore for things other than container images? A: Yes. Cosign can sign any blob, such as binaries, scripts, or configuration files. You can use it to sign anything that can be represented as a file.
Q: What happens if the Sigstore public infrastructure goes down? A: Sigstore is designed to be highly available. However, for critical infrastructure, you can host your own instances of Fulcio and Rekor. Many enterprise organizations choose to run their own infrastructure to maintain total control and privacy.
Q: Is Sigstore compliant with enterprise security policies? A: Sigstore aligns well with modern security frameworks like SLSA (Supply-chain Levels for Software Artifacts). By using Sigstore, you are taking a massive step toward meeting the requirements for provenance and integrity demanded by frameworks like NIST and the Executive Order on Cybersecurity.
Q: Do I need to be on the public internet to use Sigstore? A: While the default public infrastructure requires internet access, you can deploy Sigstore components within a private, air-gapped network. This is common in highly regulated industries like defense or finance.
Not read yet
Summary and Key Takeaways
Integrating Sigstore into your supply chain represents a fundamental shift in how you secure your software. By moving away from brittle, long-lived GPG keys and toward identity-based, ephemeral signing, you reduce your attack surface and simplify your operations.
Here are the key takeaways from this lesson:
- Identity is the new perimeter: Use OIDC to tie your software artifacts to specific, verifiable identities rather than static, easily stolen cryptographic keys.
- Automation is mandatory: Use CI/CD pipeline integration to ensure that signing happens consistently for every artifact. Manual signing is a recipe for failure.
- Verification is the enforcement mechanism: Signing an artifact is only the beginning. You must implement policy enforcement (e.g., in Kubernetes) to reject unsigned or unverified artifacts before they reach production.
- Attestations provide context: Go beyond simple signatures. Use attestations to bundle SBOMs, build provenance, and vulnerability reports with your artifacts, creating a comprehensive audit trail.
- Auditability matters: The transparency log (Rekor) is a critical component for detecting malicious activity. It ensures that even if a build system is compromised, there is a permanent record of what was signed.
- Use digests, not tags: Always refer to container images by their SHA256 digest to ensure you are verifying the exact byte-for-byte artifact that was signed.
- Start with a policy: Before you start signing, define your policy. Who is authorized to sign? Which OIDC issuers do you trust? What happens if verification fails? Clear policies make the technical implementation much smoother.
By following these principles and integrating these tools, you are building a resilient software supply chain that is significantly harder to compromise. As the industry moves toward "zero trust" architectures, Sigstore will become an essential component of your security toolkit. Start small by signing one internal service, then scale your policy enforcement as you gain confidence in your automated pipelines.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
Spend your points to unlock exam-style practice questions
Spend points to unlock GH-500 exam-style practice questions.
Practice for GH-500