From 8701566c1d16ddea18ab7c72d8010ee0b8e2b2ac Mon Sep 17 00:00:00 2001 From: Donncha O Caoimh <5656673+donnchawp@users.noreply.github.com> Date: Mon, 13 Apr 2026 13:28:29 +0100 Subject: [PATCH 1/3] Harden index.html warning dismissal handler --- wp-cache.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-cache.php b/wp-cache.php index d645567d..d9a96224 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -2097,6 +2097,11 @@ function wpsc_config_file_notices() { add_action( 'admin_notices', 'wpsc_config_file_notices' ); function wpsc_dismiss_indexhtml_warning() { check_ajax_referer( "wpsc-index-dismiss" ); + + if ( ! current_user_can( 'manage_options' ) ) { + wp_send_json_error( null, 403 ); + } + update_site_option( 'wp_super_cache_index_detected', 3 ); die( 0 ); } From b775aa29eab2d82492a7576b360d4ce77184fa73 Mon Sep 17 00:00:00 2001 From: Donncha O Caoimh <5656673+donnchawp@users.noreply.github.com> Date: Mon, 13 Apr 2026 13:31:19 +0100 Subject: [PATCH 2/3] Fix indentation --- wp-cache.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-cache.php b/wp-cache.php index d9a96224..4cc3c0c7 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -2096,14 +2096,14 @@ function wpsc_config_file_notices() { } add_action( 'admin_notices', 'wpsc_config_file_notices' ); function wpsc_dismiss_indexhtml_warning() { - check_ajax_referer( "wpsc-index-dismiss" ); + check_ajax_referer( "wpsc-index-dismiss" ); - if ( ! current_user_can( 'manage_options' ) ) { - wp_send_json_error( null, 403 ); - } + if ( ! current_user_can( 'manage_options' ) ) { + wp_send_json_error( null, 403 ); + } - update_site_option( 'wp_super_cache_index_detected', 3 ); - die( 0 ); + update_site_option( 'wp_super_cache_index_detected', 3 ); + die( 0 ); } add_action( 'wp_ajax_wpsc-index-dismiss', 'wpsc_dismiss_indexhtml_warning' ); From d79877504a1d8ca93945e5888fa914a0768acdb0 Mon Sep 17 00:00:00 2001 From: Donncha O Caoimh <5656673+donnchawp@users.noreply.github.com> Date: Mon, 13 Apr 2026 13:32:54 +0100 Subject: [PATCH 3/3] Linting fix, single quotes only here --- wp-cache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-cache.php b/wp-cache.php index 4cc3c0c7..88c15585 100644 --- a/wp-cache.php +++ b/wp-cache.php @@ -2096,7 +2096,7 @@ function wpsc_config_file_notices() { } add_action( 'admin_notices', 'wpsc_config_file_notices' ); function wpsc_dismiss_indexhtml_warning() { - check_ajax_referer( "wpsc-index-dismiss" ); + check_ajax_referer( 'wpsc-index-dismiss' ); if ( ! current_user_can( 'manage_options' ) ) { wp_send_json_error( null, 403 );