Added iframe JS and data url escaping

Related to #1531
This commit is contained in:
Dan Brown
2019-08-06 21:08:24 +01:00
parent 4de719b325
commit 2955f414dd
2 changed files with 40 additions and 0 deletions

View File

@ -765,6 +765,12 @@ class EntityRepo
$scriptElem->parentNode->removeChild($scriptElem);
}
// Remove data or JavaScript iFrames
$badIframes = $xPath->query('//*[contains(@src, \'data:\')] | //*[contains(@src, \'javascript:\')]');
foreach ($badIframes as $badIframe) {
$badIframe->parentNode->removeChild($badIframe);
}
// Remove 'on*' attributes
$onAttributes = $xPath->query('//@*[starts-with(name(), \'on\')]');
foreach ($onAttributes as $attr) {