| | |
| | | $washer = new rcube_washtml; |
| | | $washed = $washer->wash($html); |
| | | |
| | | $this->assertRegExp('|style=\'font-family: "新細明體","serif"; color: red\'|', $washed, "Unicode chars in style attribute - quoted (#1489697)"); |
| | | $this->assertRegExp('|style="font-family: \"新細明體\",\"serif\"; color: red"|', $washed, "Unicode chars in style attribute - quoted (#1489697)"); |
| | | |
| | | $html = "<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> |
| | | <body><span style='font-family:新細明體;color:red'>test</span></body></html>"; |
| | |
| | | |
| | | $this->assertRegExp('|line-height: 1;|', $washed, "Untouched line-height (#1489917)"); |
| | | $this->assertRegExp('|; height: 10px|', $washed, "Fixed height units"); |
| | | |
| | | $html = "<div style=\"padding: 0px\n 20px;border:1px solid #000;\"></div>"; |
| | | $expected = "<div style=\"padding: 0px 20px; border: 1px solid #000\"></div>"; |
| | | |
| | | $washer = new rcube_washtml; |
| | | $washed = $washer->wash($html); |
| | | |
| | | $this->assertTrue(strpos($washed, $expected) !== false, "White-space and new-line characters handling"); |
| | | } |
| | | |
| | | /** |
| | | * Test invalid style cleanup - XSS prevention (#1490227) |
| | | */ |
| | | function test_style_wash_xss() |
| | | { |
| | | $html = "<img style=aaa:'\"/onerror=alert(1)//'>"; |
| | | $exp = "<img style=\"aaa: '"/onerror=alert(1)//'\" />"; |
| | | |
| | | $washer = new rcube_washtml; |
| | | $washed = $washer->wash($html); |
| | | |
| | | $this->assertTrue(strpos($washed, $exp) !== false, "Style quotes XSS issue (#1490227)"); |
| | | |
| | | $html = "<img style=aaa:'"/onerror=alert(1)//'>"; |
| | | $exp = "<img style=\"aaa: '"/onerror=alert(1)//'\" />"; |
| | | |
| | | $washer = new rcube_washtml; |
| | | $washed = $washer->wash($html); |
| | | |
| | | $this->assertTrue(strpos($washed, $exp) !== false, "Style quotes XSS issue (#1490227)"); |
| | | } |
| | | } |