mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 19:25:22 +01:00
Add function dol_string_onlythesehtmlattributes() and option
MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES to enable it.
This commit is contained in:
@@ -571,6 +571,21 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolStringOnlyTheseHtmlAttributes
|
||||
*
|
||||
* @return number
|
||||
*/
|
||||
public function testDolStringOnlyTheseHtmlAttributes()
|
||||
{
|
||||
$stringtotest = '<div onload="ee"><a href="123"><span class="abc">abc</span></a></div>';
|
||||
$decodedstring = dol_string_onlythesehtmlattributes($stringtotest);
|
||||
$decodedstring = preg_replace("/\n$/", "", $decodedstring);
|
||||
$this->assertEquals('<div><a href="123"><span class="abc">abc</span></a></div>', $decodedstring, 'Function did not sanitize correclty with test 1');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* testGetRandomPassword
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user