Skip to content

Vuln rc av#824

Merged
AntonV1211 merged 4 commits into
devfrom
vuln_rc_av
Jun 30, 2026
Merged

Vuln rc av#824
AntonV1211 merged 4 commits into
devfrom
vuln_rc_av

Conversation

@AntonV1211

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings June 29, 2026 07:34
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 18.46154% with 159 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.56%. Comparing base (9637d6d) to head (ecd4b29).
⚠️ Report is 6 commits behind head on dev.

Files with missing lines Patch % Lines
...b/Cleantalk/ApbctWP/RateLimit/ApbctRateLimiter.php 0.00% 61 Missing ⚠️
lib/Cleantalk/Common/RateLimiter/RateLimiter.php 15.68% 43 Missing ⚠️
lib/Cleantalk/Common/Templates/Dto.php 0.00% 18 Missing ⚠️
lib/Cleantalk/Common/Templates/Singleton.php 0.00% 12 Missing ⚠️
lib/Cleantalk/ApbctWP/RemoteCalls.php 0.00% 10 Missing ⚠️
...ib/Cleantalk/Common/RateLimiter/RateLimiterDto.php 0.00% 6 Missing ⚠️
lib/Cleantalk/Common/Templates/Multiton.php 0.00% 5 Missing ⚠️
...Cleantalk/ApbctWP/UpdatePlugin/DbColumnCreator.php 88.46% 3 Missing ⚠️
lib/Cleantalk/ApbctWP/State.php 50.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (18.46%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #824      +/-   ##
============================================
- Coverage     26.68%   26.56%   -0.12%     
- Complexity     5683     5744      +61     
============================================
  Files           270      277       +7     
  Lines         24258    24434     +176     
============================================
+ Hits           6473     6491      +18     
- Misses        17785    17943     +158     

☔ 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

This PR introduces a new rate-limiting mechanism for WordPress “remote calls” to mitigate abuse, including a dedicated DB table, a WordPress-specific limiter implementation, and test coverage to validate the intended behavior.

Changes:

  • Add a generic Cleantalk\Common\RateLimiter library (config/DTO/base logic) and WordPress adapter ApbctRateLimiter.
  • Enforce remote-call rate limiting in RemoteCalls::perform() and adjust cooldown timestamp updates to occur only after authorization.
  • Extend PHPUnit tests to cover the new rate-limit behavior and UID generation strategy (per-IP).

Reviewed changes

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

Show a summary per file
File Description
tests/ApbctWP/TestRemoteCalls.php Adds tests asserting the presence/placement of remote-call rate limiting and cooldown behavior.
tests/ApbctWP/RateLimit/TestApbctRateLimiter.php Adds unit tests validating per-IP UID generation (UA ignored) using RateLimiter stubs.
psalm.xml Updates Psalm ignore list to exclude new Common Templates/RateLimiter directories (and Singleton).
lib/Cleantalk/Common/Templates/Singleton.php Introduces a Common Singleton trait (used by new Common code).
lib/Cleantalk/Common/Templates/Multiton.php Introduces a Common Multiton trait built atop the Common Singleton trait.
lib/Cleantalk/Common/Templates/Dto.php Introduces a Common DTO base class used by the RateLimiter DTO.
lib/Cleantalk/Common/Templates/composer.json Adds Composer metadata/autoload for the Common Templates subpackage.
lib/Cleantalk/Common/Templates/.gitignore Adds package-local gitignore for the Common Templates subpackage.
lib/Cleantalk/Common/Schema.php Adds the rate_limits table schema definition.
lib/Cleantalk/Common/RateLimiter/tests/psalm.xml Adds Psalm config for the RateLimiter subpackage tests.
lib/Cleantalk/Common/RateLimiter/tests/phpunit.xml Adds PHPUnit config for the RateLimiter subpackage tests.
lib/Cleantalk/Common/RateLimiter/tests/.phpcs.xml Adds PHPCS ruleset for the RateLimiter subpackage tests.
lib/Cleantalk/Common/RateLimiter/README.md Adds RateLimiter subpackage README (currently placeholder).
lib/Cleantalk/Common/RateLimiter/RateLimiterDto.php Adds DTO representing stored rate-limit records.
lib/Cleantalk/Common/RateLimiter/RateLimiterConfig.php Adds config object for limiter type/limit/period.
lib/Cleantalk/Common/RateLimiter/RateLimiter.php Adds abstract base rate-limiter logic and required persistence hooks.
lib/Cleantalk/Common/RateLimiter/composer.json Adds Composer metadata/autoload for the RateLimiter subpackage.
lib/Cleantalk/Common/RateLimiter/.gitignore Adds package-local gitignore for the RateLimiter subpackage.
lib/Cleantalk/ApbctWP/State.php Defines APBCT_TBL_RATE_LIMITS constant for the new table.
lib/Cleantalk/ApbctWP/RemoteCalls.php Adds pre-cooldown rate-limit enforcement and moves last_call updates after authorization.
lib/Cleantalk/ApbctWP/RateLimit/ApbctRateLimiter.php Adds WP/DB-backed implementation of the rate limiter (per-IP UID).
composer.json Adds cleantalk/rate-limiter to runtime requirements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/Cleantalk/Common/RateLimiter/RateLimiter.php Outdated
Comment thread lib/Cleantalk/Common/RateLimiter/RateLimiter.php Outdated
Comment thread lib/Cleantalk/Common/RateLimiter/RateLimiter.php Outdated
Comment thread lib/Cleantalk/Common/RateLimiter/RateLimiter.php Outdated
Comment thread lib/Cleantalk/Common/RateLimiter/RateLimiter.php Outdated
Comment thread tests/ApbctWP/TestRemoteCalls.php Outdated
Comment thread lib/Cleantalk/Common/RateLimiter/tests/psalm.xml Outdated
Comment thread lib/Cleantalk/Common/RateLimiter/composer.json
Comment thread lib/Cleantalk/Common/Templates/composer.json
Comment thread lib/Cleantalk/Common/RateLimiter/README.md
@AntonV1211
AntonV1211 merged commit c1354a9 into dev Jun 30, 2026
7 of 8 checks passed
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