Skip to content

Commit 615b143

Browse files
committed
Merge pull request #2 from vanilla/hotfix/aggressive-span-stripping
Fix aggressive span stripping
2 parents 7c717dc + 95e89ce commit 615b143

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

tests/IssuesTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* @author Todd Burry <todd@vanillaforums.com>
4+
* @copyright 2009-2016 Vanilla Forums Inc.
5+
* @license Proprietary
6+
*/
7+
8+
namespace Htmlawed\Tests;
9+
10+
use Htmlawed;
11+
12+
/**
13+
* Test issues that come up on Github.
14+
*/
15+
class IssuesTest extends \PHPUnit_Framework_TestCase {
16+
/**
17+
* Test overly aggressive span stripping.
18+
*
19+
* @link https://github.com/vanilla/htmlawed/issues/1
20+
*/
21+
public function testAggressiveSpanStripping() {
22+
$html = '<span style="expression(alert(\'XSS\')">foo</span>';
23+
$expected = 'foo';
24+
25+
$config = ['deny_attribute' => 'on*,style'] + Htmlawed::$defaultConfig;
26+
$filtered = Htmlawed::filter($html, $config);
27+
$this->assertSame($expected, $filtered);
28+
}
29+
}

0 commit comments

Comments
 (0)