Make WordPress Core

Changeset 40197


Ignore:
Timestamp:
03/06/2017 01:57:21 PM (8 years ago)
Author:
johnbillion
Message:

Press This: Verify intent before fetching in-page resources using Press This.

Props vortfu

Merges [40195] to the 4.6 branch.

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

  • branches/4.6/src/wp-admin/includes/class-wp-press-this.php

    r39971 r40197  
    722722             */
    723723            if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
    724                 $data = $this->source_data_fetch_fallback( $data['u'], $data );
     724                if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'scan-site' ) ) {
     725                    $data = $this->source_data_fetch_fallback( $data['u'], $data );
     726                } else {
     727                    $data['errors'] = 'missing nonce';
     728                }
    725729            } else {
    726730                foreach ( array( '_images', '_embeds' ) as $type ) {
     
    12381242            'v' => ! empty( $data['v'] ) ? $data['v'] : '',
    12391243            'u' => ! empty( $data['u'] ) ? $data['u'] : '',
    1240             'hasData' => ! empty( $data ),
     1244            'hasData' => ! empty( $data ) && ! isset( $data['errors'] ),
    12411245        );
    12421246
     
    13701374        <form method="GET">
    13711375            <label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
    1372             <input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
     1376            <input type="url" name="u" id="url-scan" class="scan-url" value="<?php echo esc_attr( $site_data['u'] ) ?>" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
    13731377            <input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
     1378            <?php wp_nonce_field( 'scan-site' ); ?>
    13741379        </form>
    13751380    </div>
Note: See TracChangeset for help on using the changeset viewer.