diff options
| author | Stefan Esser | 2014-02-13 10:39:30 +0100 |
|---|---|---|
| committer | Stefan Esser | 2014-02-13 10:39:30 +0100 |
| commit | 1a0dbc9684ddd3f6227a09346c63c1c5e789bd4d (patch) | |
| tree | f7e8bfdf4ab59e265f6927afa34f5f493f267075 | |
| parent | 286ded52361e1cd31151cf945f4d8c7bb05da1c7 (diff) | |
Tests for suhosin.log.use-x-forwarded-for
| -rw-r--r-- | tests/logging/use_x_forwarded_for_off.phpt | 23 | ||||
| -rw-r--r-- | tests/logging/use_x_forwarded_for_off_no_remote_addr.phpt | 18 | ||||
| -rw-r--r-- | tests/logging/use_x_forwarded_for_on.phpt | 23 | ||||
| -rw-r--r-- | tests/logging/use_x_forwarded_for_on_no_x_forwarded.phpt | 18 |
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-- | ||
| 2 | Testing: suhosin.log.use-x-forwarded-for=Off | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php include "../skipifnotcli.inc"; ?> | ||
| 5 | --INI-- | ||
| 6 | suhosin.log.sapi=0 | ||
| 7 | suhosin.log.stdout=255 | ||
| 8 | suhosin.log.script=0 | ||
| 9 | suhosin.log.syslog=0 | ||
| 10 | suhosin.executor.func.blacklist=max | ||
| 11 | suhosin.log.use-x-forwarded-for=Off | ||
| 12 | --ENV-- | ||
| 13 | return <<<END | ||
| 14 | REMOTE_ADDR=101.102.103.104 | ||
| 15 | HTTP_X_FORWARDED_FOR=1.2.3.4 | ||
| 16 | END; | ||
| 17 | --FILE-- | ||
| 18 | <?php | ||
| 19 | max(1,2); | ||
| 20 | ?> | ||
| 21 | --EXPECTF-- | ||
| 22 | Warning: max() has been disabled for security reasons in %s on line 2 | ||
| 23 | ALERT - 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-- | ||
| 2 | Testing: suhosin.log.use-x-forwarded-for=Off (without REMOTE_ADDR set) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php include "../skipifnotcli.inc"; ?> | ||
| 5 | --INI-- | ||
| 6 | suhosin.log.sapi=0 | ||
| 7 | suhosin.log.stdout=255 | ||
| 8 | suhosin.log.script=0 | ||
| 9 | suhosin.log.syslog=0 | ||
| 10 | suhosin.executor.func.blacklist=max | ||
| 11 | suhosin.log.use-x-forwarded-for=Off | ||
| 12 | --FILE-- | ||
| 13 | <?php | ||
| 14 | max(1,2); | ||
| 15 | ?> | ||
| 16 | --EXPECTF-- | ||
| 17 | Warning: max() has been disabled for security reasons in %s on line 2 | ||
| 18 | ALERT - 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-- | ||
| 2 | Testing: suhosin.log.use-x-forwarded-for=On | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php include "../skipifnotcli.inc"; ?> | ||
| 5 | --INI-- | ||
| 6 | suhosin.log.sapi=0 | ||
| 7 | suhosin.log.stdout=255 | ||
| 8 | suhosin.log.script=0 | ||
| 9 | suhosin.log.syslog=0 | ||
| 10 | suhosin.executor.func.blacklist=max | ||
| 11 | suhosin.log.use-x-forwarded-for=On | ||
| 12 | --ENV-- | ||
| 13 | return <<<END | ||
| 14 | REMOTE_ADDR=101.102.103.104 | ||
| 15 | HTTP_X_FORWARDED_FOR=1.2.3.4 | ||
| 16 | END; | ||
| 17 | --FILE-- | ||
| 18 | <?php | ||
| 19 | max(1,2); | ||
| 20 | ?> | ||
| 21 | --EXPECTF-- | ||
| 22 | Warning: max() has been disabled for security reasons in %s on line 2 | ||
| 23 | ALERT - 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-- | ||
| 2 | Testing: suhosin.log.use-x-forwarded-for=On (without X-Forwarded-For set) | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php include "../skipifnotcli.inc"; ?> | ||
| 5 | --INI-- | ||
| 6 | suhosin.log.sapi=0 | ||
| 7 | suhosin.log.stdout=255 | ||
| 8 | suhosin.log.script=0 | ||
| 9 | suhosin.log.syslog=0 | ||
| 10 | suhosin.executor.func.blacklist=max | ||
| 11 | suhosin.log.use-x-forwarded-for=On | ||
| 12 | --FILE-- | ||
| 13 | <?php | ||
| 14 | max(1,2); | ||
| 15 | ?> | ||
| 16 | --EXPECTF-- | ||
| 17 | Warning: max() has been disabled for security reasons in %s on line 2 | ||
| 18 | ALERT - function within blacklist called: max() (attacker 'X-FORWARDED-FOR not set', file '%s', line 2) \ No newline at end of file | ||
