mirror of https://github.com/mikaku/Monitorix.git
added sanitization of CGI variables #203
This commit is contained in:
parent
677ddbcfbc
commit
ce702bce45
|
@ -285,6 +285,23 @@ if($mode ne "localhost") {
|
||||||
($mode, $val) = split(/\./, $mode);
|
($mode, $val) = split(/\./, $mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# this should disarm all XSS and Cookie Injection attempts
|
||||||
|
my $OK_CHARS='-a-zA-Z0-9_'; # a restrictive list of valid chars
|
||||||
|
$graph =~ s/[^$OK_CHARS]/_/go; # only $OK_CHARS are allowed
|
||||||
|
$mode =~ s/[^$OK_CHARS]/_/go; # only $OK_CHARS are allowed
|
||||||
|
$when =~ s/[^$OK_CHARS]/_/go; # only $OK_CHARS are allowed
|
||||||
|
$color =~ s/[^$OK_CHARS]/_/go; # only $OK_CHARS are allowed
|
||||||
|
$val =~ s/[^$OK_CHARS]/_/go; # only $OK_CHARS are allowed
|
||||||
|
$silent =~ s/[^$OK_CHARS]/_/go; # only $OK_CHARS are allowed
|
||||||
|
|
||||||
|
#$graph =~ s/\&/&/g;
|
||||||
|
#$graph =~ s/\</</g;
|
||||||
|
#$graph =~ s/\>/>/g;
|
||||||
|
#$graph =~ s/\"/"/g;
|
||||||
|
#$graph =~ s/\'/'/g;
|
||||||
|
#$graph =~ s/\(/(/g;
|
||||||
|
#$graph =~ s/\)/)/g;
|
||||||
|
#$graph =~ s/\////g;
|
||||||
|
|
||||||
if(lc($config{httpd_builtin}->{enabled}) ne "y") {
|
if(lc($config{httpd_builtin}->{enabled}) ne "y") {
|
||||||
print("Content-Type: text/html\n");
|
print("Content-Type: text/html\n");
|
||||||
|
|
Loading…
Reference in New Issue