From e66f0f078e987a6cffd9954d94a06d961589ff8b Mon Sep 17 00:00:00 2001 From: Kunal Nagar <2741371+kunalnagar@users.noreply.github.com> Date: Tue, 17 Jan 2023 18:40:54 -0500 Subject: [PATCH] fix: CSRF in Logs form (#61) --- admin/AdminClass.php | 4 ++-- admin/views/logs.php | 1 + custom-404-pro.php | 2 +- readme.txt | 5 ++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/admin/AdminClass.php b/admin/AdminClass.php index 491a277..391f94e 100755 --- a/admin/AdminClass.php +++ b/admin/AdminClass.php @@ -113,12 +113,12 @@ public function form_settings_general() { public function custom_404_pro_admin_init() { global $wpdb; - if(current_user_can('administrator')) { + if( current_user_can( 'administrator' ) && wp_verify_nonce( $_REQUEST['form-logs-options'], 'form-logs-options' ) ) { if ( array_key_exists( 'action', $_REQUEST ) ) { $action = sanitize_text_field($_REQUEST['action']); if ( $action === 'c4p-logs--delete' ) { if ( array_key_exists( 'path', $_REQUEST ) ) { - $this->helpers->delete_logs( sanitize_url($_REQUEST['path']) ); + $this->helpers->delete_logs( $_REQUEST['path'] ); $message = urlencode( 'Log(s) successfully deleted!' ); wp_redirect( admin_url( 'admin.php?page=c4p-main&c4pmessage=' . $message . '&c4pmessageType=success' ) ); } else { diff --git a/admin/views/logs.php b/admin/views/logs.php index 16d01c2..1c507f4 100755 --- a/admin/views/logs.php +++ b/admin/views/logs.php @@ -12,6 +12,7 @@
+