Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5944

CSRF prevention does not work with https URLs on the default port

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 6.20.0
    • 7.0.0, 6.21.0
    • wicket
    • None

    Description

      If your URL is https on the default port (so no :443 on the end), then the CSRF prevention (WICKET-5919) rejects requests with the Origin header supplied.

      In CsrfPreventionRequestCycleListener, line 519 looks like this

      if (port != -1 && "http".equals(scheme) && port != 80 || "https".equals(scheme) && port != 443)

      So the port != -1 test binds only to the "http" half of the or statement, and the if block executes, which appends ":-1" to the end of the "https" URL. I think it should instead say

      if (port != -1 && ("http".equals(scheme) && port != 80 || "https".equals(scheme) && port != 443))

      Attachments

        Activity

          People

            dashorst Martijn Dashorst
            alexgrant Alex Grant
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: