Needs review
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Sep 2012 at 14:19 UTC
Updated:
16 Jan 2019 at 15:40 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
glcp commentedHere are the changes needed to fix this bug:
in the file views/theme/theme.inc, around line 498, change this line:
by this one:
and
around line 509, change this line:
by this one:
We should check if others character could be in the label. This fix works only for the ' character. We also need to fix the translation files if there are any.
Thanks to fix this bug.
Comment #2
sphism commentedHi, I'll try to make a patch for this.
The first change looks good but the second one
$title = t('sort by ') . $label;
You shouldn't concatenate a translated field onto the label like that, you should do it like they've done:
$title = t('sort by @s', array('@s' => $label));
However where that @ sign is - you can use a couple of different signs to do slightly different things, which may accomplish what you are trying to achieve.
http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/forma...
Comment #3
sphism commentedHaving a look into this now
Comment #4
sphism commentedHere's a views export of a simple view to demonstrate the issue.
It lists all content title's in a table, the title field has been renamed to Title's and made sortable. The issue is that the tooltip says Title's
Also the sort order has been exposed with the name Title's and we get a similar issue in the "Sort By" drop down list Title's.
I've attached a screenshot showing both these
Comment #5
sphism commentedThis patch fixes both the issue's in #4 and the screen shot show's the fixes.
Note that I've used the title of:
Title's <> "
to check for single/double quotes and less/greater than. It's interesting that the less/greater than is removed from the tooltip, but remain in the drop down (is that an XSS issue?)
I'm wrapping the title outputs in htmlspecialchars_decode($title, ENT_QUOTES) so that single and double quotes are turned back into regular text.
Essentially this means you have a check_plain, to encode it then the htmlspecialchars_decode to decode it again. I believe that this will verify UTF-8 and stop XSS.
If there's a better way to do this then let me know, but I think this is correct.
Comment #6
sphism commentedChanging version to 7.x-3.x-dev to see if my patch gets tested...
Comment #7
ecrown commentedthe patch at #5 worked for me was having the same issue on a multilingual site
Comment #8
sylvainm commentedI think you don't need to use htmlspecialchars_decode, as the problem is that the $label is escaped twice.
I tried to remove the double escaping and did not succeed to have an XSS with the attached patch.
What do you think about ?
Comment #9
chris matthews commentedThe 4 year old patch in #8 to views_plugin_exposed_form.inc and theme.inc applied cleanly to the latest views 7.x-3.x-dev and if still relevant needs to be reviewed.