Skip to content

Commit 3e1ba6c

Browse files
committed
refactor: sanitize routes action param
1 parent a266415 commit 3e1ba6c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

includes/Core/Util/Route.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ public static function post($hook, $invokeable)
2727
public static function request($method, $hook, $invokeable)
2828
{
2929
$action = $_REQUEST['action'] ?? $_POST['action'] ?? $_GET['action'];
30+
$action = sanitize_text_field($action);
3031

3132
if (
3233
(isset($_SERVER['REQUEST_METHOD']) && sanitize_text_field($_SERVER['REQUEST_METHOD']) != $method)
3334
|| empty($action)
34-
|| (!empty($action) && strpos(sanitize_text_field($action), $hook) === false)
35+
|| (!empty($action) && strpos($action, $hook) === false)
3536
) {
3637
if (static::$_no_auth) {
3738
static::$_no_auth = false;

0 commit comments

Comments
 (0)