From 0effcbe8f674a309d484f28388efe8774eba3c5d Mon Sep 17 00:00:00 2001 From: Gawuww Date: Mon, 4 Nov 2024 16:54:02 +0200 Subject: [PATCH] FIX: CS & eslint --- modules/actions-v2/call-webhook/call-webhook-action.php | 2 +- modules/captcha/friendly-captcha/friendly-captcha.php | 2 +- modules/captcha/friendly-captcha/verify-token-action.php | 1 + modules/captcha/hcaptcha/hcaptcha.php | 2 +- modules/captcha/hcaptcha/verify-token-action.php | 1 + modules/captcha/re-captcha-v3/re-captcha-v3.php | 2 +- modules/captcha/re-captcha-v3/verify-token-action.php | 1 + modules/captcha/turnstile/turnstile.php | 2 +- modules/captcha/turnstile/verify-token-action.php | 1 + modules/security/csrf/module.php | 1 + modules/security/honeypot/module.php | 1 + modules/security/wp-nonce/module.php | 1 + 12 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/actions-v2/call-webhook/call-webhook-action.php b/modules/actions-v2/call-webhook/call-webhook-action.php index 62e50cc31..5c3c634cd 100644 --- a/modules/actions-v2/call-webhook/call-webhook-action.php +++ b/modules/actions-v2/call-webhook/call-webhook-action.php @@ -48,7 +48,7 @@ public function do_action( array $request, Action_Handler $handler ) { 'body' => $request, ); - if ( $webhook_timeout !== false ) { + if ( false !== $webhook_timeout ) { $args['timeout'] = $webhook_timeout; } diff --git a/modules/captcha/friendly-captcha/friendly-captcha.php b/modules/captcha/friendly-captcha/friendly-captcha.php index 356d23e9a..348c219f8 100644 --- a/modules/captcha/friendly-captcha/friendly-captcha.php +++ b/modules/captcha/friendly-captcha/friendly-captcha.php @@ -31,7 +31,7 @@ public function verify( array $request ) { $action->send_request(); } catch ( Gateway_Exception $exception ) { throw new Spam_Exception( - Module::SPAM_EXCEPTION, + Module::SPAM_EXCEPTION, // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped $exception->getMessage(), // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ...$exception->get_additional() // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ); diff --git a/modules/captcha/friendly-captcha/verify-token-action.php b/modules/captcha/friendly-captcha/verify-token-action.php index 770e15641..2b578b4c5 100644 --- a/modules/captcha/friendly-captcha/verify-token-action.php +++ b/modules/captcha/friendly-captcha/verify-token-action.php @@ -41,6 +41,7 @@ public function before_make_request() { return; } + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new Gateway_Exception( Module::SPAM_EXCEPTION, 'Empty solution. Spammer detected' ); } diff --git a/modules/captcha/hcaptcha/hcaptcha.php b/modules/captcha/hcaptcha/hcaptcha.php index c36b2b562..8e435d237 100644 --- a/modules/captcha/hcaptcha/hcaptcha.php +++ b/modules/captcha/hcaptcha/hcaptcha.php @@ -33,7 +33,7 @@ public function verify( array $request ) { $action->send_request(); } catch ( Gateway_Exception $exception ) { throw new Spam_Exception( - Module::SPAM_EXCEPTION, + Module::SPAM_EXCEPTION, // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped $exception->getMessage(), // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ...$exception->get_additional() // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ); diff --git a/modules/captcha/hcaptcha/verify-token-action.php b/modules/captcha/hcaptcha/verify-token-action.php index 5bf914416..df9f8a48d 100644 --- a/modules/captcha/hcaptcha/verify-token-action.php +++ b/modules/captcha/hcaptcha/verify-token-action.php @@ -22,6 +22,7 @@ public function send_request() { return $response; } + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new Gateway_Exception( Module::SPAM_EXCEPTION ); } diff --git a/modules/captcha/re-captcha-v3/re-captcha-v3.php b/modules/captcha/re-captcha-v3/re-captcha-v3.php index 5cc67da1b..186bc3f65 100644 --- a/modules/captcha/re-captcha-v3/re-captcha-v3.php +++ b/modules/captcha/re-captcha-v3/re-captcha-v3.php @@ -46,7 +46,7 @@ public function verify( array $request ) { $action->send_request(); } catch ( Gateway_Exception $exception ) { throw new Spam_Exception( - Module::SPAM_EXCEPTION, + Module::SPAM_EXCEPTION, // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped $exception->getMessage(), // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ...$exception->get_additional() // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ); diff --git a/modules/captcha/re-captcha-v3/verify-token-action.php b/modules/captcha/re-captcha-v3/verify-token-action.php index e218f40a4..85944d0ff 100644 --- a/modules/captcha/re-captcha-v3/verify-token-action.php +++ b/modules/captcha/re-captcha-v3/verify-token-action.php @@ -55,6 +55,7 @@ public function before_make_request() { return; } + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new Gateway_Exception( Module::SPAM_EXCEPTION, 'Empty token. Spammer detected' ); } diff --git a/modules/captcha/turnstile/turnstile.php b/modules/captcha/turnstile/turnstile.php index 635bdcdd9..ac05959f9 100644 --- a/modules/captcha/turnstile/turnstile.php +++ b/modules/captcha/turnstile/turnstile.php @@ -36,7 +36,7 @@ public function verify( array $request ) { $action->send_request(); } catch ( Gateway_Exception $exception ) { throw new Spam_Exception( - Module::SPAM_EXCEPTION, + Module::SPAM_EXCEPTION, // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped $exception->getMessage(), // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ...$exception->get_additional() // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped ); diff --git a/modules/captcha/turnstile/verify-token-action.php b/modules/captcha/turnstile/verify-token-action.php index 78d7f07c9..3d03908ea 100644 --- a/modules/captcha/turnstile/verify-token-action.php +++ b/modules/captcha/turnstile/verify-token-action.php @@ -59,6 +59,7 @@ public function before_make_request() { return; } + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new Gateway_Exception( Module::SPAM_EXCEPTION, 'Empty solution. Spammer detected' ); } diff --git a/modules/security/csrf/module.php b/modules/security/csrf/module.php index ecaf0e3ad..220a1bde4 100644 --- a/modules/security/csrf/module.php +++ b/modules/security/csrf/module.php @@ -82,6 +82,7 @@ public function handle_request( array $request ): array { Csrf_Token_Model::clear(); if ( ! Csrf_Tools::verify( $this->token, $this->client ) ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new Spam_Exception( self::SPAM_EXCEPTION ); } diff --git a/modules/security/honeypot/module.php b/modules/security/honeypot/module.php index 431d11fc8..5f10159ab 100644 --- a/modules/security/honeypot/module.php +++ b/modules/security/honeypot/module.php @@ -102,6 +102,7 @@ public function handle_request( array $request ): array { } if ( ! empty( $request[ self::FIELD ] ) ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new Spam_Exception( self::SPAM_EXCEPTION ); } diff --git a/modules/security/wp-nonce/module.php b/modules/security/wp-nonce/module.php index 47a670fca..9ffd6e844 100644 --- a/modules/security/wp-nonce/module.php +++ b/modules/security/wp-nonce/module.php @@ -95,6 +95,7 @@ public function handle_request( array $request ): array { $nonce = $request[ self::KEY ] ?? ''; if ( ! $this->verify( $nonce ) ) { + // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw new Spam_Exception( self::SPAM_EXCEPTION ); }