Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
filter.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Apr 2010 at 04:01 UTC
Updated:
18 Nov 2014 at 07:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
meba commentedHere we go.
There are many occurences though and i am thinking about putting check_plain directly to filter_formats() function, during the load phase. Not sure if that will break anything. Opinion?
Comment #3
meba commentedAh, I see a problem in the patch format, the previous one will fail testing. Reroll.
Comment #4
sunWhy those changes?
Powered by Dreditor.
Comment #5
sunComment #6
sunLatest patch in #635212: Fallback format is not configurable contains all necessary/proper security fixes for this issue, which need to be moved over here.
Comment #7
sunThe remaining changes of that patch. No idea whether they are still valid.
Comment #8
sunComment #9
sunUnless someone confirms that #7 is required, demoting to normal.
Comment #10
tamerzg commentedThere is no need for this patch in D8, at least as of current dev version.
Comment #11
mgiffordSimple patch adding check_plain() to the filter module. Still applies nicely. Why isn't this in Core yet?
Comment #12
helmo commentedI'm unable to reproduce the XSS on node/add/article. The form API already does check_plain().
But I can reproduce it on /filter/tips which is linked on the node creation form as "More information about text formats".
So I would opt that only the change to filter.pages.inc is needed.
Comment #13
dcam commentedThis was marked as needing tests in #9. I don't see any existing tests for the filter/tips page. Personally, I would just add onto the end of testTextFormatCRUD() rather than creating a whole new test class at this stage of the 7.x lifecycle, but others might feel differently. Someone should be able to just copy the first 5 lines of the function, change the title to include a javascript alert, drupalGet() the tips page, and make sure it's encoded. I'm tagging this as a Novice issue for the addition of the test.
As for the fix in #12, it looks good to me. I'd RTBC it if it weren't for the test. Once applied, the filter names are encoded on filter/tips.
I think it's correct to remove the additional changes to _filter_tips() that were in #3 (sun had a problem with them as mentioned in #4). _filter_tips() is only called in three places, each of them inside a call to theme_filter_tips(). If the filter names were run through check_plain() in _filter_tips() and in theme_filter_tips(), they would end up double-encoded.
Comment #14
joshi.rohit100Added the test case. Please review now.
Comment #15
joshi.rohit100forgot to add interdiff.
Comment #16
dcam commentedThanks for your hard work @joshi.rohit100. =) I have a few notes about the test.
Sorry, I know I wasn't clear, but I meant that I would literally append the new assertion into the end of testTextFormatCRUD() rather than adding a new method or class with method. That way we would avoid forcing Simpletest to create yet another new environment for this one, simple assertion.
Also, I know I said you could "copy the first five lines," but this comment should be changed and made relevant to the new assertion.
Finally, could you make a tests-only patch, please? It's good to know for certain that the test is going to fail without the fix.
Comment #17
dcam commentedComment #18
joshi.rohit100thanks @dcam for pointing in right direction. Here is the test only patch.
Comment #19
dcam commentedOk, this is a great demonstration of why it's good to include a tests-only patch. The test passed, even though we know from manual testing that there is a bug. Now we know that something is wrong with the test.
Comment #20
helmo commentedThe test had a permission problem, it could not see the filter format as the anonymous test had no access to it.
I've now adapted it to give anonymous permission to it.
Comment #22
helmo commentedYay, the tests only patch failed... now the full patch.
Comment #23
helmo commentedComment #24
helmo commented@dcam: Can you agree with the test like this?
Comment #25
dcam commentedThank you, @joshi.rohit100 and @helmo. You both did great work on this. RTBC.
Comment #28
dcam commentedComment #29
David_Rothstein commentedCommitted to 7.x - thanks!
Comment #31
David_Rothstein commented(And it looks like this code is in Drupal 8 too, but the XSS issue there is fixed by Twig auto-escape.)