Udp. Search form. Process requests only if a native search form is used.#821
Udp. Search form. Process requests only if a native search form is used.#821alexandergull wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the native WordPress search form integration so spam checks run only when the request originates from a search form that CleanTalk actually rendered/protected, preventing unintended processing of arbitrary search requests.
Changes:
- Track “protected search form rendered” state per-page via AltSessions and verify it against
HTTP_REFERERbefore running search spam checks. - Clear the tracked state after a protected search is submitted to prevent reuse.
- Add PHPUnit coverage for the new tracking/verification behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/Cleantalk/Antispam/IntegrationsByClass/WPSearchForm.php |
Adds AltSessions-backed tracking for rendered native search forms and gates testSpam() on that state. |
tests/Antispam/IntegrationsByClass/TestWPSearchForm.php |
Adds tests for storing, matching, and clearing the rendered-search-form state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4a3da08 to
da5b5a6
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #821 +/- ##
============================================
+ Coverage 26.57% 26.76% +0.18%
- Complexity 5676 5703 +27
============================================
Files 269 270 +1
Lines 24258 24292 +34
============================================
+ Hits 6446 6501 +55
+ Misses 17812 17791 -21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| $current = is_array($current) ? $current : []; | ||
|
|
||
| if (!isset($current[$drawn_for_uri])) { | ||
| $current[$drawn_for_uri] = 1; | ||
| AltSessions::set('search_form_ready', $current); |
https://app.doboard.com/1/task/49674