Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-25608

error responses from Nuget v3 remotes may not be properly parsed as errors

    Details

    • Type: Bug
    • Status: New
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.26.1
    • Fix Version/s: None
    • Component/s: nuget-v3
    • Labels:
    • Notability:
      3

      Description

      The Github Package Registry for example can reply with a 400 status code if a query limit is exceed. The response content is JSON, but it is not going to be a normal query result. Despite that NXRM can still try to parse it as such and throw a runtime error:

      2020-10-19 10:39:18,927-0700 DEBUG [qtp1103545988-20693]  *UNKNOWN org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://nuget.pkg.github.com:443
      
      2020-10-19 10:39:19,304-0700 DEBUG [qtp1103545988-20693]  *UNKNOWN org.apache.http.headers - http-outgoing-244 >> GET /example/query?skip=0&q=asd&take=250&prerelease=true&supportedFramework=.NETFramework%2CVersion%3Dv4.5.2 HTTP/1.1
      
      2020-10-19 10:39:19,431-0700 DEBUG [qtp1103545988-20693]  *UNKNOWN org.apache.http.headers - http-outgoing-244 << HTTP/1.1 400 Bad Request
      
      2020-10-19 10:39:19,432-0700 DEBUG [qtp1103545988-20693]  *UNKNOWN org.apache.http.headers - http-outgoing-244 << Content-Type: application/json; charset=utf-8
      
      2020-10-19 10:39:19,434-0700 DEBUG [qtp1103545988-20693]  *UNKNOWN org.apache.http.headers - http-outgoing-244 << X-Nuget-Warning: BAD_REQUEST:requested results size 250 exceeds max results per page 100.
      2020-10-19 10:39:19,438-0700 WARN  [qtp1103545988-20693]  *UNKNOWN org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: GET /repository/nuget-v3/v3/query/beta?q=asd&skip=0&take=26&prerelease=true&supportedFramework=.NETFramework,Version=v4.5.2
      java.lang.NullPointerException: null
       at com.sonatype.nexus.repository.nuget.internal.v3.NugetProxySearchHandler.rewriteRegistrationUrls(NugetProxySearchHandler.java:108)
       at com.sonatype.nexus.repository.nuget.internal.v3.NugetProxySearchHandler.createPayload(NugetProxySearchHandler.java:87)
       at com.sonatype.nexus.repository.nuget.internal.v3.NugetProxySearchHandler.handle(NugetProxySearchHandler.java:79)
      

      Expected

      Improve the response parser to better detect error JSON payloads as such and not error parsing them.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              plynch Peter Lynch
              Last Updated By:
              Wes Wannemacher Wes Wannemacher
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Date of First Response:

                  tigCommentSecurity.panel-title