Aleksander Machniak
2014-05-20 2d233bf49c7d1eee76c2d0b9591a4576a99b5e66
Fix incorrect handling of HTML comments in messages sanitization code (#1489904)
3 files modified
13 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_washtml.php 2 ●●● patch | view | raw | blame | history
tests/Framework/Washtml.php 10 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -5,6 +5,7 @@
- Fix unintentional draft autosave request if autosave is disabled (#1489882)
- Fix malformed References: header in send/saved mail (#1489891)
- Fix handling unicode characters in links (#1489898)
- Fix incorrect handling of HTML comments in messages sanitization code (#1489904)
RELEASE 1.0.1
-------------
program/lib/Roundcube/rcube_washtml.php
@@ -456,7 +456,7 @@
        // Remove invalid HTML comments (#1487759)
        // Don't remove valid conditional comments
        // Don't remove MSOutlook (<!-->) conditional comments (#1489004)
        $html = preg_replace('/<!--[^->\[\n]+>/', '', $html);
        $html = preg_replace('/<!--[^-<>\[\n]+>/', '', $html);
        // fix broken nested lists
        self::fix_broken_lists($html);
tests/Framework/Washtml.php
@@ -53,6 +53,16 @@
        $washed = $washer->wash($html);
        $this->assertEquals('<!-- html ignored --><!-- body ignored --><p>test</p>', $washed, "HTML invalid comments (#1487759)");
        $html   = "<p>para1</p><!-- comment --><p>para2</p>";
        $washed = $washer->wash($html);
        $this->assertEquals('<!-- html ignored --><!-- body ignored --><p>para1</p><!-- node type 8 --><p>para2</p>', $washed, "HTML comments - simple comment");
        $html   = "<p>para1</p><!-- <hr> comment --><p>para2</p>";
        $washed = $washer->wash($html);
        $this->assertEquals('<!-- html ignored --><!-- body ignored --><p>para1</p><!-- node type 8 --><p>para2</p>', $washed, "HTML comments - tags inside (#1489904)");
    }
    /**