Trigger a test group webhook API gives unexpected 422 when IP access is restricted
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
The trigger a test group hook REST API endpoint returns a 422 Ensure the project has merge requests. response if the request comes from an IP address that is not allowed through the restrict group access settings.
Instead, this should probably be a 403 with an appropriate message.
This was discovered when working with a large, GitLab Premium customer on a Support ticket (internal).
Steps to reproduce
- Enable restrict group access by IP address. Make sure that an IP address that can be used to test later is not on the list.
- From an IP address which isn't allowed, call the trigger a test group hook API. Observe the response.
Example Project
What is the current bug behavior?
422 Ensure the project has merge requests. response
What is the expected correct behavior?
403 response with a relevant mssage
Relevant logs and/or screenshots
Rails logs will have a message Attempting to access IP restricted group, and the allowed field has the value false.
Output of checks
This bug happens on GitLab.com.
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)