Skip to content

Latest commit

 

History

History
475 lines (368 loc) · 17.4 KB

requirements.md

File metadata and controls

475 lines (368 loc) · 17.4 KB

Requirements

Table of Contents:

Reminder: The definitions below are not yet finalized and subject to change, particularly SLSA 3-4.

This document enumerates all of the detailed requirements for an artifact to meet SLSA. For a broader overview, including basic terminology and threat model, see the main page.

Definitions

Immutable reference: An identifier that is guaranteed to always point to the same, immutable artifact. This MUST allow the consumer to locate the artifact and SHOULD include a cryptographic hash of the artifact's contents to ensure integrity. Examples: git URL + branch/tag/ref + commit ID; cloud storage bucket ID + SHA-256 hash; Subversion URL (no hash).

Platform: Infrastructure or service that hosts the source, build, or distribution of software. Examples: GitHub, Google Cloud Build, Travis CI, Mozilla's self-hosted Mercurial server.

Provenance: Metadata about how an artifact was produced.

Revision: An immutable, coherent state of a source. In Git, for example, a revision is a commit in the history reachable from a specific branch in a specific repository. Different revisions within one repo MAY have different levels. Example: the most recent revision on a branch meets SLSA 4 but very old historical revisions before the cutoff do not.

Trusted persons: Set of persons who are granted the authority to maintain a software project. For example, https://github.com/MarkLodato/dotfiles has just one trusted person (MarkLodato), while https://hg.mozilla.org/mozilla-central has a set of trusted persons with write access to the mozilla-central repository.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Source requirements

RequirementDescriptionL1L2L3L4
Version Controlled

Every change to the source is tracked in a version control system that meets the following requirements:

  • [Change History] There exists a record of the history of changes that went into the revision. Each change must contain: the identities of the uploader and reviewers (if any), timestamps of the reviews (if any) and submission, the change description / justification, the content of the change, and the parent revisions.

  • [Immutable Reference] There exists a way to indefinitely reference this particular, immutable revision. In git, this is the {repo URL + branch/tag/ref + commit ID}.

Most popular version control system meet this requirement, such as git, Mercurial, Subversion, or Perforce.

NOTE: This does NOT require that the code, uploader/reviewer identities, or change history be made public. Rather, some organization must attest to the fact that these requirements are met, and it is up to the consumer whether this attestation is sufficient.

Verified History

Every change in the revision's history has at least one strongly authenticated actor identities (author, uploader, reviewer, etc.) and timestamp. It must be clear which identities were verified, and those identities must use two-step verification or similar. (Exceptions noted below.)

  • [First-Parent History] In the case of a non-linear version control system, where a revision can have more than one parent, only the "first parent history" is in scope. In other words, when a feature branch is merged back into the main branch, only the merge itself is in scope.
  • [Historical Cutoff] There is some TBD exception to allow existing projects to meet SLSA 3/4 even if historical revisions were present in the history. Current thinking is that this could be either last N months or a platform attestation guaranteeing that future changes in the next N months will meet the requirements.
Retained Indefinitely

The revision and its change history are preserved indefinitely and cannot be deleted, except when subject to an established and transparent policy for obliteration, such as a legal or policy requirement.

  • [Immutable History] It must not be possible for persons to delete or modify the history, even with multi-party approval, except by trusted platform admins with two-party approval following the obliterate policy.
  • [Limited Retention for SLSA 2] At SLSA 2 (but not 3), it is acceptable for the retention to be limited to 18 months, as attested by the source control platform.
    • Example: If a commit is made on 2020-04-05 and then a retention attestation is generated on 2021-01-01, the commit must be retained until at least 2022-07-01.
18 mo.
Two-Person Reviewed

Every change in the revision's history was agreed to by two trusted persons prior to submission, and both of these trusted persons were strongly authenticated. (Exceptions from Verified History apply here as well.)

  • The following combinations are acceptable:
    • Uploader and reviewer are two different trusted persons.
    • Two different reviewers are trusted persons.
  • [Different Persons] The platform ensures that no person can use alternate identities to bypass the two-person review requirement.
    • Example: if a person uploads with identity X then reviews with alias Y, the platform understands that this is the same person and does not consider the review requirement satisfied.
  • [Informed Review] The reviewer is able and encouraged to make an informed decision about what they're approving. The reviewer should be presented with a full, meaningful content diff between the proposed revision and the previously reviewed revision. For example, it is not sufficient to just indicate that file changed without showing the contents.
  • [Context-specific Approvals] Approvals are for a specific context, such as a repo + branch in git. Moving fully reviewed content from one context to another still requires review. (Exact definition of "context" depends on the project, and this does not preclude well-understood automatic or reviewless merges, such as cutting a release branch.)
    • Git example: If a fully reviewed commit in one repo is merged into a different repo, or a commit in one branch is merged into a different branch, then the merge still requires review.

Build Requirements

Requirements on build process:

RequirementDescriptionL1L2L3L4
Scripted Build

All build steps were fully defined in some sort of "build script". The only manual command, if any, was to invoke the build script.

Examples:

  • Build script is Makefile, invoked via make all.
  • Build script is .github/workflows/build.yaml, invoked by GitHub Actions.
Build Service

All build steps ran using some build service, not on a developer's workstation.

Examples: GitHub Actions, Google Cloud Build, Travis CI.

Ephemeral Environment

The build service ensured that the build steps ran in an ephemeral environment, such as a container or VM, provisioned solely for this build, and not reused from a prior build.

Isolated

The build service ensured that the build steps ran in an isolated environment free of influence from other build instances, whether prior or concurrent.

  • It MUST NOT be possible for a build to access any secrets of the build service, such as the provenance signing key.
  • It MUST NOT be possible for two builds that overlap in time to influence one another.
  • It MUST NOT be possible for one build to persist or influence the build environment of a subsequent build.
  • Build caches, if used, MUST be purely content-addressable to prevent tampering.
Parameterless

The build output cannot be affected by user parameters other than the build entry point and the top-level source location. In other words, the build is fully defined through the build script and nothing else.

Examples:

Hermetic

All transitive build steps, sources, and dependencies were fully declared up front with immutable references, and the build steps ran with no network access.

The user-defined build script:

  • MUST declare all dependencies, including sources and other build steps, using immutable references in a format that the build service understands.

The build service:

  • MUST fetch all artifacts in a trusted control plane.
  • MUST disallow mutable references.
  • MUST verify the integrity of each artifact.
    • If the immutable reference includes a cryptographic hash, the service MUST verify the hash and reject the fetch if the verification fails.
    • Otherwise, the service MUST fetch the artifact over a channel that ensures transport integrity, such as TLS or code signing.
  • MUST prevent network access while running the build steps.
    • This requirement is "best effort." It SHOULD deter a reasonable team from having a non-hermetic build, but it need not stop a determined adversary. For example, using a container to prevent network access is sufficient.
Reproducible

Re-running the build steps with identical input artifacts results in bit-for-bit identical output. Builds that cannot meet this MUST provide a justification why the build cannot be made reproducible.

"○" means that this requirement is "best effort". The user-provided build script SHOULD declare whether the build is intended to be reproducible or a justification why not. The build service MAY blindly propagate this intent without verifying reproducibility. A consumer MAY reject the build if it does not reproduce.

Provenance Requirements

Requirements on the process by which provenance is generated and consumed:

RequirementDescriptionL1L2L3L4
Available

The provenance is available to the consumer in a format that the consumer accepts. The format SHOULD be in-toto provenance, but another format MAY be used if both producer and consumer agree and it meets all the other requirements.

Authenticated

The provenance's authenticity and integrity can be verified by the consumer. This SHOULD be through a digital signature from a private key accessible only to the service generating the provenance.

Service Generated

The data in the provenance MUST be obtained from the build service (either because the generator is the build service or because the provenance generator reads the data directly from the build service).

Regular users of the service MUST NOT be able to inject or alter the contents, except as noted below.

The following provenance fields MAY be generated by the user-controlled build steps:

  • The output artifact hash from Identifies Artifact.
    • Reasoning: This only allows a "bad" build to falsely claim that it produced a "good" artifact. This is not a security problem because the consumer MUST accept only "good" builds and reject "bad" builds.
  • The "reproducible" boolean and justification from Reproducible.
Non-Falsifiable

Provenance cannot be falsified by the build service's users.

NOTE: This requirement is a stricter version of Service Generated.

  • The provenance signing key MUST be stored in a secure key management system accessible only to the build service account.
  • The provenance signing key MUST NOT be accessible to the environment running the user-defined build steps.
  • Every field in the provenance MUST be generated or verified by the build service in a trusted control plane. The user-controlled build steps MUST NOT be able to inject or alter the contents, except as noted below.

The following provenance fields MAY be generated by the user-controlled build steps without the build service verifying their correctness:

  • The output artifact hash from Identifies Artifact.
    • Reasoning: This only allows a "bad" build to falsely claim that it produced a "good" artifact. This is not a security problem because the consumer MUST accept only "good" builds and reject "bad" builds.
  • The "reproducible" boolean and justification from Reproducible.
Dependencies Complete

Provenance records all build dependencies that were available while running the build steps. This includes the initial state of the machine, VM, or container of the build worker.

  • MUST include all user-specified build steps, sources, dependencies.
  • SHOULD include all service-provided artifacts.

Requirements on the contents of the provenance:

RequirementDescriptionL1L2L3L4
Identifies Artifact

The provenance identifies the output artifact via a cryptographic hash. The RECOMMENDED algorithm is SHA-256 for cross-system compatibility. If another algorithm is used, it SHOULD be resistant to collisions and second preimages.

Identifies Builder

The provenance identifies the entity that performed the build and generated the provenance. This represents the entity that the consumer must trust. Examples: "GitHub Actions with a GitHub-hosted worker", "jdoe@example.com's machine".

Identifies Source

The provenance identifies the source containing the top-level build script, via an immutable reference. Example: git URL + branch/tag/ref + commit ID.

Identifies Entry Point

The provenance identifies the "entry point" or command that was used to invoke the build script. Example: make all.

Includes All Build Parameters

The provenance includes all build parameters under a user's control. See Parameterless for details. (At L3, the parameters must be listed; at L4, they must be empty.)

Includes All Transitive Dependencies

The provenance includes all transitive dependencies listed in Dependencies Complete.

Includes Reproducible Info

The provenance includes a boolean indicating whether build is intended to be reproducible and, if so, all information necessary to reproduce the build. See Reproducible for more details.

Includes Metadata

The provenance includes metadata to aid debugging and investigations. This SHOULD at least include start and end timestamps and a permalink to debug logs.

"○" = RECOMMENDED.

Common requirements

Common requirements for every trusted system involved in the supply chain (source, build, distribution, etc.)

TODO: Expand this section. Currently it is under-specified.

RequirementDescriptionL1L2L3L4
Security

The system meets some TBD baseline security standard to prevent compromise. (Patching, vulnerability scanning, user isolation, transport security, secure boot, machine identity, etc. Perhaps NIST 800-53 or a subset thereof.)

Access

All physical and remote access must be rare, logged, and gated behind multi-party approval.

Superusers

Only a small number of platform admins may override the guarantees listed here. Doing so MUST require approval of a second platform admin.