Skip to content

Fix. FW. Improve statement on WAF module to prevent false positive. - #710

Merged
svfcode merged 2 commits into
fixfrom
upd-fw-waf
Aug 11, 2026
Merged

Fix. FW. Improve statement on WAF module to prevent false positive.#710
svfcode merged 2 commits into
fixfrom
upd-fw-waf

Conversation

@svfcode

@svfcode svfcode commented Aug 11, 2026

Copy link
Copy Markdown
Member

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

This PR introduces PHPUnit coverage around WAF::hasSignature() to ensure “catch-all” body signatures (e.g., #.*#) don’t trigger unless constrained by headers/URL, helping reduce WAF false positives.

Changes:

  • Added a new test suite validating that unconstrained catch-all body regex signatures do not match.
  • Added positive/negative tests for header-constrained catch-all signatures.
  • Added tests ensuring non-catch-all signatures (narrow regex / literal strings) still match as expected.
Suppressed comments (1)

tests/lib/CleantalkSP/SpbctWP/Firewall/WAFHasSignatureTest.php:61

  • These new tests assert that a catch-all body regexp like #.*# must not match when waf_headers/waf_url are empty. However, the current implementation of WAF::hasSignature() returns true as soon as the body matches and whatToCheckAdditionally(...) returns 'nothing' (see lib/CleantalkSP/SpbctWP/Firewall/WAF.php:422-425). As-is, this test will fail unless the corresponding production logic change is included in this PR.
    public function testCatchAllWithoutHeadersDoesNotMatch()
    {
        $signature = array(
            'body'        => '#.*#',
            'waf_headers' => null,
            'waf_url'     => null,
        );

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/lib/CleantalkSP/SpbctWP/Firewall/WAFHasSignatureTest.php

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 no new comments.

@svfcode
svfcode merged commit b693343 into fix Aug 11, 2026
2 checks passed
@svfcode
svfcode deleted the upd-fw-waf branch August 12, 2026 06:02
Glomberg added a commit that referenced this pull request Aug 17, 2026
* Mod. Settings. Moving Vulnerability Check settings to React

* Mod. Settings. Moving Admin Bar settings to React

* Fix jest config, add test for settings

* Jest test for firewall and scanner

* Mod. Settings. Moving Miscellaneous settings to React

* fix php, js test errors

* fix php, js test errors

* New. UserPassCheck. Debugging functionality using the cron task launch button

* Mod. UserPassCheck. Rendering the status of the check and its results

* Fix js eslint errors, upd common libs

* Fix. FW. Improve logs.

* Mod. PSCTab. Caching data for fast content display

* Upd. Settings. Add BFP option. (#694)

* Upd. Settings. Add BFP option.

* make desc dinamic

* fix cp

* fix cp

* Upd. Firewall. Improve BFP module to protect woo login. (#693)

* Upd. Firewall. Improve BFP module to protect woo login.

* upd

* fix cp

* fix cp

* fix psalm

* fix cp

* fix cp

* Security Firewall UI update

https://app.doboard.com/1/task/38882

* Upd version 2.185.99-dev

* Upd version 2.185.99-fix

* UI update. Renamed the account creation button and description. Add new params in request

https://app.doboard.com/1/task/53201

* Fix. Scan. Improve surface iterator to filter not available dirs. (#705)

* Fix. Scan. Improve surface iterator to filter not available dirs.

* fix cp

* Upd. Scan. Update skip policy. (#704)

* Upd. Scan. Update skip policy.

* fix cp

* Mod. PSCTab. Filtering by installed plug-ins, PC search, active PSC filtering

* Fix. PSCTab. Editing the caching logic and general output in accordance with the available cache data

* Fix. Integrations. Update upload checker verify from ACF.

* Fix. PSCTab. Edits for the formation of values ​​for the total number of PSCs, edits for comments

* Fix. Scan. Show unknown accordion. (#709)

* Fix. Scan. Show unknown accordion.

* fix cp

* File synchronization

https://app.doboard.com/1/task/38991

* Fix. Remote Calls. Wrong response fixed. (#707)

* Mod. Settings. Transferring settings to React

* Fix. FW. Improve statement on WAF module to prevent false positive. (#710)

* Fix. FW. Improve statement on WAF module to prevent false positive.

* upd

* Fix errors

* Jest test

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix copilot review

* Sync branch

* Fix eslint

* Fix. Settings. Refactoring and deleting old code

* Fix. Settings. Improve curl wrapper.

* Fix. Settings. Auto cure setting fixed.

* Fix. Admin banners. Critical files banner fixed. (#712)

* Version: 2.186 and changelog updated.

* Fix. Readme. WP 7.1 compatibility added.

* Upd. Readme. Changelog updated.

* Upd. Readme. Changelog updated.

* Fix. Code. Bundle rebuilt.

* Fix. Upload checker. Check files during meadia uploading fixed. (#713)

* Fix. Code. Unused code removed.

* Upd.  Readme. Changelog updated.

---------

Co-authored-by: AntonV1211 <antonV1211@yandex.ru>
Co-authored-by: svfcode <svfcode@mail.ru>
Co-authored-by: Aleksandr Banins <alexander.b@cleantalk.org>
Co-authored-by: AntonV1211 <39616556+AntonV1211@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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