Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33318

GitHub Enterprise Server validation does not work when private mode is enabled

      The method checkApiUrlValidity() does not work fine when a GitHub Enterprise instance is configured in private mode.

      When I've added this method in GitHub API forget to check with this configuration:

      public void checkApiUrlValidity() throws IOException {
          retrieve().to("/", GHApiInfo.class).check(apiUrl);
      }
      

      Probably, we need to do changes in this plugin (to handle the error) and in GitHub API.

          [JENKINS-33318] GitHub Enterprise Server validation does not work when private mode is enabled

          Manuel Recena Soto created issue -
          Manuel Recena Soto made changes -
          Description New:
          Manuel Recena Soto made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Manuel Recena Soto made changes -
          Description Original:
          New: The method {{checkApiUrlValidity()}} does not work fine when a GitHub Enterprise instace is configured in {{private mode}}.

          When I've added this method in [GitHub API|https://github.com/kohsuke/github-api] forget to check with this configuration:

          {noformat}
          public void checkApiUrlValidity() throws IOException {
              retrieve().to("/", GHApiInfo.class).check(apiUrl);
          }
          {noformat}

          Probably, we need to do changes in this plugin (to handle the error) and in *GitHub API*.

          This seems to be what I'm talking about here and here.

          For info, from my GitHub Enterprise instance:

          Mar 05, 2016 12:37:50 AM org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri
          WARNING: Server returned HTTP response code: 401 for URL: https://github.example.com/api/v3/
          
          $ curl -i https://github.example.com/api/v3/                                                     
          HTTP/1.1 401 Unauthorized
          Server: GitHub.com
          Date: Fri, 04 Mar 2016 23:56:42 GMT
          Content-Type: application/json; charset=utf-8
          Content-Length: 130
          Status: 401 Unauthorized
          X-GitHub-Media-Type: github.v3
          X-XSS-Protection: 1; mode=block
          X-Frame-Options: deny
          Content-Security-Policy: default-src 'none'
          Access-Control-Allow-Credentials: true
          Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
          Access-Control-Allow-Origin: *
          X-GitHub-Request-Id: 3f457a05-16e9-490f-b28e-175cdffa45b8
          Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
          X-Content-Type-Options: nosniff
          
          {
            "message": "Must authenticate to access this API.",
            "documentation_url": "https://developer.github.com/enterprise/2.5/v3"
          }
          

          The 401 response throws an IOException, which the plugin turns into a generic error message.

          This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly

          Christopher Orr added a comment - This seems to be what I'm talking about here and here . For info, from my GitHub Enterprise instance: Mar 05, 2016 12:37:50 AM org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri WARNING: Server returned HTTP response code: 401 for URL: https: //github.example.com/api/v3/ $ curl -i https: //github.example.com/api/v3/ HTTP/1.1 401 Unauthorized Server: GitHub.com Date: Fri, 04 Mar 2016 23:56:42 GMT Content-Type: application/json; charset=utf-8 Content-Length: 130 Status: 401 Unauthorized X-GitHub-Media-Type: github.v3 X-XSS-Protection: 1; mode=block X-Frame-Options: deny Content-Security-Policy: default -src 'none' Access-Control-Allow-Credentials: true Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval Access-Control-Allow-Origin: * X-GitHub-Request-Id: 3f457a05-16e9-490f-b28e-175cdffa45b8 Strict-Transport-Security: max-age=31536000; includeSubdomains; preload X-Content-Type-Options: nosniff { "message" : "Must authenticate to access this API." , "documentation_url" : "https: //developer.github.com/enterprise/2.5/v3" } The 401 response throws an IOException , which the plugin turns into a generic error message . This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly

          orrc I did not have time to solve this bug but I'll work on it this weekend. Thanks for you feedback.

          Manuel Recena Soto added a comment - orrc I did not have time to solve this bug but I'll work on it this weekend. Thanks for you feedback.
          Manuel Recena Soto made changes -
          Description Original: The method {{checkApiUrlValidity()}} does not work fine when a GitHub Enterprise instace is configured in {{private mode}}.

          When I've added this method in [GitHub API|https://github.com/kohsuke/github-api] forget to check with this configuration:

          {noformat}
          public void checkApiUrlValidity() throws IOException {
              retrieve().to("/", GHApiInfo.class).check(apiUrl);
          }
          {noformat}

          Probably, we need to do changes in this plugin (to handle the error) and in *GitHub API*.
          New: The method {{checkApiUrlValidity()}} does not work fine when a GitHub Enterprise instance is configured in {{private mode}}.

          When I've added this method in [GitHub API|https://github.com/kohsuke/github-api] forget to check with this configuration:

          {noformat}
          public void checkApiUrlValidity() throws IOException {
              retrieve().to("/", GHApiInfo.class).check(apiUrl);
          }
          {noformat}

          Probably, we need to do changes in this plugin (to handle the error) and in *GitHub API*.
          Manuel Recena Soto made changes -
          Link New: This issue is related to JENKINS-33228 [ JENKINS-33228 ]
          Manuel Recena Soto made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly

          In this form we don't need a credentials to validate if the URL is or not a valid Endpoint URL. Where you defines the GitHub source or GitHub Organization can be useful. I'll file an Jira issue for that.

          Manuel Recena Soto added a comment - This is also why the GitHub Plugin's UI, where I can enter credentials and click the "Verify credentials" is way more user-friendly In this form we don't need a credentials to validate if the URL is or not a valid Endpoint URL. Where you defines the GitHub source or GitHub Organization can be useful. I'll file an Jira issue for that.

            recena Manuel Recena Soto
            recena Manuel Recena Soto
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: