404 response when using the . character in the namespace for the push_rule API endpoint
Summary
When making requests to the push_rule API endpoint using the namespace instead of the project ID one gets a 404 response if the namespace contains .
Steps to reproduce
- Create a project with a
.
character in the namespace - Make an API request to the push_rule API endpoint:
curl --header "PRIVATE-TOKEN: .." "https://gitlab.example.com/api/v4/projects/group%2Fproject.path/push_rule"
- Get a 404 response
Example Project
What is the current bug behavior?
- A 404 response is returned
What is the expected correct behavior?
The push rules should be returned. For example request to the protected branches endpoint works with the a .
in the namespace:
curl --header "PRIVATE-TOKEN: .." "https://gitlab.example.com/api/v4/projects/group%2Fproject.path/protected_branches"
Relevant logs and/or screenshots
./gitlab-workhorse/current:{"content_type":"application/json","correlation_id":"01HFYTTJ67D4VHB224M9Y8EBDN","duration_ms":19,"host":"omnibus-instance.env-078f9f6d.gcp.gitlabsandbox.net","level":"info","method":"GET","msg":"access","proto":"HTTP/1.1","referrer":"","remote_addr":"41.90.187.175:0","remote_ip":"41.90.187.175","route":"^/api/","status":404,"system":"http","time":"2023-11-23T19:34:33Z","ttfb_ms":19,"uri":"/api/v4/projects/aviato%2Ftest.encode/push_rule","user_agent":"curl/8.1.2","written_bytes":25}
./gitlab-rails/api_json.log:{"time":"2023-11-23T19:34:33.944Z","severity":"INFO","duration_s":0.00152,"db_duration_s":0.0,"view_duration_s":0.00152,"status":404,"method":"GET","path":"/api/v4/projects/aviato%2Ftest.encode/push_rule","params":[],"host":"omnibus-instance.env-078f9f6d.gcp.gitlabsandbox.net","remote_ip":"41.90.187.175, 41.90.187.175","ua":"curl/8.1.2","route":"/api/:version/*path","queue_duration_s":0.008971,"db_count":0,"db_write_count":0,"db_cached_count":0,"db_replica_count":0,"db_primary_count":0,"db_main_count":0,"db_ci_count":0,"db_main_replica_count":0,"db_ci_replica_count":0,"db_replica_cached_count":0,"db_primary_cached_count":0,"db_main_cached_count":0,"db_ci_cached_count":0,"db_main_replica_cached_count":0,"db_ci_replica_cached_count":0,"db_replica_wal_count":0,"db_primary_wal_count":0,"db_main_wal_count":0,"db_ci_wal_count":0,"db_main_replica_wal_count":0,"db_ci_replica_wal_count":0,"db_replica_wal_cached_count":0,"db_primary_wal_cached_count":0,"db_main_wal_cached_count":0,"db_ci_wal_cached_count":0,"db_main_replica_wal_cached_count":0,"db_ci_replica_wal_cached_count":0,"db_replica_duration_s":0.0,"db_primary_duration_s":0.0,"db_main_duration_s":0.0,"db_ci_duration_s":0.0,"db_main_replica_duration_s":0.0,"db_ci_replica_duration_s":0.0,"cpu_s":0.013709,"mem_objects":3929,"mem_bytes":376824,"mem_mallocs":1495,"mem_total_bytes":533984,"pid":49462,"worker_id":"puma_0","rate_limiting_gates":[],"correlation_id":"01HFYTTJ67D4VHB224M9Y8EBDN","meta.caller_id":"* /api/:version/*path","meta.remote_ip":"41.90.187.175","meta.feature_category":"not_owned","meta.client_id":"ip/41.90.187.175","request_urgency":"default","target_duration_s":1}
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)