Admins can push to any branch on which _anyone_ has push permissions, regardless of the admin's permissions
Summary
If any user or role is allowed to push to a protected branch, all admins, instance-wide, can push to the protected branch regardless of whether that admin has privileges within the individual project. Example: If any user or role can push directly a branch, the admin can also push directly to that branch, but if no one can push, neither can an admin override permissions.
The customer reported this behavior when they were still on 13.11.x, but has since upgraded to 13.12 and the issue persists.
Steps to reproduce
- Protect a branch
- Push to the protected branch as admin - observe that permissions are denied
- Authorize any user on that project to push directly, but not the admin
- Attempt to push to the protected branch as admin, observe that admin can now push
Example Project
What is the current bug behavior?
Admins can push directly to any branch to which any user can push directly, even if that admin is not part of the project.
What is the expected correct behavior?
One would expect for administrators to not be able to override permissions and push directly to branches on which they are not authorized.
Or, an admin should functionally be "root" across the instance and have full control, not have their access limited by branch protections.
Relevant logs and/or screenshots
Output of checks
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
NA
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)