Skip to content

Commit 29a906b

Browse files
authored
Harden index.html warning dismissal handler (#1034)
* Harden index.html warning dismissal handler * Fix indentation * Linting fix, single quotes only here
1 parent a48df42 commit 29a906b

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

wp-cache.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,9 +2096,14 @@ function wpsc_config_file_notices() {
20962096
}
20972097
add_action( 'admin_notices', 'wpsc_config_file_notices' );
20982098
function wpsc_dismiss_indexhtml_warning() {
2099-
check_ajax_referer( "wpsc-index-dismiss" );
2100-
update_site_option( 'wp_super_cache_index_detected', 3 );
2101-
die( 0 );
2099+
check_ajax_referer( 'wpsc-index-dismiss' );
2100+
2101+
if ( ! current_user_can( 'manage_options' ) ) {
2102+
wp_send_json_error( null, 403 );
2103+
}
2104+
2105+
update_site_option( 'wp_super_cache_index_detected', 3 );
2106+
die( 0 );
21022107
}
21032108
add_action( 'wp_ajax_wpsc-index-dismiss', 'wpsc_dismiss_indexhtml_warning' );
21042109

0 commit comments

Comments
 (0)