diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-12-25 18:06:17 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-12-25 18:06:17 +0100 |
commit | 7ac94421bf85eb04c00c5ed05390e1ea0c6bcb0b (patch) | |
tree | c90fd761303f5285e13f1a5fad963403c4e6fed3 /tests/Framework | |
parent | 0931a97c5fc7231df99fdf4cdeebb525392886ed (diff) |
Move washtml class into Roundcube Framework (rcube_washtml), add some improvements
Diffstat (limited to 'tests/Framework')
-rw-r--r-- | tests/Framework/Washtml.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php new file mode 100644 index 000000000..088ac4a8c --- /dev/null +++ b/tests/Framework/Washtml.php @@ -0,0 +1,28 @@ +<?php + +/** + * Test class to test rcube_washtml class + * + * @package Tests + */ +class Framework_Washtml extends PHPUnit_Framework_TestCase +{ + + /** + * Test the elimination of some XSS vulnerabilities + */ + function test_html_xss3() + { + // #1488850 + $html = '<p><a href="data:text/html,<script>alert(document.cookie)</script>">Firefox</a>' + .'<a href="vbscript:alert(document.cookie)">Internet Explorer</a></p>'; + + $washer = new rcube_washtml; + + $washed = $washer->wash($html); + + $this->assertNotRegExp('/data:text/', $washed, "Remove data:text/html links"); + $this->assertNotRegExp('/vbscript:/', $washed, "Remove vbscript: links"); + } + +} |