Make WordPress Core

Changeset 40201


Ignore:
Timestamp:
03/06/2017 02:03:20 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.2 branch.

Location:
branches/4.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2

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

    r39975 r40201  
    698698             */
    699699            if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
    700                 $data = $this->source_data_fetch_fallback( $data['u'], $data );
     700                if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'scan-site' ) ) {
     701                    $data = $this->source_data_fetch_fallback( $data['u'], $data );
     702                } else {
     703                    $data['errors'] = 'missing nonce';
     704                }
    701705            } else {
    702706                foreach ( array( '_images', '_embeds' ) as $type ) {
     
    11981202            'v' => ! empty( $data['v'] ) ? $data['v'] : '',
    11991203            'u' => ! empty( $data['u'] ) ? $data['u'] : '',
    1200             'hasData' => ! empty( $data ),
     1204            'hasData' => ! empty( $data ) && ! isset( $data['errors'] ),
    12011205        );
    12021206
     
    13301334        <form method="GET">
    13311335            <label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
    1332             <input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
     1336            <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' ) ?>" />
    13331337            <input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
     1338            <?php wp_nonce_field( 'scan-site' ); ?>
    13341339        </form>
    13351340    </div>
Note: See TracChangeset for help on using the changeset viewer.