Skip to content

Commit

Permalink
Harden the maintenance mode bypass while scraping.
Browse files Browse the repository at this point in the history
  • Loading branch information
costdev committed Feb 17, 2024
1 parent ad8f28c commit 56a2298
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/wp-includes/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,12 @@ function wp_is_maintenance_mode() {

// Do not enable maintenance mode while scraping for fatal errors.
if ( isset( $_REQUEST['wp_scrape_key'], $_REQUEST['wp_scrape_nonce'] ) ) {
return false;
$key = substr( sanitize_key( wp_unslash( $_REQUEST['wp_scrape_key'] ) ), 0, 32 );
$nonce = wp_unslash( $_REQUEST['wp_scrape_nonce'] );

if ( get_transient( 'scrape_key_' . $key ) === $nonce ) {
return false;
}
}

if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) {
Expand Down

0 comments on commit 56a2298

Please sign in to comment.