Administrators outside of admin mode allowed to merge MRs targeting a protected branch
Summary
In our Gitlab Omnibus installation (15.3.1) administrators that have left Admin Mode are still allowed to merge MRs that target a protected branch, even though their project membership role doesn't allow them to do so.
Steps to reproduce
- Create a project where an admin has role 'Developer'
- Protect the 'main' branch, only allow the role 'Maintainers' to merge and push
- Create a MR targeting the main branch
- Make sure the admin has left Admin Mode
- Now the admin is still able to merge the MR
Example Project
What is the current bug behavior?
An admin whose project role doesn't allow them to merge an MR targeting a protected branch is allowed to merge such an MR outside of Admin Mode.
What is the expected correct behavior?
An admin whose project role doesn't allow them to merge an MR targeting a protected branch is only allowed to merge such an MR when Admin Mode has been entered.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Omnibus version: 15.3.1
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)