mirror of
https://github.com/unraid/webgui.git
synced 2026-01-28 20:49:04 -06:00
Merge pull request #304 from Squidly271/patch-4
Docker Security: Remove <script> and <iframe>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user