]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Repos/EntityRepo.php
Added iframe JS and data url escaping
[bookstack] / app / Entities / Repos / EntityRepo.php
index aad9a1205895a18bfce0b0143ae244e2d9bffd51..7ca25b785286cb7f4e5e44ccbb4216c1c1881c4e 100644 (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) {