Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content: source track draft: simplify and clarify level goals #1097

Merged
merged 45 commits into from
Aug 15, 2024
Merged
Changes from 20 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
989aeb8
initial content, waiting for main to be updated.
zachariahcox Jul 12, 2024
b4f8b7b
Merge branch 'slsa-framework:main' into users/zacox/scp
zachariahcox Jul 15, 2024
68e8632
react to pr feedback.
zachariahcox Jul 16, 2024
5d5df51
linter
zachariahcox Jul 16, 2024
b2071c0
clarity
zachariahcox Jul 16, 2024
cc8a51c
linter
zachariahcox Jul 17, 2024
5a456d6
Update docs/spec/draft/source-requirements.md
zachariahcox Jul 22, 2024
ad62f09
Update docs/spec/draft/source-requirements.md
zachariahcox Jul 22, 2024
e4050b4
address pr feedback.
zachariahcox Jul 22, 2024
47f8ad3
clarify "code owners"
zachariahcox Jul 22, 2024
d212e08
reimagine as a level 1 requirement
zachariahcox Jul 22, 2024
8bf4205
Update docs/spec/draft/source-requirements.md
zachariahcox Jul 29, 2024
2343b07
Update docs/spec/draft/source-requirements.md
zachariahcox Jul 29, 2024
a7fd4fe
pr feedback
zachariahcox Jul 29, 2024
b003548
cleanup
zachariahcox Jul 29, 2024
09b0c67
add two more useful definitions
zachariahcox Jul 29, 2024
6d3e582
large rewrite
zachariahcox Jul 31, 2024
99f372a
talk vaguely about unit testing
zachariahcox Jul 31, 2024
6b82d6d
every revision
zachariahcox Jul 31, 2024
a583425
cleanup
zachariahcox Jul 31, 2024
64132b8
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
9ab53dc
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
7269b05
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
1be7b2a
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
7faa87d
typos!
zachariahcox Aug 2, 2024
843729c
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
69f611c
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
08ec500
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
6515598
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
f962ac4
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 2, 2024
d809349
pr feedback, remove trusted review process stuff
zachariahcox Aug 8, 2024
2f86109
consumable branch clarity?
zachariahcox Aug 8, 2024
834d64c
pr comment feedback
zachariahcox Aug 9, 2024
9b72a77
adding scenarios to the expunging section
zachariahcox Aug 12, 2024
006a4c1
hopefully last rewrite.
zachariahcox Aug 12, 2024
febc191
update cyoa
zachariahcox Aug 12, 2024
6e3f3e3
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 12, 2024
6c05dc1
move choose your own adventure stuff out.
zachariahcox Aug 12, 2024
3919bad
source attestation copy edits
zachariahcox Aug 12, 2024
cb63de3
add disclaimer about use of git VCS
zachariahcox Aug 14, 2024
f2398a4
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 15, 2024
d1219c6
Update docs/spec/draft/verifying-source.md
zachariahcox Aug 15, 2024
5527616
Update docs/spec/draft/verifying-source.md
zachariahcox Aug 15, 2024
6df6b33
Update docs/spec/draft/source-requirements.md
zachariahcox Aug 15, 2024
31d63ba
Update docs/spec/draft/source-requirements.md
TomHennen Aug 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 148 additions & 52 deletions docs/spec/draft/source-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ Consumers can examine the various source provenance attestations to determine if
| Source Provenance | Information about which Source Control Platform (SCP) produced a revision, when it was generated, what process was used, who the contributors were, and what parent revisions it was based on.
| Organization | A collection of people who collectively create the Source. Examples of organizations include open-source projects, a company, or a team within a company. The organization defines the goals and methods of the repository.
| Repository | A uniquely identifiable instance of a VCS hosted on an SCP. The repository controls access to the Source in the version control system. The objective of a repository is to reflect the intent of the organization that controls it.
| Branch | A named pointer to a revision. Branches may be modified by authorized actors. In git, cloning a repo will download all revisions in the history of the "default" branch to the local machine.
| Change | A set of modifications to the source in a specific context. As an example, a proposed change to a "releases/1" branch may require higher scrutiny than a change to "users/1".
| Branch | A named pointer to a revision. Branches may be modified by authorized actors. In git, cloning a repo will download all revisions in the history of the "default" branch to the local machine. Branches may have different security requirements.
| Change | A set of modifications to the source in a specific context. Can be proposed and reviewed before being accepted.
| Change History | A record of the history of revisions that preceded a specific revision.
| Push / upload / publish | When an actor authenticates to an SCP to add or modify content. Typically makes a new revision reachable from a branch.
| Review / approve / vote | When an actor authenticates to a change review tool to leave comments or endorse / reject the source change proposal they were presented.

## Source Roles

Expand All @@ -49,90 +51,184 @@ Consumers can examine the various source provenance attestations to determine if
| Trusted person | A human who is authorized by the organization to propose and approve changes to the source.
| Trusted robot | Automation with an authentic identity that is authorized by the organization to propose and/or approve changes to the source.
| Untrusted person | A human who has limited access to the project. They MAY be able to read the source. They MAY be able to propose or review changes to the source. They MAY NOT approve changes to the source or perform any privileged actions on the project.
| Proposer | An actor that proposes a particular change to the source.
| Reviewer | An actor that reviews a particular change to the source.
| Approver | An actor that approves a particular change to the source.
| Merger | An actor that applies a change to the source. This typically involves creating the new revision and updating a branch. This person may be the proposer or a different trusted person, depending on the version control platform.
| Proposer | An actor that proposes (or uploads) a particular change to the source.
| Reviewer / Voter / Approver | An actor that reviews (or votes on) a particular change to the source.
| Merger | An actor that applies a change to the source. This actor may be the proposer.

## Source Platform Requirements
## Safe Expunging Process
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

The version control system MUST provide at least:
Administrators have the ability to expunge (remove) content from a repository and its change history without leaving a record of the removed content.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
This includes changing files, history, or changing references in git and is used to accommodate legal or privacy compliance requirements.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
When used as an attack, this is called “repo hijacking” (or “repo-jacking”) and is one of the primary threats source provenance attestations protect against.

- **[Immutable reference]** There exists a deterministic way to identify this particular revision. This is usually {project identifier + revision ID}. When the revision ID is a digest of the revision, as in git, nothing more is needed. When the revision ID is a number or otherwise not a digest, then the project server MUST guarantee that revisions cannot be altered once created.
TODO: Determine how organizations can provide transparency around this process.

- **[Change history]** There exists a record of the history of changes that went into the revision. Each change MUST contain:
- The immutable reference to the new revision.
- The identities of the proposer, reviewers (if any), and merger (if different to the proposer).
- Timestamps of change submission. If a change is reviewed, then the change history MUST also include timestamps for any reviews.
- The change description/justification.
- The content of the change.
- The parent revisions.
## Levels
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Most popular version control systems meet these requirement, such as git, Subversion, Mercurial, and Perforce.
### Level 1: Immutable revisions and Change Management Processeses
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

The source control platform MUST provide at least:
Summary: The source is stored and managed through a modern version control system and modified via a codified revision process.

- An account system or some other means of identifying persons.
- A mechanism for modifying the canonical source through a **revision process**.
Intended for: Organizations wanting to easily and quickly gain some benefits of SLSA and better integrate with the SLSA ecosystem without changing their source workflows.

The source control platform SHOULD additionally provide:
Benefits:
Version control solves software development challenges ranging from change attribution to effective collaboration.
It is a software development best practice with more benefits than we can discuss here.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

- A mechanism for assigning roles and/or permissions to identities.
- A mechanism for including code review in the revision process.
- Two-factor authentication for the account system (L2+ only).
- Audit logs for sensitive actions, such as modifying security controls.
Requirements: The combination of SCP and VCS MUST provide:

## Levels
#### Revisions are immutable and uniquely identifiable

There exists a deterministic way to identify a particular revision.

This is usually a combination of the repository ID and revision ID.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume the repository ID is different from the URL to locate the repository on the SCP? For example, the repository ID for this one is 346517502 per https://api.github.com/repos/slsa-framework/slsa.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I had imagined the repository ID is the URL (e.g. https://github.com/slsa-framework/slsa).

Having it be something that's meaningful to humans would be pretty beneficial.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that's partly what I was getting at. I wonder if there's an endpoint to translate the numeric ID to the URL or if the current definition for repository (even without the ID) inherently has a URL associated with it because we only consider a repository on the SCP at the moment. This is part of the massaging I wonder if I should take a stab at separately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should consider the numeric ID to be an implementation detail and not worry about it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's an interesting question -- today we definitely have resurrection and rename attacks (so you need the gh repo numeric id to disambiguate), but I think in combination with the git object id, the url is probably fine.
IE, it doesn't likely matter much if a hijacked repo (with a different numeric id) has the same url and ships the same revision, we can ship the corresponding attestation. I'd want to think through it some more.

When the revision ID is a digest of the contend of the revision (as in git) nothing more is needed.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
When the revision ID is a number or otherwise not a digest, then the SCP MUST document how the immutability of the revision is established.
See also [Use cases for non-cryptographic, immutable, digests](https://github.com/in-toto/attestation/blob/main/spec/v1/digest_set.md#use-cases-for-non-cryptographic-immutable-digests).

#### Identity Management

There exists an identity management system or some other means of identifying actors.
This system may be a federated authentication system (AAD, Google, Okta, GitHub, etc) or custom implementation (gittuf, gpg-signatures on commits, etc).
The SCP MUST document how actors are identified for the purposes of attribution.

Activities conducted on the SCP SHOULD be attributed to authenticated identities.

#### Trusted revision process

There exists a trusted mechanism for modifying the source pointed-to by a [branch](#definitions).
It MUST NOT be possible to modify the content of a branch without following the documented process.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you envisioning for "documented process"?

It could be something like "each project needs to write down in a README how they make changes to their codebase and then have some way to enforce that in the SCP" but that doesn't seem right. It would be putting too much on the individual project owners. (and it would be really hard to check automatically). So maybe it's just for the SCP.

Maybe it's more like "The SCP must document how changes can be made to the underlying VCS and what restrictions project owners can place on that process. When owners configure these restrictions it must not be possible to bypass the restrictions. E.g. if a project branch is configured to require a pull request prior to merge it must not be possible to modify that branch without going through a pull request."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are you envisioning for "documented process"?

For soc 2 style audits, there's a real document somewhere that matters, but I don't think we need that here. I generally think these kind of semantics can just be encoded into the rules and that's good enough.

Effectively, a git repo is going to be full of a lot of junk. For consumers to make sense of it, an organization needs to explain very basically how they're using git. I think there should be some statement, configuration, or document of process that says or implies:

My Development Process

  1. this repo has some semantically important refspecs
  2. "/refs/heads/main" is the one we try to keep healthy. Revisions reachable from main represent a meaningful history of the intent of this repo and have followed our development process. The ref has been minimally protected and we do not allow force pushes to this ref without following a Safe Expunging Process.
  3. (optional) /refs/heads/users/* is where we work and is probably full of random user stuff that is not to be trusted or consumed directly.
  4. (optional) /refs/heads/release/* represent revisions held to an even higher scrutiny.
  5. (optional) we ❤️ automated tests. our unit testing workflow is called .github/workflows/test.yaml and a clean run is required to merge into main or release branches. Revisions with a green CI are generally better than those without.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my only objection is how open ended that sounds (and asking all the OSS maintainers to document that explicitly sounds like a chore no one would like).

However, it seems like something we can very easily cover automatically? "The source repo MUST indicate which branches and tags are protected by SLSA controls and which level they are protected at."


An example of a revision process could be: all proposed changes MUST be pre-approved by code experts before being included on a protected branch in git.

The revision process MUST specify the branch a contributor is proposing to update.

### Level 2: Provenance
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Summary: A consumer can ask the SCP for everything it knows about a specific revision of a repository. The information is provided in a standardized format.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Summary: A consumer can ask the SCP for everything it knows about a specific revision of a repository. The information is provided in a standardized format.
Summary: The SCP has tamper-proof evidence that documents how revisions in the repository were created and by whom. This information can be provided to verifiers as needed in standardized formats.

The current wording of the summary suggests that any consumer can request this evidence (which will be very detailed). For OSS that's probably fine but for closed source software it would be a problem as it might leak PII, intellectual property, etc...

I think the real goal is that the SCP and those responsible for checking the SCP have access to this evidence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But perhaps 'consumer' is really "people and tooling that have access to the source code", which might not include downstream users of the software itself?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you can clone the repo, you should be able to get the attestation (that's how build attestation serving works too).
There may be cases where the source is packaged into a zip or something, in that case there's lots of wiggle room to inject malicious content and we should fall back to the build track approach: "We don't know what's in there but it was definitely built here." etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, "read access to the repo implies read access to the tamper-proof evidence?" That works for me.

Access to source in a zip should be considered out of scope since SLSA doesn't consider that to be source.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't consider that to be source

That's an interesting topic on its own -- not all zips are the same I guess. GH lets you download as a zip to avoid the inefficient git clone. It's a common way to consume source in build systems -- I think it's used by actions directly?

It seems like if you have access to the repo revision, you should be able to get the attestations.
I generally think it shouldn't matter how you transferred a repository -- if there is a stable way to recover the repository id, that should be enough to verify.

If the revision you care about is packaged into some other zip in a way that is not generated / underwritten by the SCP, you'd definitely need to fall back to other package security techniques.


Intended for: Organizations that need to enforce policy on consumed source.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Benefits: Provides reliable information to policy enforcement tools.

Requirements:

#### Source provenance attestation
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Source attestations are associated with the revision identifier delivered to consumers and are a record of everything the SCP knows about the revision's creation process.

For example, if you perform a `git clone` operation, a consumer MUST be able to fetch the source attestation document using the commit id at the tip of the checked-out branch.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Failure of the SCP to return a source attestation for the commit id is the same as saying the revision was not known to have been produced on the SCP.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

#### Trusted revision process requirements

The change management tool MUST provide at a minimum:

### Level 1: Version controlled
##### Strong Authentication

Summary: The project source is stored and managed through a modern version control system.
The strongly authenticated idenenty used to login to the SCP MUST be used for the generation of source provenance attestations.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
This is typically the identity used to push to a git server.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This is typically the identity used to push to a git server.
This is typically the identity associated with the actor's pushes to a Git server or the reviews they submit on an SCP.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How strongly do you feel about the "associated with the actor's pushes to a Git server" change?

It seems like it could be excessively formal while "used to push" seems to get the same thing across.

But maybe there's a technical nuance I'm not aware of that makes "used to push" ambiguous?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could get a little more nuanced, which I was planning to take a stab at addressing separately. On another part, for applicable types of identities, the doc mention things like signatures that could tie into this bit with git signed pushes and so on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, then I wonder if we can just leave it alone? It does say 'typically' which doesn't rule out doing something fancier?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but I think there's still some tension in the former sentence about the identity used in the provenance attestation, since elsewhere the doc indicates other mechanisms are allowed to. Definitely support punting this one to a separate PR / discussion.

Copy link
Contributor

@adityasaky adityasaky Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, here's what I mean re identity management:

#### Identity Management
There exists an identity management system or some other means of identifying actors.
This system may be a federated authentication system (AAD, Google, Okta, GitHub, etc) or custom (gittuf, gpg-signatures on commits, etc).

I also want to note that I can help massage the gittuf bits there as it uses signatures as the authenticating mechanism, but provides the authenticated metadata layer that can determine what signing keys / identities are trusted, so effectively the policy layer. I don't want to overload this one PR or put all the burden on @zachariahcox to incorporate changes!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. One thing that might help is having some way to talk about 'the system' as a whole vs the individual pieces. That system needs identity management and it might be that that is provided by the SCP, or with something like GitTuf, or via 'control over an email address'? Then perhaps the details can go into something like https://slsa.dev/spec/v1.0/verifying-systems for source systems?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite possibly! That's what I hope to propose, and I think that naturally addresses some of the points I raised elsewhere about the attestations we'd use in this track.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, "used to push" is the typical case for the big cloud SCPs.

If your identity system is signature based, I guess we'd be trying to say "the identity used by the SCP's primary authentication mechanism?"

Ideally no system would use a mix of identities -- like if one commit wasn't signed, it would fall through to trusting the committer or something.


Intended for: Organizations that are unwilling or unable to host their source on a source control platform. If possible, skip to Level 2.
Other forms of identity MAY be included as informational.
Examples include a git commit "author" and "committer" and a gpg signature's "user id."
These forms of identity are user-provided and not typically verified by the source provenance attestation issuer.

See [source roles](#source-roles).

##### Change context

The change management tool MUST record the "target" context for the change proposal and the previous / current revision in that context.

##### Informed Review

The change management tool MUST record the specific code change proposal (a "diff" in git) displayed to reivewers (if any) or instructions to recreate it.
The reviewer is able and encouraged to make an informed decision about what they're approving.
The reviewer MUST be presented with a full, meaningful content diff between the proposed revision and the previously reviewed revision.
It is not sufficient to indicate that a file changed without showing the contents.

##### Verified Timestamps

The change management tool MUST record timestamps for all contributions and review activities.
User-provided values MUST NOT be used.

##### Human-readable change description

The change management tool SHOULD record a description of the proposed change and all discussions / commentary related to it.
All collected content SHOULD be made immutable if the change is accepted.

## Choose your own adventure
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Now that you have a trustworthy way to communicate your security claims, what should you be looking for in those claims?
Here are a few extremely common examples.

### Changes are pre-authorized by two different authorized actors

Summary: All changes to the source are approved by two trusted actors prior to submission.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Intended for: Enterprise repositories and mature open source projects.

Benefits: A compromise of a single account does not result in compromise of the source.

Requirements:

**[Version controlled]** Every change to the source is tracked in a version control system that meets the requirements listed in [Source Platform Requirements](#source-platform-requirements).
#### Two authorized actors

All changes to the source are approved by two authorized actors prior to submission.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
If the proposer is also an authorized actor, the proposer MAY approve their own proposal and count as one of the two required actors.

#### Different actors

It MUST NOT be possible for a single actor to control more than one voting accounts.

Benefits: Version control solves software development challenges ranging from change attribution to effective collaboration. It is a software development best practice with more benefits than we can discuss here.
Should the organization discover that it issued multiple accounts to the same actors, it MUST act to rectify the situation.
For example, it might revoke project privileges for all but one of the accounts and perform retroactive code reviews on any changes where that actors' accounts are the author and/or code reviewer(s).
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

### Level 2: Verified history
### Expert Code Reivew

Summary: The source code and its change history metadata are retained and authenticated to allow trustworthy auditing and analysis of the source code.
Summary: All changes to the source are pre-approved by experts in those areas.

Intended for: Organizations that are unwilling or unable to incorporate code review into their software development practices.
Intended for: Enterprise repositories and mature open source projects.

Benefits: Prevents mistakes made by developers who are unfamiliar with the area.

Requirements:
**[Strong authentication]** User accounts that can modify the source or the project's configuration must use multi-factor authentication or its equivalent.

**[Verified timestamps]** Each entry in the change history must contain at least one timestamp that is determined by the source control platform and cannot be modified by clients. It MUST be clear in the change history which timestamps are determined by the source control platform.
#### Code ownership

Each part of the source MUST have a clearly identified set of experts.

#### Approvals from all relevant experts

**[Retained history]** The change history MUST be preserved as long as the source is hosted on the source control system. The source MAY migrate to another source control system, but the organization MUST retain the change history if possible. It MUST NOT be possible for persons to delete or modify the change history, even with multi-party approval, except by trusted platform admins following an established deletion policy.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved
For each portion of the source modified by a change proposal, pre-approval MUST be granted by a member of the defined expert set.
A approval from an actor that is a member of multiple expert groups may satisfy the requirement for all groups in which they are a member.

Benefits: Attributes changes in the version history to specific actors and timestamps, which allows for post-auditing, incident response, and deterrence for bad actors. Multi-factor authentication makes account compromise more difficult, further ensuring the integrity of change attribution.
### Review Every Single Revision

### Level 3: Changes are authorized
Summary: The final revision was reviewed by all relevant experts prior to submission.
TomHennen marked this conversation as resolved.
Show resolved Hide resolved

Summary: All changes to the source are approved by two trusted persons prior to submission.
Intended for: The highest-of-high-security-posture repos.

Intended for: Enterprise projects and mature open source projects.
Benefits: Provides the maximum chance for experts to spot and reject problems before they ship.

Requirements:

**[Code review]** All changes to the source are approved by two trusted persons prior to submission. User accounts that can perform code reviews MUST use two-factor authentication or its equivalent.
The following combinations of trusted persons are acceptable:
#### Reset votes on all changes

If the proposal is modified after receiving expert approval, all previously granted approvals MUST be revoked.
A new approval MUST be granted from ALL required reviewers.

The new approval MAY be granted by an actor who approved a previous iteration.

- Proposer and reviewer are two different trusted persons.
- Two different reviewers are trusted persons.
### Automated testing

The code review system must meet the following requirements:
Summary: The final revision was validated against a suite of vetted automated tests.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

- **[Informed review]** The reviewer is able and encouraged to make an informed decision about what they're approving. The reviewer MUST 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 a file changed without showing the contents.
- **[Context-specific approvals]** Approvals are for a specific context, such as a repo + target branch + revision in git. Moving fully reviewed content from one context to another still requires review, except for well-understood automatic processes. For example, you do not need to review each change to cut a release branch, but you do need review when backporting changes from the main branch to an existing release branch.
- **[Atomic change sets]** Changes are recorded in the change history as a single revision that consists of the net delta between the proposed revision and the parent revision. In the case of a nonlinear version control system, where a revision can have more than one parent, the diff must be against the "first common parent" between the parents. In other words, when a feature branch is merged back into the main branch, only the merge itself is in scope.
Intended for: All organizations and repositories.

Trusted robots MAY be exempted from the code review process. It is RECOMMENDED that trusted robots so exempted be run only software built at Build L3+ from sources that meet Source L3.
Benefits: Automatic testing has many benefits, including improved accuracy, error prevention and reduced workload on your human developers.

**[Different persons]** The organization strives to ensure that no two user accounts correspond to the same person. Should the organization discover that it issued multiple accounts to the same person, it MUST act to rectify the situation. For example, it might revoke project privileges for all but one of the accounts and perform retroactive code reviews on any changes where that person's accounts are the author and/or code reviewer(s).
Requirements: For each configured automatic test, results MUST be collected by the change review tool and included in the source provenance attestation.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved

Benefits: A compromise of a single human or account does not result in compromise of the project, since all changes require review from two humans.
For example, you may configure a "required GitHub Actions workflow" to run your test suites.
Only change proposals with a successful workflow run id would be allowed to be submitted.
zachariahcox marked this conversation as resolved.
Show resolved Hide resolved