Option: Use sanitize=FALSE in token_replace and let drupal_set_title sanitize the title string. I think this is a fair option as drupal_set_title will check_plain for us, although hook_token implementations often run filter_xss as well...so please debate.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2052917-sanitize-title-once-7.patch | 518 bytes | jpstrikesback |
| #1 | 2052917-sanitize-title-once.patch | 608 bytes | jpstrikesback |
Comments
Comment #1
jpstrikesback commentedAnd the patch.
Comment #2
jpstrikesback commentedProper status
Comment #3
jpstrikesback commentedAnd proper version...
Comment #4
gregglesAn alternative would be to call drupal_set_title with the second parameter of PASS_THROUGH. Token should already be filtering things in a way to make them work for drupal_set_title.
Before committing anything, though, try it with javascript as the value of a token and see if the script executes. Try again with < as part of a title and see if it gets double escaped. If your filtering is right, there will be no double escaping and no script executing.
Comment #5
rballou commentedThis looks like it would be good to apply. The patch doesn't apply cleanly though, so if you can re-roll against dev I can then apply it.
I ended up deciding it was better to let
drupal_set_titletocheck_plainsince in the future there may be other things at play with the title if needed.Thanks everyone
Comment #6
jpstrikesback commented@greggles I would have done that but then a user could actually enter unsafe input and have it shown since you can enter more than tokens (even tho they'd likely need admin perm)
@rballou I'll re-roll shortly, cheers!
Comment #7
jpstrikesback commentedHere it is, I must have rolled that 1st one against something other than dev...
Comment #8
gregglesre #6 - good point ;) I haven't used the module and didn't look at code beyond this patch so my first paragraph of advice might be totally wrong.
Comment #9
jpstrikesback commentedAll good, and thanks for the input regardless!
Comment #10
rballou commentedCommitted. Thanks everyone