Make WordPress Core


Ignore:
Timestamp:
05/16/2017 12:15:06 PM (7 years ago)
Author:
ocean90
Message:

Customize: Ignore invalid customization sessions.

Merge of [40704] to the 4.5 branch.

Location:
branches/4.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.5

  • branches/4.5/src/wp-includes/class-wp-customize-manager.php

    r37768 r40707  
    386386
    387387        show_admin_bar( false );
     388
     389        /*
     390         * Clear incoming post data if the user lacks a CSRF token (nonce). Note that the customizer
     391         * application will inject the customize_preview_nonce query parameter into all Ajax requests.
     392         * For similar behavior elsewhere in WordPress, see rest_cookie_check_errors() which logs out
     393         * a user when a valid nonce isn't present.
     394         */
     395        $has_post_data_nonce = (
     396            check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce', false )
     397            ||
     398            check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce', false )
     399            ||
     400            check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'customize_preview_nonce', false )
     401        );
     402        if ( ! $has_post_data_nonce ) {
     403            unset( $_POST['customized'] );
     404            unset( $_REQUEST['customized'] );
     405        }
    388406
    389407        if ( ! current_user_can( 'customize' ) ) {
Note: See TracChangeset for help on using the changeset viewer.