From 80aef7ba67cc7b506f2ade7ea1f260f1803df80e Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 29 Nov 2017 16:40:35 +0000 Subject: [PATCH] Hardening: Remove the ability to upload JavaScript files for users who do not have the `unfiltered_html` capability. Merges [42261] to the 4.0 branch. Built from https://develop.svn.wordpress.org/branches/4.0@42303 git-svn-id: http://core.svn.wordpress.org/branches/4.0@42132 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 9b61f2115d..f794b3e1d7 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2331,8 +2331,9 @@ function get_allowed_mime_types( $user = null ) { if ( function_exists( 'current_user_can' ) ) $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' ); - if ( empty( $unfiltered ) ) - unset( $t['htm|html'] ); + if ( empty( $unfiltered ) ) { + unset( $t['htm|html'], $t['js'] ); + } /** * Filter list of allowed mime types and file extensions.