Supply Chain Attestations

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 8 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Supply Chain Attestations: Securing the Software Lifecycle

Introduction: Why Supply Chain Security Matters

In modern software development, we rarely build applications from scratch. Instead, we assemble them like complex machines, pulling in thousands of lines of third-party code, open-source libraries, and pre-built container images. While this approach significantly boosts productivity, it introduces a massive attack surface. If an attacker compromises a dependency or injects malicious code during the build process, that vulnerability travels all the way to your production environment. Supply chain security is the practice of ensuring that the software you deploy is exactly what you intended it to be, and that it hasn't been tampered with along its journey from source code to the final runtime artifact.

Supply chain attestations are the foundational mechanism for establishing this trust. An attestation is essentially a verifiable statement made by a trusted party about a software artifact. It acts like a digital "certificate of origin" or a "quality inspection report" that follows the software through its lifecycle. By using attestations, you can prove that a specific container image was built using a specific commit, that it passed security scans, and that it was produced on a hardened, authorized build system. Without these attestations, you are essentially flying blind, trusting that the software you run is safe without any cryptographic proof to back up that assumption.

This lesson will guide you through the conceptual framework of attestations, the tools required to implement them, and the best practices for integrating them into your existing CI/CD pipelines. We will move beyond simple dependency scanning and look at how to create a chain of custody that makes your software environment defensible against modern supply chain threats.


Not read yet

Understanding the Core Components of Attestations

To understand attestations, you must first understand the relationship between artifacts, signatures, and metadata. An artifact is the tangible output of your build process—a binary, a JAR file, or a container image. A signature provides proof of identity, confirming that the artifact was created by a specific entity. An attestation, however, is a layer above the signature; it is a structured document (often in JSON format) that contains specific claims about the artifact, which is then digitally signed.

The Anatomy of an Attestation

An attestation typically follows a standard format, such as the in-toto predicate specification. It includes several key fields:

  • Subject: The unique identifier (usually a digest or hash) of the artifact being discussed.
  • Predicate Type: Defines the schema of the statement being made (e.g., "this image passed a vulnerability scan" or "this image was built from this specific git repository").
  • Predicate Content: The actual data, such as the list of vulnerabilities found or the build environment details.
  • Signature: A cryptographic signature generated by the build system or security scanner that guarantees the attestation has not been modified.

Callout: Attestations vs. Signatures A signature tells you who created the artifact. An attestation tells you what is true about that artifact. You can have a perfectly valid signature on a malicious piece of code. Attestations provide the necessary context—such as "this code was built on a secure CI runner"—that allows you to make an informed decision about whether to trust that signature.

The Role of Metadata in Supply Chain Security

Metadata is the backbone of supply chain visibility. When you build an application, you generate a Software Bill of Materials (SBOM). An SBOM lists every component inside your software. An attestation, by contrast, provides a statement about that SBOM or the process used to generate it. By combining SBOMs and attestations, you create a verifiable record that allows security teams to query the state of their entire fleet. For example, if a new zero-day vulnerability is discovered, you can use your attestation records to immediately identify which images were built before the patch was applied, rather than manually checking every single repository.


Not read yet

Practical Implementation: Generating and Verifying Attestations

To implement attestations, we rely on tools that integrate with existing CI/CD workflows. The most prominent ecosystem in this space is the Sigstore project, which includes tools like cosign. cosign allows you to sign container images and attach attestations directly to them in a container registry.

Step 1: Setting Up Your Signing Key

Before you can create attestations, you need a way to sign them. While you can use traditional PKI (Public Key Infrastructure) with private keys, many modern teams use keyless signing, which leverages OIDC (OpenID Connect) tokens from your CI provider (like GitHub Actions or GitLab CI) to establish identity without managing long-lived secrets.

If you are using a local environment for testing, you can generate a key pair:

# Generate a key pair
cosign generate-key-pair

This will produce a cosign.pub (public key) and a cosign.key (private key). Keep the private key secure, as it is the only way to generate attestations that your organization will trust.

Step 2: Creating an Attestation

Let's say you have performed a vulnerability scan on a container image and want to attach the results as an attestation. You first need a JSON file containing the scan results.

{
  "vulnerability_scan_tool": "trivy",
  "scan_status": "pass",
  "vulnerabilities_found": 0,
  "timestamp": "2023-10-27T10:00:00Z"
}

Now, you use cosign to attach this file to your container image:

cosign attest --key cosign.key --predicate scan-results.json --type vuln my-registry.com/my-app:latest

Step 3: Verifying the Attestation

Verifying is just as important as creating. Before deploying a container, your production environment should check that the required attestations exist and are valid.

cosign verify-attestation --key cosign.pub --type vuln my-registry.com/my-app:latest

If the command succeeds, it returns the signed payload. If the signature is invalid, or if the attestation is missing, the command will fail, and your deployment pipeline should be configured to stop the rollout immediately.


Not read yet

The Workflow: Integrating Attestations into CI/CD

A robust supply chain security strategy requires that attestations be generated automatically. Manual processes are prone to human error and are easily bypassed. Your CI pipeline should be the only entity authorized to generate these attestations for production artifacts.

Standard CI Pipeline Workflow

  1. Build Phase: The CI runner builds the container image and generates an SBOM.
  2. Scan Phase: A security tool (like Trivy or Grype) scans the image and outputs a results file.
  3. Attestation Phase: The CI runner signs the SBOM and the scan results, pushing them as attestations to the registry alongside the image.
  4. Admission Control: In the Kubernetes cluster, an admission controller (like Kyverno or Policy Controller) intercepts deployment requests. It verifies the attestations before allowing the image to pull.

Note: The Importance of Admission Control Generating attestations is useless if you do not enforce them. An admission controller acts as the final gatekeeper. By configuring it to require a "provenance" attestation and a "vulnerability scan" attestation, you ensure that no unverified code can ever run in your production cluster.

Handling Common Pitfalls

One common mistake is relying on attestations that are too broad. For instance, creating an attestation that says "this image passed a scan" is helpful, but it is better to include the specific tool version and the policy used for the scan. If the scanner tool itself is compromised or updated, you need to know exactly which version made the claim.

Another pitfall is key management. Storing signing keys in plain text inside your CI configuration is a major security risk. Always use secret management systems (like HashiCorp Vault, AWS Secrets Manager, or GitHub Secrets) to inject keys into your build environment at runtime. Even better, adopt keyless signing to remove the burden of key management entirely.


Not read yet

Comparison of Attestation Types

When designing your security policy, consider the different types of attestations you might require.

Attestation Type Purpose Key Benefit
Provenance Proves where and how the software was built. Prevents "shadow builds" from unauthorized machines.
SBOM Lists the contents of the software. Enables rapid response to new vulnerabilities (CVEs).
Vulnerability Records scan results at build time. Ensures no known high-risk flaws are deployed.
QA/Test Records that integration tests passed. Ensures functional integrity of the release.

By requiring a combination of these, you create a "defense in depth" strategy. Even if an attacker manages to bypass one check, they must still forge multiple, independent attestations to get their malicious code into your production environment.


Advanced Topic: Policy as Code

Once you start generating attestations, you will quickly realize that managing them manually becomes impossible. This is where "Policy as Code" enters the picture. Instead of checking attestations by hand, you define rules in a language like Rego (used by Open Policy Agent/OPA).

A policy might state: "Only allow images that have a signed provenance attestation from the authorized CI platform AND a vulnerability scan attestation with zero critical vulnerabilities."

Example OPA Policy Snippet

package admission

default allow = false

# Allow if the image has a valid signature and scan attestation
allow {
    input.attestations.vulnerability_scan.status == "pass"
    input.attestations.provenance.verified == true
}

This approach allows you to scale security across hundreds of microservices. If your security requirements change, you update the policy file in a central repository, and the change is automatically applied to all clusters.


Not read yet

Best Practices for a Secure Supply Chain

To build a truly resilient system, you must treat your supply chain as a critical part of your infrastructure. Follow these industry-standard guidelines to ensure your attestations provide actual security value rather than just "compliance theater."

1. Automate Everything

Never allow manual creation of attestations. If a human can sign an attestation, the process is vulnerable to social engineering. Ensure that only automated CI runners have the permissions to push signatures and attestations to your registry.

2. Use Short-Lived Credentials

If you are not using keyless signing, rotate your signing keys frequently. If a key is compromised, a short expiration window limits the damage an attacker can do. Keyless signing, which uses temporary OIDC tokens, is the current gold standard for minimizing this risk.

3. Build Reproducibility

Strive for reproducible builds, where the same source code always results in the exact same binary hash. This makes verifying provenance much easier, as you can re-run the build to confirm that the attestation is accurate.

4. Monitor and Audit

Treat your registry’s metadata as a log source. Audit who is signing what and when. If you see an unexpected signing event from a user account or a build runner that should not have access, investigate immediately.

5. Define Clear Policies

Do not collect data you do not intend to use. If you generate a vulnerability scan attestation but do not have an admission controller configured to block failing scans, you are wasting resources. Start with one required attestation type and expand as your maturity grows.


Not read yet

Common Questions (FAQ)

Q: What happens if the registry is compromised?

A: Even if an attacker gains access to your registry, they cannot forge your attestations because they do not have your private signing keys (or the ability to request a valid OIDC token). Your admission controller will reject any artifacts that do not have a valid, cryptographically signed attestation, effectively neutralizing the compromised registry.

Q: Do attestations slow down my build pipeline?

A: The overhead of signing an attestation is negligible—usually a few milliseconds. The primary bottleneck is the scanning process itself, which you should be doing anyway. Attestations are a lightweight way to wrap that data for later verification.

Q: Can I use attestations for non-container artifacts?

A: Yes. While cosign is famous for containers, the concepts apply to any file. You can sign binaries, ZIP files, or even configuration manifests. The in-toto framework is designed to be language and format-agnostic.

Q: How do I handle third-party base images?

A: This is a classic supply chain problem. You should "re-sign" or "re-attest" third-party images in your own private registry. After pulling a public image, scan it yourself, generate your own attestation, and then allow your internal systems to use your version of that image.


Not read yet

Summary and Key Takeaways

Supply chain security is no longer an optional component of software development; it is a fundamental requirement for any organization that takes its production environment seriously. By implementing attestations, you move away from a model of "blind trust" in your build system and toward a model of "cryptographic verification."

Key Takeaways:

  • Attestations are verifiable claims: They provide context and proof about software artifacts, going beyond simple identity signatures.
  • Automation is mandatory: Use CI/CD pipelines to generate and attach attestations automatically; manual processes are insufficient for modern security needs.
  • Verification is the goal: Generating an attestation is only half the battle. You must use admission controllers to enforce these attestations at the point of deployment.
  • Shift toward keyless signing: Utilize OIDC-based identity providers to avoid the risks associated with long-lived private keys.
  • Policy as Code: Use tools like OPA to define and enforce security requirements consistently across your entire infrastructure.
  • Defense in Depth: Combine multiple attestation types—such as SBOMs, vulnerability scans, and provenance records—to create a multi-layered security posture.
  • Auditability: Treat your attestation records as a source of truth for compliance and incident response, allowing you to react instantly when a new threat is discovered.

By following these principles and integrating these tools into your workflow, you create a software supply chain that is not only faster and more efficient but also significantly more resistant to tampering and unauthorized intervention. Start small by signing your container images, then move toward full policy enforcement, and you will find your organization much better prepared for the evolving threat landscape.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.