You can clone with
HTTPS or Subversion.
"About me" field allows to include <script>alert('hacked')</script> and it gets executed successfully in when viewing the profile.
That sounds like a good interim solution.
This should probably be partly the job of the content type to declare whether a given field should allow [ no html, filtered html, or full html ] + defined per role. Of course, on further thought, that should probably only apply to textareas, and all other fields should most likely simply disallow any form of html.
I think the problem is not in the input, but rather in output. No need to limit user's input (<script>alert('hacked')</script> is a pretty valid description of someone's profile :) really.), but output should always be escaped (maybe at layout template level?).
Good point. I had mistakenly considered this as input filtering. So, to combine your point with mine, the output should be filtered as one of [plain text, filtered html, full html]. This article focuses on your point, but also touches on mine: http://www.lullabot.com/articles/drupal-input-formats-and-filters
Just to round out this conversation a little more, it should be noted that input filtering will probably give better performance for most cases (filter once, on db insert/update, instead of filtering every time it's viewed) - at the cost of some content flexibility. (Depending on the performance difference between input and output filtering, that might be an easy choice for most people.)
Ensure all fields escaped in output via = rather than - in EJS (as pe…
…r issue #102), need to check across all modules.
One potential method of sanitization - albeit probably heavy+/expensive - might be to use jsdom (+jquerify if needed) to get innerText.
Another potential method - but labor-intensive: port htmLawed to js [http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed]. NOTE: It also has some useful test cases that we might want to run against whatever solution is used.
I made a modification to use the sanitizer npm module which uses caja as dennishall suggested. Changed the content and user modules to sanitize output. Pull request to follow.
The sanitizer stuff causes problems.
Do you know how to configure the sanitizer? I is removing links inside of each post.
So if the post has an <a href="..."> it ends up with <a> only removing href.
I understand that a href can pose a problem but in a CMS you need to be able to post items which have HTML that might be considered problematic since the posts are not just rich text. It looks like the sanitizer assumes we're just dealing with HTML formatted text and not HTML pages.