Cannot use SUDO in API calls with private token
Summary
I want to use the API to create issues on behalf of other users, using SUDO. Even if I use the private token of the root user, I get 403 Forbidden.
Steps to reproduce
curl -X POST 'https://our-gitlab-instance/api/v3/projects/test%2Ftestproject/issues?private_token=THEPRIVATETOKEN' --header "SUDO: AUserName" --data "description=description&title=Test issue 2"
Expected behavior
I expect an issue 'Test issue 2' to be created in the project test/testproject, with as the creator the user with user name AUserName.
Actual behavior
I get:
{"message":"403 Forbidden - Must be admin to use sudo"}
Results of GitLab application Check
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... no
User id for git: 985. Groupd id for git: 983
Try fixing it:
sudo chown -R git:git /var/opt/gitlab/git-data/repositories
For more information see:
doc/install/installation.md in section "GitLab Shell"
Please fix the error above and rerun the checks.
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
5/1 ... ok
5/2 ... ok
35/6 ... repository is empty
61/14 ... ok
61/15 ... ok
34/16 ... ok
62/20 ... ok
70/21 ... repository is empty
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... no
Try fixing it:
sudo chown -R git /var/opt/gitlab/gitlab-rails/uploads
sudo find /var/opt/gitlab/gitlab-rails/uploads -type f -exec chmod 0644 {} \;
sudo find /var/opt/gitlab/gitlab-rails/uploads -type d -not -path /var/opt/gitlab/gitlab-rails/uploads -exec chmod 0700 {} \;
For more information see:
doc/install/installation.md in section "GitLab"
Please fix the error above and rerun the checks.
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
projects have namespace: ...
5/1 ... yes
5/2 ... yes
35/6 ... yes
61/14 ... yes
61/15 ... yes
34/16 ... yes
62/20 ... yes
70/21 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.1)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 61
Checking GitLab ... Finished
Results of GitLab environment info
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.3.1p112
Gem Version: 2.6.6
Bundler Version:1.13.6
Rake Version: 10.5.0
Sidekiq Version:4.2.1
GitLab information
Version: 8.14.4
Revision: 3ea6c8d
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: (i removed this)
HTTP Clone URL: (i removed this)
SSH Clone URL: (i removed this)
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: cas3
GitLab Shell
Version: 4.0.3
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Possible fixes
It will probably have something to do with this commit: https://gitlab.com/gitlab-org/gitlab-ce/commit/3ed96afc47c481db4f8c0a6581602abaee920808