This issue has been created
There are 6 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-398805b7-4cdc-4338-ae9e-22fed79dfc6d XWIKI-25770 Open

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

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-12d85e86-78c8-4246-8fd4-04d0bb0200d0 Michael Hamann created this issue on 16/Nov/26 11:48
 
Summary: The No button of the space delete confirmation cuts the xredirect URL at its first ampersand
Issue Type: cid:jira-generated-image-avatar-398805b7-4cdc-4338-ae9e-22fed79dfc6d Bug
Affects Versions: 14.10.5, 15.1-rc-1, 18.9.0
Assignee: Unassigned
Components: App Within Minutes, Web - Templates & Resources
Created: 16/Nov/26 11:48
Labels: regression
Priority: cid:jira-generated-image-static-critical-c6da26c4-ef74-4834-9008-236c32f3bd4c Critical
Reporter: Michael Hamann
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.

 
 

6 updates

 
cid:jira-generated-image-avatar-12d85e86-78c8-4246-8fd4-04d0bb0200d0 Changes by Michael Hamann on 16/Nov/26 11:48
 
Fix Version: 18.4.9
Fix Version: 17.10.16
Fix Version: 16.10.20
Fix Version: 18.10.0-rc-1
Attachment: deletespace-confirmation-18.9.0.png
Assignee: Michael Hamann