Make WordPress Core

Changeset 44069 for branches/4.0


Ignore:
Timestamp:
12/13/2018 01:55:22 AM (6 years ago)
Author:
peterwilsoncc
Message:

Multisite: Validate activation links.

Merges [44048] to the 4.0 branch.

Location:
branches/4.0
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/wp-activate.php

    r44037 r44069  
    2727$result = null;
    2828
    29 if ( ! empty( $_GET['key'] ) ) {
     29if ( isset( $_GET['key'] ) && isset( $_POST['key'] ) && $_GET['key'] !== $_POST['key'] ) {
     30    wp_die( __( 'A key value mismatch has been detected. Please follow the link provided in your activation email.' ), __( 'An error occurred during the activation' ), 400 );
     31} elseif ( ! empty( $_GET['key'] ) ) {
    3032    $key = $_GET['key'];
    3133} elseif ( ! empty( $_POST['key'] ) ) {
  • branches/4.0/src/wp-admin/includes/screen.php

    r39768 r44069  
    450450            switch ( $base ) {
    451451                case 'post' :
    452                     if ( isset( $_GET['post'] ) )
     452                    if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] )
     453                        wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
     454                    elseif ( isset( $_GET['post'] ) )
    453455                        $post_id = (int) $_GET['post'];
    454456                    elseif ( isset( $_POST['post_ID'] ) )
  • branches/4.0/src/wp-admin/post.php

    r33545 r44069  
    1717wp_reset_vars( array( 'action' ) );
    1818
    19 if ( isset( $_GET['post'] ) )
     19if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] )
     20    wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
     21elseif ( isset( $_GET['post'] ) )
    2022    $post_id = $post_ID = (int) $_GET['post'];
    2123elseif ( isset( $_POST['post_ID'] ) )
     
    8385}
    8486
     87if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
     88    wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
     89}
     90
    8591if ( isset( $_POST['deletepost'] ) )
    8692    $action = 'delete';
  • branches/4.0/src/wp-includes/class-wp.php

    r29454 r44069  
    266266            if ( isset( $this->extra_query_vars[$wpvar] ) )
    267267                $this->query_vars[$wpvar] = $this->extra_query_vars[$wpvar];
     268            elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] )
     269                wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
    268270            elseif ( isset( $_POST[$wpvar] ) )
    269271                $this->query_vars[$wpvar] = $_POST[$wpvar];
  • branches/4.0/src/wp-includes/ms-deprecated.php

    r27716 r44069  
    241241
    242242    $ref = '';
    243     if ( isset( $_GET['ref'] ) )
    244         $ref = $_GET['ref'];
    245     if ( isset( $_POST['ref'] ) )
    246         $ref = $_POST['ref'];
     243    if ( isset( $_GET['ref'] ) && isset( $_POST['ref'] ) && $_GET['ref'] !== $_POST['ref'] ) {
     244        wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
     245    } elseif ( isset( $_POST['ref'] ) ) {
     246        $ref = $_POST[ 'ref' ];
     247    } elseif ( isset( $_GET['ref'] ) ) {
     248        $ref = $_GET[ 'ref' ];
     249    }
    247250
    248251    if ( $ref ) {
     
    257260
    258261    $url = wpmu_admin_redirect_add_updated_param( $url );
    259     if ( isset( $_GET['redirect'] ) ) {
     262    if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) {
     263        wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
     264    } elseif ( isset( $_GET['redirect'] ) ) {
    260265        if ( substr( $_GET['redirect'], 0, 2 ) == 's_' )
    261266            $url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
Note: See TracChangeset for help on using the changeset viewer.