Update css-sanitizer to v1.0.2

Also fold a unit test into the normal function since we don't have to
have two valid responses based on css-sanitizer version.

Change-Id: I107c8b911781924ce9cc0730257243b9cb1592a6
This commit is contained in:
Brad Jorsch 2017-06-13 11:54:40 -04:00
parent fd29884a23
commit 5fd77aa0d7
2 changed files with 5 additions and 23 deletions

View file

@ -2,7 +2,7 @@
"license": "GPL-2.0+",
"require": {
"cssjanus/cssjanus": "1.2.0",
"wikimedia/css-sanitizer": "~1.0.1"
"wikimedia/css-sanitizer": "~1.0.2"
},
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",

View file

@ -77,33 +77,15 @@ class TemplateStylesContentTest extends TextContentTest {
[ 'severity' => 'fatal', 'novalue' => true ],
Status::newFatal( 'templatestyles-error-bad-value-for-property', 1, 27, 'font-family' ),
],
];
}
/**
* @dataProvider provideHtmlInjection
* @param string $text Input text
* @param string $output Valid escaped output text
*/
public function testHtmlInjection( $text, $output ) {
$status = $this->newContent( $text )->sanitize();
if ( $status->isOk() ) { // css-sanitizer 1.0.2+
$this->assertEquals( Status::newGood( $output ), $status );
} else { // css-sanitizer 1.0.1
$this->assertTrue( $status->hasMessage( 'templatestyles-end-tag-injection' ) );
}
}
public static function provideHtmlInjection() {
return [
'</style> in string' => [
'.foo { content: "</style>"; }',
'.mw-parser-output .foo{content:"\3c /style\3e "}',
[],
Status::newGood( '.mw-parser-output .foo{content:"\3c /style\3e "}' )
],
'</style> via identifiers' => [
'.foo { grid-area: \< / style 0 / \>; }',
'.mw-parser-output .foo{grid-area:\3c /style 0/\3e }',
[],
Status::newGood( '.mw-parser-output .foo{grid-area:\3c /style 0/\3e }' ),
],
];
}