Protected branches can be deleted

Summary

According to our documentation, no one should be allowed to delete a branch if it is protected: https://docs.gitlab.com/ee/user/project/protected_branches.html#who-can-modify-a-protected-branch

When a branch is protected, the default behavior enforces these restrictions on the branch. Delete the branch - No one

However, one can delete a protected branch using UI and Delete Repository Branch API

Steps to reproduce

  1. Create a branch
  2. Protect it from Settings -> Repository -> Protected branch
  3. Go to Repository -> Branches and press the trashcan icon to delete the protected branch

The same branch can be also deleted with Delete Repository Branch API

What is the current bug behavior?

Protected branch can be deleted

What is the expected correct behavior?

No one should be able to remove protected branches

Relevant logs and/or screenshots

image

Output of checks

This bug happens on GitLab.com

Assignee Loading
Time tracking Loading