This is not a vague / white list per se, but if it is executed correctly, it provides control over users and strictly controlled access only to shell commands specified in the code.
$Ops = array( 'function1' => function($parameter){ DO PARAMETER CHECK HERE; shell_exec("CommandThatIsSafetoPerform" + parameter here); }, 'function2' => function($parameter){ DO PARAMETER CHECK HERE; shell_exec("CommandThatIsSafetoPerform" + parameter here); }, 'function3' => function($parameter){ DO PARAMETER CHECK HERE; shell_exec("CommandThatIsSafetoPerform" + parameter here); }, );
then call use something like this:
call_user_func(Ops["function1"], "your parameter here");
A few special notes: Giving users access to options poses problems. You are better off with ALL hard coding and not give users the ability to modify any of the parameters.
source share