Closed Bug 505652 Opened 15 years ago Closed 15 years ago

Over-escaping forum-thread titles in the "Support Website Forums" page

Categories

(support.mozilla.org :: General, defect)

x86
All
defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stephend, Assigned: paulc)

References

()

Details

(Whiteboard: sumo_only)

Attachments

(4 files)

(Not putting this into Forums, because I don't think this code is forum code, as that works properly in step 3.)

STR:

1. Load http://support.mozilla.com/en-US/kb/Support+Website+Forums
2. Look under "Most Popular Topics", at "I have the dreaded "Icanseek" a..."
3. Compare that to http://support.mozilla.com/tiki-view_forum_thread.php?locale=en-US&forumId=1&comments_parentId=386372

Expected Results:

"I have the dreaded "Icanseek" a..."

Actual Results:

See above
Attached image Screenshot
Bug is in the 5th forum title down from the left.
"Support Website Forums" makes me sad.
Assignee: nobody → paul.craciunoiu
Target Milestone: --- → 1.2.1
So I see this in the screenshot, but I created an article with the same title on my local copy, and it shows up alright. Stephen, could you maybe try to reproduce this on stage? That forum topic doesn't show on the page anymore on prod.
happens on stage too...
Target Milestone: 1.2.1 → 1.3
Reopen if we can reproduce.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
OK, just reproduced.

https://support-stage.mozilla.org/en-US/kb/Support+Website+Forums
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Paul and I did investigation and so here's the conclusion:

We're escaping in the FORM that posts to the support forum (But not the forum that edits posts or posts to the contributor forum) so titles in the DATABASE are escaped (ugh).  We're then (likely) passing the raw title on tiki-view_forum and tiki-view_forum_thread without further escaping BUT the module that handles the forum front page IS doing a second escape.

The ideal situation is we DO NOT escape when entering new forum threads so the data in the table is the exact string entered and then we DO escape everywhere we display that text.  This would require making sure that we check everywhere we might be showing forum titles to make sure escaping is done.
Attached patch patch, v1Splinter Review
So as Cheng, Stephen and I discussed, there was some over-escaping going on -- in forum_advanced_post.php

It turns out that the escaping was done in php, which is risky and opens up vulnerabilities. Escaping should be done one display. This patch fixes that:
* comments out the php escaping in forum_advanced_post.php
* adds escaping on editing and viewing the forum topic titles in tiki-view_forum.php and tiki-view_forum_thread.php

I've looked carefully over these files so I hope I haven't missed anything. This will need some good QA to make sure we don't open up other vulnerabilities. However, strings were NOT previously properly escaped, as you can see here:
https://support-stage.mozilla.org/tiki-view_forum_thread.php?comments_parentId=374591&forumId=1
Notice <script> gets turned into <sc<x>ript> but <a> doesn't get escaped. This breaks, for example, here:
https://support-stage.mozilla.org/tiki-view_forum.php?locale=en-US&forumId=1 (see that the topic posted by Test contains 2 links in the title), potentially allowing spammers to replace the title link with their own -- see https://support-stage.mozilla.org/tiki-view_forum_thread.php?locale=en-US&comments_parentId=374592&forumId=1 whose title is broken professionally :)
Attachment #391291 - Flags: review?(laura)
Severity: major → critical
Make sure you do not regress bug 500146.
Blocks: 506101
Attachment #391291 - Flags: review?(laura) → review+
r48845 / r48846
Status: REOPENED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → FIXED
Verified FIXED, w00t! :-)
Status: RESOLVED → VERIFIED
Blocks: 511542
Whiteboard: sumo_only
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: