All guides

SLSA build levels: what each one asks of a pipeline

SLSA version 1.2 has a Build track with levels L0 to L3. Each level adds requirements, from provenance that exists to a hardened build platform. GitHub documents which levels its artifact attestations reach.

A laptop showing a stylesheet in a code editor

The current specification

SLSA stands for Supply-chain Levels for Software Artifacts. The specification at slsa.dev is version 1.2, with the status Approved. It defines levels and tracks. The Build track has four levels, L0 to L3. The changes that version 1.2 lists since version 1.1 are the new Source track, an updated threat model and a structure that accommodates several tracks.

The specification notes that an earlier version used a single unnamed track, SLSA 1 to 4, and that version 1.0 removed the source aspects to focus on the Build track.

What each level requires

  • Build L0: no guarantees. There are no requirements. L0 means SLSA is absent.
  • Build L1: provenance exists. The build platform automatically generates provenance: who built the package, which build process ran and what the top-level inputs were. The producer follows a consistent build process and distributes the provenance. It may be unsigned, and the specification calls it trivial to bypass or forge. It catches mistakes, such as a release built from a commit that is missing upstream.
  • Build L2: hosted build platform. Builds run on a hosted platform, never on a workstation, and the platform itself generates and signs the provenance. Consumers validate that signature. This prevents tampering after the build.
  • Build L3: hardened builds. The platform keeps runs from influencing one another, even inside one project, and keeps the signing secret out of reach of the build steps a user defines. Each build gets a fresh environment, and one build cannot poison a cache that another build reads. This prevents tampering during the build.

Each level includes the one below it.

Producer and platform duties

The specification splits the requirements between two parties.

The producer has the same three duties at L1, L2 and L3: choose a build platform that can reach the level, follow a consistent build process, and distribute provenance to consumers.

The build platform is responsible for two things: provenance generation and isolation between builds. Provenance must exist at L1, be authentic at L2 and be unforgeable at L3. Isolation must be hosted at L2 and isolated at L3.

The producer must choose a platform capable of the desired level and implement any controls that platform specifies.

Provenance

Provenance is an attestation that a build platform produced a set of artifacts by running a build definition. The recommended format is the SLSA Provenance predicate, type https://slsa.dev/provenance/v1, within the in-toto attestation framework. This is the schema summary from the specification:

Text

{
    "_type": "https://in-toto.io/Statement/v1",
    "subject": [...],
    "predicateType": "https://slsa.dev/provenance/v1",
    "predicate": {
        "buildDefinition": {
            "buildType": string,
            "externalParameters": object,
            "internalParameters": object,
            "resolvedDependencies": [ ...#ResourceDescriptor ],
        },
        "runDetails": {
            "builder": {
                "id": string,
                "builderDependencies": [ ...#ResourceDescriptor ],
                "version": { ...string },
            },
            "metadata": {
                "invocationId": string,
                "startedOn": #Timestamp,
                "finishedOn": #Timestamp,
            },
            "byproducts": [ ...#ResourceDescriptor ],
        }
    }
}

builder.id identifies the build platform, which stands for every entity trusted to run the build and record the provenance. externalParameters is the external interface to the build. SLSA treats these values as untrusted: they must be included in the provenance and verified downstream. internalParameters are set by the platform and are optional.

GitHub artifact attestations

The actions/attest action generates SLSA build provenance by default, signs it with a short-lived Sigstore certificate and stores it with the repository. GitHub's documentation makes two claims, both against SLSA v1.0:

  • Artifact attestations by themselves provide Build Level 2.
  • Building inside a reusable workflow can meet Build Level 3, because a reusable workflow isolates the build from the workflow that calls it.

For L3, move the build and the attest step into a reusable workflow that many repositories share:

YAML

# the calling workflow, in the application repository
permissions:
  attestations: write
  contents: read
  id-token: write

jobs:
  build:
    uses: my-org/build-workflows/.github/workflows/build.yml@main

GitHub's documentation says both the calling workflow and the reusable workflow need these three permissions. The reference after @ can be a branch, a release tag or a commit SHA. When you verify, name the repository that holds the signing workflow:

Shell

gh attestation verify dist/app.tar.gz -o my-org \
  --signer-repo my-org/build-workflows

--signer-workflow narrows the check to one workflow file. --deny-self-hosted-runners fails verification for an attestation that a self-hosted runner generated.

What a level leaves open

The specification states the limit of Build L3: it covers a well-intentioned build running securely and no more. It does not require the build platform to prevent a producer from performing a risky or insecure build.

GitHub adds two cautions of its own. An artifact attestation does not guarantee that the artifact is secure. Generating attestations alone provides no security benefit: they must be verified for the benefit to be realized.

What to do first

  1. Move release builds off workstations and onto a hosted build platform. L2 requires it.
  2. Add the actions/attest step to the release workflow. By default it generates signed build provenance.
  3. Verify with gh attestation verify before you deploy, since GitHub states that the benefit comes only from verification.
  4. Move the build into a shared reusable workflow and verify with --signer-repo.

Sources

Want a second pair of eyes on yours? We do this work for a living.

Book a call

More guides