Merge request approvals API returns 403 for Auditor
Summary
The get configuration API call (GET /projects/:id/approvals
) returns 403
for a token belonging to an Auditor. The same call authenticated with a token from an Administrator succeeds. Adding the Auditor as a member of the project with the Maintainer role gets this API call to work but removes the benefit of the Auditor role.
The restrictions associated with the Auditor user do not seem to indicate that this information would be limited.
Steps to reproduce
- Create an account with the Auditor role
- Create a Personal Access Token associated with the user with the Auditor role
- Make an API call like
curl --request GET --url https://gitlab.example.com/api/v4/projects/5/approvals --header 'Authorization: Bearer glpat-AUDITOR_TOKEN'
- Observe that a
403
is returned - Make the same API call abvoe with a token for the Administrator
- Observe that the requested data is returned in a
200
response
Example Project
Any project on gitlab.com
would act as a good example. An API token associated with an Auditor accoutn will be needed.
What is the current bug behavior?
The Auditor gets 403
when trying to GET /projects/:id/approvals
.
What is the expected correct behavior?
The Auditor should get 200
and the requested data when trying to GET /projects/:id/approvals
.
Relevant logs and/or screenshots
Output of checks
This has been observed in GitLab 14.6 and 14.7.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Proxy: no Current User: git Using RVM: no Ruby Version: 2.7.5p203 Gem Version: 3.1.4 Bundler Version:2.1.4 Rake Version: 13.0.6 Redis Version: 6.0.16 Git Version: 2.33.1. Sidekiq Version:6.3.1 Go Version: unknown GitLab information Version: 14.7.2-ee Revision: 39a169b2f25 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 12.7 URL: https://gitlab.example.com HTTP Clone URL: https://gitlab.example.com/some-group/some-project.git SSH Clone URL: git@gitlab.example.com:some-group/some-project.git Elasticsearch: no Geo: no Using LDAP: yes Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 13.22.2 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 13.22.2 ? ... OK (13.22.2) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes (cluster/worker) ... 1/1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 8 users of 100 limit.
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units) Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units) Projects have namespace: ... 2/1 ... yes 1/2 ... yes 10/3 ... yes 1/4 ... yes 13/5 ... yes 13/6 ... yes 13/7 ... yes 1/8 ... yes 7/9 ... yes 2/10 ... yes 1/11 ... yes Redis version >= 5.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.5) Git version >= 2.33.0 ? ... yes (2.33.1) Git user has default SSH configuration? ... yes Active users: ... 4 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished