Artifact Attestations and Provenance
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 11 read · keep scrolling
✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro
Lesson: Artifact Attestations and Provenance in Modern Automation
Introduction: Why Provenance Matters
In the current landscape of software development and automated deployment, the speed at which we move code from a developer’s workstation to production is unprecedented. However, this velocity introduces significant risk. How do we know that the container image or binary artifact sitting in our registry is the exact same one that was built by our trusted CI/CD pipeline? How do we verify that it was built from the correct source code, using authorized build tools, and that it has passed all necessary security scans?
This is where artifact attestations and provenance come into play. Provenance refers to the "chain of custody" for a software artifact—a verifiable record of how, when, and by whom a piece of software was created. Attestations are the signed statements that testify to these facts. Without these mechanisms, an organization is essentially flying blind, trusting that their build environment hasn't been compromised by malicious actors injecting unauthorized code or modifying binaries during the build process.
By implementing provenance, you move from a model of "implicit trust" to "explicit verification." This transition is essential for securing your supply chain against sophisticated attacks, such as those where a build server is compromised to inject backdoors into legitimate software updates. In this lesson, we will explore the technical foundations of attestations, how to generate and verify them, and how to integrate these practices into your existing automation workflows.
Not read yet
Understanding the Core Concepts: Provenance and Attestations
To effectively implement these security measures, we must first define the terminology. While the terms are often used interchangeably, they represent distinct components of a secure software supply chain.
What is Provenance?
Provenance is the metadata that describes the origin and history of an artifact. Think of it like a birth certificate for your software. It should contain information such as the source code repository URL, the commit hash used for the build, the specific build instructions, the dependencies included, and the identity of the build system. When an artifact has verifiable provenance, you can mathematically prove that it originated from a specific, trusted pipeline.
What is an Attestation?
An attestation is a signed document that makes a claim about an artifact. For example, a vulnerability scanner might generate an attestation that says: "I have scanned this image, and it contains no high-severity vulnerabilities." This statement is then cryptographically signed by the scanner's identity. Because it is signed, any downstream system can verify that the claim was made by the authorized scanner and that the content of the claim has not been tampered with.
Callout: The Difference Between Provenance and Attestations While provenance is a specific type of metadata regarding origin, attestations are a broader category of claims. You can have attestations about provenance (e.g., "This was built by GitHub Actions"), attestations about security (e.g., "This passed a Snyk scan"), and attestations about compliance (e.g., "This was approved by QA"). Provenance is the "who and where," while attestations are the "what and how."
Not read yet
The Technical Foundation: SLSA and Sigstore
To implement these concepts, we rely on industry-standard frameworks and tools. The most prominent of these are SLSA (Supply-chain Levels for Software Artifacts) and Sigstore.
SLSA (Supply-chain Levels for Software Artifacts)
SLSA is a security framework that provides a path to hardening your software supply chain. It defines different levels of integrity, starting from Level 1 (scripted builds) up to Level 4 (hermetic, reproducible builds). By following SLSA guidelines, you ensure that your build process is auditable and resistant to common tampering techniques.
Sigstore
Sigstore is a collection of tools that simplifies the process of signing and verifying software. Historically, code signing was difficult because it required managing complex Public Key Infrastructure (PKI). Sigstore removes this burden by using short-lived, ephemeral keys that are tied to OIDC (OpenID Connect) identities, such as your company email or a GitHub account. This makes it trivial to sign artifacts without the headache of long-term key management.
Not read yet
Step-by-Step Implementation: Generating Provenance
Let’s look at how to generate provenance for a container image using modern tooling. We will use cosign, the flagship tool of the Sigstore project, to attach provenance to an image.
Step 1: Set Up Your Build Environment
Before you can generate provenance, your build environment must be able to authenticate with your OIDC provider. If you are using GitHub Actions, this is handled automatically. If you are running on a custom runner, ensure your environment has the necessary environment variables set to allow the OIDC handshake.
Step 2: Build the Artifact
You must build your artifact in a way that the build system can capture the metadata. For container images, this usually involves using a tool like ko or docker buildx with provenance generation enabled.
# Using buildx to generate provenance metadata during the build
docker buildx build --provenance=true --push -t my-registry/my-app:v1.0.0 .
The --provenance=true flag tells the builder to generate an attestation that includes the build details, such as the source repository and the commit hash.
Step 3: Sign the Attestation
Once the image is pushed, you use cosign to generate the attestation and sign it.
# Generate and sign the attestation
cosign attest --yes --predicate provenance.json --type slsa my-registry/my-app:v1.0.0
In this command, provenance.json is the metadata file created by your build system. The cosign attest command takes this file, wraps it in an envelope, signs it with your OIDC identity, and pushes it to the registry alongside your container image.
Note: Always ensure your build system is configured to use short-lived keys whenever possible. Storing long-lived private keys in a CI/CD environment is a major security risk, as a compromise of the environment leads to a compromise of your entire signing infrastructure.
Not read yet
Verifying Attestations in Automation
Generating attestations is only half the battle. If your deployment pipeline doesn't verify these attestations, you haven't actually improved your security posture. Verification must occur at the point of consumption—for example, when a Kubernetes cluster pulls an image.
Implementing Admission Controllers
In a Kubernetes environment, the most robust way to verify attestations is through an admission controller like Kyverno or Policy Controller. These tools intercept requests to pull images and check if they possess the required signatures and attestations.
Example: Kyverno Policy for Verification
You can define a policy that refuses any image that lacks a valid provenance attestation.
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-provenance
spec:
validationFailureAction: Enforce
rules:
- name: verify-image-provenance
match:
resources:
kinds:
- Pod
verifyImages:
- imageReferences:
- "my-registry/my-app:*"
attestors:
- entries:
- keys:
publicKeys: |-
-----BEGIN PUBLIC KEY-----
... (Your public key) ...
-----END PUBLIC KEY-----
attestations:
- predicateType: https://slsa.dev/provenance/v0.2
conditions:
- all:
- key: "{{provenance.builder.id}}"
operator: Equals
value: "https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@refs/tags/v1.2.0"
In this policy, we are enforcing that the image must have a SLSA provenance attestation, and the builder ID must match our authorized GitHub Actions workflow. If an attacker tries to deploy an image built on their own machine, the policy will reject it because it lacks the correct provenance signature.
Not read yet
Best Practices for Secure Provenance
Implementing these systems requires a disciplined approach to configuration and maintenance. Here are the core best practices for maintaining a secure provenance strategy.
1. Automate Everything
Manual signing is prone to human error and is not scalable. Your build pipeline should automatically sign artifacts and generate attestations as part of the standard build process. If a build fails to generate an attestation, the pipeline should fail immediately.
2. Practice "Least Privilege" for Signers
Not every build job should have the authority to sign production artifacts. Use separate keys or OIDC identities for different environments. For example, a "development" build job should not be able to sign an artifact that is allowed to be deployed into "production."
3. Use Immutable Tags
Always use specific versions or digests (SHA256 hashes) when referencing artifacts. If you use mutable tags like latest, an attacker could replace the image with a malicious one, and your verification logic might be tricked if it isn't careful about how it handles tag resolution.
4. Monitor and Audit Attestations
Treat your attestations as security logs. Regularly audit your registry to ensure that all production artifacts have the required attestations. If you find an artifact in production that lacks provenance, treat it as a security incident and investigate how it bypassed your controls.
Callout: The "Heremetic Build" Standard A hermetic build is a process where the build environment has no access to the network and all dependencies are pinned by cryptographic hash. While achieving full hermeticity is difficult, it is the gold standard for SLSA Level 4. It ensures that the build is deterministic—meaning if you run the same build twice, you get the exact same byte-for-byte output, which is the ultimate proof of provenance.
Not read yet
Common Pitfalls and How to Avoid Them
Even with the best intentions, teams often fall into traps when implementing provenance. Understanding these pitfalls will help you avoid costly mistakes.
Pitfall 1: Relying Solely on Image Signatures
Many teams stop at signing the image itself. While signing the image confirms who pushed it, it does not confirm how it was built. An attacker with access to your registry credentials could sign a malicious image. Attestations provide the necessary context (the "how") that a simple signature lacks.
Pitfall 2: Key Management Overload
Trying to manage a PKI infrastructure with long-lived GPG keys is a common point of failure. Keys get lost, stolen, or expired. Always prefer Sigstore’s OIDC-based signing over traditional GPG keys. It simplifies the lifecycle management and reduces the risk of key leakage.
Pitfall 3: Ignoring Dependency Provenance
It is easy to focus on the provenance of your own code, but modern applications are 90% dependencies. If you don't verify the provenance of your dependencies, you are vulnerable to "dependency confusion" attacks. Use tools like sbom-tool to generate a Software Bill of Materials (SBOM) and attest to the integrity of your third-party libraries.
Pitfall 4: "Fail-Open" Configurations
In the early stages of implementation, it is tempting to set your verification policies to "warn" rather than "enforce." While this is good for testing, leaving it in this state indefinitely defeats the purpose of the security control. Always transition to "enforce" mode once you have confirmed your build pipelines are correctly generating attestations.
Not read yet
Comparison: Traditional Signing vs. Modern Attestations
To better understand the shift in the industry, consider the following comparison between traditional GPG-based signing and modern provenance-based attestations.
| Feature | Traditional GPG Signing | Modern Attestations (Sigstore/SLSA) |
|---|---|---|
| Key Management | Manual (High overhead) | Automated (OIDC/Ephemeral) |
| Identity | Static keys | Short-lived OIDC tokens |
| Metadata | Limited (Signature only) | Rich (Build logs, SBOM, Security scans) |
| Verification | Cryptographic only | Cryptographic + Policy-based |
| Scalability | Low | High |
Integrating SBOMs into Your Provenance Strategy
An SBOM (Software Bill of Materials) is a comprehensive list of all components, libraries, and modules that make up your software. When you combine an SBOM with provenance, you create a powerful security narrative.
Why combine them?
Provenance tells you where the code came from, and the SBOM tells you what is inside it. By signing your SBOM as an attestation, you ensure that the list of dependencies hasn't been tampered with. If a vulnerability is discovered in a common library (like Log4j), you can instantly query your registry to see which images contain that library by looking at the signed SBOM attestations.
How to generate and sign an SBOM
You can use tools like syft to generate an SBOM and then use cosign to attach it to your image:
# Generate the SBOM
syft my-registry/my-app:v1.0.0 -o cyclonedx-json > sbom.json
# Attach it as an attestation
cosign attest --yes --predicate sbom.json --type cyclonedx my-registry/my-app:v1.0.0
This creates a verifiable link between the container image and its contents, enabling proactive security monitoring.
Not read yet
Advanced Topic: Handling Multi-Stage Pipelines
In complex environments, an artifact might pass through several stages: build, test, scan, and deploy. Each stage should ideally produce an attestation.
The "Chain of Attestations"
- Build Job: Produces the container image and a provenance attestation.
- Security Scanner: Pulls the image, scans it, and produces a vulnerability scan attestation.
- QA/Approval Job: Validates the scan results and produces an "approval" attestation.
- Admission Controller: Verifies that all three attestations are present and valid before allowing the image to run.
This creates a "gated" deployment process where no human intervention is required, yet every step of the process is cryptographically verified. If the vulnerability scanner finds a high-severity issue, it simply doesn't sign the attestation, and the deployment is automatically blocked.
Tip: Start by implementing provenance for your primary build job. Once that is stable, add a vulnerability scan attestation. Do not try to implement the entire multi-stage chain at once, as debugging verification failures across multiple attestations can be complex.
Not read yet
Security Best Practices Checklist
To ensure your implementation is effective, use this checklist to audit your current environment:
- OIDC Integration: Are you using OIDC for your signing identity instead of long-lived secret keys?
- Provenance Enabled: Do all your build pipelines generate SLSA-compliant provenance?
- Verification Policy: Do you have an admission controller (e.g., Kyverno) enforcing the presence of attestations in production?
- SBOM Coverage: Are you generating and signing SBOMs for all your primary production artifacts?
- Audit Logging: Are you logging all verification events? (This helps you identify if someone is trying to deploy non-compliant images).
- Dependency Pinning: Are your build scripts pinning dependencies by hash rather than version string?
Common Questions and Troubleshooting
"My build takes too long with provenance enabled. What should I do?"
Generating provenance adds minimal overhead to a build process. If you are experiencing significant latency, the issue is likely related to the network calls during the signing process (e.g., talking to the OIDC provider). Ensure your CI/CD runners have efficient network paths to your identity provider and registry.
"What happens if the registry is down?"
If your registry is unreachable, your admission controller will likely fail to verify the attestations. This is a "fail-closed" security posture. To mitigate this, ensure your container registry has high availability and consider caching policies for verification metadata if your infrastructure supports it.
"Can I retroactively add attestations to old images?"
Technically, yes, you can sign an existing image. However, the provenance will be inaccurate because it will reflect the time of signing rather than the time of the original build. It is best practice to rebuild the image using your modern, secure pipeline to ensure the provenance metadata is accurate.
Not read yet
Key Takeaways
- Trust, but Verify: Implicit trust in your build system is a vulnerability. Provenance and attestations provide the cryptographic proof necessary to secure your software supply chain.
- Use Modern Tooling: Leverage Sigstore and SLSA frameworks. Avoid the complexity and risk associated with managing traditional GPG keys and custom PKI infrastructure.
- Automation is Mandatory: If a security process is manual, it will eventually be bypassed. Integrate signing and attestation generation directly into your CI/CD pipelines so it happens for every build, without exception.
- Enforcement is the Goal: Generating attestations is useless if you don't verify them. Use admission controllers in your production environment to enforce that only verified, signed artifacts are allowed to execute.
- Context Matters: Provenance is about the "how and where," while attestations provide the "what." Combining these with SBOMs gives you a complete, searchable, and auditable history of your software.
- Start Small: Begin by enabling provenance on one critical service. Once the pipeline is stable and the verification policy is working, expand the scope to other services and add additional attestations like security scans.
- Treat Attestations as Code: Your signing policies and verification rules should be stored in version control, reviewed by peers, and tested in a staging environment just like your application code.
By following these principles, you will significantly reduce the attack surface of your software supply chain and ensure that your automation processes are not only fast but also fundamentally secure. Implementing these practices is a journey, not a destination, so prioritize consistency and incremental improvement as you harden your infrastructure.
Not read yet
Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.
- Scheduled Event Triggers
- Scheduled Event Triggers Quiz5q
- Manual Workflow Dispatch
- Manual Workflow Dispatch Quiz5q
- Webhook Event Triggers
- Webhook Event Triggers Quiz5q
- Repository Events Configuration
- Repository Events Configuration Quiz5q
- Workflow Dispatch Inputs
- Workflow Dispatch Inputs Quiz5q
- Reusable Workflows with workflow_call
- Reusable Workflows with workflow_call Quiz5q
- Jobs and Steps Fundamentals
- Jobs and Steps Fundamentals Quiz5q
- Conditional Logic in Workflows
- Conditional Logic in Workflows Quiz5q
- Job Dependencies with needs
- Job Dependencies with needs Quiz5q
- Service Containers Configuration
- Service Containers Configuration Quiz5q
- Matrix Strategy Configuration
- Matrix Strategy Configuration Quiz5q
- YAML Anchors and Aliases
- YAML Anchors and Aliases Quiz5q
- Predefined Contexts Usage
- Predefined Contexts Usage Quiz5q
- Azure Integration Patterns
- Azure Integration Patterns Quiz5q
- AWS Integration Patterns
- AWS Integration Patterns Quiz5q
- Kubernetes Deployments
- Kubernetes Deployments Quiz5q
- Notification Integrations
- Notification Integrations Quiz5q
- Code Quality Integrations
- Code Quality Integrations Quiz5q
- Third-Party Service Integration
- Third-Party Service Integration Quiz5q
- Workflow Orchestration Patterns
- Workflow Orchestration Patterns Quiz5q
- Multi-Environment Workflows
- Multi-Environment Workflows Quiz5q
- Blue-Green and Canary Deployments
- Blue-Green and Canary Deployments Quiz5q
- GitHub-Hosted Runners Configuration
- GitHub-Hosted Runners Configuration Quiz5q
- Self-Hosted Runners Setup
- Self-Hosted Runners Setup Quiz5q
- Runner Groups Management
- Runner Groups Management Quiz5q
- IP Allow Lists and Networking
- IP Allow Lists and Networking Quiz5q
- Runner Troubleshooting
- Runner Troubleshooting Quiz5q
- Environment Protections
- Environment Protections Quiz5q
- Trustworthy Marketplace Actions
- Trustworthy Marketplace Actions Quiz5q
- Script Injection Mitigation
- Script Injection Mitigation Quiz5q
- GITHUB_TOKEN Permissions
- GITHUB_TOKEN Permissions Quiz5q
- OIDC Token for Cloud Federation
- OIDC Token for Cloud Federation Quiz5q
- Action Version Pinning
- Action Version Pinning Quiz5q
- Artifact Attestations and Provenance
- Artifact Attestations and Provenance Quiz5q
Spend your points to unlock exam-style practice questions
Spend points to unlock GH-200 exam-style practice questions.
Practice for GH-200