CIS GitHub Benchmark v1.2.0
This document provides prescriptive guidance for establishing a secure configuration posture for securing GitHub.
Run this compliance with Prowler
Run in Prowler Cloudprowler github --compliance cis_1.2.0_githubRequirements (120)
1 Source Code5023
1.1.1Manage all code projects in a version control platform.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Manage all code projects in a version control platform.
- Audit Procedure
Ensure that all code activity is managed through Github repository for every micro-service or application developed by an organization.
- Assessment Status
Manual
- Rationale Statement
Version control platforms keep track of every modification to code. They represent the cornerstone of code security, as well as allowing for better code collaboration within engineering teams. With granular access management, change tracking, and key signing of code edits, version control platforms are the first step in securing the software supply chain.
- Remediation Procedure
Upload existing code projects to a dedicated Github organization and repositories and create an identity for each active team member who might contribute or need access to it.
1.1.2Use a task management system to trace any code back to its associated task.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Use a task management system to trace any code back to its associated task.
- Audit Procedure
Ensure every code change can be traced back to its origin task in a task management system.
- Assessment Status
Manual
- Rationale Statement
The ability to trace each piece of code back to its associated task simplifies the Agile and DevOps process by enabling transparency of any code changes. This allows faster remediation of bugs and security issues, while also making it harder to push unauthorized code changes to sensitive projects. Additionally, using a task management system simplifies achieving compliance, as it is easier to track each regulation.
- Remediation Procedure
Use a task management system to manage tasks as the starting point for each code change. Whether it is a new feature, bug fix, or security fix - all should originate from a dedicated task (ticket) in your organization's task management system. These tasks should also be linked to the code changes themselves in a way that is easy to follow: from code to task, and from task back to code.
1.1.3Ensure that every code change is reviewed and approved by two authorized contributors who are both strongly authenticated - using Multi-Factor Authentication (MFA), from the team relevant to the code change.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure that every code change is reviewed and approved by two authorized contributors who are both strongly authenticated - using Multi-Factor Authentication (MFA), from the team relevant to the code change.
- Default Value
0
- Audit Procedure
For every code repository in use, perform the next steps to verify that two approvals from the specific code repository team are required to push new code to the code base:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require a pull request before merging and Require approvals are checked, and verify that Required number of approvals before merging is set to 2.
- Impact Statement
To enforce a code review requirement, verification for a minimum of two reviewers must be put into place. This will ensure new code will not be able to be pushed to the code base before it has received two independent approvals.
- Assessment Status
Automated
- Rationale Statement
To prevent malicious or unauthorized code changes, the first layer of protection is the process of code review. This process involves engineer teammates reviewing each other's code for errors, optimizations, and general knowledge-sharing. With proper peer reviews in place, an organization can detect unwanted code changes very early in the process of release. In order to help facilitate code review, companies should employ automation to verify that every code change has been reviewed and approved by at least two team members before it is pushed into the code base. These team members should be from the team that is related to the code change, so it will be a meaningful review.
- Remediation Procedure
For every code repository in use, perform the next steps to require two approvals from the specific code repository team in order to push new code to the code base:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you added the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Check Require a pull request before merging and Require approvals, and set Required number of approvals before merging to 2.
- Click Create or Save changes.
1.1.4Ensure that when a proposed code change is updated, previous approvals are declined, and new approvals are required.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure that when a proposed code change is updated, previous approvals are declined, and new approvals are required.
- Audit Procedure
For each code repository in use, perform the next steps to verify that each updated code suggestion declines the previously received approvals:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require a pull request before merging is checked, and verify that Dismiss stale pull request approvals when new commits are pushed is checked.
- Impact Statement
If new code changes are pushed to a specific proposal, all previously accepted code change proposals must be declined.
- Assessment Status
Manual
- Rationale Statement
An approval process is necessary when code changes are suggested. Through this approval process, however, changes can still be made to the original proposal even after some approvals have already been given. This means malicious code can find its way into the code base even if the organization has enforced a review policy. To ensure this is not possible, outdated approvals must be declined when changes to the suggestion are introduced.
- Remediation Procedure
For each code repository in use, perform the next steps to enforce dismissal of given approvals to code change suggestions if those suggestions were updated:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you added the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require pull request reviews before merging and then Dismiss stale pull request approvals when new commits are pushed.
- Click Create or Save changes.
1.1.5Only trusted users should be allowed to dismiss code change reviews.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Only trusted users should be allowed to dismiss code change reviews.
- Default Value
By default, all users who have write access to the code repository are able to dismiss code change reviews.
- Audit Procedure
For each code repository in use, perform the next steps to verify that only trusted users are allowed to dismiss code change reviews:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Verify that Require a pull request before merging and Restrict who can dismiss pull request reviews is checked.
- Verify that no users and teams are specified except for organization and repository admins. If it is obligatory, verify that the users or teams specified were carefully selected to be trusted with the ability to dismiss code change reviews.
- Impact Statement
In cases where a code change proposal has been updated since it was last reviewed and the person who reviewed it isn't available for approval, a general collaborator would not be able to merge their code changes until a user with "dismiss review" abilities could dismiss the open review.
Users who are not allowed to dismiss code change reviews will not be permitted to do so, and thus are unable to waive the standard flow of approvals.
- Assessment Status
Manual
- Rationale Statement
Dismissing a code change review permits users to merge new suggested code changes without going through the standard process of approvals. Controlling who can perform this action will prevent malicious actors from simply dismissing the required reviews to code changes and merging malicious or dysfunctional code into the code base.
- Remediation Procedure
For each code repository in use, perform the next steps to restrict dismissal of code changes reviews unless it is necessary:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you added the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require pull request reviews before merging and Restrict who can dismiss pull request reviews.
- Do not add any user or team unless it is obligatory. If it is obligatory, carefully select the users or teams whom you trust with the ability to dismiss code change reviews.
- Click Create or Save changes.
1.1.6Code owners are trusted users that are responsible for reviewing and managing an important piece of code or configuration. An organization is advised to set code owners for every extremely sensitive code or configuration.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Code owners are trusted users that are responsible for reviewing and managing an important piece of code or configuration. An organization is advised to set code owners for every extremely sensitive code or configuration.
- Default Value
None
- Audit Procedure
In every code repository, verify that a file named CODEOWNERS exists in the root, docs/, or .github/ directory of the repository. In the CODEOWNERS file, verify that the users specified are users you trust.
- Impact Statement
Code owner users will receive notifications for every change that occurs to the code and subsequently added as reviewers of pull requests automatically.
- Assessment Status
Manual
- Rationale Statement
Configuring code owners protects data by verifying that trusted users will notice and review every edit, thus preventing unwanted or malicious changes from potentially compromising sensitive code or configurations.
- Remediation Procedure
In every code repository create a CODEOWNERS file in the root, docs/, or .github/ directory of the repository. In the file, specify codeowners for the .github/workflows/ directory atleast. Specify organization members you trust. For example:
.github/workflows/ @user1 @user2
1.1.7Ensure trusted code owners are required to review and approve any code change proposal made to their respective owned areas in the code base.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure trusted code owners are required to review and approve any code change proposal made to their respective owned areas in the code base.
- Default Value
Code owners are not required to review changes by default.
- Audit Procedure
For every code repository in use, perform the following steps to verify that code owners are required to review all code change proposals relevant to areas they own before code merge:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require a pull request before merging and Require review from Code Owners are checked.
- Impact Statement
If an organization enforces code owner-based reviews, some code change proposals would not be able to be merged to the codebase before specific, trusted individuals approve them.
- Assessment Status
Manual
- Rationale Statement
Configuring code owners ensures that no code, especially code which could prove malicious, will slip into the source code or configuration files of a repository. This allows an organization to mark areas in the code base that are especially sensitive or more prone to an attack. It can also enforce review by specific individuals who are designated as owners to those areas so that they may filter out unauthorized or unwanted changes beforehand.
- Remediation Procedure
For every code repository in use, perform the following steps to require code owners' approvals for each change proposal related to code they own:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require pull request reviews before merging and Require review from Code Owners.
- Click Create or Save changes.
1.1.8Keep track of code branches that are inactive for a lengthy period of time and periodically remove them.2
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Keep track of code branches that are inactive for a lengthy period of time and periodically remove them.
- Default Value
By default, newly opened Git branches would never be removed, regardless of activity or inactivity.
- Audit Procedure
For each code repository in use, verify that all existing Git branches are active or have yet to be checked for inactivity by performing the next steps:
- On GitHub.com, navigate to the main page of the repository.
- Above the list of files, click Branches.
- Use the navigation at the top of the page to view the Stale branches. The Stale view shows all branches that no one has committed to in the last three months, ordered by the branches with the oldest commits first.
- If the list is empty, you are compliant. If the list is not empty, but there is a valid reason the branches listed are not deleted, you are compliant.
- Impact Statement
Removing inactive Git branches means that any code changes they contain would be removed along with them, thus work done in the past might not be accessible after auditing for inactivity.
- Assessment Status
Manual
- Rationale Statement
Git branches that have been inactive (i.e., no new changes introduced) for a long period of time are enlarging the surface of attack for malicious code injection, sensitive data leaks, and CI pipeline exploitation. They potentially contain outdated dependencies which may leave them highly vulnerable. They are more likely to be improperly managed, and could possibly be accessed by a large number of members of the organization.
- Remediation Procedure
For each code repository in use, review existing Git branches and remove those which have not been active for a period of time by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Above the list of files, click Branches.
- Use the navigation at the top of the page to view the Stale branches. The Stale view shows all branches that no one has committed to in the last three months, ordered by the branches with the oldest commits first.
- For each branch listed, either delete it by clicking the trash bin icon, or find the valid reason it still exists.
You can perform the next steps to prevent pull request branches from becoming stale branches:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- Under "Pull Requests", select Automatically delete head branches.
1.1.9Before a code change request can be merged to the code base, all predefined checks must successfully pass.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Before a code change request can be merged to the code base, all predefined checks must successfully pass.
- Default Value
By default, no checks are defined per project, and thus no enforcement of checks is made.
- Audit Procedure
For each code repository in use, verify that status checks are required to pass before allowing any code change proposal merge by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require status checks to pass before merging is checked.
- Impact Statement
Code changes in which all checks do not pass successfully would not be able to be pushed into the code base of the specific code repository.
- Assessment Status
Manual
- Rationale Statement
On top of manual reviews of code changes, a code protect should contain a set of prescriptive checks which validate each change. Organizations should enforce those status checks so that changes can only be introduced if all checks have successfully passed. This set of checks should serve as the absolute quality, stability, and security conditions which must be met in order to merge new code to a project.
- Remediation Procedure
For each code repository in use, require all status checks to pass before permitting a merge of new code by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", check if there is a rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require status checks to pass before merging.
- Click Create or Save changes.
1.1.10Organizations should make sure each suggested code change is in full sync with the existing state of its origin code repository before allowing merging.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- References
- https://github.blog/changelog/2022-02-03-more-ways-to-keep-your-pull-request-branch-up-to-date/
- Subsection
1.1 Code Changes
- Description
Organizations should make sure each suggested code change is in full sync with the existing state of its origin code repository before allowing merging.
- Default Value
By default, there is no requirement to update a branch before merging it.
- Audit Procedure
For each code repository in use, verify that open branches must be updated before merging is permitted by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require status checks to pass before merging and Require branches to be up to date before merging are checked.
- Impact Statement
If enforced, outdated branches would not be able to be merged into their origin repository without first being updated to contain any recent changes.
- Assessment Status
Manual
- Rationale Statement
Git branches can easily become outdated since the origin code repository is constantly being edited. This means engineers working on separate code branches can accidentally include outdated code with potential security issues which might have already been fixed, overriding the potential solutions for those security issues when merging their own changes.
- Remediation Procedure
For each code repository in use, enforce a policy to only allow merging open branches if they are current with the latest change from their original repository by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require status checks to pass before merging and Require branches to be up to date before merging.
- Click Create or Save changes.
1.1.11Organizations should enforce a "no open comments" policy before allowing code change merging.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Organizations should enforce a "no open comments" policy before allowing code change merging.
- Default Value
By default, code changes with open comments on them are able to be merged into the code base.
- Audit Procedure
For every code repository in use, verify that each merged code change does not contain open, unattended comments by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require conversation resolution before merging is checked.
- Impact Statement
Code change proposals containing open comments would not be able to be merged into the code base.
- Assessment Status
Manual
- Rationale Statement
In an open code change proposal, reviewers can leave comments containing their questions and suggestions. These comments can also include potential bugs and security issues. Requiring all comments on a code change proposal to be resolved before it can be merged ensures that every concern is properly addressed or acknowledged before the new code changes are introduced to the code base.
- Remediation Procedure
For each code repository in use, require open comments to be resolved before the relevant code change can be merged by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require conversation resolution before merging.
- Click Create or Save changes.
1.1.12Ensure every commit in a pull request is signed and verified before merging.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- References
- https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
- Subsection
1.1 Code Changes
- Description
Ensure every commit in a pull request is signed and verified before merging.
- Audit Procedure
Ensure only signed commits can be merged for every branch, especially the main branch, via branch protection rules by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require signed commits is checked.
- Impact Statement
Pull requests with unsigned commits cannot be merged.
- Assessment Status
Manual
- Rationale Statement
Signing commits, or requiring to sign commits, gives other users confidence about the origin of a specific code change. It ensures that the author of the change is not hidden and is verified by the version control system, thus the change comes from a trusted source.
- Remediation Procedure
For each repository in use, enforce the branch protection rule of requiring signed commits, and make sure only signed commits are capable of merging by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require signed commits.
- Click Create or Save changes.
1.1.13Linear history is the name for Git history where all commits are listed in chronological order, one after another. Such history exists if a pull request is merged either by rebase merge (re-order the commits history) or squash merge (squashes all commits to one). Ensure that linear history is required by requiring the use of rebase or squash merge when merging a pull request.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Linear history is the name for Git history where all commits are listed in chronological order, one after another. Such history exists if a pull request is merged either by rebase merge (re-order the commits history) or squash merge (squashes all commits to one). Ensure that linear history is required by requiring the use of rebase or squash merge when merging a pull request.
- Audit Procedure
For every code repository in use, perform the following steps to verify that linear history is required and/or that only squash merge and rebase merge are allowed:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Require linear history is checked.
- Impact Statement
Pull request cannot be merged except squash or rebase merge.
- Assessment Status
Manual
- Rationale Statement
Enforcing linear history produces a clear record of activity, and as such it offers specific advantages: it is easier to follow, easier to revert a change, and bugs can be found more easily.
- Remediation Procedure
For every code repository in use, perform the following steps to require linear history and/or allow only rebase merge and squash merge:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Require linear history.
- Click Create or Save changes.
1.1.14Ensure administrators are subject to branch protection rules.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure administrators are subject to branch protection rules.
- Default Value
Administrator accounts are not subject to branch protection rules by default.
- Audit Procedure
For every code repository in use, validate branch protection rules also apply to administrator accounts by performing the next steps:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Do not allow bypassing the above settings is checked.
- Impact Statement
Administrator users won't be able to push code directly to the protected branch without being compliant with listed branch protection rules.
- Assessment Status
Manual
- Rationale Statement
Administrators by default are excluded from any branch protection rules. This means these privileged users (both on the repository and organization levels) are not subject to protections meant to prevent untrusted code insertion, including malicious code. This is extremely important since administrator accounts are often targeted for account hijacking due to their privileged role.
- Remediation Procedure
For every code repository in use, enforce branch protection rules on administrators as well, by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Do not allow bypassing the above settings.
- Click Create or Save changes.
1.1.15Ensure that only trusted users can push or merge new code to protected branches.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure that only trusted users can push or merge new code to protected branches.
- Audit Procedure
For every code repository in use, ensure only trusted and responsible users can push or merge new code by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Restrict who can push to matching branches is checked and that only trusted and responsible users and teams are selected.
- Impact Statement
Only administrators and trusted users can push or merge to the protected branch.
- Assessment Status
Manual
- Rationale Statement
Requiring that only trusted users may push or merge new changes reduces the risk of unverified code, especially malicious code, to a protected branch by reducing the number of trusted users who are capable of doing such.
- Remediation Procedure
For every code repository in use, allow only trusted and responsible users to push or merge new code by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches. 4.Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Select Restrict who can push to matching branches and choose trusted and responsible users and teams who will have the permission to do so.
- Click Create or Save changes.
1.1.16The "Force Push" option allows users with "Push" permissions to force their changes directly to the branch without a pull request, and thus should be disabled.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
The "Force Push" option allows users with "Push" permissions to force their changes directly to the branch without a pull request, and thus should be disabled.
- Audit Procedure
For every code repository in use, validate that no one can force push code by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Allow force pushes is not checked.
- Impact Statement
Users cannot force push to protected branches.
- Assessment Status
Manual
- Rationale Statement
The "Force Push" option allows users to override the existing code with their own code. This can lead to both intentional and unintentional data loss, as well as data infection with malicious code. Disabling the "Force Push" option prohibits users from forcing their changes to the master branch, which ultimately prevents malicious code from entering source code.
- Remediation Procedure
For each repository in use, block the option to "Force Push" code by performing the following:
Ensure that Trunk / Long-standing branches are protected by Policies and submitted to PR while applying the 4-eyes approach.
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Uncheck Allow force pushes.
- Click Create or Save changes.
1.1.17Ensure that users with only push access are incapable of deleting a protected branch.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure that users with only push access are incapable of deleting a protected branch.
- Audit Procedure
For each repository that is being used, verify that protected branches cannot be deleted by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, you are not compliant.
- Ensure that Allow deletions is not checked.
- Impact Statement
Protected branches cannot be deleted.
- Assessment Status
Manual
- Rationale Statement
When enabling deletion of a protected branch, any user with at least push access to the repository can delete a branch. This can be potentially dangerous, as a simple human mistake or a hacked account can lead to data loss if a branch is deleted. It is therefore crucial to prevent such incidents by denying protected branch deletion.
- Remediation Procedure
For each repository that is being used, block the option to delete protected branches by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", verify that there is at least one rule for your main branch. If there is, click Edit to its right. If there isn't, click Add rule.
- If you add the rule, under "Branch name pattern", type the branch name or pattern you want to protect.
- Uncheck Allow deletions.
- Click Create or Save changes.
1.1.18Ensure that every pull request is required to be scanned for risks.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure that every pull request is required to be scanned for risks.
- Audit Procedure
For each repository in use, ensure that every pull request must be scanned for risks by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Actions.
- Ensure that at least one workflow is configured to run like that:
on: push: branches: [ "main" ] pull_request: branches: [ "main" ]and that it has a step that runs code scanning on the code.
- Assessment Status
Manual
- Rationale Statement
Scanning pull requests to detect risks allows for early detection of vulnerable code and/or dependencies and helps mitigate potentially malicious code.
- Remediation Procedure
For every repository in use, enforce risk scanning on every pull request by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Actions.
- If the repository already has at least one workflow set up and running, click New workflow and go to step 5. If there are currently no workflows configured for the repository, go to the next step.
- Scroll down to the "Security" category and click Configure under the workflow you want to configure or click View all to see all available security workflows.
- On the right pane of the workflow page, click Documentation and follow the on-screen instructions to tailor the workflow to your needs.
1.1.19Ensure that changes in the branch protection rules are audited.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Ensure that changes in the branch protection rules are audited.
- Audit Procedure
Ensure changes in branch protection rules are audited by performing the following regularly:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Archives" section of the sidebar, click Logs, then click Audit log.
- Use the action qualifier in your query and look for protected_branch category. Ensure every action is reasonable and secure and is investigated if not.
- Assessment Status
Manual
- Rationale Statement
Branch protection rules should be configured on every repository. The only users who may change such rules are administrators. In a case of an attack on an administrator account or of human error on the part of an administrator, protection rules could be disabled, and thus decrease source code confidentiality as a result. It is important to track and audit such changes to prevent potential incidents as soon as possible.
- Remediation Procedure
Use the audit log to audit changes in branch protection rules by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Archives" section of the sidebar, click Logs, then click Audit log.
- Use the action qualifier in your query and look for protected_branch category. Ensure every action is reasonable and secure and investigate if not.
1.1.20Enforce branch protection on the default and main branch.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.1 Code Changes
- Description
Enforce branch protection on the default and main branch.
- Audit Procedure
Perform the following to ensure branch protection is enforced on the main branch:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Under Branch protection rules, verify that there is a rule applied to the "main" or default branch.
- Assessment Status
Manual
- Rationale Statement
The default or main branch of repositories is considered very important, as it is eventually gets deployed to the production. Therefore it needs protection. By enforcing branch protection rules on this branch, it is secured from unwanted or unauthorized changes. It can also be protected from untested and unreviewed changes and more.
- Remediation Procedure
Perform the following to enforce branch protection on the main branch:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Code and automation" section of the sidebar, click Branches.
- Next to "Branch protection rules", click Add rule.
- Under "Branch name pattern", type the branch name or pattern you want to protect. Ensure it applies to the main branch name.
- Configure policies you want.
- Click Create.
1.2.1A SECURITY.md file is a security policy file that offers instruction on reporting security vulnerabilities in a project. When someone creates an issue within a specific project, a link to the SECURITY.md file will subsequently be shown.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.2 Repository Management
- Description
A SECURITY.md file is a security policy file that offers instruction on reporting security vulnerabilities in a project. When someone creates an issue within a specific project, a link to the SECURITY.md file will subsequently be shown.
- Audit Procedure
Verify that each public repository has a SECURITY.md file by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under the repository name, click Security.
- Verify that Security policy is enabled.
- Assessment Status
Manual
- Rationale Statement
A SECURITY.md file provides users with crucial security information. It can also serve an important role in project maintenance, encouraging users to think ahead about how to properly handle potential security issues, updates, and general security practices.
- Remediation Procedure
Enforce that each public repository has a SECURITY.md file by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under the repository name, click Security.
- In the left sidebar, click Security policy.
- Click Start setup.
- In the new SECURITY.md file, add information about supported versions of your project and how to report a vulnerability.
- At the bottom of the page, type a commit message.
- Below the commit message fields, choose to create a new branch for your commit and then create a pull request.
- Click Propose file change.
1.2.2Limit the ability to create repositories to trusted users and teams.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.2 Repository Management
- Description
Limit the ability to create repositories to trusted users and teams.
- Audit Procedure
Verify that only trusted users and teams can create repositories by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Access" section of the sidebar, click Member privileges.
- Under "Repository creation", ensure that Public and Private are not checked. This means only owners are able to create repositories.
- Impact Statement
Specific users will not be permitted to create repositories.
- Assessment Status
Manual
- Rationale Statement
Restricting repository creation to trusted users and teams is recommended in order to keep the organization properly structured, track fewer items, prevent impersonation, and to not overload the version-control system. It will allow administrators easier source code tracking and management capabilities, as they will have fewer repositories to track. The process of detecting potential attacks also becomes far more straightforward, as well, since the easier it is to track the source code, the easier it is to detect malicious acts within it. Additionally, the possibility of a member creating a public repository and sharing the organization's data externally is significantly decreased.
- Remediation Procedure
Restrict repository creation to trusted users and teams only by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Access" section of the sidebar, click Member privileges.
- Under "Repository creation", unselect both options - Public and Private.
- Click Save.
1.2.3Ensure only a limited number of trusted users can delete repositories.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.2 Repository Management
- Description
Ensure only a limited number of trusted users can delete repositories.
- Default Value
Only organization owners or members with admin privileges can delete repositories.
- Audit Procedure
Verify that only a limited number of trusted users can delete repositories by performing either of the following steps:
If Your organizations > Settings > Access > Member privileges > Allow members to delete or transfer repositories for this organization is selected, verify that every admin member is trusted by you:
- In every repository, on GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings and then in the "Access" section of the sidebar, click Collaborators & teams.
- Under "Manage access" use the dropdown Role menu to filter and search for admin members. Verify that there are only two of them and that they are trusted and qualified.
If it is not selected, verify that every organization owner is trusted by you:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click the name of your organization and under your organization name, click People.
- You will see a list of the people in your organization. Click Role and select Owners. Verify that there are only a few of them and that they are trusted and qualified.
In any case, only members with administrator or organization owner privileges can delete repositories, regardless of your setting.
- Impact Statement
Certain users will not be permitted to delete repositories.
- Assessment Status
Manual
- Rationale Statement
Restricting the ability to delete repositories protects the organization from intentional and unintentional data loss. This ensures that users cannot delete repositories or cause other potential damage — whether by accident or due to their account being hacked — unless they have the correct privileges.
- Remediation Procedure
Enforce repository deletion by a few trusted and responsible users only by performing either of the following steps:
If Your organizations > Settings > Access > Member privileges > Allow members to delete or transfer repositories for this organization is selected, allow only trusted members to have admin privileges:
- In every repository, on GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings and then in the "Access" section of the sidebar, click Collaborators & teams.
- Under "Manage access" use the dropdown Role menu to filter and search for admin members. Change their role by clicking the Role dropdown next to the username until there are only two trusted and qualified users with admin privileges.
If it is not selected, allow only trusted users to become an organization owner:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click the name of your organization and under your organization name, click People.
- You will see a list of the people in your organization. Click Role and select Owners. Check every member you want to change permissions to. Above the list of members, use the drop-down menu and click Change role and choose Member > change role. Do that until there are only a few trusted and qualified users with organization owner privileges.
In any case, only members with administrator or organization owner privileges can delete repositories, regardless of your setting.
1.2.4Ensure only trusted and responsible users can delete issues.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.2 Repository Management
- Description
Ensure only trusted and responsible users can delete issues.
- Default Value
Only organization owners or members with admin privileges can delete issues.
- Audit Procedure
Verify that only a limited number of trusted users can delete issues by performing either of the following steps:
If Your organizations > Settings > Access > Member privileges > Allow members to delete issues for this organization is selected, verify that every admin member is trusted by you:
- In every repository, on GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings and then in the "Access" section of the sidebar, click Collaborators & teams.
- Under "Manage access" use the dropdown Role menu to filter and search for admin members. Verify that there are only two of them and that they are trusted and qualified.
If it is not selected, verify that every organization owner is trusted by you:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click the name of your organization and under your organization name, click People.
- You will see a list of the people in your organization. Click Role and select Owners. Verify that there are only a few of them and that they are trusted and qualified.
In any case, only members with administrator or organization owner privileges can delete issues, regardless of your setting.
- Impact Statement
Certain users will not be permitted to delete issues.
- Assessment Status
Manual
- Rationale Statement
Issues are a way to keep track of things happening in repositories, such as setting new milestones or requesting urgent fixes. Deleting an issue is not a benign activity, as it might harm the development workflow or attempt to hide malicious behavior. Because of this, it should be restricted and allowed only by trusted and responsible users.
- Remediation Procedure
Restrict issue deletion to a few trusted and responsible users only by performing either of the following steps:
If Your organizations > Settings > Access > Member privileges > Allow members to delete issues for this organization is selected, allow only trusted members to have admin privileges:
- In every repository, on GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings and then in the "Access" section of the sidebar, click Collaborators & teams.
- Under "Manage access" use the dropdown Role menu to filter and search for admin members. Change their role by clicking the Role dropdown next to the username until there are only two trusted and qualified users with admin privileges.
If it is not selected, allow only trusted users to become an organization owner:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click the name of your organization and under your organization name, click People.
- You will see a list of the people in your organization. Click Role and select Owners. Check every member you want to change permissions to. Above the list of members, use the drop-down menu and click Change role and choose Member > change role. Do that until there are only a few trusted and qualified users with organization owner privileges.
In any case, only members with administrator or organization owner privileges can delete issues, regardless of your setting.
1.2.5Track every fork of code and ensure it is accounted for.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.2 Repository Management
- Description
Track every fork of code and ensure it is accounted for.
- Audit Procedure
Verify that the following steps are done regularly to track and examine forks:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Insights.
- In the left sidebar, click Forks.
- Examine the forks listed there.
- Impact Statement
Disabling forks completely may slow down the development process as more actions will be necessary to take in order to fork a repository.
- Assessment Status
Manual
- Rationale Statement
A fork is a copy of a repository. On top of being a plain copy, any updates to the original repository itself can be pulled and reflected by the fork under certain conditions. A large number of repository copies (forks) become difficult to manage and properly secure. New and sensitive changes can often be pushed into a critical repository without developer knowledge of an updated copy of the very same repository. If there is no limit on doing this, then it is recommended to track and delete copies of organization repositories as needed.
- Remediation Procedure
Track forks and examine them by performing the following on a regular basis:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Insights.
- In the left sidebar, click Forks.
- Examine the forks listed there.
1.2.6Ensure every change in visibility of projects is tracked.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.2 Repository Management
- Description
Ensure every change in visibility of projects is tracked.
- Audit Procedure
Ensure that every change in project visibility is tracked and investigated, by performing the following regularly:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Archives" section of the sidebar, click Logs, then click Audit log.
- Use the repo qualifier in your query and look for access category. Ensure every change is reasonable and secure and is investigated if it is not.
- Assessment Status
Manual
- Rationale Statement
Visibility of projects determines who can access a project and/or fork it: anyone, designated users, or only members of the organization. If a private project becomes public, this may point to a potential attack, which can ultimately lead to data loss, the leaking of sensitive information, and finally to a supply chain attack. It is crucial to track these changes in order to prevent such incidents.
- Remediation Procedure
Track every change in project visibility and investigate if suspicious behavior occurs, by performing the following regularly:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Archives" section of the sidebar, click Logs, then click Audit log.
- Use the repo qualifier in your query and look for access category. Ensure every change is reasonable and secure and investigate if it is not.
1.2.7Track inactive repositories and remove them periodically.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.2 Repository Management
- Description
Track inactive repositories and remove them periodically.
- Audit Procedure
Perform the following to ensure that all the repositories in the organization are active, and those that are not reviewed or archived:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click on your organization name and then on repositories.
- Ensure every repository listed has been active in the last 3 to 6 months. If it's not, then ensure it is archived or reviewed regularly.
- Impact Statement
Bug fixes and deployment of necessary changes could prove complicated for archived repositories.
- Assessment Status
Manual
- Rationale Statement
Inactive repositories (i.e., no new changes introduced for a long period of time) can enlarge the surface of a potential attack or data leak. These repositories are more likely to be improperly managed, and thus could possibly be accessed by a large number of users in an organization.
- Remediation Procedure
Perform the following to review all inactive repositories and archive them periodically:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click on your organization name and then on repositories.
- Ensure every repository listed has been active in the last 3 to 6 months. Every repository that isn't active you should either review or archive by performing the next steps:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- Under "Danger Zone", click Archive this repository.
- Read the warnings.
- Type the name of the repository you want to archive.
- Click I understand the consequences, archive this repository.
1.3.1Track inactive user accounts and periodically remove them.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Track inactive user accounts and periodically remove them.
- Audit Procedure
If you have GitHub Enterprise Cloud, perform the following:
- In the top-right corner of GitHub.com, click your profile photo, then click Your enterprises.
- In the list of enterprises, click the enterprise you want to view.
- In the enterprise account sidebar, click Compliance.
- To download your Dormant Users (beta) report as a CSV file, under "Other", click Download.
- Verify that there are no users listed.
- Assessment Status
Manual
- Rationale Statement
User accounts that have been inactive for a long period of time are enlarging the surface of attack. Inactive users with high-level privileges are of particular concern, as these accounts are more likely to be targets for attackers. This could potentially allow access to large portions of an organization should such an attack prove successful. It is recommended to remove them as soon as possible in order to prevent this.
- Remediation Procedure
If you have GitHub Enterprise Cloud, perform the following:
- In the top-right corner of GitHub.com, click your profile photo, then click Your enterprises.
- In the list of enterprises, click the enterprise you want to view.
- In the enterprise account sidebar, click Compliance.
- To download your Dormant Users (beta) report as a CSV file, under "Other", click Download.
- Find the users listed in the file under Your organizations > your organization > People and select them.
- Click Remove from organization and Remove members.
1.3.2Limit ability to create teams to trusted and specific users.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Limit ability to create teams to trusted and specific users.
- Audit Procedure
For every organization, ensure that team creation is limited to specific, trusted users by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Access" section of the sidebar, click Member privileges.
- Under "Team creation rules", verify that Allow members to create teams is not selected.
- Impact Statement
Only specific users will be able to create new teams.
- Assessment Status
Manual
- Rationale Statement
The ability to create new teams should be restricted to specific members in order to keep the organization orderly and ensure users have access to only the lowest privilege level necessary. Teams typically inherit permissions from their parent team, thus if base permissions are less restricted and any user has the ability to create a team, a permission leverage could occur in which certain data is made available to users who should not have access to it. Such a situation could potentially lead to the creation of shadow teams by an attacker. Restricting team creation will also reduce additional clutter in the organizational structure, and as a result will make it easier to track changes and anomalies.
- Remediation Procedure
For every organization, limit team creation to specific, trusted users by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Access" section of the sidebar, click Member privileges.
- Under "Team creation rules", deselect Allow members to create teams.
- Click Save.
1.3.3Ensure the organization has a minimum number of administrators.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Ensure the organization has a minimum number of administrators.
- Audit Procedure
Verify the minimum number of administrators in your organization by performing the following:
- In the top right corner of GitHub, click your profile photo, then click Your profile.
- On the left side of your profile page, under "Organizations", click the icon for your organization.
- Under your organization name, click People.
- In the Role drop-down, choose Owners.
- If there are minimum number of members in the list, you are compliant.
- Assessment Status
Manual
- Rationale Statement
Organization administrators have the highest level of permissions, including the ability to add/remove collaborators, create or delete repositories, change branch protection policy, and convert to a publicly-accessible repository. Due to the permissive access granted to an organization administrator, it is highly recommended to keep the number of administrator accounts as minimal as possible.
- Remediation Procedure
Set the minimum number of administrators in your organization by performing the following:
- In the top right corner of GitHub, click your profile photo, then click Your profile.
- On the left side of your profile page, under "Organizations", click the icon for your organization.
- Under your organization name, click People.
- In the Role drop-down, choose Owners.
- Select the person or people you'd like to remove from owner role.
- Above the list of members, use the drop-down menu and click Change role.
- Select Member, then click Change role.
1.3.4Require collaborators from outside the organization to use Multi-Factor Authentication (MFA) in addition to a standard user name and password when authenticating to the source code management platform.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Require collaborators from outside the organization to use Multi-Factor Authentication (MFA) in addition to a standard user name and password when authenticating to the source code management platform.
- Audit Procedure
For each repository in use, verify that Multi-Factor Authentication is enforced for contributors and is the only way to authenticate, by doing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- Under "Authentication", check if Require two-factor authentication for everyone in your organization is checked. If so, you are compliant.
- Impact Statement
A member without enabled Multi-Factor Authentication cannot contribute to the project. They must enable Multi-Factor Authentication a before they can contribute any code.
- Assessment Status
Manual
- Rationale Statement
By default every user authenticates within the system by password only. If the password of a user is compromised, however, the user account and every repository to which they have access are in danger of data loss, malicious code commits, and data theft. It is therefore recommended that each user has Multi-Factor Authentication enabled. This adds an additional layer of protection to ensure the account remains secure even if the user's password is compromised.
- Remediation Procedure
For each repository in use, enforce Multi-Factor Authentication is the only way to authenticate for contributors, by doing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- Under "Authentication", select Require two-factor authentication for everyone in your organization, then click Save.
1.3.5Require members of the organization to use Multi-Factor Authentication (MFA) in addition to a standard user name and password when authenticating to the source code management platform.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Require members of the organization to use Multi-Factor Authentication (MFA) in addition to a standard user name and password when authenticating to the source code management platform.
- Audit Procedure
For every organization that exists in your GitHub platform, verify that Multi-Factor Authentication is enforced and is the only way to authenticate, by doing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- Under "Authentication", check if Require two-factor authentication for everyone in your organization is checked. If so, you are compliant.
- Impact Statement
Members will be removed from the organization if they don't have Multi-Factor Authentication already enabled. If this is the case, it is recommended that an invitation be sent to reinstate the user's access and former privileges. They must enable Multi-Factor Authentication to accept the invitation.
- Assessment Status
Manual
- Rationale Statement
By default every user authenticates within the system by password only. If the password of a user is compromised, however, the user account and every repository to which they have access are in danger of data loss, malicious code commits, and data theft. It is therefore recommended that each user has Multi-Factor Authentication enabled. This adds an additional layer of protection to ensure the account remains secure even if the user's password is compromised.
- Remediation Procedure
For every organization that exists in your GitHub platform, enforce Multi-Factor Authentication and define it as the only way to authenticate, by doing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- Under "Authentication", select Require two-factor authentication for everyone in your organization, then click Save.
- If prompted, read the information about members and outside collaborators who will be removed from the organization. Type your organization's name to confirm the change, then click Remove members & require two-factor authentication.
1.3.6Existing members of an organization can invite new members to join, however new members must only be invited with their company-approved email.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Existing members of an organization can invite new members to join, however new members must only be invited with their company-approved email.
- Audit Procedure
For each organization in use, verify for every invitation that the invited email address is company-approved by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click the name of your organization and under your organization name, click People.
- On the People tab, click Invitations. Verify that each invitation email is company approved by your company.
- Impact Statement
Existing members would not be able to invite new users who do not have a company-approved email address.
- Assessment Status
Manual
- Rationale Statement
Ensuring new members of an organization have company-approved email prevents existing members of the organization from inviting arbitrary new users to join. Without this verification, they can invite anyone who is using the organization's version control system or has an active email account, thus allowing outside users (and potential threat actors) to easily gain access to company private code and resources. This practice will subsequently reduce the chance of human error or typos when inviting a new member.
- Remediation Procedure
For each organization, allow only users with company-approved email to be invited. If a user was invited without company-approved email, perform the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Click the name of your organization and under your organization name, click People.
- On the People tab, click Invitations. Next to the username or email address of the person whose invitation you'd like to cancel, click Edit invitation.
- To cancel the user's invitation to join your organization, click Cancel invitation.
1.3.7Ensure every repository has two users with administrative permissions.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Ensure every repository has two users with administrative permissions.
- Audit Procedure
For every repository in use, verify there are two administrators by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Access" section of the sidebar, click Collaborators & teams.
- Under Manage access, verify that there are only 2 members with Admin permission.
- Impact Statement
Removing administrative users from a repository would result in them losing high-level access to that repository.
- Assessment Status
Manual
- Rationale Statement
Repository administrators have the highest permissions to said repository. These include the ability to add/remove collaborators, change branch protection policy, and convert to a publicly-accessible repository. Due to the liberal access granted to a repository administrator, it is highly recommended that only two contributors occupy this role.
- Remediation Procedure
For every repository in use, set two administrators by performing the following:
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Access" section of the sidebar, click Collaborators & teams.
- Under Manage access, find the team or person whose you'd like to revoke admin permissions, then select the Role drop-down and click a new role.
1.3.8Base permissions define the permission level automatically granted to all organization members. Define strict base access permissions for all of the repositories in the organization, including new ones.1
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Base permissions define the permission level automatically granted to all organization members. Define strict base access permissions for all of the repositories in the organization, including new ones.
- Default Value
Read permission
- Audit Procedure
Verify that strict base permissions are set for the organization repositories by doing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Access" section of the sidebar, click Member privileges.
- Under "Base permissions", verify that it is set to "Read" or "None". If it does, you are compliant.
- Impact Statement
Users might not be able to access organization repositories or perform some acts as commits. These specific permissions should be granted individually for each user or team, as needed.
- Assessment Status
Manual
- Rationale Statement
Defining strict base permissions is the best practice in every role-based access control (RBAC) system. If the base permission is high — for example, "write" permission — every member of the organization will have "write" permission to every repository in the organization. This will apply regardless of the specific permissions a user might need, which generally differ between organization repositories. The higher the permission, the higher the risk for incidents such as bad code commit or data breach. It is therefore recommended to set the base permissions to the strictest level possible.
- Remediation Procedure
Set strict base permissions for the organization repositories with the next steps:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Access" section of the sidebar, click Member privileges.
- Under "Base permissions", use the drop-down to select new base permissions - "Read" or "None".
- Review the changes. To confirm, click Change default permission to PERMISSION.
1.3.9Confirm the domains an organization owns with a "Verified" badge.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Confirm the domains an organization owns with a "Verified" badge.
- Audit Procedure
Only if you have an enterprise account, view the enterprise organization profile page and ensure it has a "Verified" badge in it.
- Assessment Status
Manual
- Rationale Statement
Verifying the organization's domain gives developers assurance that a given domain is truly the official home for a public organization. Attackers can pretend to be an organization and steal information via a faked/spoof domain, therefore the use of a "Verified" badge instills more confidence and trust between developers and the open-source community.
- Remediation Procedure
Only if you have an enterprise account, verify the organization's domains and secure a "Verified" badge next to its name by performing the following:
- In the top-right corner of GitHub.com, click your profile photo, then click Your enterprises.
- In the list of enterprises, click the enterprise you want to view. Then in the enterprise account sidebar, click Settings.
- Under "Settings", click Verified & approved domains.
- Click Add a domain.
- In the domain field, type the domain you'd like to verify, then click Add domain.
- Follow the instructions under Add a DNS TXT record to create a DNS TXT record with your domain hosting service. Wait for your DNS configuration to change, which may take up to 72 hours. You can confirm your DNS configuration has changed by running the
digcommand on the command line, replacing ENTERPRISE-ACCOUNT with the name of your enterprise account, and example.com with the domain you'd like to verify. You should see your new TXT record listed in the command output.
dig _github-challenge-ENTERPRISE-ACCOUNT.DOMAIN-NAME +nostats +nocomments +nocmd TXT- After confirming your TXT record is added to your DNS, follow steps one through three above to navigate to your enterprise account's approved and verified domains.
- To the right of the domain that's pending verification, click the 3-dots, then click Continue verifying. Click Verify.
- Optionally, after the "Verified" badge is visible on your organizations' profiles, delete the TXT entry from the DNS record at your domain hosting service.
1.3.10Restrict the Source Code Management (SCM) organization's email notifications to approved domains only.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Restrict the Source Code Management (SCM) organization's email notifications to approved domains only.
- Audit Procedure
Only if you have an enterprise account, ensure Source Code Management email notifications are restricted to approved domains only by performing the following:
- In the top-right corner of GitHub.com, click your profile photo, then click Your enterprises.
- In the list of enterprises, click the enterprise you want to view. Then in the enterprise account sidebar, click Settings.
- Under "Settings", click Verified & approved domains.
- Under "Notification preferences", verify that Restrict email notifications to only approved or verified domains is selected.
- Impact Statement
Only members with approved email would be able to receive Source Code Management notifications.
- Assessment Status
Manual
- Rationale Statement
Restricting Source Code Management email notifications to verified domains only prevents data leaks, as personal emails and custom domains are more prone to account takeover via DNS hijacking or password breach.
- Remediation Procedure
Only if you have an enterprise account, restrict Source Code Management email notifications to approved domains only by performing the following:
- In the top-right corner of GitHub.com, click your profile photo, then click Your enterprises.
- In the list of enterprises, click the enterprise you want to view. Then in the enterprise account sidebar, click Settings.
- Under "Settings", click Verified & approved domains.
- Under "Notification preferences", select Restrict email notifications to only approved or verified domains.
- Click Save.
1.3.11As an organization, become an SSH Certificate Authority and provide SSH keys for accessing repositories.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
As an organization, become an SSH Certificate Authority and provide SSH keys for accessing repositories.
- Audit Procedure
Only if you have an enterprise account, verify that the enterprise organization has an SSH Certificate Authority server and provides an SSH certificate with which to sign keys by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- Verify that there's an SSH certificate authority listed there.
- Impact Statement
Members with unverified keys will not be able to clone organization repositories. Signing, certification, and verification might also slow down the development process.
- Assessment Status
Manual
- Rationale Statement
There are two ways for remotely working with Source Code Management: via HTTPS, which requires authentication by user/password, or via SSH, which requires the use of SSH keys. SSH authentication is better in terms of security; key creation and distribution, however, must be done in a secure manner. This can be accomplished by implementing SSH certificates, which are used to validate the server's identity. A developer will not be able to connect to a Git server if its key cannot be verified by the SSH Certificate Authority (CA) server. As an organization, one can verify the SSH certificate signature used to authenticate if a CA is defined and used. This ensures that only verified developers can access organization repositories, as their SSH key will be the only one signed by the CA certificate. This reduces the risk of misuse and malicious code commits.
- Remediation Procedure
Only if you have an enterprise account, deploy an SSH Certificate Authority server and configure it to provide an SSH certificate with which to sign keys by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- To the right of "SSH Certificate Authorities", click New CA.
- Under "Key," paste your public SSH key.
- Click Add CA.
- Click Save.
1.3.12Limit Git access based on IP addresses by having a allowlist of IP addresses from which connection is possible.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Limit Git access based on IP addresses by having a allowlist of IP addresses from which connection is possible.
- Audit Procedure
Only if you have an enterprise account, in every organization of yours, ensure access is allowed only by IP allowlist, and that access is forbidden for all other IPs by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- Verify that there's an IP address, or a range of addresses in CIDR notation listed. Also verify that Enable IP allow list is selected.
- Impact Statement
Only members with allowlisted IP addresses will be able to access the organization's Git repositories.
- Assessment Status
Manual
- Rationale Statement
Allowing access to Git repositories (source code) only from specific IP addresses adds yet another layer of restriction and reduces the risk of unauthorized connection to the organization's assets. This will prevent attackers from accessing Source Code Management (SCM), as they would first need to know the allowed IP addresses to gain access to them.
- Remediation Procedure
Only if you have an enterprise account, create an IP allowlist and forbid all other IPs from accessing the source code by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Security" section of the sidebar, click Authentication security.
- At the bottom of the "IP allow list" section, enter an IP address, or a range of addresses in CIDR notation. Optionally, enter a description of the allowed IP address or range.
- Click Add.
- After that, under "IP allow list", select Enable IP allow list.
- Click Save.
1.3.13Track code anomalies.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.3 Contribution Access
- Description
Track code anomalies.
- Audit Procedure
For every repository in use, ensure code anomalies relevant to the organization are promptly investigated.
- Assessment Status
Manual
- Rationale Statement
Carefully analyze any code anomalies within the organization. For example, a code anomaly could be a push made outside of working hours. Such a code push has a higher likelihood of being the result of an attack, as most if not all members of the organization would likely be outside the office. Another example is an activity that exceeds the average activity of a particular user. Tracking and auditing such behaviors creates additional layers of security and can aid in early detection of potential attacks.
- Remediation Procedure
For every repository in use, track and investigate anomalous code behavior and activity.
1.4.1Ensure an administrator approval is required when installing applications.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.4 Third-Party
- Description
Ensure an administrator approval is required when installing applications.
- Default Value
Maintainers are organization owners.
- Audit Procedure
Verify that applications are installed only after receiving administrator approval:
a. For GitHub Apps, you are compliant by default. That is because by default only organization owners and administrators can install them.
b. For OAuth Apps, perform the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Third-party Access" section of the sidebar, click OAuth application policy.
- Under "Third-party application access policy" verify that the policy status is Access restricted.
- Impact Statement
Applications will not be installed without administrator approval.
- Assessment Status
Manual
- Rationale Statement
Applications are typically automated integrations that improve the workflow of an organization. They are written by third-party developers, and therefore should be validated before using in case they're malicious or not trustable. Because administrators are expected to be the most qualified and trusted members of the organization, they should review the applications being installed and decide whether they are both trusted and necessary.
- Remediation Procedure
Require an administrator approval for every installed application:
a. For GitHub Apps, you are compliant by default. That is because by default only organization owners and administrators can install them.
b. For OAuth Apps, perform the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Third-party Access" section of the sidebar, click OAuth application policy.
- Under "Third-party application access policy", click Setup application access restrictions.
- After you review the information about third-party access restrictions, click Restrict third-party application access.
1.4.2Ensure stale (inactive) applications are reviewed and removed if no longer in use.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.4 Third-Party
- Description
Ensure stale (inactive) applications are reviewed and removed if no longer in use.
- Audit Procedure
Verify that all the applications in the organization are actively used, and remove those that are no longer in use.
- Assessment Status
Manual
- Rationale Statement
Applications that have been inactive for a long period of time are enlarging the surface of attack for data leaks. They are more likely to be improperly managed, and could possibly be accessed by third-party developers as a tool for collecting internal data of the organization or repository in which they are installed. It is important to remove these inactive applications as soon as possible.
- Remediation Procedure
Review all stale applications and periodically remove them.
1.4.3Ensure installed application permissions are limited to the lowest privilege level required.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.4 Third-Party
- Description
Ensure installed application permissions are limited to the lowest privilege level required.
- Audit Procedure
Verify that each installed application has the least privilege needed:
a. For GitHub Apps, perform the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Integrations" section of the sidebar, click GitHub Apps.
- Next to every GitHub App, click Configure.
- Review the GitHub App's permissions and repository access. Verify that the App permissions are the least possible and that it can access only necessary repositories.
- Assessment Status
Manual
- Rationale Statement
Applications are typically automated integrations that can improve the workflow of an organization. They are written by third-party developers, and therefore should be reviewed carefully before use. It is recommended to use the "least privilege" principle, granting applications the lowest level of permissions required. This may prevent harm from a potentially malicious application with unnecessarily high-level permissions leaking data or modifying source code.
- Remediation Procedure
Grant permissions to applications by the "least privilege" principle, meaning the lowest possible permission necessary:
a. For GitHub Apps, perform the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the "Integrations" section of the sidebar, click GitHub Apps.
- Next to every GitHub App, click Configure.
- Review the GitHub App's permissions and repository access. Edit the permissions granted to the least possible. For example, restrict the number of repositories the App can access.
- Click Save.
1.4.4Use only secured webhooks in the source code management platform.0
Attributes
- Profile
Level 1
- Section
1 Source Code
- Subsection
1.4 Third-Party
- Description
Use only secured webhooks in the source code management platform.
- Audit Procedure
Perform the following to secure all webhooks used(over HTTPS):
- Navigate to your organization or repository and select Settings.
- Select Webhooks on the side menu.
- Ensure all webhooks starts with 'https'.
- Impact Statement
Perform the following to ensure all webhooks used are secured (HTTPS):
- Navigate to your organization or repository and select Settings.
- Select Webhooks on the side menu.
- Verify that each webhook URL starts with 'https'.
- Assessment Status
Manual
- Rationale Statement
A webhook is an event listener, attached to critical and sensitive parts of the software delivery process. It is triggered by a list of events (such as a new code being committed), and when triggered, the webhook sends out a notification with some payload to specific internet endpoints. Since the payload of the webhook contains sensitive organization data, it's important all webhooks are directed to an endpoint (URL) protected by SSL verification (HTTPS). This helps ensure that the data sent is delivered to securely without any man-in-the-middle, who could easily access and even alter the payload of the request.
- Remediation Procedure
Perform the following to secure all webhooks used(over HTTPS):
- Navigate to your organization or repository and select Settings.
- Select Webhooks on the side menu.
- Find the webhooks that starts with 'http' and not 'https'.
- Ensure the endpoint (URL) of the webhook listens to secured port (443) and uses certificate.
- Click Edit.
- Change the payload URL to https and ensure Enable SSL verification is checked.
- Click Update webhook.
1.5.1Detect and prevent sensitive data in code, such as confidential ID numbers, passwords, etc.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.5 Code Risks
- Description
Detect and prevent sensitive data in code, such as confidential ID numbers, passwords, etc.
- Audit Procedure
For every repository in use, verify that scanners are set to identify and prevent the existence of sensitive data in code by performing the following (enterprise only):
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Security" section of the sidebar, click Code security and analysis.
- Scroll down to the bottom of the page. If you see a Disable button, it means that secret scanning is already enabled for the repository.
- Assessment Status
Manual
- Rationale Statement
Having sensitive data in the source code makes it easier for attackers to maliciously use such information. In order to avoid this, designate scanners to identify and prevent the existence of sensitive data in the code.
- Remediation Procedure
For every repository in use, designate scanners to identify and prevent sensitive data in code by performing the following (enterprise only):
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the "Security" section of the sidebar, click Code security and analysis.
- Scroll down to the bottom of the page and click Enable for secret scanning.
- Additional Information
By January 2023, this feature is supposed to be open to all plans. Until then it is only for enterprise users.
1.5.2Detect and prevent misconfigurations and insecure instructions in CI pipelines0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.5 Code Risks
- Description
Detect and prevent misconfigurations and insecure instructions in CI pipelines
- Audit Procedure
Verify that a CI instructions scanning tool is set to identify and prevent misconfigurations and insecure instructions and that it scans all CI pipelines.
- Assessment Status
Manual
- Rationale Statement
Detecting and fixing misconfigurations or insecure instructions in CI pipelines decreases the risk for a successful attack through or on the CI pipeline. The more secure the pipeline, the less risk there is for potential exposure of sensitive data, a deployment being compromised, or external access mistakenly being granted to the CI infrastructure or the source code.
- Remediation Procedure
Set a CI instructions scanning tool to identify and prevent misconfigurations and insecure instructions and scans all CI pipelines.
1.5.3Detect and prevent misconfigurations or insecure instructions in Infrastructure as Code (IaC) files, such as Terraform files.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.5 Code Risks
- Description
Detect and prevent misconfigurations or insecure instructions in Infrastructure as Code (IaC) files, such as Terraform files.
- Audit Procedure
For every repository that holds IaC instructions files, verify that a scanning tool is set to identify and prevent misconfigurations and insecure instructions.
- Assessment Status
Manual
- Rationale Statement
Detecting and fixing misconfigurations and/or insecure instructions in IaC (Infrastructure as Code) files decreases the risk for data leak or data theft. It is important to secure IaC instructions in order to prevent further problems of deployment, exposed assets, or improper configurations, which can ultimately lead to easier ways to attack and steal organization data.
- Remediation Procedure
For every repository that holds IaC instructions files, set a scanning tool to identify and prevent misconfigurations and insecure instructions.
1.5.4Detect and prevent known open source vulnerabilities in the code.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.5 Code Risks
- Description
Detect and prevent known open source vulnerabilities in the code.
- Audit Procedure
For every repository that is in use, verify that a scanning tool is set to identify and prevent code vulnerabilities by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under the repository name, click Security.
- Verify that "Code scanning alerts" is Enabled or that there is a workflow that scans your code.
- Assessment Status
Manual
- Rationale Statement
Open source code blocks are used a lot in developed software. This has its own advantages, but it also has risks. Because the code is open for everyone, it means that attackers can publish or add malicious code to these open-source code blocks, or use their knowledge to find vulnerabilities in an existing code. Detecting and fixing such code vulnerabilities, by SCA (Software Composition Analysis) prevents insecure flaws from reaching production. It gives another opportunity for developers to secure the source code before it is deployed in production, where it is far more exposed and vulnerable to attacks.
- Remediation Procedure
For every repository that is in use, set a scanning tool to identify and prevent code vulnerabilities by performing the following:
- On GitHub.com, navigate to the main page of the repository.
- Under the repository name, click Security.
- To the right of "Code scanning alerts", click Set up code scanning.
- Under "Get started with code scanning", click Set up this workflow on a workflow of your choice.
- To customize how code scanning scans your code, edit the workflow.
- Use the Start commit drop-down and type a commit message.
- Choose whether you'd like to commit directly to the default branch or create a new branch and start a pull request.
- Click Commit new file or Propose new file.
- Additional Information
All public repositories in all plans can use code scanning in GitHub. In private repositories, only GitHub Enterprise can use code scanning.
1.5.5Detect, prevent and monitor known open-source vulnerabilities in packages that are being used.1
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.5 Code Risks
- Description
Detect, prevent and monitor known open-source vulnerabilities in packages that are being used.
- Audit Procedure
Verify that scanners are set to monitor, identify, and prevent open-source vulnerabilities in packages by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings. In the "Security" section of the sidebar, click Code security and analysis.
- Verify that the Dependabot alerts is enabled and that Enable by default for new repositories is checked.
It is also recommended to verify that you're using another additional solution for package scanning because GitHub doesn't always recognize the vulnerabilities.
- Assessment Status
Manual
- Rationale Statement
Open-source vulnerabilities might exist before one starts to use a package, but they are also discovered over time. New attacks and vulnerabilities are announced every now and then. It is important to keep track of these and to monitor whether the dependencies used are affected by the recent vulnerability. Detecting and fixing those packages' vulnerabilities decreases the attack surface within deployed and running applications that use such packages. It prevents security flaws from reaching the production environment which could eventually lead to a security breach.
- Remediation Procedure
Set scanners that will monitor, identify, and prevent open-source vulnerabilities in packages by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings. In the "Security" section of the sidebar, click Code security and analysis.
- Under "Code security and analysis", to the right of Dependabot alerts, click Disable all or Enable all.
- Check the Enable by default for new repositories option and then click Enable Dependabot alerts.
It is also recommended to use another additional solution for package scanning because GitHub doesn't always recognize the vulnerabilities.
1.5.6Detect open-source license problems in used dependencies and fix them.0
Attributes
- Profile
Level 2
- Section
1 Source Code
- Subsection
1.5 Code Risks
- Description
Detect open-source license problems in used dependencies and fix them.
- Audit Procedure
Ensure a license scanning tool is set up to identify open-source license problems and that every package you use is scanned by it.
- Assessment Status
Manual
- Rationale Statement
A software license is a legal document that establishes several key conditions between a software company or developer and a user in order to allow the use of software. Software licenses have the potential to create code dependencies. Not following the conditions in the software license can also lead to lawsuits. When using packages with a software license, especially commercial ones (which are the most permissive), it is important to verify what is allowed by that license in order to be protected against lawsuits.
- Remediation Procedure
Designate a license scanning tool to identify open-source license problems and fix them and scan every package you use.
2 Build Pipelines330
2.1.1Ensure each pipeline has a single responsibility in the build process.0
Attributes
- Profile
Level 2
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Ensure each pipeline has a single responsibility in the build process.
- Audit Procedure
For each pipeline, ensure it has only one responsibility in the build process.
- Assessment Status
Manual
- Rationale Statement
Build pipelines generally have access to multiple secrets depending on their purposes. There are, for example, secrets of the test environment for the test phase, repository and artifact credentials for the build phase, etc. Limiting access to these credentials/secrets is therefore recommended by dividing pipeline responsibilities, as well as having a dedicated pipeline for each phase with the lowest privilege instead of a single pipeline for all. This will ensure that any potential damage caused by attacks on a workflow will be limited.
- Remediation Procedure
Divide each multi-responsibility pipeline into multiple pipelines, each having a single responsibility with the least privilege. Additionally, create all new pipelines with a sole purpose going forward.
2.1.2Ensure the pipeline orchestrator and its configuration are immutable.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Ensure the pipeline orchestrator and its configuration are immutable.
- Audit Procedure
Verify that the pipeline orchestrator, its configuration, and all other aspects of the build environment are immutable.
- Assessment Status
Manual
- Rationale Statement
An immutable infrastructure is one that cannot be changed during execution of the pipeline. This can be done, for example, by using Infrastructure as Code for configuring the pipeline and the pipeline environment. Utilizing such infrastructure creates a more predictable environment because updates will require re-deployment to prevent any previous configuration from interfering. Because it is dependent on automation, it is easier to revert changes. Testing code is also simpler because it is based on virtualization. Most importantly, an immutable pipeline infrastructure ensures that a potential attacker seeking to compromise the build environment itself would not be able to do so if the orchestrator, its configuration, and any other component cannot be changed. Verifying that all aspects of the pipeline infrastructure and configuration are immutable therefore keeps them safe from malicious tampering attempts.
- Remediation Procedure
Use an immutable pipeline orchestrator and ensure that its configuration and all other aspects of the built environment are immutable, as well.
2.1.3Keep build logs of the build environment detailing configuration and all activity within it. Also, consider to store them in a centralized organizational log store.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Keep build logs of the build environment detailing configuration and all activity within it. Also, consider to store them in a centralized organizational log store.
- Audit Procedure
Verify that the build environment is logged and stored in a centralized organizational log store.
- Assessment Status
Manual
- Rationale Statement
Logging the environment is important for two primary reasons: one, for debugging and investigating the environment in case of a bug or security incident; and two, for reproducing the environment easily when needed. Storing these logs in a centralized organizational log store allows the organization to generate useful insights and identify anomalies in the build process faster.
- Remediation Procedure
Keep logs of the build environment. For example, use the .buildinfo file for Debian build workers. Also, store the logs in a centralized organizational log store.
2.1.4Automate the creation of the build environment.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Automate the creation of the build environment.
- Audit Procedure
Verify that the deployment of the build environment is automated and can be easily redeployed.
- Assessment Status
Manual
- Rationale Statement
Automating the deployment of the build environment reduces the risk for human mistakes — such as a wrong configuration or exposure of sensitive data — because it requires less human interaction and intervention. It also eases re-deployment of the environment. It is best to automate with Infrastructure as Code because it offers more control over changes made to the environment creation configuration and stores to a version control platform.
- Remediation Procedure
Automate the deployment of the build environment.
2.1.5Restrict access to the build environment (orchestrator, pipeline executor, their environment, etc.) to trusted and qualified users only.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Restrict access to the build environment (orchestrator, pipeline executor, their environment, etc.) to trusted and qualified users only.
- Audit Procedure
Verify each build environment is accessible only to known and authorized users.
- Impact Statement
Reducing the number of users who have access to the build process means those users would lose their ability to make direct changes to that process.
- Assessment Status
Manual
- Rationale Statement
A build environment contains sensitive data such as environment variables, secrets, and the source code itself. Any user that has access to this environment can make changes to the build process, including changes to the code within it. Restricting access to the build environment to trusted and qualified users only will reduce the risk for mistakes such as exposure of secrets or misconfiguration. Limiting access also reduces the number of accounts that are vulnerable to hijacking in order to potentially harm the build environment.
- Remediation Procedure
Restrict access to the build environment to trusted and qualified users.
2.1.6Require users to login in to access the build environment - where the orchestrator, the pipeline executer, where the build workers are running, etc.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Require users to login in to access the build environment - where the orchestrator, the pipeline executer, where the build workers are running, etc.
- Audit Procedure
Ensure authentication is required to access the build environment.
- Impact Statement
Anonymous users won't be able to access the build environment.
- Assessment Status
Manual
- Rationale Statement
Requiring users to authenticate and disabling anonymous access to the build environment allows organization to track every action on that environment, good or bad, to its actor. This will help recognizing attack and its attacker because the authentication is required.
- Remediation Procedure
Require authentication to access the build environment and disable anonymous access.
2.1.7Build tools providers offer a secure way to store secrets that should be used during the build process. These secrets will often be credentials used to access other tools, for example for pulling code or for uploading artifacts. Access to these secrets can be defined on various scopes, for example in github it could be on an organization level or a repository level and there is also control on whether these secrets are passed to forked pull request. To protect these critical assets it is important to choose the most restrictive scope necessary.0
Attributes
- Profile
Level 2
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Build tools providers offer a secure way to store secrets that should be used during the build process. These secrets will often be credentials used to access other tools, for example for pulling code or for uploading artifacts. Access to these secrets can be defined on various scopes, for example in github it could be on an organization level or a repository level and there is also control on whether these secrets are passed to forked pull request. To protect these critical assets it is important to choose the most restrictive scope necessary.
- Audit Procedure
For each build tool in use, review the secrets defined and the permission scopes they are assigned.
- Impact Statement
Increased risk of exposure of build related secrets.
- Assessment Status
Manual
- Rationale Statement
Allowing over permissive access to these secrets may affect on their exposure. For example if a secret is defined in an organization level, and users can create new repositories, there is a scenario where a user can create a new repo and run a controlled build just to exfiltrate these secrets.
- Remediation Procedure
For each build tool, review the secrets defined and their permissions scope and change over permissive scopes to more restrictive ones based on the required access.
2.1.8Scan the build infrastructure and its dependencies for vulnerabilities. It is recommended that this be done automatically.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Scan the build infrastructure and its dependencies for vulnerabilities. It is recommended that this be done automatically.
- Audit Procedure
Verify that your build infrastructure is automatically scanned for vulnerabilities.
- Assessment Status
Manual
- Rationale Statement
Automatic scanning for vulnerabilities detects known vulnerabilities in the tooling used by the build infrastructure and its dependencies. These vulnerabilities can lead to a potentially massive breach if not handled as fast as possible, as attackers might also be aware of such vulnerabilities.
- Remediation Procedure
Set an automated vulnerability scanning for your build infrastructure.
2.1.9Do not use default passwords of build tools and components.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Do not use default passwords of build tools and components.
- Audit Procedure
For each build tool, ensure the password used is not the default one.
- Assessment Status
Manual
- Rationale Statement
Sometimes build tools and components are provided with default passwords for the first login. This password is intended to be used only on the first login and should be changed immediately after. Using the default password substantially increases the attack risk. It is especially important to ensure that default passwords are not used in build tools and components.
- Remediation Procedure
For each build tool, change the default password.
2.1.10Use secured webhooks of the build environment.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Use secured webhooks of the build environment.
- Audit Procedure
For each webhook in use, ensure it is secured (HTTPS).
- Assessment Status
Manual
- Rationale Statement
Webhooks are used for triggering an HTTP request based on an action made in the platform. Typically, build environment feature webhooks for a pipeline trigger based on source code event. Since webhooks are an HTTP POST request, they can be malformed if not secured over SSL. To prevent a potential hack and compromise of the webhook or to the environment or web server excepting the request, use only secured webhooks.
- Remediation Procedure
For each webhook in use, change it to secured (over HTTPS).
2.1.11Ensure the build environment has a minimum number of administrators.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.1 Build Environment
- Description
Ensure the build environment has a minimum number of administrators.
- Audit Procedure
Verify that the build environment has only the minimum number of administrators.
- Assessment Status
Manual
- Rationale Statement
Build environment administrators have the highest level of permissions, including the ability to add/remove users, create or delete pipelines, control build workers, change build trigger permissions and more. Due to the permissive access granted to a build environment administrator, it is highly recommended to keep the number of administrator accounts as minimal as possible.
- Remediation Procedure
Set the minimum number of administrators in the build environment.
2.2.1Use a clean instance of build worker for every pipeline run.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
Use a clean instance of build worker for every pipeline run.
- Audit Procedure
Ensure that every pipeline that is being run has its own clean, new runner.
- Impact Statement
Data and cache will not be saved in different pipeline runs.
- Assessment Status
Manual
- Rationale Statement
Using a clean instance of build worker for every pipeline run eliminates the risks of data theft, data integrity breaches, and unavailability. It limits the pipeline's access to data stored on the file system from previous runs, and the cache is volatile. This prevents malicious changes from affecting other pipelines or the Continuous Integration/Continuous Delivery system itself.
- Remediation Procedure
Create a clean build worker for every pipeline that is being run, or use build platform-hosted runners, as they typically offer a clean instance for every run.
2.2.2A worker’s environment can be passed (for example, a pod in a Kubernetes cluster in which an environment variable is passed to it). It also can be pulled, like a virtual machine that is installing a package. Ensure that the environment and commands are passed to the workers and not pulled from it.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
A worker’s environment can be passed (for example, a pod in a Kubernetes cluster in which an environment variable is passed to it). It also can be pulled, like a virtual machine that is installing a package. Ensure that the environment and commands are passed to the workers and not pulled from it.
- Audit Procedure
For each build worker, ensure its environment and commands are passed and not pulled.
- Assessment Status
Manual
- Rationale Statement
Passing an environment means additional configuration happens in the build time phase and not in run time. It will also pass locally and not remotely. Passing a worker environment, instead of pulling it from an outer source, reduces the possibility for an attacker to gain access and potentially pull malicious code into it. By passing locally and not pulling from remote, there is also less chance of an attack based on the remote connection, such as a man-in-the-middle or malicious scripts that can run from remote. This therefore prevents possible infection of the build worker.
- Remediation Procedure
For each build worker, pass its environment and commands to it instead of pulling it.
2.2.3Separate responsibilities in the build workflow, such as testing, compiling, pushing artifacts, etc., to different build workers so that each worker will have a single duty.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
Separate responsibilities in the build workflow, such as testing, compiling, pushing artifacts, etc., to different build workers so that each worker will have a single duty.
- Audit Procedure
For each build worker, ensure it has the least responsibility possible, preferably only one duty.
- Assessment Status
Manual
- Rationale Statement
Separating duties and allocating them to many workers makes it easier to verify each step in the build process and ensure there is no corruption. It also limits the effect of an attack on a build worker, as such an attack would be less critical if the worker has less access and duties that are subject to harm.
- Remediation Procedure
For each build worker, limit its responsibility to one duty.
2.2.4Ensure that build workers have minimal network connectivity.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
Ensure that build workers have minimal network connectivity.
- Audit Procedure
Verify that build workers, environment, and any other components have only the required minimum of network connectivity.
- Impact Statement
Developers will not have connectivity to every resource they might need from the outside. Workers will also only be able to exchange data through shareable storage.
- Assessment Status
Manual
- Rationale Statement
Restricting the network connectivity of build workers decreases the possibility that an attacker would be capable of entering the organization from the outside. If the build workers are connected to the public internet without any restriction, it is far simpler for attackers to compromise them. Limiting network connectivity between build workers also protects the organization in case an attacker was successful and subsequently attempts to spread the attack to other components of the environment.
- Remediation Procedure
Limit the network connectivity of build workers, environment, and any other components to the necessary minimum.
2.2.5Add traces to build workers' operating systems and installed applications so that in run time, collected events can be analyzed to detect suspicious behavior patterns and malware.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
Add traces to build workers' operating systems and installed applications so that in run time, collected events can be analyzed to detect suspicious behavior patterns and malware.
- Audit Procedure
Verify that a run-time security solution is enforced on every active build worker.
- Assessment Status
Manual
- Rationale Statement
Build workers are exposed to data exfiltration attacks, code injection attacks, and more while running. It is important to secure them from such attacks by enforcing run-time security on the build worker itself. This will identify attempted attacks in real time and prevent them.
- Remediation Procedure
Deploy and enforce a run-time security solution on build workers.
2.2.6Scan build workers for vulnerabilities. It is recommended that this be done automatically.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
Scan build workers for vulnerabilities. It is recommended that this be done automatically.
- Audit Procedure
For each build worker, ensure the environmental sources it uses are scanned for vulnerabilities.
- Assessment Status
Manual
- Rationale Statement
Automatic scanning for vulnerabilities detects known weaknesses in environmental sources in use, such as docker images or kernel versions. Such vulnerabilities can lead to a massive breach if these environments are not replaced as fast as possible, since attackers also know about these vulnerabilities and often try to take advantage of them. Setting automatic scanning which scans environmental sources ensures that if any new vulnerability is revealed, it can be replaced quickly and easily. This protects the worker from being exposed to attacks.
- Remediation Procedure
For each build worker, automatically scan its environmental sources, such as docker image, for vulnerabilities.
2.2.7Store the deployment configuration of build workers in a version control platform, such as Github.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
Store the deployment configuration of build workers in a version control platform, such as Github.
- Audit Procedure
Verify that the deployment configuration of build workers is stored in a version control platform.
- Impact Statement
Changes in deployment configuration may only be applied by declaration in the version control platform. This could potentially slow down the development process.
- Assessment Status
Manual
- Rationale Statement
Build workers are a sensitive part of the build phase. They generally have access to the code repository, the Continuous Integration platform, the deployment platform, etc. This means that an attacker gaining access to a build worker may compromise other platforms in the organization and cause a major incident. One thing that can protect workers is to ensure that their deployment configuration is safe and well-configured. Storing the deployment configuration in version control enables more observability of these configurations because everything is catalogued in a single place. It adds another layer of security, as every change will be reviewed and noticed, and thus malicious changes will theoretically occur less. In the case of a mistake, bug, or security incident, it also offers an easier way to "revert" back to a safe version or add a "hot fix" quickly.
- Remediation Procedure
Document and store every deployment configuration of build workers in a version control platform.
2.2.8Monitor the resource consumption of build workers and set alerts for high consumption that can lead to resource exhaustion.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.2 Build Worker
- Description
Monitor the resource consumption of build workers and set alerts for high consumption that can lead to resource exhaustion.
- Audit Procedure
Verify that there is monitoring of resources consumption for each build worker.
- Assessment Status
Manual
- Rationale Statement
Resource exhaustion is when machine resources or services are highly consumed until exhausted. Resource exhaustion may lead to DOS (Denial of Service). When such a situation happens to build workers, it slows down and even stops the build process, which harms the production of artifacts and the organization's ability to deliver software on schedule. To prevent that, it is recommended to monitor resources consumption in the build workers and set alerts to notify when they are highly consumed. That way resource exhaustion can be acknowledged and prevented at an early stage.
- Remediation Procedure
Set reources consumption monitoring for each build worker.
2.3.1Use pipeline as code for build pipelines and their defined steps.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Use pipeline as code for build pipelines and their defined steps.
- Audit Procedure
Verify that all build steps are defined as code and stored in a version control system.
- Assessment Status
Manual
- Rationale Statement
Storing pipeline instructions as code in a version control system means automation of the build steps and less room for human error, which could potentially lead to a security breach. Additionally, It creates the ability to revert back to a previous pipeline configuration in order to pinpoint the affected change should a malicious incident occur.
- Remediation Procedure
Convert pipeline instructions into code-based syntax and upload them to the organization's version control platform.
2.3.2Define clear expected input and output for each build stage.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Define clear expected input and output for each build stage.
- Audit Procedure
For each build stage, verify that the expected input and output are clearly defined.
- Assessment Status
Manual
- Rationale Statement
In order to have more control over data flow in the build pipeline, clearly define the input and output of the pipeline steps. If anything malicious happens during the build stage, it will be recognized more easily and stand out as an anomaly.
- Remediation Procedure
For each build stage, clearly define what is expected for input and output.
2.3.3Write pipeline output artifacts to a secured storage repository.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Write pipeline output artifacts to a secured storage repository.
- Audit Procedure
For each pipeline that produces output artifacts, ensure that they're written to a secured storage repository.
- Assessment Status
Manual
- Rationale Statement
To maintain output artifacts securely and reduce the potential surface for attack, store such artifacts separately in secure storage. This separation enforces the Single Responsibility Principle by ensuring the orchestration platform will not be the same as the artifact storage, which reduces the potential harm of an attack. Using the same security considerations as the input (for example, the source code) will protect artifacts stored and will make it harder for a malicious actor to successfully execute an attack.
- Remediation Procedure
For each pipeline that produces output artifacts, write them to a secured storage repository.
2.3.4Track and review changes to pipeline files.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Track and review changes to pipeline files.
- Audit Procedure
For each pipeline file, ensure changes to it are being tracked and reviewed.
- Assessment Status
Manual
- Rationale Statement
Pipeline files are sensitive files. They have the ability to access sensitive data and control the build process, thus it is just as important to review changes to pipeline files as it is to verify source code. Malicious actors can potentially add harmful code to these files, which may lead to sensitive data exposure and hijacking of the build environment or artifacts.
- Remediation Procedure
For each pipeline file, track changes to it and review them.
2.3.5Restrict access to pipeline triggers.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Restrict access to pipeline triggers.
- Audit Procedure
For every pipeline in use, verify only the necessary users have permission to trigger it.
- Assessment Status
Manual
- Rationale Statement
Build pipelines are used for multiple reasons. Some are very sensitive, such as pipelines which deploy to production. In order to protect the environment from malicious acts or human mistakes, such as a developer deploying a bug to production, it is important to apply the Least Privilege principle to pipeline triggering. This principle requires restrictions placed on which users can run which pipeline. It allows for sensitive pipelines to only be run by administrators, who are generally the most trusted and skilled members of the organization.
- Remediation Procedure
For every pipeline in use, grant only the necessary users permission to trigger it.
2.3.6Scan the pipeline for misconfigurations. It is recommended that this be performed automatically.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Scan the pipeline for misconfigurations. It is recommended that this be performed automatically.
- Audit Procedure
For each pipeline, verify that it is automatically scanned for misconfigurations.
- Assessment Status
Manual
- Rationale Statement
Automatic scans for misconfigurations detect human mistakes and misconfigured tasks. This protects the environment from backdoors caused by such mistakes, which create easier access for attackers. For example, a task that mistakenly configures credentials to persist on the disk makes it easier for an attacker to steal them. This type of incident can be prevented by auto-scanning.
- Remediation Procedure
For each pipeline, set automated misconfiguration scanning.
2.3.7Scan pipelines for vulnerabilities. It is recommended that this be implemented automatically.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Scan pipelines for vulnerabilities. It is recommended that this be implemented automatically.
- Audit Procedure
For each pipeline, verify that it is automatically scanned for vulnerabilities.
- Assessment Status
Manual
- Rationale Statement
Automatic scanning for vulnerabilities detects known vulnerabilities in pipeline instructions and components, allowing faster patching in case one is found. These vulnerabilities can lead to a potentially massive breach if not handled as fast as possible, as attackers might also be aware of such vulnerabilities.
- Remediation Procedure
For each pipeline, set automated vulnerability scanning.
2.3.8Detect and prevent sensitive data, such as confidential ID numbers, passwords, etc., in pipelines.0
Attributes
- Profile
Level 2
- Section
2 Build Pipelines
- Subsection
2.3 Pipeline Instructions
- Description
Detect and prevent sensitive data, such as confidential ID numbers, passwords, etc., in pipelines.
- Audit Procedure
For every pipeline that is in use, verify that scanners are set to identify and prevent the existence of sensitive data within it.
- Assessment Status
Automated
- Rationale Statement
Sensitive data in pipeline configuration, such as cloud provider credentials or repository credentials, create vulnerabilities with which malicious actors could steal such information if they gain access to a pipeline. In order to mitigate this, set scanners that will identify and prevent the existence of sensitive data in the pipeline.
- Remediation Procedure
For every pipeline that is in use, set scanners that will identify and prevent sensitive data within it.
2.4.1Sign all artifacts in all releases with user or organization keys.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.4 Pipeline Integrity
- Description
Sign all artifacts in all releases with user or organization keys.
- Audit Procedure
Ensure every artifact in every release is signed.
- Assessment Status
Manual
- Rationale Statement
Signing artifacts is used to validate both their integrity and security. Organizations signal that artifacts may be trusted and they themselves produced them by ensuring that every artifact is properly signed. The presence of this signature also makes potentially malicious activity far more difficult.
- Remediation Procedure
For every artifact in every release, verify that all are properly signed.
2.4.2External dependencies may be public packages needed in the pipeline, or perhaps the public image being used for the build worker. Lock these external dependencies in every build pipeline.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.4 Pipeline Integrity
- Description
External dependencies may be public packages needed in the pipeline, or perhaps the public image being used for the build worker. Lock these external dependencies in every build pipeline.
- Audit Procedure
Ensure every external dependency being used in pipelines is locked.
- Assessment Status
Manual
- Rationale Statement
External dependencies are sources of code that aren't under organizational control. They might be intentionally or unintentionally infected with malicious code or have known vulnerabilities, which could result in sensitive data exposure, data harvesting, or the erosion of trust in an organization. Locking each external dependency to a specific, safe version gives more control and less chance for risk.
- Remediation Procedure
For all external dependencies being used in pipelines, verify they are locked.
2.4.3Validate every dependency of the pipeline before use.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.4 Pipeline Integrity
- Description
Validate every dependency of the pipeline before use.
- Audit Procedure
For every dependency used in every pipeline, ensure it has been validated.
- Assessment Status
Manual
- Rationale Statement
To ensure that a dependency used in a pipeline is trusted and has not been infected by malicious actor (for example, the codecov incident), validate dependencies before using them. This can be accomplished by comparing the checksum of the dependency to its checksum in a trusted source. If a difference arises, this is a sign that an unknown actor has interfered and may have added malevolent code. If this dependency is used, it will infect the environment, which could end in a massive breach and leave the organization exposed to data leaks, etc.
- Remediation Procedure
For every dependency used in every pipeline, validate each one.
2.4.4Verify that the build pipeline creates reproducible artifacts, meaning that an artifact of the build pipeline is the same in every run when given the same input.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.4 Pipeline Integrity
- Description
Verify that the build pipeline creates reproducible artifacts, meaning that an artifact of the build pipeline is the same in every run when given the same input.
- Audit Procedure
Ensure that build pipelines create reproducible artifacts.
- Assessment Status
Manual
- Rationale Statement
A reproducible build is a build that produces the same artifact when given the same input data. Ensuring that the build pipeline produces the same artifact when given the same input helps verify that no change has been made to the artifact. This action allows an organization to trust that its artifacts are built only from safe code that has been reviewed and tested and has not been tainted or changed abruptly.
- Remediation Procedure
Create build pipelines that produce the same artifact given the same input (for example, artifacts that do not rely on timestamps).
2.4.5SBOM (Software Bill of Materials) is a file that specifies each component of software or a build process. Generate an SBOM after each run of a pipeline.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.4 Pipeline Integrity
- Description
SBOM (Software Bill of Materials) is a file that specifies each component of software or a build process. Generate an SBOM after each run of a pipeline.
- Audit Procedure
For each pipeline, ensure it produces a Software Bill of Materials on every run.
- Assessment Status
Manual
- Rationale Statement
Generating a Software Bill of Materials after each run of a pipeline will validate the integrity and security of that pipeline. Recording every step or component role in the pipeline ensures that no malicious acts have been committed during the pipeline's run.
- Remediation Procedure
For each pipeline, configure it to produce a Software Bill of Materials on every run.
2.4.6SBOM (Software Bill of Materials) is a file that specifies each component of software or a build process. It should be generated after every pipeline run. After it is generated, it must then be signed.0
Attributes
- Profile
Level 1
- Section
2 Build Pipelines
- Subsection
2.4 Pipeline Integrity
- Description
SBOM (Software Bill of Materials) is a file that specifies each component of software or a build process. It should be generated after every pipeline run. After it is generated, it must then be signed.
- Audit Procedure
For each pipeline, ensure it signs the Software Bill of Materials it produces on every run.
- Assessment Status
Manual
- Rationale Statement
Software Bill of Materials (SBOM) is a file used to validate the integrity and security of a build pipeline. Signing it ensures that no one tampered with the file when it was delivered. Such interference can happen if someone tries to hide unusual activity. Validating the SBOM signature can detect this activity and prevent much greater incident.
- Remediation Procedure
For each pipeline, configure it to sign its produced Software Bill of Materials on every run.
3 Dependencies120
3.1.1Ensure third-party artifacts and open-source libraries in use are trusted and verified.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
Ensure third-party artifacts and open-source libraries in use are trusted and verified.
- Audit Procedure
For every GitHub action (building block of a GitHub workflow), ensure verification before use by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the left sidebar, click Actions, then click General.
- Under "Policies", ensure Allow OWNER, and select non-OWNER, actions and reusable workflows, and Allow actions created by GitHub are checked.
Alternatively, perform the following for each repository where GitHub actions are used:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the left sidebar, click Actions, then click General.
- Under "Actions permissions", ensure Allow OWNER, and select non-OWNER, actions and reusable workflows and Allow actions created by GitHub are checked.
- Assessment Status
Manual
- Rationale Statement
Verify third-party artifacts used in code are trusted and have not been infected by a malicious actor before use. This can be accomplished, for example, by comparing the checksum of the dependency to its checksum in a trusted source. If a difference arises, this may be a sign that someone interfered and added malicious code. If this dependency is used, it will infect the environment and could end in a massive breach, leaving the organization exposed to data leaks and more.
- Remediation Procedure
Verify every GitHub action (building block of a GitHub workflow) in use by performing the following:
- In the top right corner of GitHub.com, click your profile photo, then click Your organizations.
- Next to the organization, click Settings.
- In the left sidebar, click Actions, then click General.
- Under "Policies", check Allow OWNER, and select non-OWNER, actions and reusable workflows, and then Allow actions created by GitHub.
- Click Save.
Alternatively, perform the following for each repository where GitHub actions are used:
- On GitHub.com, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the left sidebar, click Actions, then click General.
- Under "Actions permissions", check Allow OWNER, and select non-OWNER, actions and reusable workflows, and then Allow actions created by GitHub.
- Click Save.
3.1.2A Software Bill Of Materials (SBOM) is a file that specifies each component of software or a build process. Require an SBOM from every third-party provider.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
A Software Bill Of Materials (SBOM) is a file that specifies each component of software or a build process. Require an SBOM from every third-party provider.
- Audit Procedure
For every third-party dependency in use, ensure it has a Software Bill of Materials.
- Assessment Status
Manual
- Rationale Statement
A Software Bill of Materials (SBOM) for every third-party artifact helps to ensure an artifact is safe to use and fully compliant. This file lists all important metadata, especially all the dependencies of an artifact, and allows for verification of each dependency. If one of the dependencies/artifacts are attacked or has a new vulnerability (for example, the "SolarWinds" or even "log4j" attacks), it is easier to detect what has been affected by this incident because dependencies in use are listed in the SBOM file.
- Remediation Procedure
For every third-party dependency in use, require a Software Bill of Materials from its supplier.
3.1.3Require and verify signed metadata of the build process for all dependencies in use.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
Require and verify signed metadata of the build process for all dependencies in use.
- Audit Procedure
For each artifact used, ensure it was supplied with verified and signed metadata of its build process. The signature should be the organizational signature and should be verifiable by common Certificate Authority servers.
- Assessment Status
Manual
- Rationale Statement
The metadata of a build process lists every action that took place during an artifact build. It is used to ensure that an artifact has not been compromised during the build, that no malicious code was injected into it, and that no nefarious dependencies were added during the build phase. This creates trust between user and vendor that the software supplied is exactly the software that was promised. Signing this metadata adds a checksum to ensure there have been no revisions since its creation, as this checksum changes when the metadata is altered. Verification of proper metadata signature with Certificate Authority confirms that the signature was produced by a trusted entity.
- Remediation Procedure
For each artifact in use, require and verify signed metadata of the build process.
3.1.4Monitor, or ask software suppliers to monitor, dependencies between open-source components in use.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
Monitor, or ask software suppliers to monitor, dependencies between open-source components in use.
- Audit Procedure
For each open-source component, ensure its dependencies are monitored.
- Assessment Status
Manual
- Rationale Statement
Monitoring dependencies between open-source components helps to detect if software has fallen victim to attack on a common open-source component. Swift detection can aid in quick application of a fix. It also helps find potential compliance problems with components usage. Some dependencies might not be compatible with the organization's policies, and other dependencies might have a license that is not compatible with how the organization uses this specific dependency. If dependencies are monitored, such situations can be detected and mitigated sooner, potentially deterring malicious attacks.
- Remediation Procedure
For each open-source component, monitor its dependencies.
3.1.5Prioritize trusted package registries over others when pulling a package.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
Prioritize trusted package registries over others when pulling a package.
- Audit Procedure
For each package registry in use, ensure it is trusted.
- Assessment Status
Manual
- Rationale Statement
When pulling a package by name, the package manager might look for it in several package registries, some of which may be untrusted or badly configured. If the package is pulled from such a registry, there is a higher likelihood that it could prove malicious. In order to avoid this, configure packages to be pulled from trusted package registries.
- Remediation Procedure
For each package to be downloaded, configure it to be downloaded from a trusted source.
3.1.6A Software Bill of Materials (SBOM) is a file that specifies each component of software or a build process. When using a dependency, demand its SBOM and ensure it is signed for validation purposes.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
A Software Bill of Materials (SBOM) is a file that specifies each component of software or a build process. When using a dependency, demand its SBOM and ensure it is signed for validation purposes.
- Audit Procedure
For every artifact supplied, ensure it has a validated, signed Software Bill of Materials.
- Assessment Status
Manual
- Rationale Statement
A Software Bill of Materials (SBOM) creates trust between its provider and its users by ensuring that the software supplied is the software described, without any potential interference in between. Signing an SBOM creates a checksum for it, which will change if the SBOM's content was changed. With that checksum, a software user can be certain nothing had happened to it during the supply chain, engendering trust in the software. When there is no such trust in the software, the risk surface is increased because one cannot know if the software is potentially vulnerable. Demanding a signed SBOM and validating it decreases that risk.
- Remediation Procedure
For every artifact supplied, require and verify a signed Software Bill of Materials from its supplier.
3.1.7Pin dependencies to a specific version. Avoid using the "latest" tag or broad version.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
Pin dependencies to a specific version. Avoid using the "latest" tag or broad version.
- Audit Procedure
For every dependency in use, ensure it is pinned to a specific version.
- Assessment Status
Manual
- Rationale Statement
When using a wildcard version of a package, or the "latest" tag, the risk of encountering a new, potentially malicious package increases. The "latest" tag pulls the last package pushed to the registry. This means that if an attacker pushes a new, malicious package successfully to the registry, the next user who pulls the "latest" will pull it and risk attack. This same rule applies to a wildcard version - assuming one is using version v1.*, it will install the latest version of the major version 1, meaning that if an attacker can push a malicious package with that same version, those using it will be subject to possible attack. By using a secure, verified version, use is restricted to this version only and no other may be pulled, decreasing the risk for any malicious package.
- Remediation Procedure
For every dependency in use, pin to a specific version.
3.1.8Use packages that are more than 60 days old.0
Attributes
- Profile
Level 2
- Section
3 Dependencies
- Subsection
3.1 Third-Party Packages
- Description
Use packages that are more than 60 days old.
- Audit Procedure
For every package used, ensure it is more than 60 days old.
- Impact Statement
Developers may not use packages that are less than 60 days old.
- Assessment Status
Manual
- Rationale Statement
Third-party packages are a major risk since an organization cannot control their source code, and there is always the possibility these packages could be malicious. It is therefore good practice to remain cautious with any third-party or open-source package, especially new ones, until they can be verified that they are safe to use. Avoiding a new package allows the organization to fully examine it, its maintainer, and its behavior, and gives enough time to determine whether or not to use it.
- Remediation Procedure
If a package used is less than 60 days old, stop using it and find another solution.
3.2.1Enforce a policy for dependency usage across the organization. For example, disallow the use of packages less than 60 days old.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.2 Validate Packages
- Description
Enforce a policy for dependency usage across the organization. For example, disallow the use of packages less than 60 days old.
- Audit Procedure
Verify that a policy for dependency usage is enforced across the organization.
- Assessment Status
Manual
- Rationale Statement
Enforcing a policy for dependency usage in an organization helps to manage dependencies across the organization and ensure that all usage is compliant with security policy. If, for example, the policy limits the package managers that can be used, enforcing it will make sure that every dependency is installed only from these package managers, and limit the risk of installing from any untrusted source.
- Remediation Procedure
Enforce policies for dependency usage across the organization.
3.2.2Automatically scan every package for vulnerabilities.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.2 Validate Packages
- Description
Automatically scan every package for vulnerabilities.
- Audit Procedure
Ensure automatic scanning of packages for vulnerabilities is enabled.
- Assessment Status
Manual
- Rationale Statement
Automatic scanning for vulnerabilities detects known vulnerabilities in packages and dependencies in use, allowing faster patching when one is found. Such vulnerabilities can lead to a massive breach if not handled as fast as possible, as attackers will also know about those vulnerabilities and swiftly try to take advantage of them. Scanning packages regularly for vulnerabilities can also verify usage compliance with the organization's security policy.
- Remediation Procedure
Set automatic scanning of packages for vulnerabilities.
3.2.3A software license is a document that provides legal conditions and guidelines for the use and distribution of software, usually defined by the author. It is recommended to scan for any legal implications automatically.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.2 Validate Packages
- Description
A software license is a document that provides legal conditions and guidelines for the use and distribution of software, usually defined by the author. It is recommended to scan for any legal implications automatically.
- Audit Procedure
Ensure license implication rules are configured and are scanned automatically.
- Assessment Status
Manual
- Rationale Statement
When using packages with software licenses, especially commercial ones which tend to be the strictest, it is important to verify that the use of the package meets the conditions of the license. If the use of the package violates the licensing agreement, it exposes the organization to possible lawsuits. Scanning used packages for such license implications leads to faster detection and quicker fixes of such violations, and also reduces the risk for a lawsuit.
- Remediation Procedure
Set automatic package scanning for license implications.
3.2.4Scan every package automatically for ownership change.0
Attributes
- Profile
Level 1
- Section
3 Dependencies
- Subsection
3.2 Validate Packages
- Description
Scan every package automatically for ownership change.
- Audit Procedure
Ensure automatic scanning of packages for ownership change is set.
- Assessment Status
Manual
- Rationale Statement
A change in package ownership is not a regular action. In some cases it can lead to a massive problem (for example, the "event-stream" incident). Open-source contributors are not always trusted, since by its very nature everyone can contribute. This means malicious actors can become contributors as well. Package maintainers might transfer their ownership to someone they do not know if maintaining the package is too much for them, in some cases without the other user's knowledge. This has led to known security breaches in the past. It is best to be aware of such activity as soon as it happens and to carefully examine the situation before continuing using the package in order to determine its safety.
- Remediation Procedure
Set automatic scanning of packages for ownership change.
4 Artifacts140
4.1.1Configure the build pipeline to sign every artifact it produces and verify that each artifact has the appropriate signature.0
Attributes
- Profile
Level 2
- Section
4 Artifacts
- Subsection
4.1 Verification
- Description
Configure the build pipeline to sign every artifact it produces and verify that each artifact has the appropriate signature.
- Default Value
Artifacts are not signed by Default.
- Audit Procedure
Verify that the build pipeline signs every new artifact it produces and all artifacts are signed.
There are many different signing tools or options each have there own method or commands to verify that the code or package created is signed.
- Assessment Status
Manual
- Rationale Statement
A cryptographic signature can be used to verify artifact authenticity. The signature created with a certain key is unique and not reversible, thus making it unique to the author. This means that an attacker tampering with a signed artifact will be noticed immediately using a simple verification step because the signature will change. Signing artifacts by the build pipeline that produces them ensures the integrity of those artifacts.
- Remediation Procedure
Sign every artifact produced with the build pipeline that created it. Configure the build pipeline to sign each artifact.
Steps from GitHub Documentation:
You can follow the steps below to sign artifacts in GitHub actions. The trick involves loading in your private key into GitHub Actions using the gpg command-line commands.
Export your gpg private key from the system that you have created it. Find your key-id (using gpg --list-secret-keys --keyid-format=long) Export the gpg secret key to an ASCII file using gpg --export-secret-keys -a <key-id> > secret.txt Edit secret.txt using a plain text editor, and replace all newlines with a literal "\n" until everything is on a single line Set up GitHub Actions secrets Create a secret called OSSRH_GPG_SECRET_KEY using the text from your edited secret.txt file (the whole text should be in a single line) Create a secret called OSSRH_GPG_SECRET_KEY_PASSWORD containing the password for your gpg secret key Create a GitHub Actions step to install the gpg secret key Add an action similar to:
- id: install-secret-key name: Install gpg secret key run: | cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONGVerify that the secret key is shown in the GitHub Actions logs You can remove the output from list secret keys if you are confident that this action will work, but it is better to leave it in there Bring it all together, and create a GitHub Actions step to publish Add an action similar to:
- id: publish-to-central name: Publish to Central Repository env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} run: | mvn \ --no-transfer-progress \ --batch-mode \ -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ clean deployAfter a couple of hours, verify that the artifact got published to The Central Repository
4.1.2Encrypt artifacts before they are distributed and ensure only trusted platforms have decryption capabilities.0
Attributes
- Profile
Level 2
- Section
4 Artifacts
- Subsection
4.1 Verification
- Description
Encrypt artifacts before they are distributed and ensure only trusted platforms have decryption capabilities.
- Default Value
Artifacts do not get encrypted by default.
- Audit Procedure
Ensure every artifact is encrypted before it is delivered.
- Assessment Status
Manual
- Rationale Statement
Build artifacts might contain sensitive data such as production configurations. In order to protect them and decrease the risk for breach, it is recommended to encrypt them before delivery. Encryption makes data unreadable, so even if attackers gain access to these artifacts, they won't be able to harvest sensitive data from them without the decryption key.
- Remediation Procedure
Encrypt every artifact before distribution.
4.1.3Grant decryption capabilities of artifacts only to trusted and authorized platforms.0
Attributes
- Profile
Level 2
- Section
4 Artifacts
- Subsection
4.1 Verification
- Description
Grant decryption capabilities of artifacts only to trusted and authorized platforms.
- Audit Procedure
Ensure only trusted and authorized platforms have decryption capabilities of the organization's artifacts.
- Assessment Status
Manual
- Rationale Statement
Build artifacts might contain sensitive data such as production configuration. To protect them and decrease the risk of a breach, it is recommended to encrypt them before delivery. This will make them unreadable for every unauthorized user who doesn't have the decryption key. By implementing this, the decryption capabilities become overly sensitive in order to prevent a data leak or theft. Ensuring that only trusted and authorized platforms can decrypt the organization's packages decreases the possibility for an attacker to gain access to the critical data in artifacts.
- Remediation Procedure
Grant decryption capabilities of the organization's artifacts only for trusted and authorized platforms.
4.2.1Software certification is used to verify the safety of certain software usage and to establish trust between the supplier and the consumer. Any artifact can be certified. Limit the authority to certify different artifacts.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.2 Access to Artifacts
- Description
Software certification is used to verify the safety of certain software usage and to establish trust between the supplier and the consumer. Any artifact can be certified. Limit the authority to certify different artifacts.
- Audit Procedure
Ensure only certain artifacts can be certified by certain parties.
- Assessment Status
Manual
- Rationale Statement
Artifact certification is a powerful tool in establishing trust. Clients use a software certificate to verify that the artifact is safe to use according to their security policies. Because of this, certifying artifacts is considered sensitive. If an artifact is for debugging or internal use, or if it were compromised, the organization would not want certification. An attacker gaining access to both certificate authority and the artifact registry might also be able to certify its own artifact and cause a major breach. To prevent these issues, limit which artifacts can be certified by which platform so there will be minimal access to certification.
- Remediation Procedure
Limit which artifact can be certified by which authority.
4.2.2Minimize ability to upload artifacts to the lowest number of trusted users possible.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.2 Access to Artifacts
- Description
Minimize ability to upload artifacts to the lowest number of trusted users possible.
- Audit Procedure
Ensure only trusted and qualified users can upload new artifacts, and that their number is the lowest possible.
- Assessment Status
Manual
- Rationale Statement
Artifacts might contain sensitive data. Even the simplest mistake can also lead to trust issues with customers and harm the integrity of the product. To decrease these risks, allow only trusted and qualified users to upload new artifacts. Those users are less likely to make mistakes. Having the lowest number of such users possible will also decrease the risk of hacked user accounts, which could lead to a massive breach or artifact compromising.
- Remediation Procedure
Allow only trusted and qualified users to upload new artifacts and limit them in number.
4.2.3Enforce Multi-Factor Authentication (MFA) for user access to the package registry.0
Attributes
- Profile
Level 2
- Section
4 Artifacts
- Subsection
4.2 Access to Artifacts
- Description
Enforce Multi-Factor Authentication (MFA) for user access to the package registry.
- Audit Procedure
For each package registry in use, verify that Multi-Factor Authentication is enforced and is the only way to authenticate.
- Assessment Status
Manual
- Rationale Statement
By default, every user authenticates to the system by password only. If a user's password is compromised, the user account and all its related packages are in danger of data theft and malicious builds. It is therefore recommended that each user enables Multi-Factor Authentication. This additional step guarantees that the account stays secure even if the user's password is compromised, as it adds another layer of authentication.
- Remediation Procedure
For each package registry in use, enforce Multi-Factor Authentication as the only way to authenticate.
4.2.4Manage users and their access to the package registry with an external authentication server and not with the package registry itself.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.2 Access to Artifacts
- Description
Manage users and their access to the package registry with an external authentication server and not with the package registry itself.
- Audit Procedure
For each package registry, verify that its user access is not managed locally, but instead with the main authentication server of the organization.
- Assessment Status
Manual
- Rationale Statement
Some package registries offer a tool for user management, aside from the main Lightweight Directory Access Protocol (LDAP) or Active Directory (AD) server of the organization. That tool usually offers simple authentication and role-based permissions, which might not be granular enough. Having multiple user management tools in the organization could result in confusion and privilege escalation, as there will be more to manage. To avoid a situation where users escalate their privileges because someone missed them, manage user access to the package registry via the main authentication server and not locally on the package registry.
- Remediation Procedure
For each package registry, use the main authentication server of the organization for user management and do not manage locally.
4.2.5For GitHub Private or Internal repositories anonymous access is not available. Verify that all repos that require access controls are Private or Internal.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.2 Access to Artifacts
- Description
For GitHub Private or Internal repositories anonymous access is not available. Verify that all repos that require access controls are Private or Internal.
- Audit Procedure
To Audit the existing settings:
- On your GitHub Enterprise Server instance, navigate to the main page of the repository.
- Under your repository name, click Settings
- Under "Danger Zone", to the right of to "Change repository visibility", click Change visibility.
Review the current selection.
- Impact Statement
Only logged and authorized users will be able to access artifacts.
- Assessment Status
Manual
- Rationale Statement
Disable the option to view artifacts as an anonymous user in order to protect private artifacts from being exposed.
- Remediation Procedure
Changing a repository's visibility
-
On your GitHub Enterprise Server instance, navigate to the main page of the repository.
-
Under your repository name, click Settings
-
Under "Danger Zone", to the right of to "Change repository visibility", click Change visibility.
-
Select a visibility.
-
Choose
- Mark private
- Make Internal
- To verify that you're changing the correct repository's visibility, type the name of the repository you want to change the visibility of.
-
4.2.6Ensure the package registry has a minimum number of administrators.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.2 Access to Artifacts
- Description
Ensure the package registry has a minimum number of administrators.
- Audit Procedure
Verify that your package registry has only the minimum number of administrators.
For each repository that you administer on GitHub, you can see an overview of every team or person with access to the repository. From the overview, you can also invite new teams or people, change each team or person's role for the repository, or remove access to the repository.
- Impact Statement
Administrator privileges are required to provide and maintain a secure and stable platform but allowing extraneous administrator accounts can create a vulnerability.
- Assessment Status
Manual
- Rationale Statement
Package registry admins have the ability to add/remove users, repositories, packages. Due to the permissive access granted to an admin, it is highly recommended to keep the number of administrator accounts as minimal as possible.
- Remediation Procedure
Set the minimum number of administrators in your package registry.
To accomplish this:
For each repository that you administer on GitHub, you can see an overview of every team or person with access to the repository. From the overview, choose Manage access and provide access to the appropriate people or teams.
4.3.1Validate artifact signatures before uploading to the package registry.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.3 Package Registries
- Description
Validate artifact signatures before uploading to the package registry.
- Default Value
Artifacts are not scanned by default.
- Audit Procedure
Ensure every artifact in the package registry has been validated with its signature.
- On GitHub, navigate to a pull request
- On the pull request, click <> Commits and view the detailed information regarding the signature.
- Assessment Status
Manual
- Rationale Statement
Cryptographic signature is a tool to verify artifact authenticity. Every artifact is supposed to be signed by its creator in order to confirm that it was not compromised before reaching the client. Validating an artifact signature before delivering it is another level of protection which ensures the signature has not been changed, meaning no one tried or succeeded in tampering with the artifact. This creates trust between the supplier and the client.
- Remediation Procedure
Validate every artifact with its signature before uploading it to the package registry. It is recommended to do so automatically.
4.3.2Validate the signature of all versions of an existing artifact.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.3 Package Registries
- Description
Validate the signature of all versions of an existing artifact.
- Audit Procedure
For each artifact, ensure that all of its versions are signed and validated before it is uploaded or used.
Ensure every artifact in the package registry has been validated with its signature.
On GitHub, navigate to a pull request On the pull request, click <> Commits and view the detailed information regarding the signature.
- Assessment Status
Manual
- Rationale Statement
In order to be certain a version of an existing and trusted artifact is not malicious or delivered by someone looking to interfere with the supply chain, it is a good practice to validate the signatures of each version. Doing so decreases the risk of using a compromised artifact, which might lead to a breach.
- Remediation Procedure
For each artifact, sign and validate each version before uploading or using the artifact.
4.3.3Audit changes of the package registry configuration.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.3 Package Registries
- Description
Audit changes of the package registry configuration.
- Default Value
GitHub audits this by default.
- Audit Procedure
Verify that all changes to the packages registry configuration are audited.
Search the audit log with
repo category actions
- Assessment Status
Manual
- Rationale Statement
The package registry is a crucial component in the software supply chain. It stores artifacts with potentially sensitive data that will eventually be deployed and used in production. Every change made to the package registry configuration must be examined carefully to ensure no exposure of the registry's sensitive data. This examination also ensures no malicious actors have performed modifications to a stored artifact. Auditing the configuration and its changes helps in decreasing such risks.
- Remediation Procedure
Audit the changes to the package registry configuration.
4.3.4Use secured webhooks to reduce the possibility of malicious payloads.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.3 Package Registries
- Description
Use secured webhooks to reduce the possibility of malicious payloads.
- Impact Statement
Reduces the payloads that the web hook can listen for and receive.
- Assessment Status
Manual
- Rationale Statement
Webhooks are used for triggering an HTTP request based on an action made in the platform. Typically, package registries feature webhooks when a package receives an update. Since webhooks are an HTTP POST request, they can be malformed if not secured over SSL. To prevent a potential hack and compromise of the webhook or to the registry or web server excepting the request, use only secured webhooks.
- Remediation Procedure
For each webhook in use, change it to secured (over HTTPS).
4.4.1When delivering artifacts, ensure they have information about their origin. This may be done by providing a Software Bill of Manufacture (SBOM) or some metadata files.0
Attributes
- Profile
Level 1
- Section
4 Artifacts
- Subsection
4.4 Origin Traceability
- Description
When delivering artifacts, ensure they have information about their origin. This may be done by providing a Software Bill of Manufacture (SBOM) or some metadata files.
- Audit Procedure
For each artifact, ensure it has information about its origin.
- Assessment Status
Manual
- Rationale Statement
Information about artifact origin can be used for verification purposes. Having this kind of information allows the user to decide if the organization supplying the artifact is trusted. In a case of potential vulnerability or version update, this can be used to verify that the organization issuing it is the actual origin and not someone else. If users need to report problems with the artifact, they will have an address to contact as well.
- Remediation Procedure
For each artifact supplied, supply information about its origin. For each artifact in use, ask for information about its origin.
5 Deployment110
5.1.1Deployment configurations are often stored in a version control system. Separate deployment configuration files from source code repositories.0
Attributes
- Profile
Level 2
- Section
5 Deployment
- Subsection
5.1 Deployment Configuration
- Description
Deployment configurations are often stored in a version control system. Separate deployment configuration files from source code repositories.
- Audit Procedure
Ensure each deployment configuration file is stored separately from source code.
- Assessment Status
Manual
- Rationale Statement
Deployment configuration manifests are often stored in version control systems. Storing them in dedicated repositories, separately from source code repositories, has several benefits. First, it adds order to both maintenance and version control history. This makes it easier to track code or manifest changes, as well as spot any malicious code or misconfigurations. Second, it helps achieve the Least Privilege principle. Because access can be configured differently for each repository, fewer users will have access to this configuration, which is typically sensitive.
- Remediation Procedure
Store each deployment configuration file in a dedicated repository separately from source code.
5.1.2Audit and track changes made in deployment configuration.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.1 Deployment Configuration
- Description
Audit and track changes made in deployment configuration.
- Audit Procedure
For each deployment configuration, ensure changes made to it are audited and tracked.
- Assessment Status
Manual
- Rationale Statement
Deployment configuration is sensitive in nature. The tiniest mistake can lead to downtime or bugs in production, which consequently may have a direct effect on both product integrity and customer trust. Misconfigurations might also be used by malicious actors to attack the production platform. Because of this, every change in the configuration needs a review and possible "revert" in case of a mistake or malicious change. Auditing every change and tracking them helps detect and fix such incidents more quickly.
- Remediation Procedure
For each deployment configuration, track and audit changes made to it.
5.1.3Detect and prevent sensitive data – such as confidential ID numbers, passwords, etc. – in deployment configurations.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.1 Deployment Configuration
- Description
Detect and prevent sensitive data – such as confidential ID numbers, passwords, etc. – in deployment configurations.
- Audit Procedure
For each deployment configuration file, verify that scanners are set to identify and prevent the existence of sensitive data within it.
- Assessment Status
Manual
- Rationale Statement
Sensitive data in deployment configurations might create a major incident if an attacker gains access to it, as this can cause data loss and theft. It is important to keep sensitive data safe and to not expose it in the configuration. In order to prevent a possible exposure, set scanners that will identify and prevent such data in deployment configurations.
- Remediation Procedure
For each deployment configuration file, set scanners to identify and prevent sensitive data within it.
5.1.4Restrict access to the deployment configuration to trusted and qualified users only.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.1 Deployment Configuration
- Description
Restrict access to the deployment configuration to trusted and qualified users only.
- Audit Procedure
Verify each deployment configuration is accessible only to known and authorized users.
- Impact Statement
Reducing the number of users who have access to the deployment configuration means those users would lose their ability to make direct changes to that configuration.
- Assessment Status
Manual
- Rationale Statement
Deployment configurations are sensitive in nature. The tiniest mistake can lead to downtime or bugs in production, which can have a direct effect on the product's integrity and customer trust. Misconfigurations might also be used by malicious actors to attack the production platform. To avoid such harm as much as possible, ensure only trusted and qualified users have access to such configurations. This will also reduce the number of accounts that might affect the environment in case of an attack.
- Remediation Procedure
Restrict access to the deployment configuration to trusted and qualified users.
5.1.5Detect and prevent misconfigurations or insecure instructions in Infrastructure as Code (IaC) files, such as Terraform files.0
Attributes
- Profile
Level 2
- Section
5 Deployment
- Subsection
5.1 Deployment Configuration
- Description
Detect and prevent misconfigurations or insecure instructions in Infrastructure as Code (IaC) files, such as Terraform files.
- Audit Procedure
For every Infrastructure as Code (IaC) instructions file, verify that scanners are set to identify and prevent misconfigurations and insecure instructions.
- Assessment Status
Manual
- Rationale Statement
Infrastructure as Code (IaC) files are used for production environment and application deployment. These are sensitive parts of the software supply chain because they are always in touch with customers, and thus might affect their opinion of or trust in the product. Attackers often target these environments. Detecting and fixing misconfigurations and/or insecure instructions in IaC files decreases the risk for data leak or data theft. It is important to secure IaC instructions in order to prevent further problems of deployment, exposed assets, or improper configurations, which might ultimately lead to easier ways to attack and steal organization data.
- Remediation Procedure
For every Infrastructure as Code (IaC) instructions file, set scanners to identify and prevent misconfigurations and insecure instructions.
5.1.6Verify the deployment configuration manifests.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.1 Deployment Configuration
- Description
Verify the deployment configuration manifests.
- Audit Procedure
For each deployment configuration manifest in use, ensure it has been verified.
- Assessment Status
Manual
- Rationale Statement
To ensure that the configuration manifests used are trusted and have not been infected by malicious actors before arriving at the platform, it is important to verify the manifests. This may be done by comparing the checksum of the manifest file to its checksum in a trusted source. If a difference arises, this is a sign that an unknown actor has interfered and may have added malicious instructions. If this manifest is used, it might harm the environment and application deployment, which could end in a massive breach and leave the organization exposed to data leaks, etc.
- Remediation Procedure
Verify each deployment configuration manifest in use.
5.1.7Deployment configuration is often stored in a version control system and is pulled from there. Pin the configuration used to a specific, verified version or commit Secure Hash Algorithm (SHA). Avoid referring configuration without its version tag specified.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.1 Deployment Configuration
- Description
Deployment configuration is often stored in a version control system and is pulled from there. Pin the configuration used to a specific, verified version or commit Secure Hash Algorithm (SHA). Avoid referring configuration without its version tag specified.
- Audit Procedure
For every deployment configuration manifest in use, ensure it is pinned to a specific version or commit Secure Hash Algorithm (SHA).
- Impact Statement
Changes in deployment configuration will not be pulled unless their version tag or commit Secure Hash Algorithm (SHA) is specified. This might slow down the deployment process.
- Assessment Status
Manual
- Rationale Statement
Deployment configuration manifests are often stored in version control systems and pulled from there either by automation platforms, for example Ansible, or GitOps platforms, such as ArgoCD. When a manifest is pulled from a version control system without tag or commit Secure Hash Algorithm (SHA) specified, it is pulled from the HEAD revision, which is equal to the 'latest' tag, and pulls the last change made. This increases the risk of encountering a new, potentially malicious configuration. If an attacker pushes malicious configuration to the version control system, the next user who pulls the HEAD revision will pull it and risk attack. To avoid that risk, use a version tag of verified version or a commit SHA of a trusted commit, which will ensure this is the only version pulled.
- Remediation Procedure
For every deployment configuration manifest in use, pin to a specific version or commit Secure Hash Algorithm (SHA).
5.2.1Automate deployments of production environment and application.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.2 Deployment Environment
- Description
Automate deployments of production environment and application.
- Audit Procedure
For each deployment process, ensure it is automated.
- Assessment Status
Manual
- Rationale Statement
Automating the deployments of both production environment and applications reduces the risk for human mistakes — such as a wrong configuration or exposure of sensitive data — because it requires less human interaction or intervention. It also eases redeployment of the environment. It is best to automate with Infrastructure as Code (IaC) because it offers more control over changes made to the environment creation configuration and stores to a version control platform.
- Remediation Procedure
Automate each deployment process of the production environment and application.
5.2.2Verify that the deployment environment – the orchestrator and the production environment where the application is deployed – is reproducible. This means that the environment stays the same in each deployment if the configuration has not changed.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.2 Deployment Environment
- Description
Verify that the deployment environment – the orchestrator and the production environment where the application is deployed – is reproducible. This means that the environment stays the same in each deployment if the configuration has not changed.
- Audit Procedure
Verify that the deployment/production environment is reproducible.
- Assessment Status
Manual
- Rationale Statement
A reproducible build is a build that produces the same artifact when given the same input data, and in this case the same environment. Ensuring that the same environment is produced when given the same input helps verify that no change has been made to it. This action allows an organization to trust that its deployment environment is built only from safe code and configuration that has been reviewed and tested and has not been tainted or changed abruptly.
- Remediation Procedure
Adjust the process that deploys the deployment/production environment to build the same environment each time when the configuration has not changed.
5.2.3Restrict access to the production environment to a few trusted and qualified users only.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.2 Deployment Environment
- Description
Restrict access to the production environment to a few trusted and qualified users only.
- Audit Procedure
Verify that the production environment is accessible only to trusted and qualified users.
- Impact Statement
Reducing the number of users who have access to the production environment means those users would lose their ability to make direct changes to that environment.
- Assessment Status
Manual
- Rationale Statement
The production environment is an extremely sensitive one. It directly affects the customer experience and trust in a product, which has serious effects on the organization itself. Because of this sensitive nature, it is important to restrict access to the production environment to only a few trusted and qualified users. This will reduce the risk of mistakes such as exposure of secrets or misconfiguration. This restriction also reduces the number of accounts that are vulnerable to hijacking in order to potentially harm the production environment.
- Remediation Procedure
Restrict access to the production environment to trusted and qualified users.
5.2.4Do not use default passwords of deployment tools and components.0
Attributes
- Profile
Level 1
- Section
5 Deployment
- Subsection
5.2 Deployment Environment
- Description
Do not use default passwords of deployment tools and components.
- Audit Procedure
For each deployment tool, ensure the password is not the default one.
- Assessment Status
Manual
- Rationale Statement
Many deployment tools and components are provided with default passwords for the first login. This password is intended to be used only on the first login and should be changed immediately after. Using the default password substantially increases the attack risk. It is very important to ensure that default passwords are not used in deployment tools and components.
- Remediation Procedure
For each deployment tool, change the password.