Skip to content

Commit a7a4592

Browse files
committed
fix: sanitize unsubscribe request input
1 parent 6ee75df commit a7a4592

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Recovery/UnsubscribeHandler.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ private function is_post(): bool {
148148
*/
149149
private function input( string $key ): string {
150150
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- authenticated by the unguessable recovery token, not a nonce (the shopper is logged out); only an explicit POST suppresses, so a scanner GET cannot act.
151-
$raw = $_POST[ $key ] ?? ( $_GET[ $key ] ?? '' );
151+
if ( isset( $_POST[ $key ] ) ) {
152+
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- see the authentication rationale above.
153+
return sanitize_text_field( wp_unslash( $_POST[ $key ] ) );
154+
}
152155

153-
return is_string( $raw ) ? sanitize_text_field( wp_unslash( $raw ) ) : '';
156+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- see the authentication rationale above.
157+
return isset( $_GET[ $key ] ) ? sanitize_text_field( wp_unslash( $_GET[ $key ] ) ) : '';
154158
}
155159
}

0 commit comments

Comments
 (0)