TExcelTAD
Home › Software Supply Chain Security: SBOM, SLSA & Sigstore › Toolkit: cosign, in-toto, GUAC & Chainguard Images

Toolkit: cosign, in-toto, GUAC & Chainguard Images

The second toolkit lesson covers the tools that establish trust: signing and verifying, describing a whole pipeline, storing and querying supply-chain metadata at scale, and starting from base images that already ship all of it.

The Sigstore family

Tool Role
cosign sign, attest and verify images and blobs; key pairs, KMS or keyless
Fulcio the certificate authority for keyless signing (OIDC identity → 10-minute certificate)
Rekor the transparency log; rekor-cli search --email …, rekor-monitor to watch your identities
policy-controller Kubernetes admission for cosign signatures and attestations
gitsign keyless signing of Git commits and tags
sigstore-python, sigstore-js, sigstore-java, sigstore-go libraries used by pip/PyPI, npm, Maven tooling and others

A cosign command summary, all exercised in this course:

Task Command
key pair cosign generate-key-pair [--kms …]
sign an image cosign sign --key k IMG@sha256:… (keyless: no --key)
verify cosign verify --key k.pub IMG / --certificate-identity … --certificate-oidc-issuer …
attest cosign attest --type <type or URI> --predicate f IMG (types: cyclonedx, spdxjson, slsaprovenance1, openvex, …)
verify attestation + policy cosign verify-attestation --type … [--policy p.cue] IMG (CUE or Rego)
files cosign sign-blob --bundle f.sigstore.json f, cosign verify-blob --bundle …
inspect cosign tree IMG, cosign download attestation IMG

Notation (the other image-signing standard)

Notary Project / Notation (CNCF) signs OCI artifacts with X.509 certificates from your own PKI, stores signatures as OCI referrers, and verifies against a trust policy file. Teams with an existing enterprise PKI and no wish to publish identities in a public log often prefer it; cloud registries (Azure, AWS Signer) integrate with it. Ratify verifies both cosign and Notation signatures at admission.

in-toto: the whole pipeline, not just the last step

Before in-toto attestations became the standard envelope for SLSA, in-toto's original idea was bigger: a project owner signs a layout listing every step of the supply chain (checkout, build, test, package), who may perform each step (their keys), and how the steps' materials (inputs) and products (outputs) must connect. Each step records a signed link with hashes of its materials and products. Verification checks that every step ran, by an authorised functionary, and that nothing changed between steps.

python · try it yourself
import hashlib

h = lambda b: hashlib.sha256(b).hexdigest()[:12]

layout = {   # signed by the project owner
    "steps": [
        {"name": "checkout", "functionaries": {"ci-key"}},
        {"name": "build",    "functionaries": {"ci-key"}, "materials_from": "checkout"},
        {"name": "package",  "functionaries": {"release-key"}, "materials_from": "build"},
    ]
}

def run_pipeline(tamper=False, wrong_signer=False):
    src = {"main.c": h(b"int main(){}")}
    binary = {"app": h(b"compiled app")}
    built_in_package = {"app": h(b"compiled app" + (b" + backdoor" if tamper else b""))}
    return {   # links: signed records of each step
        "checkout": {"signer": "ci-key", "materials": {}, "products": src},
        "build":    {"signer": "ci-key", "materials": src, "products": binary},
        "package":  {"signer": "attacker-key" if wrong_signer else "release-key",
                     "materials": built_in_package, "products": {"app.tar": h(b"tarball")}},
    }

def verify(layout, links):
    for step in layout["steps"]:
        link = links.get(step["name"])
        if link is None:
            return f"FAIL: no link for step {step['name']}"
        if link["signer"] not in step["functionaries"]:
            return f"FAIL: step {step['name']} signed by {link['signer']}"
        before = step.get("materials_from")
        if before and link["materials"] != links[before]["products"]:
            return f"FAIL: {step['name']} consumed something {before} did not produce"
    return "PASS: every step ran, by the right functionary, on the previous step's output"

print("honest pipeline: ", verify(layout, run_pipeline()))
print("binary swapped:  ", verify(layout, run_pipeline(tamper=True)))
print("wrong packager:  ", verify(layout, run_pipeline(wrong_signer=True)))
honest pipeline:  PASS: every step ran, by the right functionary, on the previous step's output
binary swapped:   FAIL: package consumed something build did not produce
wrong packager:   FAIL: step package signed by attacker-key

The "binary swapped" case is SolarWinds-shaped: something changed the artifact between steps, and the hash chain exposes it. The real tools are in-toto-run (record a link while running a command), in-toto-record, and in-toto-verify against a layout; the Python and Go implementations are maintained by the in-toto project (CNCF). In practice most teams now get the attestation half of in-toto through SLSA provenance and adopt layouts (or their successor, in-toto policies / witness from TestifySec) when they need multi-step guarantees.

bash
in-toto-run --step-name build --key ci.key \
  --materials src/ --products dist/app -- make dist
in-toto-verify --layout root.layout --verification-keys owner.pub

GUAC: querying the metadata

Generating SBOMs, provenance and scan results for every build creates thousands of documents. GUAC (Graph for Understanding Artifact Composition, an OpenSSF project) ingests them (SPDX, CycloneDX, SLSA, in-toto, OpenVEX, OSV data, Scorecard results, deps.dev) into a graph database and answers questions across all of them through a GraphQL API and CLI:

  • Which of our deployed images contain log4j-core < 2.17.1, and which of those have no VEX saying "not affected"?
  • What's the blast radius if xz-utils 5.6.1 turns out malicious: which artifacts depend on it, directly or transitively?
  • Which artifacts have no provenance, or provenance from an unexpected builder?

GUAC is the "SBOMs are only useful if stored and queried" principle turned into infrastructure; Dependency-Track (OWASP) is a popular alternative focused on SBOM portfolios and policy.

Chainguard Images (and other hardened bases)

The cheapest vulnerability is the one you don't ship. Chainguard Images are minimal container images built from source on Wolfi, Chainguard's "undistro", and rebuilt continuously so that known vulnerabilities are fixed quickly; many have zero known CVEs at any given time. Each image is signed keylessly with cosign and carries SBOM and SLSA provenance attestations, so everything in this course can be verified on them. Public images live at cgr.dev/chainguard/<name>; the free tier offers recent tags, with versioned tags and long-term support as paid products.

bash
# the identity is Chainguard's release workflow; check their documentation for the current value
cosign verify cgr.dev/chainguard/static:latest \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  --certificate-identity-regexp '^https://github\.com/chainguard-images/'
cosign download attestation --predicate-type https://spdx.dev/Document cgr.dev/chainguard/static:latest

Alternatives with similar goals: Google's distroless images, Docker Hardened Images, Red Hat UBI micro, minimal Alpine. Whichever you choose, verify its signature and pin its digest, then let your update bot follow its frequent rebuilds.

Test yourself

In in-toto, what does a layout define?

  1. The image's file system
  2. The steps of the supply chain, who may perform each, and how their inputs and outputs must connect
  3. A vulnerability database
  4. A Kubernetes policy

What problem does GUAC address?

  1. Signing images
  2. Querying large numbers of SBOMs, attestations and vulnerability data together as a graph
  3. Building images
  4. Replacing Rekor

Why do minimal, frequently rebuilt base images (Chainguard, distroless) reduce vulnerability findings?

  1. Scanners skip them
  2. Fewer packages means fewer vulnerable components, and fast rebuilds pick up fixes quickly
  3. They disable CVE matching
  4. They are signed