summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorjvoisin2020-07-04 18:25:24 +0200
committerjvoisin2020-07-04 18:25:24 +0200
commitd4936a46b6693d374d900d45b5c1642a618148bc (patch)
treeca5e08c554d174d16b3a750851084b941d497bf6 /src/tests
parent55087da4701ddfbf4728b3670d8e46c07b4df881 (diff)
Add two tests related to x-forwarded-for and remote-addr
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/disable_function/disabled_functions_cidr_x_fwd_for.phpt16
-rw-r--r--src/tests/disable_function/disabled_functions_cidr_x_fwd_for_remote_addr.phpt17
2 files changed, 33 insertions, 0 deletions
diff --git a/src/tests/disable_function/disabled_functions_cidr_x_fwd_for.phpt b/src/tests/disable_function/disabled_functions_cidr_x_fwd_for.phpt
new file mode 100644
index 0000000..03112c7
--- /dev/null
+++ b/src/tests/disable_function/disabled_functions_cidr_x_fwd_for.phpt
@@ -0,0 +1,16 @@
1--TEST--
2Disable functions - CIDR match on an x-forwarded-for
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--ENV--
6return <<<EOF
7HTTP_X_FORWARDED_FOR=127.0.0.1
8EOF;
9--INI--
10sp.configuration_file={PWD}/config/disabled_functions_cidr.ini
11--FILE--
12<?php
13system("echo 42");
14?>
15--EXPECTF--
16Fatal error: [snuffleupagus][127.0.0.1][disabled_function] Aborted execution on call of the function 'system' in %a/disabled_functions_cidr_x_fwd_for.php on line 2
diff --git a/src/tests/disable_function/disabled_functions_cidr_x_fwd_for_remote_addr.phpt b/src/tests/disable_function/disabled_functions_cidr_x_fwd_for_remote_addr.phpt
new file mode 100644
index 0000000..9e223e8
--- /dev/null
+++ b/src/tests/disable_function/disabled_functions_cidr_x_fwd_for_remote_addr.phpt
@@ -0,0 +1,17 @@
1--TEST--
2Disable functions - x-forwarded-for and remote-addr
3--SKIPIF--
4<?php if (!extension_loaded("snuffleupagus")) die "skip"; ?>
5--ENV--
6return <<<EOF
7HTTP_X_FORWARDED_FOR=127.0.0.1
8REMOTE_ADDR=127.0.0.2
9EOF;
10--INI--
11sp.configuration_file={PWD}/config/disabled_functions_cidr.ini
12--FILE--
13<?php
14system("echo 42");
15?>
16--EXPECTF--
17Fatal error: [snuffleupagus][127.0.0.2][disabled_function] Aborted execution on call of the function 'system' in %a/disabled_functions_cidr_x_fwd_for_remote_addr.php on line 2