Merge pull request #304 from Squidly271/patch-4

Docker Security: Remove <script> and <iframe>
This commit is contained in:
tom mortensen
2018-03-19 14:21:44 -07:00
committed by GitHub

View File

@@ -374,9 +374,27 @@ function xmlToVar($xml) {
}
}
}
xmlSecurity($out);
return $out;
}
function xmlSecurity(&$template) {
foreach ($template as &$element) {
if ( is_array($element) ) {
xmlSecurity($element);
} else {
if ( is_string($element) ) {
$tempElement = htmlspecialchars_decode($element);
$tempElement = str_replace("[","<",$tempElement);
$tempElement = str_replace("]",">",$tempElement);
if ( preg_match('#<script(.*?)>(.*?)</script>#is',$tempElement) || preg_match('#<iframe(.*?)>(.*?)</iframe>#is',$tempElement) ) {
$element = "REMOVED";
}
}
}
}
}
function xmlToCommand($xml, $create_paths=false) {
global $var;
global $docroot;