summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Esser2014-06-09 09:03:03 +0200
committerStefan Esser2014-06-09 09:03:03 +0200
commit134a88c1da096f787a560c43534f07b74867b9cb (patch)
treeab925ecba15c137a3b916ac65964d9b1c32f513a /tests
parentcd70620d20aef7fa5b89065c39708186f0b590c4 (diff)
Add protection against injection attacks (like XSS/SQL/other) through HTTP User-Agent String
Diffstat (limited to 'tests')
-rw-r--r--tests/filter/server_user_agent_strip_off.phpt27
-rw-r--r--tests/filter/server_user_agent_strip_on.phpt27
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/filter/server_user_agent_strip_off.phpt b/tests/filter/server_user_agent_strip_off.phpt
new file mode 100644
index 0000000..36c6580
--- /dev/null
+++ b/tests/filter/server_user_agent_strip_off.phpt
@@ -0,0 +1,27 @@
1--TEST--
2Testing: suhosin.server.strip=On
3--DESCRIPTION--
4This test is not exactly what we want, but good enough due to limitations of the test framework.
5--INI--
6suhosin.log.syslog=0
7suhosin.log.sapi=0
8suhosin.log.stdout=255
9suhosin.log.script=0
10suhosin.server.strip=Off
11--SKIPIF--
12<?php include('skipif.inc'); ?>
13--ENV--
14return <<<END
15HTTP_USER_AGENT=Mozilla/5.0 (Windows NT 6.0; rv:29.0) <script>alert('123');</script>Gecko/20100101 Firefox/29.0
16END;
17--COOKIE--
18--GET--
19A=B
20--POST--
21--FILE--
22<?php
23var_dump($_SERVER['HTTP_USER_AGENT']);
24?>
25--EXPECTF--
26string(95) "Mozilla/5.0 (Windows NT 6.0; rv:29.0) <script>alert('123');</script>Gecko/20100101 Firefox/29.0"
27
diff --git a/tests/filter/server_user_agent_strip_on.phpt b/tests/filter/server_user_agent_strip_on.phpt
new file mode 100644
index 0000000..73d577c
--- /dev/null
+++ b/tests/filter/server_user_agent_strip_on.phpt
@@ -0,0 +1,27 @@
1--TEST--
2Testing: suhosin.server.strip=On
3--DESCRIPTION--
4This test is not exactly what we want, but good enough due to limitations of the test framework.
5--INI--
6suhosin.log.syslog=0
7suhosin.log.sapi=0
8suhosin.log.stdout=255
9suhosin.log.script=0
10suhosin.server.strip=On
11--SKIPIF--
12<?php include('skipif.inc'); ?>
13--ENV--
14return <<<END
15HTTP_USER_AGENT=Mozilla/5.0 (Windows NT 6.0; rv:29.0) <script>alert('123');</script>Gecko/20100101 Firefox/29.0
16END;
17--COOKIE--
18--GET--
19A=B
20--POST--
21--FILE--
22<?php
23var_dump($_SERVER['HTTP_USER_AGENT']);
24?>
25--EXPECTF--
26string(95) "Mozilla/5.0 (Windows NT 6.0; rv:29.0) ?script?alert(?123?);?/script?Gecko/20100101 Firefox/29.0"
27