Zum Inhalt springen

Default branch protected (SEC_BRANCH_PROTECTION)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Code SEC_BRANCH_PROTECTION · Severity Required · Category Security · Applies to Universal

Default branch should have branch protection enabled (required reviews, no force push). On GitHub and GitLab this is queryable; on Bitbucket/ADO it’s best-effort.

The scan queries your git provider’s API for whether the default branch is protected. For GitHub and GitLab the protection state is read directly; for Bitbucket and Azure DevOps this check is best-effort and may not always be conclusive.

If the default branch is protected the rule passes; if there’s no protection, it fails.

An unprotected default branch lets unreviewed code land straight on main, allows history to be rewritten with force push, and lets CI checks be bypassed. Branch protection closes these gaps with required reviews, passing status checks, and a force-push block.

GitHub: Settings → Branches → add a protection rule for the default branch; enable “Require a pull request before merging” and “Do not allow force pushes”.

GitLab: Settings → Repository → Protected branches → add the default branch; set “Allowed to force push” off and require approval to merge.

Bitbucket / Azure DevOps: Configure branch permissions/policies from repository settings (required reviewers, force-push block).

After configuring it, re-run the scan.