Grouped backports to the 4.3 branch.

- Media: Prevent CSRF setting attachment thumbnails.

Merges [55764] to the 4.3 branch.
Props dd32, isabel_brison, martinkrcho, matveb, ocean90, paulkevan, peterwilsoncc, timothyblynjacobs, xknown, youknowriad.

git-svn-id: https://develop.svn.wordpress.org/branches/4.3@55776 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-05-16 15:25:24 +00:00
parent 8ba5163b7c
commit a3b484ba13
7 changed files with 31 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "WordPress",
"version": "4.3.30",
"version": "4.3.31",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "WordPress",
"version": "4.3.30",
"version": "4.3.31",
"description": "WordPress is web software you can use to create a beautiful website or blog.",
"repository": {
"type": "svn",

View File

@ -108,7 +108,27 @@ $tech_features = array(
</h2>
<div class="changelog point-releases">
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 30 ); ?></h3>
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 31 ); ?></h3>
<p>
<?php
printf(
/* translators: %s: WordPress version number */
__( '<strong>Version %s</strong> addressed one security issue.' ),
'4.3.31'
);
?>
<?php
printf(
/* translators: %s: HelpHub URL */
__( 'For more information, see <a href="%s">the release notes</a>.' ),
sprintf(
/* translators: %s: WordPress version */
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
sanitize_title( '4.3.31' )
)
);
?>
</p>
<p>
<?php
printf(

View File

@ -2059,6 +2059,10 @@ function wp_ajax_set_attachment_thumbnail() {
wp_send_json_error();
}
if ( false === check_ajax_referer( 'set-attachment-thumbnail', '_ajax_nonce', false ) ) {
wp_send_json_error();
}
$post_ids = array();
// For each URL, try to find its corresponding post ID.
foreach ( $_POST['urls'] as $url ) {

View File

@ -104,6 +104,7 @@ VideoDetails = MediaDetails.extend({
wp.ajax.send( 'set-attachment-thumbnail', {
data : {
_ajax_nonce: wp.media.view.settings.nonce.setAttachmentThumbnail,
urls: urls,
thumbnail_id: attachment.get( 'id' )
}

View File

@ -2977,7 +2977,8 @@ function wp_enqueue_media( $args = array() ) {
/** This filter is documented in wp-admin/includes/media.php */
'captions' => ! apply_filters( 'disable_captions', '' ),
'nonce' => array(
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
'setAttachmentThumbnail' => wp_create_nonce( 'set-attachment-thumbnail' ),
),
'post' => array(
'id' => 0,

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3.30-src';
$wp_version = '4.3.31-src';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.