Make WordPress Core


Ignore:
Timestamp:
10/14/2019 07:06:04 PM (6 years ago)
Author:
whyisjake
Message:

Backporting several bug fixes.

  • Query: Remove the static query property.
  • HTTP API: Protect against hex interpretation.
  • Filesystem API: Prevent directory travelersals when creating new folders.
  • Administration: Ensure that admin referer nonce is valid.
  • REST API: Send a Vary: Origin header on GET requests.
  • Customizer: Properly sanitize background images.

Backports [46474], [46475], [46476], [46477], [46478], [46483], [46485] to the 4.5 branch.

Location:
branches/4.5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.5

  • branches/4.5/tests/phpunit/tests/auth.php

    r36617 r46497  
    142142    }
    143143
     144    public function test_check_admin_referer_with_default_action_as_string_not_doing_it_wrong() {
     145        // A valid nonce needs to be set so the check doesn't die()
     146        $_REQUEST['_wpnonce'] = wp_create_nonce( '-1' );
     147        $result               = check_admin_referer( '-1' );
     148        $this->assertSame( 1, $result );
     149
     150        unset( $_REQUEST['_wpnonce'] );
     151    }
     152
    144153    /**
    145154     * @ticket 24030
     
    152161
    153162        $this->assertEquals( $count, did_action( $this->nonce_failure_hook ) );
     163    }
     164
     165    /**
     166     * @ticket 36361
     167     */
     168    public function test_check_admin_referer_with_no_action_triggers_doing_it_wrong() {
     169        $this->setExpectedIncorrectUsage( 'check_admin_referer' );
     170
     171        // A valid nonce needs to be set so the check doesn't die()
     172        $_REQUEST['_wpnonce'] = wp_create_nonce( -1 );
     173        $result = check_admin_referer();
     174        $this->assertSame( 1, $result );
     175
     176        unset( $_REQUEST['_wpnonce'] );
     177    }
     178
     179    /**
     180     * @ticket 36361
     181     */
     182    public function test_check_ajax_referer_with_no_action_triggers_doing_it_wrong() {
     183        $this->setExpectedIncorrectUsage( 'check_ajax_referer' );
     184
     185        // A valid nonce needs to be set so the check doesn't die()
     186        $_REQUEST['_wpnonce'] = wp_create_nonce( -1 );
     187        $result = check_ajax_referer();
     188        $this->assertSame( 1, $result );
     189
     190        unset( $_REQUEST['_wpnonce'] );
    154191    }
    155192
Note: See TracChangeset for help on using the changeset viewer.