summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Esser2014-02-13 10:39:30 +0100
committerStefan Esser2014-02-13 10:39:30 +0100
commit1a0dbc9684ddd3f6227a09346c63c1c5e789bd4d (patch)
treef7e8bfdf4ab59e265f6927afa34f5f493f267075
parent286ded52361e1cd31151cf945f4d8c7bb05da1c7 (diff)
Tests for suhosin.log.use-x-forwarded-for
-rw-r--r--tests/logging/use_x_forwarded_for_off.phpt23
-rw-r--r--tests/logging/use_x_forwarded_for_off_no_remote_addr.phpt18
-rw-r--r--tests/logging/use_x_forwarded_for_on.phpt23
-rw-r--r--tests/logging/use_x_forwarded_for_on_no_x_forwarded.phpt18
4 files changed, 82 insertions, 0 deletions
diff --git a/tests/logging/use_x_forwarded_for_off.phpt b/tests/logging/use_x_forwarded_for_off.phpt
new file mode 100644
index 0000000..6b31d53
--- /dev/null
+++ b/tests/logging/use_x_forwarded_for_off.phpt
@@ -0,0 +1,23 @@
1--TEST--
2Testing: suhosin.log.use-x-forwarded-for=Off
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=0
7suhosin.log.stdout=255
8suhosin.log.script=0
9suhosin.log.syslog=0
10suhosin.executor.func.blacklist=max
11suhosin.log.use-x-forwarded-for=Off
12--ENV--
13return <<<END
14REMOTE_ADDR=101.102.103.104
15HTTP_X_FORWARDED_FOR=1.2.3.4
16END;
17--FILE--
18<?php
19 max(1,2);
20?>
21--EXPECTF--
22Warning: max() has been disabled for security reasons in %s on line 2
23ALERT - function within blacklist called: max() (attacker '101.102.103.104', file '%s', line 2) \ No newline at end of file
diff --git a/tests/logging/use_x_forwarded_for_off_no_remote_addr.phpt b/tests/logging/use_x_forwarded_for_off_no_remote_addr.phpt
new file mode 100644
index 0000000..bd4c72b
--- /dev/null
+++ b/tests/logging/use_x_forwarded_for_off_no_remote_addr.phpt
@@ -0,0 +1,18 @@
1--TEST--
2Testing: suhosin.log.use-x-forwarded-for=Off (without REMOTE_ADDR set)
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=0
7suhosin.log.stdout=255
8suhosin.log.script=0
9suhosin.log.syslog=0
10suhosin.executor.func.blacklist=max
11suhosin.log.use-x-forwarded-for=Off
12--FILE--
13<?php
14 max(1,2);
15?>
16--EXPECTF--
17Warning: max() has been disabled for security reasons in %s on line 2
18ALERT - function within blacklist called: max() (attacker 'REMOTE_ADDR not set', file '%s', line 2) \ No newline at end of file
diff --git a/tests/logging/use_x_forwarded_for_on.phpt b/tests/logging/use_x_forwarded_for_on.phpt
new file mode 100644
index 0000000..5f37ca9
--- /dev/null
+++ b/tests/logging/use_x_forwarded_for_on.phpt
@@ -0,0 +1,23 @@
1--TEST--
2Testing: suhosin.log.use-x-forwarded-for=On
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=0
7suhosin.log.stdout=255
8suhosin.log.script=0
9suhosin.log.syslog=0
10suhosin.executor.func.blacklist=max
11suhosin.log.use-x-forwarded-for=On
12--ENV--
13return <<<END
14REMOTE_ADDR=101.102.103.104
15HTTP_X_FORWARDED_FOR=1.2.3.4
16END;
17--FILE--
18<?php
19 max(1,2);
20?>
21--EXPECTF--
22Warning: max() has been disabled for security reasons in %s on line 2
23ALERT - function within blacklist called: max() (attacker '1.2.3.4', file '%s', line 2) \ No newline at end of file
diff --git a/tests/logging/use_x_forwarded_for_on_no_x_forwarded.phpt b/tests/logging/use_x_forwarded_for_on_no_x_forwarded.phpt
new file mode 100644
index 0000000..aea6e06
--- /dev/null
+++ b/tests/logging/use_x_forwarded_for_on_no_x_forwarded.phpt
@@ -0,0 +1,18 @@
1--TEST--
2Testing: suhosin.log.use-x-forwarded-for=On (without X-Forwarded-For set)
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=0
7suhosin.log.stdout=255
8suhosin.log.script=0
9suhosin.log.syslog=0
10suhosin.executor.func.blacklist=max
11suhosin.log.use-x-forwarded-for=On
12--FILE--
13<?php
14 max(1,2);
15?>
16--EXPECTF--
17Warning: max() has been disabled for security reasons in %s on line 2
18ALERT - function within blacklist called: max() (attacker 'X-FORWARDED-FOR not set', file '%s', line 2) \ No newline at end of file