diff options
| author | jvoisin | 2020-07-04 18:25:24 +0200 |
|---|---|---|
| committer | jvoisin | 2020-07-04 18:25:24 +0200 |
| commit | d4936a46b6693d374d900d45b5c1642a618148bc (patch) | |
| tree | ca5e08c554d174d16b3a750851084b941d497bf6 /src/tests/disable_function | |
| parent | 55087da4701ddfbf4728b3670d8e46c07b4df881 (diff) | |
Add two tests related to x-forwarded-for and remote-addr
Diffstat (limited to 'src/tests/disable_function')
| -rw-r--r-- | src/tests/disable_function/disabled_functions_cidr_x_fwd_for.phpt | 16 | ||||
| -rw-r--r-- | src/tests/disable_function/disabled_functions_cidr_x_fwd_for_remote_addr.phpt | 17 |
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-- | ||
| 2 | Disable functions - CIDR match on an x-forwarded-for | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --ENV-- | ||
| 6 | return <<<EOF | ||
| 7 | HTTP_X_FORWARDED_FOR=127.0.0.1 | ||
| 8 | EOF; | ||
| 9 | --INI-- | ||
| 10 | sp.configuration_file={PWD}/config/disabled_functions_cidr.ini | ||
| 11 | --FILE-- | ||
| 12 | <?php | ||
| 13 | system("echo 42"); | ||
| 14 | ?> | ||
| 15 | --EXPECTF-- | ||
| 16 | Fatal 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-- | ||
| 2 | Disable functions - x-forwarded-for and remote-addr | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --ENV-- | ||
| 6 | return <<<EOF | ||
| 7 | HTTP_X_FORWARDED_FOR=127.0.0.1 | ||
| 8 | REMOTE_ADDR=127.0.0.2 | ||
| 9 | EOF; | ||
| 10 | --INI-- | ||
| 11 | sp.configuration_file={PWD}/config/disabled_functions_cidr.ini | ||
| 12 | --FILE-- | ||
| 13 | <?php | ||
| 14 | system("echo 42"); | ||
| 15 | ?> | ||
| 16 | --EXPECTF-- | ||
| 17 | Fatal 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 | ||
