From ad0751a29c68bb73c8dffe00cc68e7c1ed96e361 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 27 Feb 2014 15:19:53 +0000 Subject: [PATCH] Add some security hardening to passed playlist attributes. Props xknown. See #26631. git-svn-id: https://develop.svn.wordpress.org/trunk@27311 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/media.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 62c124aaa9..e750cc7562 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1013,6 +1013,10 @@ function wp_get_playlist( $attr, $type ) { $orderby = 'none'; } + if ( ! in_array( $style, array( 'light', 'dark' ), true ) ) { + $style = 'light'; + } + $args = array( 'post_status' => 'inherit', 'post_type' => 'attachment', @@ -1113,13 +1117,16 @@ function wp_get_playlist( $attr, $type ) { } $data['tracks'] = $tracks; + $safe_type = esc_attr( $safe_type ); + $safe_style = esc_attr( $style ); + ob_start(); if ( 1 === $instance ): wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-playlist' ); ?> - + -
+
- < controls="controls" preload="metadata" width="">> + < controls="controls" preload="metadata" width="">>