Make WordPress Core

Changeset 40198


Ignore:
Timestamp:
03/06/2017 01:58:45 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.5 branch.

Location:
branches/4.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.5

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

    r39972 r40198  
    721721             */
    722722            if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
    723                 $data = $this->source_data_fetch_fallback( $data['u'], $data );
     723                if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'scan-site' ) ) {
     724                    $data = $this->source_data_fetch_fallback( $data['u'], $data );
     725                } else {
     726                    $data['errors'] = 'missing nonce';
     727                }
    724728            } else {
    725729                foreach ( array( '_images', '_embeds' ) as $type ) {
     
    12661270            'v' => ! empty( $data['v'] ) ? $data['v'] : '',
    12671271            'u' => ! empty( $data['u'] ) ? $data['u'] : '',
    1268             'hasData' => ! empty( $data ),
     1272            'hasData' => ! empty( $data ) && ! isset( $data['errors'] ),
    12691273        );
    12701274
     
    13981402        <form method="GET">
    13991403            <label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
    1400             <input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
     1404            <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' ) ?>" />
    14011405            <input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
     1406            <?php wp_nonce_field( 'scan-site' ); ?>
    14021407        </form>
    14031408    </div>
Note: See TracChangeset for help on using the changeset viewer.