SLSA Framework Compliance
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: Mastering SLSA Framework Compliance for Artifact Attestations
Introduction: Why Supply Chain Security Matters
In the modern software development lifecycle, the integrity of the code we ship is just as critical as the functionality it provides. We often focus heavily on securing our production environments, firewalls, and application logic, yet we frequently overlook the "provenance" of the artifacts we deploy. When you pull a container image or a binary from a registry, how do you know it was actually built from the source code you think it was? How can you verify that it hasn't been tampered with during the build process? This is where the Supply-chain Levels for Software Artifacts (SLSA) framework becomes essential.
SLSA—pronounced "salsa"—is a security framework designed to prevent tampering, improve integrity, and provide auditability for software artifacts. It moves us away from a "trust-by-default" model toward a model of verifiable provenance. By generating attestations—signed metadata that describes how an artifact was built—we create a paper trail that security tools can automatically verify. This lesson explores the mechanics of SLSA, how to implement it, and how to ensure your build pipelines are compliant with these industry-recognized standards.
Not read yet
Understanding the SLSA Framework
The SLSA framework is structured as a set of levels, ranging from 1 to 4, which represent increasing levels of security assurance. Each level defines specific requirements for how artifacts are produced and tracked. The primary goal is to ensure that the final artifact is traceable back to its source, and that the build process itself was executed in a secure, repeatable, and verifiable environment.
The Four Levels of SLSA
- SLSA Level 1: This level focuses on documentation. The build process is documented, and the artifact is accompanied by a provenance file. It is the entry point for organizations starting their supply chain security journey.
- SLSA Level 2: This level introduces the requirement for a hosted build platform. The build process must be automated, and the provenance must be signed by the build service, making it difficult to forge the origin of the artifact.
- SLSA Level 3: This level addresses the security of the build platform itself. It requires a non-falsifiable provenance, meaning the build environment must be isolated, and the build instructions must be clearly defined in a way that prevents an attacker from injecting unauthorized steps.
- SLSA Level 4: This is the highest level, requiring two-person reviews for all changes and a high degree of hermetic, reproducible builds. It is designed for the most critical systems where the threat model includes highly sophisticated adversaries.
Callout: Provenance vs. Attestation It is common to confuse these terms, but they have distinct meanings. An attestation is a generic, signed statement about an artifact, which could include vulnerability scan results, quality reports, or build information. Provenance is a specific type of attestation that details the origin of an artifact: who built it, what source code was used, what dependencies were included, and what build steps were executed. Think of an attestation as the "envelope" and provenance as the specific "document" inside.
Not read yet
Core Components of Artifact Attestations
To implement SLSA, you need to understand the technical components that make up an attestation. An attestation is essentially a piece of metadata that is cryptographically signed. If a consumer (such as a Kubernetes cluster or a deployment script) receives an artifact, it needs to verify the signature against a trusted public key and then parse the content to ensure it meets policy requirements.
The In-toto Layout
The industry standard for defining these attestations is the in-toto framework. in-toto allows you to define a "layout" for your supply chain, which includes:
- Steps: Each step in your build process is a "link" in the chain.
- Materials: These are the inputs to the process (e.g., source code, configuration files).
- Products: These are the outputs of the process (e.g., binary files, container images).
- Signatures: Cryptographic proof that the step was performed by an authorized entity or service.
By using in-toto metadata, you ensure that every part of your build pipeline is accounted for. If a malicious actor tries to swap a binary mid-build, the in-toto link for that step will fail to match the expected hash of the final product, triggering an alert or a deployment block.
Not read yet
Step-by-Step: Implementing SLSA Level 2
To achieve SLSA Level 2, you need an automated build platform that generates provenance. GitHub Actions is a common choice for this, as it supports OIDC (OpenID Connect) for secure identity and integrates well with tools like slsa-github-generator.
Step 1: Prepare Your Workflow
You must ensure your build workflow is defined in a YAML file. Your workflow should be triggered by a specific event (like a tag or a push to main) to ensure consistency.
Step 2: Integrate the Provenance Generator
Instead of just building your artifact, you will use a dedicated action to generate the provenance.
# Example GitHub Actions Workflow for SLSA Provenance
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for OIDC identity
contents: read
steps:
- uses: actions/checkout@v4
- name: Build and generate provenance
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1
with:
base64-subjects: "${{ needs.build.outputs.digest }}"
upload-assets: true
Step 3: Explanation of the Code
id-token: write: This permission is crucial. It allows the GitHub Action to request a short-lived OIDC token. This token acts as a cryptographic proof of the workflow's identity, which is then used to sign the provenance.base64-subjects: This is the hash (SHA-256) of your final artifact. You must calculate this hash before calling the generator so the provenance explicitly links to the exact bytes of your build output.generator_generic_slsa3.yml: This is a pre-built template provided by the SLSA project. It handles the heavy lifting of signing the metadata and ensuring it follows the required format.
Note: Always use specific version tags for your actions (e.g.,
@v1or@v0.4.0) rather than@main. Using@mainis a security risk because the action could be updated with malicious code without your knowledge.
Not read yet
Verifying Attestations: The Consumer Side
Generating attestations is only half the battle. If you don't verify them, you aren't actually gaining any security. Verification ensures that the artifact you are about to run matches the provenance you received.
Using Cosign for Verification
Cosign, part of the Sigstore project, is the industry standard for signing and verifying container images and other artifacts. It simplifies the process of checking if an image has a valid attestation.
To verify an image, you can use the following command:
cosign verify-attestation \
--type slsa \
--certificate-identity "https://github.com/my-org/my-repo/.github/workflows/build.yml@refs/heads/main" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
my-registry/my-image:latest
Breaking Down the Verification Command
--type slsa: Tells Cosign to look specifically for SLSA-compliant provenance data.--certificate-identity: This is the "identity" of the build. It confirms that the image was built by the specific workflow file in your repository. If an attacker tries to build the image from a different, unauthorized workflow, this check will fail.--certificate-oidc-issuer: This is the trust root, ensuring the OIDC token was issued by the legitimate GitHub Actions service.
Tip: If you are using Kubernetes, consider using an Admission Controller like Kyverno or Policy Controller. These tools can automatically run the
cosign verifycommand before allowing a pod to be scheduled. This ensures that no unverified or tampered images can ever reach your production cluster.
Not read yet
Best Practices for SLSA Compliance
Achieving SLSA compliance is not a "set it and forget it" task. It requires a cultural shift toward treating your build pipeline as part of your production infrastructure. Here are the best practices to follow:
1. Build in Isolation
The goal of SLSA is to prevent "tampering." If your build process has access to secrets, network resources, or shared filesystems that it doesn't need, an attacker can exploit those channels to inject malicious code. Use ephemeral build environments that are destroyed immediately after the build completes.
2. Use Immutable Dependencies
Always pin your dependencies by their hash, not just their version number. If you use npm install without a lockfile, you are vulnerable to dependency confusion attacks. By pinning hashes, you guarantee that the code you build today is identical to the code you build tomorrow.
3. Minimize Human Intervention
Human-in-the-loop steps are often the weakest link in the supply chain. If a human has to manually sign a release or push a binary, that step is prone to social engineering or credential theft. Automate the signing process so that it is triggered strictly by the CI/CD system.
4. Regularly Audit Provenance
Just because you have provenance doesn't mean it's correct. Regularly audit your build logs to ensure that the provenance generated matches the actual steps performed. If your build pipeline adds a new step, ensure that the provenance generator is updated to reflect that change.
5. Establish a "Root of Trust"
Ensure that your organization has a clear policy on which build systems are trusted. If you allow developers to build artifacts on their local laptops and push them to your registry, you are effectively opting out of SLSA. Enforce a policy where only the CI/CD pipeline is allowed to push images to your production registry.
Not read yet
Common Pitfalls and How to Avoid Them
Even with the best intentions, teams often fall into traps when implementing SLSA. Awareness of these pitfalls is the first step toward a more secure pipeline.
Pitfall 1: Trusting the "Builder" without Verification
Many teams implement provenance generation but never actually verify it in their production environments. Generating metadata is useless if no one checks it.
- Solution: Implement automated verification in your CD pipeline. If the verification fails, the deployment should automatically fail, and an alert should be sent to the security team.
Pitfall 2: Over-reliance on "Long-Lived" Credentials
Storing long-lived signing keys in your repository or build platform is dangerous. If those keys are leaked, an attacker can forge attestations for malicious code.
- Solution: Use Keyless Signing (Sigstore/Cosign). Keyless signing uses OIDC tokens to verify the identity of the builder, eliminating the need for long-lived private keys.
Pitfall 3: Ignoring Transitive Dependencies
You might secure your own code, but if your dependencies are compromised, your artifact is still insecure.
- Solution: Combine SLSA with Software Bill of Materials (SBOM) generation. Tools like
syftortrivycan generate an SBOM, which you can then attach as an attestation alongside your SLSA provenance.
Not read yet
Comparison Table: Standard Security vs. SLSA Compliance
| Feature | Standard CI/CD | SLSA-Compliant CI/CD |
|---|---|---|
| Trust Model | Trust the build machine | Trust the cryptographic proof |
| Integrity | Based on manual checks | Based on verifiable provenance |
| Build History | Often opaque or missing | Fully traceable and immutable |
| Key Management | High risk (long-lived keys) | Low risk (keyless/OIDC) |
| Verification | None or manual | Automated at deployment time |
Advanced Topics: Hermetic Builds
As you advance toward SLSA Level 4, you will encounter the concept of "hermetic builds." A hermetic build is one that is entirely self-contained. It does not access the network, nor does it rely on external timestamps or non-deterministic inputs.
Why is this important? Because if a build process accesses the network to download a package, it might pull a different version of that package at different times. If the build process relies on the current system time, it might produce different binaries even from the same source code. Hermetic builds ensure that if you run the build ten times, you get the exact same binary (bit-for-bit) every single time. This is called "reproducible builds."
To achieve this:
- Vendor all dependencies: Download all your dependencies into your source repository or a private, local cache.
- Disable network access: Configure your build environment to block all outbound network traffic during the build phase.
- Standardize the environment: Use the same container image for every build execution to ensure identical compiler versions, environment variables, and system libraries.
Not read yet
Handling Multi-Stage Build Pipelines
In complex organizations, a single artifact might pass through multiple stages:
- Build Stage: Compiles the source code into a binary.
- Package Stage: Wraps the binary into a container image.
- Scan Stage: Performs vulnerability analysis.
Each of these stages should generate its own attestation. When the final artifact is ready for deployment, the deployment controller should verify the "chain of custody." It checks that the binary was built by the build stage, packaged by the package stage, and scanned by the scan stage.
If any link is missing, the attestation chain is broken, and the deployment is denied. This is the ultimate goal of SLSA: a complete, unbroken chain of evidence from the first line of code to the running container.
Integrating with Security Operations (SecOps)
SLSA is not just for developers; it is a vital tool for SecOps teams. When a vulnerability is discovered (e.g., a new CVE in a common library), SecOps teams need to know exactly which artifacts contain that library.
With SLSA and SBOMs, you can query your entire production fleet. Instead of scanning every running container, you can query your attestation database: "Show me all artifacts that include version 1.2.3 of this library." Because the attestations are signed and verifiable, you can trust the results of this query implicitly. This drastically reduces the time to respond to incidents and improves your overall security posture.
Not read yet
Troubleshooting Common Issues
"Verification Failed: Signature Mismatch"
This usually happens because the artifact has been modified after it was signed. Check if any post-build steps (like adding a configuration file or changing file permissions) are occurring after the signature is applied. Always sign as the very last step of your build process.
"Provenance Not Found"
This means the artifact was built, but the attestation was either not generated or not uploaded to the OIDC-backed registry. Verify your CI/CD configuration to ensure the slsa-github-generator step is actually running and that it has the correct permissions to write to your container registry.
"OIDC Token Expired"
This occurs when the build process takes too long, or the OIDC token request is delayed. Ensure that your build environment has reliable network access to the OIDC provider (e.g., GitHub's OIDC server) and that your build steps are optimized for speed.
Not read yet
Practical Checklist for Implementation
If you are just starting, follow this checklist to ensure you don't miss the basics:
- Inventory your build pipelines: List all the ways code becomes a deployable artifact.
- Standardize on one CI/CD platform: It is much easier to secure one platform than five.
- Enable OIDC for your CI/CD: Move away from static credentials immediately.
- Start at SLSA Level 1: Focus on documenting your current process and generating metadata.
- Integrate one verification step: Start by verifying the provenance of your most critical service.
- Automate the policy: Don't let humans decide what is "secure enough"—let your admission controller decide.
- Scale to other services: Once you have a working model, apply it to the rest of your organization.
Conclusion and Key Takeaways
The SLSA framework is a powerful tool for bringing accountability and security to the software supply chain. By moving from a model of "implicit trust" to "verifiable provenance," you can protect your organization from a wide range of supply chain attacks, including dependency tampering, build-time injection, and unauthorized artifact deployment.
Key Takeaways:
- Provenance is Essential: Provenance provides the "who, what, when, and how" of your software artifacts. Without it, you are effectively flying blind.
- Automation is a Requirement: SLSA is impossible to maintain manually. Use automated tools like GitHub Actions and
slsa-github-generatorto ensure that every build produces verifiable metadata. - Verification is the Goal: Generating attestations is only the first step. You must implement automated verification in your CD pipeline or Kubernetes cluster to ensure the integrity of your production environment.
- Keyless Signing is Best Practice: Avoid the management nightmare of long-lived signing keys. Use OIDC-based identity systems to sign your attestations securely.
- Start Small, Build Up: You do not need to reach SLSA Level 4 on day one. Start at Level 1, focus on documenting your process, and incrementally improve your security posture over time.
- Treat Your Pipeline as Infrastructure: Your CI/CD pipeline is a high-value target. Secure it with the same rigor you apply to your production database or internal network.
- Culture Matters: Educate your team on the importance of supply chain security. When developers understand that SLSA helps them ship code faster and more safely, they will become your best allies in maintaining compliance.
By adopting these practices, you are not just checking a box for compliance; you are building a more resilient, transparent, and secure development process. The landscape of software security is constantly evolving, and by mastering SLSA, you are positioning yourself to stay ahead of threats while maintaining the agility your organization needs to succeed.
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