TExcelTAD

SLSA v1.0 Build Levels

SLSA (Supply-chain Levels for Software Artifacts) is an OpenSSF framework that turns "is our build trustworthy?" into a ladder of concrete, checkable requirements. Version 1.0 (April 2023) focuses on one track, Build, with four levels; the specification has since grown with clarifications and a separate Source track for source-control requirements. Each Build level makes one more class of attack from the threat model impractical.

The Build track

Level Name Requirements (simplified) Stops
Build L0 none nothing nothing
Build L1 Provenance exists a consistent, scripted build process; the build produces provenance describing how the artifact was built; provenance is distributed to consumers mistakes; gives you an inventory of how things were built. Provenance may be unsigned and could be forged
Build L2 Hosted build platform the build runs on a hosted platform (not a developer laptop), and the platform itself generates and signs the provenance tampering after the build; forged provenance (consumers verify the platform's signature)
Build L3 Hardened builds the platform isolates builds from one another, and the provenance signing material is inaccessible to user-defined build steps a compromised or malicious build step forging provenance or poisoning other builds

Two consequences that people miss:

  • The levels are about the build platform and its provenance, not about your code's quality. A Build L3 artifact can be full of vulnerabilities.
  • The jump from L2 to L3 is mostly the platform's job. GitHub-hosted runners with reusable workflows that sign provenance outside the user's steps (the design of slsa-github-generator), or Google Cloud Build, are built to meet L3; your part is to use them correctly and to verify the result.

SLSA v0.1 had an L4 (two-person review, hermetic and reproducible builds). Version 1.0 dropped it in favour of separate tracks; reproducibility and hermeticity remain good practices (Reproducible Builds) but are not Build-level requirements.

Producer, platform, consumer

SLSA assigns requirements to three parties:

Party Must
Producer (you, publishing software) choose a build platform that meets the level; build consistently; distribute the provenance
Build platform (GitHub Actions, GitLab CI, Cloud Build, …) generate complete, authentic provenance; isolate builds; protect signing keys
Consumer / verifier (you, deploying software) verify provenance: signature, builder identity, source repository, and that the subject digest matches the artifact

The last row is the one that's often skipped. Provenance nobody verifies is documentation.

A model: what level does a build reach?

The model checks a few facts about a build against the Build-track requirements and reports the highest level met. Real assessments are done against the platform's documentation (SLSA publishes guidance for build platforms), but the logic is the same: each level includes all lower ones.

python · try it yourself
REQUIREMENTS = [
    ("Build L1", ["scripted_build", "provenance_generated", "provenance_distributed"]),
    ("Build L2", ["hosted_platform", "provenance_signed_by_platform"]),
    ("Build L3", ["isolated_builds", "signing_key_unreachable_from_steps"]),
]

def level(facts):
    reached, missing = "Build L0", []
    for name, needs in REQUIREMENTS:
        missing = [n for n in needs if not facts.get(n)]
        if missing:
            return reached, f"{name} needs: {', '.join(missing)}"
        reached = name
    return reached, "top of the Build track"

builds = {
    "make on a laptop, no provenance": {"scripted_build": True},
    "laptop build + hand-written provenance": {"scripted_build": True, "provenance_generated": True,
                                               "provenance_distributed": True},
    "CI job signs provenance with a repo secret": {"scripted_build": True, "provenance_generated": True,
                                                   "provenance_distributed": True, "hosted_platform": True},
    "hosted runner, platform-signed provenance": {"scripted_build": True, "provenance_generated": True,
                                                  "provenance_distributed": True, "hosted_platform": True,
                                                  "provenance_signed_by_platform": True},
    "isolated reusable workflow signs it": {"scripted_build": True, "provenance_generated": True,
                                            "provenance_distributed": True, "hosted_platform": True,
                                            "provenance_signed_by_platform": True, "isolated_builds": True,
                                            "signing_key_unreachable_from_steps": True},
}
for name, facts in builds.items():
    got, note = level(facts)
    print(f"{name:44} {got}  ({note})")
make on a laptop, no provenance              Build L0  (Build L1 needs: provenance_generated, provenance_distributed)
laptop build + hand-written provenance       Build L1  (Build L2 needs: hosted_platform, provenance_signed_by_platform)
CI job signs provenance with a repo secret   Build L1  (Build L2 needs: provenance_signed_by_platform)
hosted runner, platform-signed provenance    Build L2  (Build L3 needs: isolated_builds, signing_key_unreachable_from_steps)
isolated reusable workflow signs it          Build L3  (top of the Build track)

Look at the third build: a CI job that signs provenance with a key stored as a repository secret is not L2, because the user's own build steps hold the signing key, so a malicious step could sign false provenance. The platform must do the signing.

Where to start

You have Do first
builds on laptops move releases to CI (a prerequisite for L2 anyway)
CI builds, no provenance generate provenance in CI (L1); GitHub artifact attestations or slsa-github-generator do it in a few lines (next lessons)
provenance nobody checks verify it at deploy time: policy on builder and source (Admission Control)
verified L3 provenance apply the same to your dependencies: prefer ones that publish provenance (npm, PyPI and many container images now do)

Test yourself

What distinguishes SLSA Build L2 from L1?

  1. Two-person code review
  2. A hosted build platform that generates and signs the provenance itself
  3. Reproducible builds
  4. An SBOM

A CI workflow signs its provenance with a private key stored as a repository secret. Why isn't that Build L3?

  1. Secrets are encrypted
  2. User-defined build steps can access the signing key, so a malicious step could forge provenance
  3. It is L3
  4. L3 needs Bazel

Which SLSA party is responsible for checking the builder identity in provenance?

  1. The build platform
  2. The producer
  3. The consumer / verifier
  4. Nobody; the signature is enough