Wildcard Protected branch setting overrides existing specific protected branch setting
Summary
If master
protected branch setting exists and there's also a wildcard protected branch that includes the master
protected branch, the wild card protected branch will override the specific master
branch push rule. Which should have been the other way around.
This would also allow the users to bypass Merge Request Approval rules and merge the MR without any approval:
https://gitlab.com/gitlab-gold/rabbit-hole-1/cicd/-/merge_requests/12
Steps to reproduce
- Create a project
- Go to the project Settings > Repository > Protected Branches
- Set
master
protected branch toAllow to Merge: Maintainers
andAllow to push: No one
- Set
*
protected branch toAllow to Merge: Maintainers
andAllow to push: Developers+Maintainers
- Try to execute git push to master branch with a
Developer
account - Observe Developer
Example Project
https://gitlab.com/gitlab-gold/rabbit-hole-1/cicd
What is the current bug behavior?
Wildcard protected branch setting overrides specific protected branch setting.
What is the expected correct behavior?
Specific protected branch should take priority over wildcard.
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com; GitLab Enterprise Edition 13.8.0-pre 1194e3e3
Results of GitLab environment info
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)