From d5b9305fa30d5f9435046afde9a312486d4d8ef1 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 6 Mar 2017 13:54:58 +0000 Subject: [PATCH] Press This: Verify intent before fetching in-page resources using Press This. Props vortfu git-svn-id: https://develop.svn.wordpress.org/trunk@40195 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-press-this.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/includes/class-wp-press-this.php b/src/wp-admin/includes/class-wp-press-this.php index 273c1ab1f1..bc5724256b 100644 --- a/src/wp-admin/includes/class-wp-press-this.php +++ b/src/wp-admin/includes/class-wp-press-this.php @@ -718,7 +718,11 @@ class WP_Press_This { * making PT fully backward compatible with the older bookmarklet. */ if ( empty( $_POST ) && ! empty( $data['u'] ) ) { - $data = $this->source_data_fetch_fallback( $data['u'], $data ); + if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'scan-site' ) ) { + $data = $this->source_data_fetch_fallback( $data['u'], $data ); + } else { + $data['errors'] = 'missing nonce'; + } } else { foreach ( array( '_images', '_embeds' ) as $type ) { if ( empty( $_POST[ $type ] ) ) { @@ -1235,7 +1239,7 @@ class WP_Press_This { $site_data = array( 'v' => ! empty( $data['v'] ) ? $data['v'] : '', 'u' => ! empty( $data['u'] ) ? $data['u'] : '', - 'hasData' => ! empty( $data ), + 'hasData' => ! empty( $data ) && ! isset( $data['errors'] ), ); if ( ! empty( $images ) ) { @@ -1367,8 +1371,9 @@ class WP_Press_This {
- + +