Skip to content

Commit

Permalink
Fix HtmlSanitizer default configuration behavior for allowed schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
tgalopin authored and nicolas-grekas committed Dec 14, 2022
1 parent 28d1912 commit f978fcf
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Tests/TextSanitizer/UrlSanitizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,33 @@ public function provideSanitize()
'output' => null,
];

yield [
'input' => 'http://trusted.com/link.php',
'allowedSchemes' => null,
'allowedHosts' => null,
'forceHttps' => false,
'allowRelative' => false,
'output' => 'http://trusted.com/link.php',
];

yield [
'input' => 'https://trusted.com/link.php',
'allowedSchemes' => null,
'allowedHosts' => null,
'forceHttps' => false,
'allowRelative' => false,
'output' => 'https://trusted.com/link.php',
];

yield [
'input' => 'data:text/plain;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
'allowedSchemes' => null,
'allowedHosts' => null,
'forceHttps' => false,
'allowRelative' => false,
'output' => 'data:text/plain;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
];

yield [
'input' => 'https://trusted.com/link.php',
'allowedSchemes' => ['https'],
Expand Down

0 comments on commit f978fcf

Please sign in to comment.