Skip to content

Commit b152eda

Browse files
Grouped backports to the 4.1 branch.
- Media: Prevent CSRF setting attachment thumbnails. Merges [55764] to the 4.1 branch. Props dd32, isabel_brison, martinkrcho, matveb, ocean90, paulkevan, peterwilsoncc, timothyblynjacobs, xknown, youknowriad. git-svn-id: https://develop.svn.wordpress.org/branches/4.1@55772 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 620c9f7 commit b152eda

File tree

7 files changed

+31
-5
lines changed

7 files changed

+31
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "WordPress",
3-
"version": "4.1.37",
3+
"version": "4.1.38",
44
"description": "WordPress is web software you can use to create a beautiful website or blog.",
55
"repository": {
66
"type": "svn",

src/wp-admin/about.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,27 @@
4242
</h2>
4343

4444
<div class="changelog point-releases">
45-
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 37 ); ?></h3>
45+
<h3><?php echo _n( 'Maintenance and Security Release', 'Maintenance and Security Releases', 38 ); ?></h3>
46+
<p>
47+
<?php
48+
printf(
49+
/* translators: %s: WordPress version number */
50+
__( '<strong>Version %s</strong> addressed one security issue.' ),
51+
'4.1.38'
52+
);
53+
?>
54+
<?php
55+
printf(
56+
/* translators: %s: HelpHub URL */
57+
__( 'For more information, see <a href="%s">the release notes</a>.' ),
58+
sprintf(
59+
/* translators: %s: WordPress version */
60+
esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
61+
sanitize_title( '4.1.38' )
62+
)
63+
);
64+
?>
65+
</p>
4666
<p>
4767
<?php
4868
printf(

src/wp-admin/includes/ajax-actions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,10 @@ function wp_ajax_set_attachment_thumbnail() {
20112011
wp_send_json_error();
20122012
}
20132013

2014+
if ( false === check_ajax_referer( 'set-attachment-thumbnail', '_ajax_nonce', false ) ) {
2015+
wp_send_json_error();
2016+
}
2017+
20142018
$post_ids = array();
20152019
// For each URL, try to find its corresponding post ID.
20162020
foreach ( $_POST['urls'] as $url ) {

src/wp-includes/js/media-audiovideo.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,7 @@
588588

589589
wp.ajax.send( 'set-attachment-thumbnail', {
590590
data : {
591+
_ajax_nonce: wp.media.view.settings.nonce.setAttachmentThumbnail,
591592
urls: urls,
592593
thumbnail_id: attachment.get( 'id' )
593594
}

src/wp-includes/media.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2862,7 +2862,8 @@ function wp_enqueue_media( $args = array() ) {
28622862
/** This filter is documented in wp-admin/includes/media.php */
28632863
'captions' => ! apply_filters( 'disable_captions', '' ),
28642864
'nonce' => array(
2865-
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
2865+
'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
2866+
'setAttachmentThumbnail' => wp_create_nonce( 'set-attachment-thumbnail' ),
28662867
),
28672868
'post' => array(
28682869
'id' => 0,

src/wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @global string $wp_version
66
*/
7-
$wp_version = '4.1.37-src';
7+
$wp_version = '4.1.38-src';
88

99
/**
1010
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)