# Ensure at least one approval is required for code changes on the default branch

- Source: https://support.icompaas.com/support/solutions/articles/a_1790019228557968-ensure-at-least-one-approval-is-required-for-code-changes-on-the-default-branch
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [Version Control System (VCS)](https://support.icompaas.com/support/solutions/c_1781179095087930) › [GitHub](https://support.icompaas.com/support/solutions/folders/f_1781179116560328)
- Last updated: 2026-10-26
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

## Description

This control ensures that every pull request targeting the default branch requires at least one approving review from someone other than the author before it can be merged.

## Rationale

Requiring at least one approval ensures that no code change reaches the default branch without being reviewed by a second person. This enforces the four-eyes principle, reduces the risk of defects and malicious changes, and provides evidence of review for audit purposes.

## Impact

-   Pull requests targeting the default branch cannot be merged without at least one approving review.
    
-   Authors cannot approve their own pull requests.
    
-   May increase the time required to merge changes.
    
-   Supports peer review, segregation of duties, and compliance requirements.
    

## Default Value

-   Disabled by default. Repository administrators must configure a ruleset or classic branch protection rule that requires a pull request with at least one approval.
    

## Remediation

Branch protection can be configured using rulesets, classic branch protection rules, or both. Complete the section that matches the repository's configuration. The control is met if either configuration enforces the requirement.

### Rulesets

#### Test Plan

1.  Sign in to GitHub with administrative access to the repository.
    
2.  Navigate to the target repository.
    
3.  Select Settings.
    
4.  Under Code and automation, select Rules → Rulesets.
    
5.  Verify that an active branch ruleset targets the default branch, that Require a pull request before merging is enabled, and that Required approvals is set to 1 or higher.
    
6.  Create a pull request against the default branch and attempt to merge it without an approval. Expected result: the merge is blocked and GitHub indicates that at least one approving review is required.
    
7.  Obtain an approval from a reviewer other than the author and attempt to merge again. Expected result: the merge is allowed (subject to any other rules in place).
    
8.  If no active ruleset targets the default branch or Required approvals is set to 0, follow the Implementation Steps below to remediate the issue and repeat the test.
    

#### Implementation Steps

1.  Sign in to GitHub with administrative access to the repository.
    
2.  Navigate to the target repository.
    
3.  Select Settings.
    

4.  Under Code and automation, select Rules → Rulesets.
    

5.  Click New ruleset and select New branch ruleset, or edit an existing branch ruleset.
    

6.  Enter a name for the ruleset.
    
7.  Under Enforcement status, select Active.
    

8.  Under Target branches, click Add target and select Include default branch.
    

9.  In the Rules section, enable Require a pull request before merging.
    
10.  Set Required approvals to 1 or higher, as required by organizational policy.
     

11.  Click Create (or Save changes for an existing ruleset) to apply the ruleset.
     

#### Backout Plan

1.  Sign in to GitHub with administrative access to the repository.
    
2.  Navigate to the target repository.
    
3.  Select Settings.
    
4.  Under Code and automation, select Rules → Rulesets.
    
5.  Edit the applicable branch ruleset.
    
6.  Set Required approvals to the previous value, or disable Require a pull request before merging.
    

7.  Click Save changes.
    
8.  Verify that pull requests can be merged according to the updated configuration.
    

### Classic Branch Protection Rule

#### Test Plan

1.  Sign in to GitHub with administrative access to the repository.
    
2.  Navigate to the target repository.
    
3.  Select Settings.
    
4.  Under Code and automation, select Branches.
    
5.  Under Branch protection rules, verify that a rule matches the default branch (e.g., main).
    
6.  Click Edit next to the rule and verify that Require a pull request before merging and Require approvals are selected, with Required number of approvals before merging set to 1 or higher.
    
7.  Create a pull request against the default branch and attempt to merge it without an approval. Expected result: the merge is blocked and GitHub indicates that at least one approving review is required.
    
8.  If no matching rule exists or approvals are not required, follow the Implementation Steps below to remediate the issue and repeat the test.
    

#### Implementation Steps

1.  Sign in to GitHub with administrative access to the repository.
    
2.  Navigate to the target repository.
    
3.  Select Settings.
    

4.  Under Code and automation, select Branches.
    
5.  Next to Branch protection rules, click Add classic branch protection rule, or click Edit next to an existing rule.
    

6.  In the Branch name pattern, enter the name of the default branch (e.g., main).
    
7.  Select Require a pull request before merging.
    
8.  Select Require approvals.
    
9.  In the Required number of approvals before merging, select 1 or higher, as required by organizational policy.
    

10.  Click Create (or Save changes for an existing rule) to apply the rule.
     

#### Backout Plan

1.  Sign in to GitHub with administrative access to the repository.
    
2.  Navigate to the target repository.
    
3.  Select Settings.
    
4.  Under Code and automation, select Branches.
    
5.  Click Edit next to the applicable branch protection rule.
    

6.  Clear Require approvals, or set Required number of approvals before merging to the previous value.
    

7.  Click Save changes.
    
8.  Verify that pull requests can be merged according to the updated configuration.
    

## References

-   [Available Rules for Rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets)
    
-   [About Protected Branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches)
    
-   [About Pull Request Reviews](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/code-quality-features/about-pull-request-reviews)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
