Skip to content

Commit

Permalink
[SECURITY] Correctly handle comment end bang state (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohader committed Sep 13, 2022
1 parent aac22d2 commit 60bfdc7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"require": {
"ext-dom": "*",
"masterminds/html5": "^2.7",
"masterminds/html5": "^2.7.6",
"php": "^7.2 || ^8.0",
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
Expand Down
22 changes: 22 additions & 0 deletions tests/ScenarioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@

class ScenarioTest extends TestCase
{
public static function allTagsAreRemovedOnMissingDeclarationDataProvider(): array
{
return [
['<div class="content">value</div><span class="content">value</span>', ''],
['<!--any--><div class="content">value</div>', '<!--any-->'],
['<!--any--!><div class="content">value</div>', '<!--any-->'],
];
}

/**
* @test
* @dataProvider allTagsAreRemovedOnMissingDeclarationDataProvider
*/
public function allTagsAreRemovedOnMissingDeclaration(string $payload, string $expectation): void
{
$behavior = new Behavior();
$sanitizer = new Sanitizer(
new CommonVisitor($behavior)
);
self::assertSame($expectation, $sanitizer->sanitize($payload));
}

public static function tagFlagsAreProcessedDataProvider(): array
{
return [
Expand Down

0 comments on commit 60bfdc7

Please sign in to comment.