Code or a function to call is taken from request input
What it finds
eval($_POST['code']), call_user_func($_GET['action']), $_GET['f'](): code or a function chosen by what the request sent lets the sender run code of their own. eval, assert, create_function, the call_user_func family and calls through a variable function name are checked.
From the rule's source, code_from_request.rs.
<?phpfunction run(){ eval($_POST['code']);tx0 reports: request input from $_POST reaches the code to run $action = $_GET['action']; call_user_func($action);tx0 reports: request input from $_GET reaches the code to run $_REQUEST['f']();tx0 reports: request input from $_REQUEST reaches the code to run $allowed = ['a' => 'list_items']; call_user_func($allowed['a']);} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/php:code-from-request" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/php:code-from-request] reason="..."tx0 explain tx0/php:code-from-request shows the same in the terminal. Found a false positive? Report it.