Ticket #26 (closed defect: fixed)

Opened 6 years ago

Last modified 22 months ago

Better HTML sanitization for the mail viewer

Reported by: rjl Owned by: mortonda@…
Priority: high Milestone: 1.0.3
Component: PHP scripts Version: 1.0.0 RC5
Severity: critical Keywords: html images sanitization mail viewer
Cc:

Description

A more thorough HTML-sanitizing routine should be used to make sure that web bugs don't slip through to the mail viewer. We can't trust MIME-type declarations, either, apparently--some parts advertised as "text/plain" in fact contain HTML that needs to be sanitized. Likewise, tag elements that support URLs as arguments (e.g. "background=...", "link=...") need to be stripped out.

Attachments

sanitize.patch (2.8 kB) - added by mortonda@… 2 years ago.
a basic implementation of htmltidy

Change History

Changed 6 years ago by dmorton

  • priority changed from normal to high
  • severity changed from normal to critical

this can cause major formatting errors, but more importantly, it could potentially introduce some security problems with a certain browser that has so many security holes it couldn't even float on dry land.

Changed 5 years ago by dmorton

  • milestone 1.0.0 RC6 deleted

Changed 3 years ago by rjl

  • patch set to 0

As David suggests in a comment to #456, we would probably be better off

using a third-party HTML filter like [http://htmlpurifier.org/ HTML Purifier].

Changed 3 years ago by anonymous

  • milestone set to 1.0.3

Changed 2 years ago by mortonda@…

a basic implementation of htmltidy

Changed 2 years ago by mortonda@…

  • owner changed from rjl to mortonda@…
  • status changed from new to accepted

The patch I just uploaded is a basic implementation, but some discussion and testing is probably needed.

First, I disabled its cache for now, until we determine if and where that cache should be set up. Maybe that should be a maia_config.php option.

Also, I set it up to disallow all URL's. This effectively blocks all images and also prevents clicking through a bit of spam.

On first glance, it seems to do a nice job, and I don't see any major performance problems on an old 1Ghz athlon even with the cache disabled, keeping in mind that this is not one of the more frequently hit sections of code.

Changed 2 years ago by mortonda@…

heh, I meant html purifier, not html tidy.

Changed 2 years ago by mortonda@…

  • status changed from accepted to testing
  • resolution set to fixed

committed in [1307], [1311], and [1312]

It will function ok without the extra config item, and while it supposedly speeds up HTMLPurifier to have a cache, I don't know if it is enough to worry about.

Changed 22 months ago by mortonda@…

  • status changed from testing to closed
Note: See TracTickets for help on using tickets.