Skip to content

Udp. Search form. Process requests only if a native search form is used.#821

Open
alexandergull wants to merge 4 commits into
devfrom
get-forms-vai-alt.ag
Open

Udp. Search form. Process requests only if a native search form is used.#821
alexandergull wants to merge 4 commits into
devfrom
get-forms-vai-alt.ag

Conversation

@alexandergull

@alexandergull alexandergull commented Jun 26, 2026

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings June 26, 2026 11:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_REFERER before 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.

Comment thread lib/Cleantalk/Antispam/IntegrationsByClass/WPSearchForm.php
Comment thread lib/Cleantalk/Antispam/IntegrationsByClass/WPSearchForm.php Outdated
Comment thread tests/Antispam/IntegrationsByClass/TestWPSearchForm.php
Comment thread tests/Antispam/IntegrationsByClass/TestWPSearchForm.php
Copilot AI review requested due to automatic review settings June 26, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread tests/Antispam/IntegrationsByClass/TestWPSearchForm.php
Comment thread lib/Cleantalk/Antispam/IntegrationsByClass/WPSearchForm.php
@alexandergull alexandergull force-pushed the get-forms-vai-alt.ag branch from 4a3da08 to da5b5a6 Compare June 26, 2026 12:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 26, 2026 12:01
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.25000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.76%. Comparing base (6695732) to head (3b732a0).
⚠️ Report is 18 commits behind head on dev.

Files with missing lines Patch % Lines
...talk/Antispam/IntegrationsByClass/WPSearchForm.php 81.25% 6 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +144 to +148
$current = is_array($current) ? $current : [];

if (!isset($current[$drawn_for_uri])) {
$current[$drawn_for_uri] = 1;
AltSessions::set('search_form_ready', $current);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants