Access level disparity in project protected branches
Summary
A user is not able to push to a protected branch with one user, even after specifying that the one user is allowed to push. We also note that there is a disparity when No role(No one) is selected and a user specified for "Allowed to push and merge" on their version 15.11.5 versus GitLab.com
API result shows access level as 40
{
"id": 102312164,
"name": "test",
"push_access_levels": [
{
"id": 120656936,
"access_level": 0,
"access_level_description": "No one",
"deploy_key_id": null,
"user_id": null,
"group_id": null
},
{
"id": 120656937,
"access_level": 40,
"access_level_description": "Brenda Nyaringita",
"deploy_key_id": null,
"user_id": 11274006,
"group_id": null
}
],
In version 15.11.5
, the customer has the same No role, 1 user
setting and they get this from the API:
{
"id": 1422,
"name": "develop",
"push_access_levels": [
{
"id": 1515,
"access_level": 0,
"access_level_description": "Jenkins Master",
"deploy_key_id": null,
"user_id": 4,
"group_id": null
},
{
"id": 1513,
"access_level": 0,
"access_level_description": "No one",
"deploy_key_id": null,
"user_id": null,
"group_id": null
}
],
Thus the failure:
{"correlation_id":"01HVQZXFH5M9FKJZK3Y5SAB23B","duration_ms":87,"error":"You are not allowed to push code to protected branches on this project.","level":"error","method":"POST","msg":"Internal API error","status":401,"time":"2024-04-18T06:57:13.584Z","url":"http://unix/gitlab/api/v4/internal/allowed"}
Workaround
The customer has to Unprotect the branch then protect it again for the permissions to show up as 40 allowing them to push.
Steps to reproduce
1.) Create a project and add branches 2.) Protect one of the branches as the screenshot above
Example Project
What is the current bug behavior?
What is the expected correct behavior?
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
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)