Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-16362

Check scheme in WebUtils#isSameOrigin

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 5.1 RC2
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      CORS specification specifies that "an origin is composed of only the scheme, hostname, and port", but WebUtils#isSameOrigin currently only checks hostname and port.

      Based on my current understanding, the main way to trigger an incorrect behavior with current implementation is to send a request from http://domain.com to https://domain.com or the other way around. Based on the spec, it should be detected by the browser as a cross origin request but won't be understood as such by our implementation, skipping CORS checks and CORS response header processing, resulting of such HTTP exchange being rejected by the browser due to the lack of CORS response headers.

      Note that performing a check on the scheme should be done very carefully in that context because it could have some unexpected side effects given that:

      • Unlike the Origin one, the Host header does not contain the scheme information (for example Host: domain.com)
      • Chrome and Safari includes the Origin header for some same origin requests, making such change on WebUtils#isSameOrigin risky.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sdeleuze Sébastien Deleuze
                Reporter:
                sdeleuze Sébastien Deleuze
                Last updater:
                Stéphane Nicoll
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  45 weeks, 1 day ago