Closed (fixed)
Project:
Comment Notify
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Mar 2011 at 17:29 UTC
Updated:
28 Jul 2011 at 23:01 UTC
Jump to comment: Most recent file
Comments
Comment #1
grendzy commentedHere's one idea. We could also consider letting token sanitize and then running decode_entities().
Other questions:
-- Do we need to protect against header injection, or does drupal_mail do this for us?
-- What happens if unfiltered HTML is passed to a module like mimemail?
Comment #2
berenddeboer commentedGrendzy, with this patch people can now post javascript and every piece of HTML. So this is clearly wrong. You will need to sanitise per the input format.
Comment #3
dave reid@berenddeboer: Isn't that up to the Mail system itself? Core does a filter_xss() within drupal_html_to_text().
Comment #4
berenddeboer commentedHere's another patch, that sanitises a body according to its format.
Comment #5
berenddeboer commentedSorry guys, bad patch file. This one should be correct.
Comment #6
gregglesGiven the hardcoded LANGUAGE_NONE I wonder if this works on multilingual sites - any comments?
Comment #7
gregglesI also tend toward Dave's perspective in #3.
Comment #8
dave reidWe need to use 'sanitize' => FALSE and it is up to the mail system to filter output. So +1 for patch in #1.
See:
_user_mail_text()
drupal_html_to_text()
For the concerns about header injection, anything run in token_replace() cannot alter message headers at all.
Comment #9
gregglesWell, this no longer applied after #952072: [comment:unsubscribe-url] is not working (and a few other token issues) but it was of course easy to re-roll.
One last look by other folks before I commit?
Comment #10
grendzy commentedlooks good - I double checked on the header injection, and mime_header_encode() will automatically encode any newlines contained in the replacement value.
Comment #11
gregglesThanks grendzy, Dave Reid for the work on this.
Now committed - http://drupalcode.org/project/comment_notify.git/commit/1364ed8