Skip to content

Use ValidateRemoteGitEndpointService for pull mirroring configuration via UI

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Problem

Based on user's report there is a difference in pull mirroring settings processing between UI and API.

API additionally validates a correctness of pull mirroring source, however UI doesn't do that.

Reproduction steps

  1. Create a project with pull mirroring via API and check the error
curl --request POST --header "PRIVATE-TOKEN: <token>" --header "Content-Type: application/json" "http://127.0.0.1:3000/api/v4/projects" --data '{"name": "pull_testing", "import_url": "http://not-existing-url-1/git"}'

{"message":"HTTP gitlab/http_v2/blocked_url_error error: URL is blocked: Host cannot be resolved or invalid"}
  1. Try to setup a pull mirroring via UI. It allows to provide an invalid import_url.

Screenshot_2024-02-16_at_14.29.10

  1. After some time, the error appears that the import url is invalid.

Screenshot_2024-02-16_at_14.38.10

Here is a source of the discrepancy between API and UI.

  • API checks the import url before saving it in the database and immediately responds with an error.
  • UI allows to save an invalid url. The verification occurs later when we try to access the remote repository.

Proposal

  • Immediately verify the provided URL when the user setup a pull mirroring.
  • Display an error when the URL is not valid
Edited by 🤖 GitLab Bot 🤖