diff --git a/docs/integrations/wordpress-vip/reviewed-exceptions.json b/docs/integrations/wordpress-vip/reviewed-exceptions.json index 1e2adaf..a25d3b3 100644 --- a/docs/integrations/wordpress-vip/reviewed-exceptions.json +++ b/docs/integrations/wordpress-vip/reviewed-exceptions.json @@ -91,12 +91,6 @@ "source": "WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__HTTP_USER_AGENT__", "reason": "Sanitized UA is PHP-request detection/audit context, not proof of identity; cache hits that bypass PHP are explicitly outside coverage." }, - { - "file": "webdecoy.php", - "function": "inject_js_verification_token", - "source": "WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__HTTP_USER_AGENT__", - "reason": "Sanitized UA is PHP-request detection/audit context, not proof of identity; cache hits that bypass PHP are explicitly outside coverage." - }, { "file": "webdecoy.php", "function": "log_client_detection", diff --git a/webdecoy.php b/webdecoy.php index 3153673..f332bd7 100644 --- a/webdecoy.php +++ b/webdecoy.php @@ -981,12 +981,6 @@ private function init_hooks(): void add_action('plugins_loaded', [$this, 'register_wp_traps'], 20); } - // JS execution verification: inject challenge token meta tag and report page serve - // Only active when scanner is enabled and API key is configured (premium) - if ($this->options['scanner_enabled'] && !is_admin() && $this->is_premium()) { - add_action('wp_head', [$this, 'inject_js_verification_token'], 1); - } - // Clear API cache when settings are saved add_action('update_option_webdecoy_options', [$this, 'clear_api_status_cache']); @@ -2868,62 +2862,6 @@ public function enqueue_clearance_client(): void ); } - /** - * Inject JS execution verification challenge token into the page head. - * Generates a unique token per page view, embeds it as a meta tag, and - * reports it to the ingest service. bot-detection-pro.js reads the meta tag - * and beacons it back. If the beacon never arrives, the visitor is a non-JS scraper. - */ - public function inject_js_verification_token(): void - { - // Skip for logged-in users if scanner excludes them - if ($this->options['scanner_exclude_logged_in'] && is_user_logged_in()) { - return; - } - - // Generate a unique challenge token (32 bytes hex = 64 chars) - $token = bin2hex(random_bytes(32)); - - // Output the meta tag in - echo '' . "\n"; - - // Report page serve to ingest service (fire-and-forget) - $api_key = $this->options['api_key']; - if (empty($api_key)) { - return; - } - - $collector = new \WebDecoy\SignalCollector($this->get_trusted_proxies()); - $ip = $collector->getIP(); - - // phpcs:ignore WordPressVIPMinimum.Variables.RestrictedVariables.cache_constraints___SERVER__HTTP_USER_AGENT__, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])) : ''; - - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $domain = isset($_SERVER['HTTP_HOST']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : ''; - - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized - $path = isset($_SERVER['REQUEST_URI']) ? sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])) : ''; - - $payload = [ - 'token' => $token, - 'domain' => $domain, - 'path' => $path, - 'ip' => $ip, - 'user_agent' => $user_agent, - ]; - - wp_remote_post('https://in.webdecoy.com/api/v1/page-serve', [ - 'timeout' => 1, - 'blocking' => false, - 'headers' => [ - 'Content-Type' => 'application/json', - 'Authorization' => 'Bearer ' . $api_key, - ], - 'body' => wp_json_encode($payload), - ]); - } - private function scanner_enabled_for_visitor(): bool { return !empty($this->options['scanner_enabled'])