summaryrefslogtreecommitdiff
path: root/tests/executor
diff options
context:
space:
mode:
authorStefan Esser2014-02-11 11:29:37 +0100
committerStefan Esser2014-02-11 11:29:37 +0100
commit90fff832ca49aff1c7dd030a8c47acf2a38a22a0 (patch)
tree63078b6fc305a62c2fce647d28157520b0c9530b /tests/executor
parent7b62847869f794f8778f0e26b6086735fb9ba379 (diff)
Commit test cases for the function blacklist/whitelist problems
Diffstat (limited to 'tests/executor')
-rw-r--r--tests/executor/function_blacklist.phpt17
-rw-r--r--tests/executor/function_blacklist_printf.phpt15
-rw-r--r--tests/executor/function_whilelist.phpt17
-rw-r--r--tests/executor/function_whilelist_absmax.phpt15
-rw-r--r--tests/executor/function_whilelist_call_user_func.phpt15
-rw-r--r--tests/executor/function_whilelist_maxabs.phpt15
6 files changed, 94 insertions, 0 deletions
diff --git a/tests/executor/function_blacklist.phpt b/tests/executor/function_blacklist.phpt
new file mode 100644
index 0000000..d3df2ed
--- /dev/null
+++ b/tests/executor/function_blacklist.phpt
@@ -0,0 +1,17 @@
1--TEST--
2Testing: suhosin.executor.func.blacklist=max
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.func.blacklist=max
8--FILE--
9<?php
10 abs(1);
11 max(1,2);
12 abs(1);
13?>
14--EXPECTF--
15ALERT - function within blacklist called: max() (attacker 'REMOTE_ADDR not set', file '%s', line 3)
16
17Warning: max() has been disabled for security reasons in %s on line 3
diff --git a/tests/executor/function_blacklist_printf.phpt b/tests/executor/function_blacklist_printf.phpt
new file mode 100644
index 0000000..66591ba
--- /dev/null
+++ b/tests/executor/function_blacklist_printf.phpt
@@ -0,0 +1,15 @@
1--TEST--
2Testing: suhosin.executor.func.blacklist=printf
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.func.blacklist=printf
8--FILE--
9<?php
10 call_user_func("printf", "hello\n");
11?>
12--EXPECTF--
13ALERT - function within blacklist called: printf() (attacker 'REMOTE_ADDR not set', file '%s', line 2)
14
15Warning: printf() has been disabled for security reasons in %s on line 2
diff --git a/tests/executor/function_whilelist.phpt b/tests/executor/function_whilelist.phpt
new file mode 100644
index 0000000..9017ab4
--- /dev/null
+++ b/tests/executor/function_whilelist.phpt
@@ -0,0 +1,17 @@
1--TEST--
2Testing: suhosin.executor.func.whitelist=abs
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.func.whitelist=abs
8--FILE--
9<?php
10 abs(1);
11 max(1,2);
12 abs(1);
13?>
14--EXPECTF--
15ALERT - function outside of whitelist called: max() (attacker 'REMOTE_ADDR not set', file '%s', line 3)
16
17Warning: max() has been disabled for security reasons in %s on line 3
diff --git a/tests/executor/function_whilelist_absmax.phpt b/tests/executor/function_whilelist_absmax.phpt
new file mode 100644
index 0000000..f240e69
--- /dev/null
+++ b/tests/executor/function_whilelist_absmax.phpt
@@ -0,0 +1,15 @@
1--TEST--
2Testing: suhosin.executor.func.whitelist=abs,max
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.func.whitelist=abs,max
8--FILE--
9<?php
10 abs(1);
11 max(1,2);
12 abs(1);
13?>
14--EXPECTF--
15
diff --git a/tests/executor/function_whilelist_call_user_func.phpt b/tests/executor/function_whilelist_call_user_func.phpt
new file mode 100644
index 0000000..a54010f
--- /dev/null
+++ b/tests/executor/function_whilelist_call_user_func.phpt
@@ -0,0 +1,15 @@
1--TEST--
2Testing: suhosin.executor.func.whitelist=call_user_func
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.func.whitelist=call_user_func
8--FILE--
9<?php
10 call_user_func("printf", "hello\n");
11?>
12--EXPECTF--
13ALERT - function outside of whitelist called: printf() (attacker 'REMOTE_ADDR not set', file '%s', line 2)
14
15Warning: printf() has been disabled for security reasons in %s on line 2
diff --git a/tests/executor/function_whilelist_maxabs.phpt b/tests/executor/function_whilelist_maxabs.phpt
new file mode 100644
index 0000000..88a356e
--- /dev/null
+++ b/tests/executor/function_whilelist_maxabs.phpt
@@ -0,0 +1,15 @@
1--TEST--
2Testing: suhosin.executor.func.whitelist=max,abs
3--SKIPIF--
4<?php include "../skipifnotcli.inc"; ?>
5--INI--
6suhosin.log.sapi=64
7suhosin.executor.func.whitelist=max,abs
8--FILE--
9<?php
10 abs(1);
11 max(1,2);
12 abs(1);
13?>
14--EXPECTF--
15