mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-10 21:00:59 +01:00
REST API: Only check password value in query parameters while checking post permissions.
The `password` property which gets sent as part of a request POST body while setting a post's password should not be checked when calculating post visibility permissions. That value in the request body is intended to update the post, not to authenticate, and may be malformed or an invalid non-string type which would cause a fatal when checking against the hashed post password value. Query parameter `?password=` values are the correct interface to check, and are also guaranteed to be strings. Props mlf20, devansh016, antonvlasenko, TimothyBlynJacobs, kadamwhite. Fixes #61837. Built from https://develop.svn.wordpress.org/trunk@59036 git-svn-id: http://core.svn.wordpress.org/trunk@58432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2bc0e28dfe
commit
c418ba0205
@ -504,9 +504,9 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
);
|
||||
}
|
||||
|
||||
if ( $post && ! empty( $request['password'] ) ) {
|
||||
if ( $post && ! empty( $request->get_query_params()['password'] ) ) {
|
||||
// Check post password, and return error if invalid.
|
||||
if ( ! hash_equals( $post->post_password, $request['password'] ) ) {
|
||||
if ( ! hash_equals( $post->post_password, $request->get_query_params()['password'] ) ) {
|
||||
return new WP_Error(
|
||||
'rest_post_incorrect_password',
|
||||
__( 'Incorrect post password.' ),
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-alpha-59035';
|
||||
$wp_version = '6.7-alpha-59036';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user