Skip to content

Commit cfc67c0

Browse files
thisismyurlclaude
andauthored
Fix: add missing sanitize_text_field() on provider input in login_form_validate_2fa()
`login_form_revalidate_2fa()` already applies sanitize_text_field( wp_unslash() ) to the same $_REQUEST['provider'] input at line 1703. The parallel validate handler on line 1563 was missing the sanitize_text_field() wrapper — only wp_unslash() was called. This brings the two handlers in line with each other and with WordPress-VIP-Go coding standards (ValidatedSanitizedInput.InputNotSanitized). The provider value flows into get_provider_for_user() as an array key lookup, so there is no functional exploit path — this is a defensive coding and PHPCS compliance fix. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3026ec3 commit cfc67c0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

class-two-factor-core.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ public static function rest_api_can_edit_user_and_update_two_factor_options( $us
15601560
public static function login_form_validate_2fa() {
15611561
$wp_auth_id = ! empty( $_REQUEST['wp-auth-id'] ) ? absint( $_REQUEST['wp-auth-id'] ) : 0;
15621562
$nonce = ! empty( $_REQUEST['wp-auth-nonce'] ) ? wp_unslash( $_REQUEST['wp-auth-nonce'] ) : '';
1563-
$provider = ! empty( $_REQUEST['provider'] ) ? wp_unslash( $_REQUEST['provider'] ) : '';
1563+
$provider = ! empty( $_REQUEST['provider'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['provider'] ) ) : '';
15641564
$redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? wp_unslash( $_REQUEST['redirect_to'] ) : '';
15651565
$is_post_request = ( 'POST' === strtoupper( $_SERVER['REQUEST_METHOD'] ) );
15661566
$user = get_user_by( 'id', $wp_auth_id );

0 commit comments

Comments
 (0)