From e2fdcb93f188a5382621379a3fa9f807c9100521 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Wed, 29 Nov 2017 15:59:41 +0000 Subject: [PATCH] Hardening: Remove the ability to upload JavaScript files for users who do not have the `unfiltered_html` capability. git-svn-id: https://develop.svn.wordpress.org/trunk@42261 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 5a2d3c5d4e..c5f6feb2f0 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -2565,8 +2565,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'] ); + } /** * Filters list of allowed mime types and file extensions.