Importing a Github Enterprise repo (using the importer tool) fails if the top level domain is not valid (custom)

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      Summary

      When using the importing tool and the GitHub Enterprise option, the import fails with a 400 (invalid url) response when the URL has a custom top level domain.

      Steps to Reproduce

      1. Go to Import tool in Web UI
      2. Select GitHub Enterprise option
      3. Enter a URL for a repo with a custom tld (eg. https://nates.repo.pvt)

      Expected Results

      Repo is imported if it can be reached

      Actual Results

      We use the Apache Commons UrlValidator (https://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/UrlValidator.html) library to check the URL. This also checks if the Top Level Domain (TLD) is one of the valid ones according to the RFC spec (it uses DomainValidator - https://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/DomainValidator.html). pvt is not a valid TLD, so it fails validation

      The below 400 error is seen in the atlassian-access.log file:

      1XX.XX.XXX.XXX | http | i@1G2MZ9Rx886x1328x0 | - | 2017-01-17 14:46:32,362 | "POST /rest/importer/latest/external-source/missing-oauth-scopes HTTP/1.1" | "http://nate.bitbucket.com:7990/plugins/servlet/import-repository/myrepo" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36" | - | - | - | - | - | rqx5li | 
      1XX.XX.XXX.XXX | http | o@1G2MZ9Rx886x1328x0 | myuser | 2017-01-17 14:46:32,362 | "POST /rest/importer/latest/external-source/missing-oauth-scopes HTTP/1.1" | "http://nate.bitbucket/com:7990/plugins/servlet/import-repository/myrepo" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36" | 400 | 178 | 225 | - | 4 | rqx5li |

      If a HAR file is generated when the issue is replicated we see the following response from Bitbucket Server: 

      "message": "The specified URL is invalid: https://nates.repo.pvt/api/v3/users/myuser"

            Assignee:
            Justin Thomas
            Reporter:
            Nate Hansberry (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: