> For the complete documentation index, see [llms.txt](https://docs.sprinto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinto.com/monitors/code-and-repository-monitors/how-to-resolve-sprinto-check-for-enabling-branch-protection-rules.md).

# How to resolve Sprinto check for enabling branch protection rules

### About <a href="#about" id="about"></a>

Sprinto check: Branch Protection rules should be enforced for admins

This Sprinto check activates upon integrating your code hosting service with Sprinto, triggering when no branch protection rules are configured on your integrated service provider account. Branch protection rules are essential security configurations designed to safeguard production code, ensuring that changes undergo thorough review before being pushed.

### Purpose <a href="#purpose" id="purpose"></a>

The purpose of this check is to guarantee the implementation of proper security configurations, such as code peer review and merge request approval, on repositories hosting production code. This method introduces an additional layer of security, preventing any sudden or malicious changes from being pushed to the code repository. Branch protection rules contribute to meeting the data compliance requirements associated with change management.

### How to resolve <a href="#how-to-resolve" id="how-to-resolve"></a>

To resolve this sprint check, you need to enable the branch protection rules on your code hosting service. Follow the below procedure for various code hosting services that you use.

#### 1. Github <a href="#id-1.-github" id="id-1.-github"></a>

Follow the below procedure to enable branch protection rules on Github:

Video Guide

Before you begin

* Ensure you are on the Team plan on GitHub.
* Ensure you have “Admin” privileges on your GitHub account to modify security configuration.

Procedure

1. Log in to[ Github](https://github.com/) with your credentials, and navigate to the main page of the repository.
2. Under the repository name, click on Settings.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080610870/original/rESn0gnMufVAFkGSB8-ltegNI0wrMQvrxA.png?1704793033" alt=""><figcaption></figcaption></figure>
3. On the sidebar under the Code and Automation section, click Branches.
4. Click Add rule next to the Branch protection rules.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080610906/original/p5r7bAHiUMTruXva0mYlFIngjXUW2oFFag.png?1704793064" alt="" width="563"><figcaption></figcaption></figure>
5. Under the Branch name pattern, type the branch name or pattern you want to protect.
6. Enable required pull request approvals
   * Select **Require a pull request before merging**.

     <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080610936/original/vvmpgLRAE6cY3aZvtR-RiLAgKkdDsNLcSA.png?1704793095" alt=""><figcaption></figcaption></figure>
   * Select **Require approvals**.
   * Set the required number of approvals to at least **1**.

{% hint style="info" %}

#### Note

Sprinto validates whether pull request approvals are enforced for protected branches. If **Require approvals** is disabled or the approval count is set to `0`, the Sprinto check may continue to fail even if other branch protection settings are enabled.
{% endhint %}

7. Select Require status checks to pass before merging.

{% hint style="info" %}

#### Note

&#x20;In case you cannot enable the status check rule, you can request [Sprinto support](mailto:www.support@sprinto.com) to disable this check for you.
{% endhint %}

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080610982/original/A4Ws7sMzfLJD9K1drEi6JKa4jIxfoiUGoA.png?1704793123" alt="" width="563"><figcaption></figcaption></figure>

8. Select Do not allow bypassing the above settings to enforce these to administrators.

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611027/original/2q1nGD_Czux_qv6pWAJS5aQrEKiHNYaDUg.png?1704793156" alt="" width="563"><figcaption></figcaption></figure>

9. Ensure Dependabot, a free Dependency Vulnerability scanner, is enabled on all production repositories.
   1. Go to the repository main page on your GitHub account.
   2. Under your repository name, click Settings.
   3. On the sidebar under the Security section, click Code Security and analysis.
   4. On Code security and analysis page, click Enable next to Dependabot alerts.

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611117/original/TQ4M6DYqb_F8ya2Wg_F3-zBsQPhFVCxzCQ.png?1704793181" alt="" width="563"><figcaption></figcaption></figure>

#### 2. Gitlab <a href="#id-2.-gitlab" id="id-2.-gitlab"></a>

Follow the below procedure to enable branch protection rules on Gitlab:

Video Guide

Before you begin

* Ensure you are on the Gitlab premium plan.
* Ensure you have “Admin” privileges on the Gitlab account to modify security configuration.

Procedure

Note: Repeat the procedure below for each Gitlab project and group with code repositories with production-side code.

1. Go to Projects > Your Project.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611188/original/OfTmz22o6-8LUivFsFhCL4bklzkxE9SvaQ.png?1704793216" alt="" width="563"><figcaption></figcaption></figure>
2. Go to Settings > Repositories > Protected branches:
   1. Ensure the required checks are in place.

      <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611221/original/AvIJ89u7gs_IZlDdK1XsAeyNpL-9zrdqkQ.png?1704793247" alt="" width="563"><figcaption></figcaption></figure>
3. Go to Settings > General > Merge Request:
   1. Ensure the required checks are in place.

      <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611267/original/9ZMs3Q3l40iRLQhEeFSWar4XmOaXCnt9Yg.png?1704793275" alt="" width="563"><figcaption></figcaption></figure>
4. Now, from main menu, go to Groups > Your groups.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611315/original/sFtSsuOEuGBsExky9zqVfkbESgY2wjyy2g.png?1704793306" alt="" width="563"><figcaption></figcaption></figure>
5. Select a project with production repositories, and :

* Click on Settings > General > Merge Request Approvals.
* Set the number of approvals required to 1.

  <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611337/original/zY9jBx5j7pJkwUlWRDgZhwU5b3kdI9u9Cw.png?1704793338" alt=""><figcaption></figcaption></figure>
* Click on Add approval rule.

  <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611376/original/A4gdDgdcIkKd0toVSqpS-Q6R558UQhzLQQ.png?1704793367" alt=""><figcaption></figcaption></figure>
* Configure approval settings.

  <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611415/original/8ZtfosLN40rLEdSm7ecQsWxvOWIhe6ddWA.png?1704793392" alt=""><figcaption></figcaption></figure>

#### 3. Bitbucket <a href="#id-3.-bitbucket" id="id-3.-bitbucket"></a>

Follow the below procedure to enable branch protection rules on Bitbucket:

Before you begin

* Ensure you are on the Bitbucket premium plan.
* Ensure you have “Admin” access on the Bitbucket account to modify the security configuration.

Procedure

1. Log in to your[ Bitbucket](https://bitbucket.org/) account.
2. Click on Repositories under the main menu.
3. Click Repository settings.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611454/original/vbC5DVhMr20ZbwDXg2E9IVMv6qlHg3XJzw.png?1704793421" alt="" width="563"><figcaption></figcaption></figure>
4. On the sidebar, under the Workflow section, click Branch Restrictions.
5. Ensure settings are set as mentioned.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611503/original/0O0uCiwH9aNFmyE45TRQm2_ZJM1R1BZWvA.png?1704793447" alt="" width="563"><figcaption></figcaption></figure>

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611565/original/VUBh6jUWuoApfIBMMW__fiJmTnFM6j2gCA.png?1704793476" alt="" width="563"><figcaption></figcaption></figure>
6. Ensure a Dependency Vulnerability scanner is enabled on all production repositories.\
   &#x20;Note: Bitbucket doesn't have a built-in free dependency scanner like Github. You can try[ SLscan](https://slscan.io/en/latest/) or[ Snyk](https://snyk.io/).

#### 4. AWS CodeCommit <a href="#id-4.-aws-codecommit" id="id-4.-aws-codecommit"></a>

Follow the below procedure for enabling branch protection rules on AWS CodeCommit:

Before you begin

* Approval rules for pull requests.
* Managed policies for approval rule templates.

Procedure

* Refer to AWS CodeCommit documentation for setting up approval rule templates. See [Permissions for actions on approval rule templates](https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-permissions-reference.html#aa-art) and [AWS-managed policies for CodeCommit](https://docs.aws.amazon.com/codecommit/latest/userguide/security-iam-awsmanpol.html).
* Ensure a Dependency Vulnerability scanner is enabled on all production repositories.\
  \
  &#x20;Note: AWS CodeCommit doesn't have a built-in free dependency scanner like Github. You can try [SLscan](https://slscan.io/en/latest/) or [Snyk](https://snyk.io/).

  <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611626/original/grsPyOP1dYlPnVld2RA5OhH-B3mw-Rv7Iw.png?1704793504" alt="" width="563"><figcaption></figcaption></figure>

#### 5. Azure DevOps <a href="#id-5.-azure-devops" id="id-5.-azure-devops"></a>

Follow the below procedure to enable branch policies on Azure DevOps:

Before you begin

* Ensure you have access to manage the branch policies on Azure DevOps.
* Ensure that the policies are enabled at the branch level.

Procedure

1. Select Repos > Branches in the Azure DevOps web portal to manage branch policies.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611671/original/7J0ajNpQW_Xd5IgVH4aml4lkcYnTvUigjA.png?1704793535" alt="" width="563"><figcaption></figcaption></figure>
2. Search for the branch and choose Branch policies.

* Enable Require a minimum number of reviewers and set the required number (at least 1).

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/72080611689/original/MOHx8oXLFjr9V2uZpGCWbFbcIaZ5HlfdwA.png?1704793563" alt="" width="563"><figcaption></figcaption></figure>

* Scroll to **Status Checks** → click **+ Add**.
* Complete the required fields (for example, *Status to check*) and click **Save**.

{% hint style="info" %}
Policies should be enabled at the branch level as they are not synced from Project level settings.
{% endhint %}

Applying these branch protection rules ensures a secure and compliant development practice across all production repositories tracked by Sprinto. Sprinto retrieves the changes and sets the Sprinto check for branch protection to “Passing.” If you need any assistance with the Sprinto check, please get in touch with [Sprinto Support](mailto:www.support@sprinto.com).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sprinto.com/monitors/code-and-repository-monitors/how-to-resolve-sprinto-check-for-enabling-branch-protection-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
