Last modified: 2014-09-17 19:22:44 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 T72921, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70921 - Reference drawer empty when ref name contains a CSS selector special character
Reference drawer empty when ref name contains a CSS selector special character
Status: RESOLVED FIXED
Product: MobileFrontend
Classification: Unclassified
stable (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-17 01:30 UTC by Adam Hyland
Modified: 2014-09-17 19:22 UTC (History)
7 users (show)

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


Attachments

Description Adam Hyland 2014-09-17 01:30:57 UTC
We currently use jQuery to pluck out the reference link and text for the reference drawer on mobile by grabbing the clicked link, appending the href to a css selector looking for daughter elements of the reference list and displaying the text of that link.

The href itself is determined (for named references) by an arbitrary string given as by the user. Crucially, the visual editor will insert placeholder named references (e.g. ":0", ":1") if you select "re-use" among the citation options for a reference which does not already have a name.

If the selector string contains unescaped special characters it will likely fail, getReference will return undefined and the text field will be blank. The colon (':') is *automatically* inserted by the visual editor for reused references and will break the CSS selector and cause the reference drawer to appear blank.

Steps to reproduce:

1. on a page with a reference list, make a named reference <ref name=":a">abcd</ref>
2. Save the page and (in mobile) tap on the reference.
3. The reference drawer will be blank

How to fix:

Sanitize the input field. Right now we escape '.' but nothing else. A user could insert any of the special characters in a name (see here for some info https://mathiasbynens.be/notes/css-escapes) so we should eventually have a solution which covers all of them but the visual editor inserts ':' likely without the knowledge of the user so that's the critical one.
Comment 1 Bingle 2014-09-17 01:35:16 UTC
Prioritization and scheduling of this bug is tracked on Trello card https://trello.com/c/rOLo9Dou
Comment 2 Gerrit Notification Bot 2014-09-17 15:19:11 UTC
Change 160971 had a related patch set uploaded by Protonk:
Escape all CSS metacharacters for ref drawer

https://gerrit.wikimedia.org/r/160971
Comment 3 Gerrit Notification Bot 2014-09-17 19:09:13 UTC
Change 160971 merged by jenkins-bot:
Escape all CSS metacharacters for ref drawer

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

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


Navigation
Links