summaryrefslogtreecommitdiff
path: root/tests/Framework/Washtml.php
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-12-26 18:49:06 +0100
committerThomas Bruederli <thomas@roundcube.net>2012-12-26 18:49:06 +0100
commitc942e4a2e9a97743850b4178ea66b3b33956e7f7 (patch)
tree8fda2746e6cd6e69fc74427c297f3113665fce00 /tests/Framework/Washtml.php
parentaabeab1e4e08ffba5d709aa71de1182dfeb698d1 (diff)
parent23b30e0afca5f9c31e05204c3a6ff3332791d3a1 (diff)
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'tests/Framework/Washtml.php')
-rw-r--r--tests/Framework/Washtml.php28
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,&lt;script&gt;alert(document.cookie)&lt;/script&gt;">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");
+ }
+
+}