Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25770

The No button of the space delete confirmation cuts the xredirect URL at its first ampersand

    XMLWordPrintable

Details

    • Unit
    • Unknown
    • N/A
    • N/A

    Description

      Steps to reproduce

      1. Log in as an administrator.
      2. Create a page in a new space, e.g. DeleteSpaceRepro.WebHome.
      3. Open the space delete confirmation with a redirect URL that has two query parameters, /xwiki/bin/view/Main/?a=1&b=2:
        /xwiki/bin/deletespace/DeleteSpaceRepro/WebHome?xredirect=%2Fxwiki%2Fbin%2Fview%2FMain%2F%3Fa%3D1%26b%3D2
        
      4. Click No.

      Expected result

      The browser goes to /xwiki/bin/view/Main/?a=1&b=2.

      Actual result

      The browser goes to:

      /xwiki/bin/view/Main/?a=1&b=2
      

      The # of & starts the URL fragment, so only a=1 is kept as query parameter and #38;b=2 becomes the fragment. Any redirect URL is cut at its first &, in its query string or in its fragment.

      Reproduced on XWiki 18.9.0 (Jetty HSQLDB distribution) with Chrome.

      Cause

      templates/deletespace.vm computes the cancel URL with the #getSanitizedURLAttributeValue macro, which already returns an XML-escaped value, and then escapes it again with $escapetool.xml($cancelURL) when passing it to #xwikimessagebox. The & of the URL thus ends up as & in the HTML, which the browser reads as the literal text &.

      The double escaping was introduced when the xredirect parameter started to be sanitized in XWIKI-20612. The application delete confirmation of App Within Minutes (AppWithinMinutes.DeleteApplication) received the same change in XWIKI-20614 and escapes its cancel URL twice in the same way.

      Without an xredirect parameter, the cancel URL is the space home page and is escaped only once, so it works.

      Attachments

        Issue Links

          Activity

            People

              MichaelHamann Michael Hamann
              MichaelHamann Michael Hamann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: