Skip to content

Commit ab1a534

Browse files
committed
Don't allow authorizing access tokens without a user
1 parent 4f5fb00 commit ab1a534

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/class-wp-json-authentication-oauth1.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ public function authorize_request_token( $key, $user = null ) {
372372
$user = $user->ID;
373373
}
374374

375+
if ( empty( $user ) ) {
376+
return new WP_Error( 'json_oauth1_invalid_user', __( 'Invalid user specified for access token' ) );
377+
}
378+
375379
$token['authorized'] = true;
376380
$token['verifier'] = wp_generate_password( self::VERIFIER_LENGTH, false );
377381
$token['user'] = $user;

0 commit comments

Comments
 (0)