Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-9301

Support HTTP redirects on scanner side

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6-M3, 6.6
    • Component/s: Scanner
    • Labels:

      Description

      It is required for the scanner to properly support redirect for the server HTTP connections. For GET requests it works out of the box thanks to okhttp doesn't work when server is secured because Authentication header is lost on redirect (for security reason), and it also doesn't work at all for POST requests (like uploading the scanner report) because POST doesn't follow redirects automatically.

      For POST it has to be manually implemented. See for example what is done for webhooks:
      https://github.com/SonarSource/sonarqube/blob/f4039bbb34726f62ee61e45503c2bfa6c87dc3fb/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/webhook/WebhookCallerImpl.java#L85-L95

      For GET requests, one option could have been to switch from preemptive authentication to add an Authenticator in Okhttp client. But it doesn't work since many WS do not return authentication error, but instead adapt their response to the user permissions. So probably like POST requests, we may have to manually handle redirects, and set again Authentication header.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              julien.henry Julien Henry
              Reporter:
              julien.henry Julien Henry
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: