Fix. Code. Editing the check_value parametere#813
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the plugin’s “cookies test” checksum logic to incorporate an additional salt value, strengthening the integrity check used to validate client-side cookies.
Changes:
- Update
apbct_cookie()to seedcheck_valuewithapi_key + salt. - Update
apbct_cookies_test()to validate the cookie checksum usingapi_key + salt.
Comments suppressed due to low confidence (1)
cleantalk.php:2735
$apbct->saltis not set on the global state object (salt is stored as$apbct->data['salt']), so this will raise an undefined property notice and may compute an incorrect cookie-test hash. Also, changing the hash input will invalidate existingapbct_cookies_testcookies; accepting the legacy (unsalted) checksum as a fallback avoids breaking in-flight form submissions right after an update.
$check_string = $apbct->api_key . $apbct->salt;
// generate value
$cookie_names = TT::getArrayValueAsArray($cookie_test, 'cookies_names');
foreach ( $cookie_names as $cookie_name ) {
$check_string .= Cookie::get($cookie_name);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (66.66%) 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 #813 +/- ##
============================================
+ Coverage 26.41% 26.52% +0.11%
- Complexity 5655 5667 +12
============================================
Files 268 269 +1
Lines 24220 24240 +20
============================================
+ Hits 6398 6430 +32
+ Misses 17822 17810 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
https://app.doboard.com/1/task/50322