From 514d9393ff9d7752426aaaa9b840ee1f94229491 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 25 Sep 2011 16:13:34 -0700 Subject: add a quick hack for XSS protection --- .gitignore | 1 + index.php | 9 +++++++++ xss-check.php.sample | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 xss-check.php.sample diff --git a/.gitignore b/.gitignore index 5df2997..3d2b2cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ msg/* conf.php +xss-check.php .htaccess *.bak diff --git a/index.php b/index.php index 1148b1d..ad16995 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,15 @@ // What directory are we in on the server. define('BASEPATH', dirname(__FILE__)); +$xss_file = BASEPATH.'/xss-check.php'; +if (file_exists($xss_file)) { + require($xss_file); + if (xss_attack()) { + echo "execution halted to prevent XSS attack."; + exit(); + } +} + // Decide where to look for things define('LIBPATH', BASEPATH.'/src/lib'.PATH_SEPARATOR.BASEPATH.'/src/ext'); define('MODELPATH', BASEPATH.'/src/models'); diff --git a/xss-check.php.sample b/xss-check.php.sample new file mode 100644 index 0000000..bfc7973 --- /dev/null +++ b/xss-check.php.sample @@ -0,0 +1,48 @@ +