Last modified: 2014-09-08 16:09:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T51232, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 49232 - $wgWellFormedXml = false; breaks our EditPage broken bot protection in edittoken
$wgWellFormedXml = false; breaks our EditPage broken bot protection in edittoken
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 50040
  Show dependency treegraph
 
Reported: 2013-06-06 06:56 UTC by Daniel Friesen
Modified: 2014-09-08 16:09 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Daniel Friesen 2013-06-06 06:56:56 UTC
When `$wgWellFormedXml = false;` is set our edittoken changes to:
<input type=hidden value=+\ name=wpEditToken>

The purpose of the \ is to protect against broken bots that mistreat the \" sequence treating it like a character escape.

We probably need to update Html.php so that it double quotes strings that end in a \.
Comment 1 Niklas Laxström 2013-06-06 13:34:44 UTC
What is the actual issue here?
Comment 2 Daniel Friesen 2013-06-06 22:47:23 UTC
(In reply to comment #1)
> What is the actual issue here?

The \ in our edit token is intended to be output into the page as \". It's a protection against badly written proxies. These proxies strip the \ turning \" into " (which could break the content).

However when `$wgWellFormedXml = false;` is set it changes to value=+\. Which means that " is no longer present and it will no longer trip up the badly written proxies.
Comment 3 Daniel Friesen 2013-06-08 11:41:30 UTC
Gerrit change #67603
Comment 4 Gerrit Notification Bot 2014-02-27 15:05:12 UTC
Change 67603 abandoned by Hashar:
Always quote attribute values ending in a backslash

Reason:
Abandoning old change. Feel free to reopen if there is still an interest in getting this merged.

https://gerrit.wikimedia.org/r/67603
Comment 5 Gerrit Notification Bot 2014-09-08 16:09:51 UTC
Change 67603 restored by Krinkle:
Always quote attribute values ending in a backslash

Reason:
If an unquoted attribute value ending in \ actually works in modern browsers, and if EditPage wants older/broken browsers to work regardless (the token slash is mostly to reject bots/scripts, it makes sense to try and support browsers where possible since clients are helpless otherwise), then it would make sense to do the quoting in EditPage.

However that's not the case.

div = document.createElement('div');
div.innerHTML = '<input type=hidden name=token value=+\ />';
div.firstChild.value
> "+"

div.innerHTML = '<input type=hidden value=c02a+\ name=wpEditToken>';
div.firstChild.value
> "c02a+"

It seems that when it's parsed as part of a server-response (instead of in a fragment), that it does work, however. Which is why third-party wikis disabling good ol' wgWellFormedXml doesn't result in a broken EditPage.

https://gerrit.wikimedia.org/r/67603

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links