Uploaded image for project: 'Project Quay'
  1. Project Quay
  2. PROJQUAY-10630

Playwright org mirror E2E tests fail due to unresolvable hostname in SSRF validation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • None
    • quay-ui
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      Problem

      Playwright E2E tests for organization mirroring fail when creating mirror configurations that use harbor.example.com as the external registry URL. The backend's SSRF validation (util/security/ssrf.py) performs DNS resolution on the provided hostname via socket.getaddrinfo(). Since harbor.example.com is not a real DNS-resolvable hostname, the API returns a 400 error:

      Cannot resolve hostname 'harbor.example.com'
      

      Affected Tests* playwright/e2e/organization/org-mirroring.spec.ts - "deletes mirror configuration with confirmation" (line 342)

      • playwright/e2e/organization/org-mirroring.spec.ts - "creates config with Harbor registry type" (line 599)

      Root Cause

      The Python API unit tests (endpoints/api/test/test_org_mirror.py) work because they mock DNS resolution via a pytest fixture (_mock_dns_for_ssrf_validation) that patches util.security.ssrf._getaddrinfo to return a fake public IP. The Playwright E2E tests hit the real running backend, so there is no equivalent mock -- the actual DNS lookup fails for the fake hostname.

      Impact

      These two tests fail consistently in any environment where harbor.example.com does not resolve in DNS, which is every standard environment.

              rh-ee-shossain Shaon Hossain
              rh-ee-shossain Shaon Hossain
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: