cabennett85/gittest — Issue #1122: Unbalanced html getting through member mail
Author: cabennett85
Created: 2012-03-02 00:37:08+00:00
State: open

Here's the report from a user:

Subject: bug report: unbalanced tags not cleared
I accidentally mistyped the close tag on some bold text, which made
the rest of my reply bold. That's OK, it was my bad. But then when the
other person responded, their response was in bold as well! Why aren't
you closing any open HTML tags at the end of each response? While I'm
here, let me do some more HTML tests:

Colored text text: This should be green
Centered text test:
This should be centered
Fieldset test: legend is herebody is here

Colored text is failing.
Centered text is failing.
Fieldset text is failing.

--------------------------------

I found the issue, in the function new_member_message (functions.php), we're using the older clean_db_input / clean_db_input_custom functions. If we used cleaninput , we'd pass it through HTML Purifier, which balances the tags.

To reproduce, just send a PM with an unclosed bold tag, and then reply to it, you'll see the reply is also bolded but shouldn't be.

To fix, replace with cleaninput calls. Test that the same HTML tags are still allowed.