# Ensure branch protection is enabled on the default branch

- Source: https://support.icompaas.com/support/solutions/articles/a_1790019226138681-ensure-branch-protection-is-enabled-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-09-21
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Description**

Ensure the repository's default branch has an active ruleset applied to it, establishing a baseline of protection rather than leaving the branch completely unprotected.

**Rationale**

Without any active ruleset, the default branch has no restrictions on direct pushes, deletions, force pushes, or unreviewed merges. A baseline ruleset is the foundation required before any of the more specific protections, such as required reviews or status checks, can be enforced.

**Impact**

-   Establishes a minimum baseline of protection for the repository's most important branch
    
-   Provides the foundation required to enforce reviews, status checks, and other controls
    
-   Reduces the risk of unrestricted direct pushes, deletions, or force pushes to production code
    
-   Supports compliance with secure software development frameworks
    

**Default Value**

By default, a newly created repository's default branch has no ruleset applied to it.

**Pre-Requisites**

-   Admin access to the repository
    

**Test Plan**

1.  Sign in to GitHub at [https://github.com](https://github.com/).
    
2.  Select the relevant repository.
    
3.  Click Settings.
    
4.  In the "Code, planning, and automation" section of the sidebar, click Rulesets.
    
5.  Verify that an active ruleset exists whose target branches include the default branch.
    
6.  If no active ruleset covers the default branch, follow the implementation steps.
    

**Implementation Steps**

1.  Sign in to GitHub at [https://github.com](https://github.com/).
    
2.  Select the relevant repository.
    
3.  Click Settings.
    
4.  In the "Code, planning, and automation" section of the sidebar, click Rulesets.
    
5.  Click New ruleset, then New branch ruleset.
    
6.  Under Ruleset Name, enter a name, and set Enforcement status to Active.
    
7.  Under Target branches, click Add target, then select Include default branch.
    
8.  Under Rules, select the protections appropriate to your organization's policy, such as required pull requests, status checks, and restrictions on force pushes and deletions.
    
9.  Click Create.
    

**Backout Plan**

1.  Sign in to GitHub at [https://github.com](https://github.com/).
    
2.  Select the relevant repository.
    
3.  Click Settings.
    
4.  In the "Code, planning, and automation" section of the sidebar, click Rulesets.
    
5.  Next to the ruleset targeting the default branch, click the options menu, then click Delete ruleset.
    
6.  Confirm the deletion.
    

**Reference**

-   [https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets)

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