Skip to content
  • There are no suggestions because the search field is empty.

GitHub branch protection is enforced

Checks that the default branch of every selected GitHub repository is protected by a ruleset or branch protection rule, also for administrators.

GitHub branch protection is enforced

This check verifies that the default branch of every selected GitHub repository is protected, administrators included, so nobody with write access changes production code outside your rules. It answers the question an auditor asks: is your source code protected against unchecked changes, and can you show that you keep checking?

In short: ISOPlanner reads the branch protection of your repositories through the ISOPlanner GitHub App, which an owner of your organization installs with read-only permissions. A branch passes when a branch protection rule or an active ruleset protects it and, by default, administrators cannot bypass that protection. When one repository fails, the run is rejected and a task is created that names per repository what to fix on GitHub. Every scheduled run is kept as evidence and is linked to the controls named below. The check is one of the six checks of the GitHub app in the Store; five of them share one connection.

What the check verifies

GitHub protects a branch with branch protection rules and rulesets. The check reads both, for each branch a rule names, and combines them as GitHub does; a ruleset in evaluate mode or disabled does not count. A branch passes when it is protected and meets the rule: by default administrators cannot bypass the protection, and optionally the branch cannot be deleted. The run is accepted when every evaluated repository passes.

FrameworkControls this check gives evidence for
ISO 27001:2022A.8.4 Access to source code, A.8.9 Configuration management, A.8.32 Change management
SOC 2CC8.1 Change management
NIS2 Quality Mark (High)4.15 Controlled implementation of changes, 6.1 Access to the source code
NIS2 Quality Mark (Substantial)6.1 Access to the source code

When you add the check, ISOPlanner links it to the controls in this table of the frameworks your organization uses, and to the controls of your other frameworks that are related to them. A framework you add later is linked the same way. The NIS2 Quality Mark has three levels (Basic, Substantial and High) and your organization uses one of them; each NIS2 row names the levels it applies to. You can change the links. The check is evidence for these controls; it does not cover them completely.

Before you start

  • Automated control monitoring is part of the Business and Premium subscriptions of ISOPlanner.
  • The check belongs to the GitHub app. Add the app first: go to Administration > Store, click More info on the GitHub tile and then Start free trial. The trial takes 30 days and renews into a paid subscription unless you cancel it. If your organization already uses another GitHub check, this check is already there.
  • You need a licensed manager or administrator role in ISOPlanner to add the app and to set up the check.
  • An organization on GitHub.com: personal accounts and GitHub Enterprise Server are not supported. Private repositories need a paid GitHub plan (Team or Enterprise): on GitHub Free they have no branch protection and fail.
  • An owner of the GitHub organization installs the ISOPlanner GitHub App and connects it in ISOPlanner; anyone else is refused.
  • To make a failing repository pass, an administrator of the repository changes its rules on GitHub.

The app asks for these permissions, all read-only, in one set:

PermissionWhy
Repository: Administration (read)Reads the branch protection rules.
Repository: Metadata (read)Lists the granted repositories and reads the active rulesets.
Organization: Members (read)Lists the members and outside collaborators, and confirms that you are an owner when you connect.
Organization: Administration (read)Reads whether the organization requires two-factor authentication.

1. Connect GitHub

You connect once. Five of the six GitHub checks use the same connection, the ISOPlanner GitHub App; GitHub CODEOWNERS file exists has one of its own.

  1. Go to Administration > Settings > Automation, open the tab Control monitoring and click the card GitHub branch protection is enforced.
  2. Under Authorization click Connect GitHub, then Continue to GitHub.
  3. Sign in on GitHub as an owner. If the app is not installed yet, choose the organization, all or selected repositories, and approve the read permissions.
  4. GitHub returns you to ISOPlanner, and the dialog says that it is connected to your GitHub organization.

The Connect GitHub dialog with the read permissions the ISOPlanner GitHub App asks for

Finish on GitHub within 15 minutes. ISOPlanner stores no password or token, only the installation. To change which repositories the app sees, or to remove it, click Manage on GitHub; Reconnect GitHub connects again.

2. Set the options

Repositories

Click Test under Test and manage results, then Repositories.

OptionWhat it does
All repositories granted to the appThe default. Every repository the app can see, also one you grant it later.
Repositories to leave outWith all repositories: names not checked, one per line, at most 100.
Only the repositories named belowOnly the names under Repository names, 1 to 100.
Include archived repositoriesOff by default.
Include forksOff by default.

Options

Click Options. The default branch rules hold for every repository without rules of its own; Add branch rule adds one, at most 10.

OptionWhat it does
BranchEmpty by default: the default branch of each repository. Or the name of a branch.
The protection also binds administratorsOn by default. Administrators cannot bypass the protection.
Deleting the branch must be blockedOff by default.
A checklist item per repositoryOn by default. Off: one checklist item lists the repositories that do not comply.

For rules of their own, select repositories in the result and click Repository settings (at most 200 repositories); Use default rules undoes it. A rule names a branch, not a pattern such as release/*. A run evaluates at most 200 repositories and reads at most 1,500 branches.

3. Test and read the result

The test starts when you open the dialog; Run starts it again after you change the repositories or the rules. A test shows the result and stores nothing.

Test result of GitHub branch protection is enforced: one private repository that fails because its GitHub plan offers no branch protection

ColumnWhat it shows
RepositoryThe repository; (own rules) when it has rules of its own.
RuleThe branch: default branch, or its name.
AdminsWhether administrators are bound: Yes, No or unknown.
Deletion blockedYes or No.
FoundWhat protects the branch, or why the rule fails.

Above the table the result reads Compliant or Not compliant, with the number of repositories evaluated and failing. An icon marks each row that passes or fails.

In this example the only repository is private on GitHub Free, so GitHub offers no branch protection for it: Evidence Rejected.

4. Schedule and switch on

  1. In the test dialog choose the Incident response template: the task template ISOPlanner uses when a run is rejected. Give the template an assignee.
  2. Under Set a schedule click Schedule. The check can run daily at most.
  3. Under Status switch the check to Active.

From then on every run stores Evidence Accepted or Evidence Rejected. A rejected run creates a task from the template with one checklist item per failing repository: what was found and where to change it. How the results show in the annual plan, on dashboards and on the controls is in Automated Control Monitoring.

The statuses at a glance

Protection per branch

FoundMeaningWhat to do
Branch protection rule, Ruleset or Branch protection rule and rulesetWhat protects the branch. It passes when it meets the rule.Nothing.
The branch is not protectedIt fails.Add a branch ruleset that targets it (Settings > Rules > Rulesets).
The protection does not bind administratorsAdministrators can bypass the rule. It fails.Enable "Do not allow bypassing the above settings" in the rule.
Protected by rulesets onlyThe bypass list cannot be read. It fails while administrators must be bound.See the questions below.
The branch can be deletedOnly when deletion must be blocked. It fails.Enable "Restrict deletions".
GitHub's plan does not offer branch protection for this private repository.Private, on GitHub Free. It fails.Move to a paid plan, or leave the repository out and record why.
The branch does not exist.It fails.Correct the branch name of the rule.
The repository does not exist or is not granted to the ISOPlanner GitHub App.It fails.Grant it to the app on GitHub, or correct the selection.

The outcome of a run and the status of the check

StatusMeaning
Evidence AcceptedEvery evaluated repository passed.
Evidence RejectedAt least one repository failed, no repository was left to evaluate, or not every repository could be read.
ActiveThe check runs on its schedule.
Needs AttentionThe check is switched on but the GitHub connection is not authorized, for example because the app was removed or suspended, or a new permission was not accepted.
DisabledThe check does not run. This is the status right after you add the app.

Questions and troubleshooting

Protected by rulesets only; whether administrators can bypass them cannot be read.

GitHub does not show apps who may bypass a ruleset, so such a branch fails rather than passing unverified. Add a branch protection rule with "Do not allow bypassing the above settings", or switch The protection also binds administrators off and record how you check the bypass list.

Only an owner of the GitHub organization can connect it to ISOPlanner.

A member can only request the installation. An owner approves it on GitHub and clicks Connect GitHub.

The app was installed on a personal GitHub account.

Install it on your organization instead.

This GitHub installation could not be matched to your request.

The steps on GitHub took over 15 minutes or were started by someone else. Click Connect GitHub again.

The app is no longer installed, is suspended, or asks for a permission that was not accepted

The check shows Needs Attention. An owner fixes it on GitHub (Open on GitHub in the dialog), then tests the connection again.

No repository to evaluate

None of the repositories granted to the app fits the selection. Grant repositories on GitHub or widen the selection.

Not every repository was evaluated

The selection holds more repositories or branches than one run reads, so every run is rejected. Narrow the selection.

I cannot delete the check

A check of an app you subscribe to cannot be removed, only switched to Disabled. To stop paying for the GitHub app, cancel it in the Store. The ISOPlanner GitHub App stays installed until an owner uninstalls it on GitHub (organization Settings > GitHub Apps).

Related articles