# Ensure default branch protection is enforced for maintainers and owners

- Source: https://support.icompaas.com/support/solutions/articles/a_1789073193465992-ensure-default-branch-protection-is-enforced-for-maintainers-and-owners
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [Version Control System (VCS)](https://support.icompaas.com/support/solutions/c_1781179095087930) › [GitLab](https://support.icompaas.com/support/solutions/folders/f_178117912544158)
- Last updated: 2026-10-27
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

Description:

This check verifies that the default branch's protection settings apply to every role, including Maintainers and Owners, so that changes can only be introduced through merge requests rather than a direct push that bypasses review.

  

Rationale:

If Maintainers or Owners are still permitted to push directly to the default branch, branch protection becomes optional for the very roles most likely to have broad access. A compromised or careless Maintainer or Owner account could then push unreviewed or malicious code straight to the default branch, undermining the entire protection strategy.

  

Impact:

-   Ensures default branch protection cannot be bypassed by Maintainer or Owner accounts
    
-   Requires all changes, including those from privileged roles, to go through a merge request
    
-   Reduces the risk of a compromised Maintainer or Owner account pushing unreviewed code
    
-   Strengthens overall change control and code review discipline
    

  

Default Value:

By default, GitLab protects a newly created project's default branch with Allowed to push and merge set to Maintainers, meaning Maintainers and Owners can still push directly to the branch without opening a merge request.

  

Pre-Requisites:

-   Maintainer or Owner access to the project
    
-   An existing GitLab project with a protected default branch
    

  

Test Plan:

1.  Sign in to GitLab at [https://gitlab.com](https://gitlab.com/).
    
2.  Select the relevant project.
    
3.  Select Settings, then Repository.
    
4.  Expand the Protected branches section.
    
5.  Locate the entry for the default branch.
    
6.  Verify that Allowed to push and merge is set to No one.
    
7.  If Allowed to push and merge allows Maintainers or any other role, follow the implementation steps.
    

  

Implementation Steps:

1.  Sign in to GitLab at [https://gitlab.com](https://gitlab.com/).
    
2.  Select the relevant project.
    
3.  Select Settings, then Repository.
    

4.  Expand the Protected branches section.
    

5.  Next to the default branch, select Edit under Allowed to push and merge.
    
6.  Set Allowed to push and merge to No one.
    
7.  Confirm Allowed to merge remains set to Maintainers, or a more restrictive role.
    

8.  Save the changes.
    

  

Backout Plan:

1.  Sign in to GitLab at [https://gitlab.com](https://gitlab.com/).
    
2.  Select the relevant project.
    
3.  Select Settings, then Repository.
    
4.  Expand the Protected branches section.
    
5.  Next to the default branch, select Edit under Allowed to push and merge.
    
6.  Set Allowed to push and merge back to Maintainers.
    
7.  Save the changes.
    

  

Reference:

-   [https://docs.gitlab.com/ee/user/project/protected\_branches.html](https://support.icompaas.com/home/icsys-026/support/support_web/%5Bobject%20Object%5D)
    
-   [https://docs.gitlab.com/ee/user/project/repository/branches/protected.html](https://support.icompaas.com/home/icsys-026/support/support_web/%5Bobject%20Object%5D)

## 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.
