Skip to content

Commit e88a48a

Browse files
committed
Whitelist post arguments in XML-RPC
Built from https://develop.svn.wordpress.org/trunk@40677 git-svn-id: http://core.svn.wordpress.org/trunk@40540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent d8f9498 commit e88a48a

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

wp-includes/class-wp-xmlrpc-server.php

+24-6
Original file line numberDiff line numberDiff line change
@@ -1295,10 +1295,31 @@ private function _toggle_sticky( $post_data, $update = false ) {
12951295
* @return IXR_Error|string
12961296
*/
12971297
protected function _insert_post( $user, $content_struct ) {
1298-
$defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
1299-
'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
1298+
$defaults = array(
1299+
'post_status' => 'draft',
1300+
'post_type' => 'post',
1301+
'post_author' => null,
1302+
'post_password' => null,
1303+
'post_excerpt' => null,
1304+
'post_content' => null,
1305+
'post_title' => null,
1306+
'post_date' => null,
1307+
'post_date_gmt' => null,
1308+
'post_format' => null,
1309+
'post_name' => null,
1310+
'post_thumbnail' => null,
1311+
'post_parent' => null,
1312+
'ping_status' => null,
1313+
'comment_status' => null,
1314+
'custom_fields' => null,
1315+
'terms_names' => null,
1316+
'terms' => null,
1317+
'sticky' => null,
1318+
'enclosure' => null,
1319+
'ID' => null,
1320+
);
13001321

1301-
$post_data = wp_parse_args( $content_struct, $defaults );
1322+
$post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults );
13021323

13031324
$post_type = get_post_type_object( $post_data['post_type'] );
13041325
if ( ! $post_type )
@@ -1488,9 +1509,6 @@ protected function _insert_post( $user, $content_struct ) {
14881509

14891510
$post_data['tax_input'] = $terms;
14901511
unset( $post_data['terms'], $post_data['terms_names'] );
1491-
} else {
1492-
// Do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'.
1493-
unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
14941512
}
14951513

14961514
if ( isset( $post_data['post_format'] ) ) {

wp-includes/version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @global string $wp_version
66
*/
7-
$wp_version = '4.8-beta1-40676';
7+
$wp_version = '4.8-beta1-40677';
88

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

0 commit comments

Comments
 (0)