Add policy label for branch rule settings

What does this MR do and why?

This merge request adds visual indicators to show when branch protection rules are controlled by security policies.

The changes introduce two new components: a "PolicyBadge" that displays either "enforced by policy" or "policy warn mode" with a shield icon, and a "DisabledByPolicyPopover" that provides additional context. When a branch is protected by a security policy, the system now shows these visual cues next to the branch name and grays out any conflicting access level text to indicate those settings are overridden by the policy.

The implementation includes proper data flow from the backend (adding security policy fields to GraphQL queries), through the frontend components, and includes comprehensive test coverage. This helps users understand when their branch protection settings are being managed by organizational security policies rather than manual configuration.

References

Screenshots or screen recordings

Description UI
Policy enforced label and warning

How to set up and validate locally

  1. Go to Project -> Secure-> Policies -> New approval policy

  2. Create policy in warn mode and this setting enabled

    Screenshot 2026-02-04 at 16.12.59.png

  3. Go to Settings -> Repository -> Branch Rules

  4. Make sure you see label and warning icon

  5. Go back yo policy, updated it to enforced

  6. Check settings again

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #536379 (closed)

Edited by Artur Fedorov

Merge request reports

Loading
Loading