Pings/Trackbacks: In wp_xmlrpc_server::pingback_ping(), strip inline JS and CSS while trying to figure out the pingback context.

Props david.binda.
Fixes #47283.

git-svn-id: https://develop.svn.wordpress.org/trunk@45823 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-08-17 13:58:12 +00:00
parent c5438c3720
commit e810b32f42

View File

@ -6880,7 +6880,10 @@ class wp_xmlrpc_server extends IXR_Server {
return $this->pingback_error( 32, __( 'We cannot find a title on that page.' ) );
}
$remote_source = strip_tags( $remote_source, '<a>' ); // just keep the tag we need
// Remove all script and style tags including their content.
$remote_source = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $remote_source );
// Just keep the tag we need.
$remote_source = strip_tags( $remote_source, '<a>' );
$p = explode( "\n\n", $remote_source );