Maintainers cannot change project name through the API
Summary
Project members with role Maintainer can change the project's name through the GUI, but get a 403 Forbidden
when doing the same through the API.
Steps to reproduce
- Create a project and assign yourself Maintainer role
- Go to the Project settings and make sure you can change the project name. (The display name, not the path)
- Create a personal access token with
api
permissions - Using the
Edit Project
API endpoint and you Personal Access Token, try to change the name of the previous project. You should get a403 Forbidden
.
Example Project
I'm running GitLab docker image 15.3.3-ee locally to test this, and create a dummy project.
What is the current bug behavior?
Project Maintainers can change the project name through the GUI but not through the API.
What is the expected correct behavior?
Project maintainers should be able to change the project name through the API.
Relevant logs and/or screenshots
-
nginx/gitlab_access.log
:
172.14.0.1 - - [22/Sep/2022:08:47:30 +0000] "PUT /api/v4/projects/2 HTTP/1.1" 403 27 "" "PostmanRuntime/7.28.4" -
==> gitlab-rails/api_json.log <==
{"time":"2022-09-22T08:52:18.121Z","severity":"INFO","duration_s":0.02702,"db_duration_s":0.00451,"view_duration_s":0.02251,"status":403,"method":"PUT","path":"/api/v4/projects/2","params":[{"key":"name","value":"test2"}],"host":"gitlab.example.com","remote_ip":"172.14.0.1, 172.14.0.1","ua":"PostmanRuntime/7.28.4","route":"/api/:version/projects/:id","user_id":2,"username":"jcoelho","token_type":"PersonalAccessToken","token_id":1,"queue_duration_s":0.018469,"redis_calls":4,"redis_duration_s":0.0011459999999999999,"redis_read_bytes":440,"redis_write_bytes":275,"redis_cache_calls":3,"redis_cache_duration_s":0.000694,"redis_cache_read_bytes":440,"redis_cache_write_bytes":169,"redis_shared_state_calls":1,"redis_shared_state_duration_s":0.000452,"redis_shared_state_write_bytes":106,"db_count":9,"db_write_count":0,"db_cached_count":0,"db_replica_count":0,"db_primary_count":9,"db_main_count":9,"db_main_replica_count":0,"db_replica_cached_count":0,"db_primary_cached_count":0,"db_main_cached_count":0,"db_main_replica_cached_count":0,"db_replica_wal_count":0,"db_primary_wal_count":0,"db_main_wal_count":0,"db_main_replica_wal_count":0,"db_replica_wal_cached_count":0,"db_primary_wal_cached_count":0,"db_main_wal_cached_count":0,"db_main_replica_wal_cached_count":0,"db_replica_duration_s":0.0,"db_primary_duration_s":0.007,"db_main_duration_s":0.007,"db_main_replica_duration_s":0.0,"cpu_s":0.040702,"mem_objects":17454,"mem_bytes":1953747,"mem_mallocs":4647,"mem_total_bytes":2651907,"pid":1468,"worker_id":"puma_7","rate_limiting_gates":[],"correlation_id":"01GDJ6BMGPAJG67YENV9A43HE0","meta.caller_id":"PUT /api/:version/projects/:id","meta.remote_ip":"172.14.0.1","meta.feature_category":"projects","meta.user":"jcoelho","meta.project":"gitlab-instance-35564aed/test","meta.root_namespace":"gitlab-instance-35564aed","meta.client_id":"user/2","content_length":"23","request_urgency":"low","target_duration_s":5}
- Postman request
PUT /api/v4/projects/2 HTTP/1.1
Host: gitlab.example.com
Authorization: Bearer glpat-*************
Content-Type: application/json
Content-Length: 23
{
"name": "test2"
}
Output of checks
This bug happens on GitLab.com
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.6 Bundler Version:2.3.15 Rake Version: 13.0.6 Redis Version: 6.2.7 Sidekiq Version:6.4.0 Go Version: unknown GitLab information Version: 15.3.3-ee Revision: 1615d086ad8 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 13.6 URL: http://gitlab.example.com HTTP Clone URL: http://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: no Using Omniauth: yes Omniauth Providers: GitLab Shell Version: 14.10.0 Repository storage paths: - default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
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 >= 14.10.0 ? ... OK (14.10.0) 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: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
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? ... skipped (no tmp uploads folder yet) 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 2/2 ... yes Redis version >= 6.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.5) Git user has default SSH configuration? ... yes Active users: ... 2 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-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished