Security: Fix bug in `wp_is_local_html_output()`.
Prior to this changeset, the check for the correct RSD link output was relying on a specific protocol, although it needs to accept both the HTTP and HTTPS version of the URL. Props TimothyBlynJacobs. Fixes #52542. See #47577. Built from https://develop.svn.wordpress.org/trunk@50391 git-svn-id: http://core.svn.wordpress.org/trunk@50002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
50f8dafe17
commit
f7fd9adee1
|
@ -204,7 +204,7 @@ function wp_cron_conditionally_prevent_sslverify( $request ) {
|
||||||
function wp_is_local_html_output( $html ) {
|
function wp_is_local_html_output( $html ) {
|
||||||
// 1. Check if HTML includes the site's Really Simple Discovery link.
|
// 1. Check if HTML includes the site's Really Simple Discovery link.
|
||||||
if ( has_action( 'wp_head', 'rsd_link' ) ) {
|
if ( has_action( 'wp_head', 'rsd_link' ) ) {
|
||||||
$pattern = esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ); // See rsd_link().
|
$pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) ); // See rsd_link().
|
||||||
return false !== strpos( $html, $pattern );
|
return false !== strpos( $html, $pattern );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ function wp_is_local_html_output( $html ) {
|
||||||
// 3. Check if HTML includes the site's REST API link.
|
// 3. Check if HTML includes the site's REST API link.
|
||||||
if ( has_action( 'wp_head', 'rest_output_link_wp_head' ) ) {
|
if ( has_action( 'wp_head', 'rest_output_link_wp_head' ) ) {
|
||||||
// Try both HTTPS and HTTP since the URL depends on context.
|
// Try both HTTPS and HTTP since the URL depends on context.
|
||||||
$pattern = esc_url( preg_replace( '#^https?:(?=//)#', '', get_rest_url() ) ); // See rest_output_link_wp_head().
|
$pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( get_rest_url() ) ); // See rest_output_link_wp_head().
|
||||||
return false !== strpos( $html, $pattern );
|
return false !== strpos( $html, $pattern );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.7-beta3-50390';
|
$wp_version = '5.7-beta3-50391';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue