Skip to content

Fix URL validator for mirror services when using localhost

Furkan Ayhan requested to merge 443296-fix-url-validator into master

What does this MR do and why?

After converting from the old UrlBlocker to the new one (#430830), we saw that some self-hosted users experienced problems with the mirror repositories (#443296 (closed)).

The problem is caused when using local domains. I investigated the problem and found that UpdateMirrorService and UpdateRemoteMirrorService do not send the allow_localhost and allow_local_network settings to UrlBlocker. After adding these settings, it started to work successfully.

It's still strange that this used to be working in the old UrlBlocker.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. etc/hosts

Add another local address to test;

172.16.123.1 gdk.test gdk-mirror.test
  1. config/gitlab.yml

Allow it to be a host;

allowed_hosts: ["gdk-mirror.test"]
  1. admin/application_settings/network

I don't have any setting other than allowing local requests.

Screenshot_2024-04-02_at_15.48.20

  1. Create a project by mirroring a local project

Screenshot_2024-04-02_at_15.52.37

Without the changes in this MR

  1. After successful project creation, you'll see that mirroring does not work

Screenshot_2024-04-02_at_15.53.28

With the changes in this MR

  1. After successful project creation, you'll see that mirroring does work

Screenshot_2024-04-02_at_16.04.32

Edited by Furkan Ayhan

Merge request reports

Loading