Security review fixes: keep pending-capture ids, ship uninstall.php (+verify step), webhook guard, IPv6 /64 + global order throttle, token-safe redirects, honest refund wording, request-id and overlay-token hardening
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68bd917660
commit
473fe192cd
28 files changed
+747
-34
No files matched your search
@@ -25,6 +25,25 @@ final class Maintenance {
|
||||
wp_clear_scheduled_hook( self::HOOK );
|
||||
}
|
||||
|
||||
/**
|
||||
* The single definition of "abandoned checkout", mirrored by the DELETE below (MaintenancePurgeTest checks both).
|
||||
* Never purgeable: not pending, younger than MAX_AGE_DAYS, a test row (goal_id 0), or ANY row carrying PayPal capture
|
||||
* evidence (a capture id, even from a PENDING/under-review capture: PayPal may still finalize it by webhook).
|
||||
*
|
||||
* @param array|object $row status, goal_id, paypal_capture_id, created_at (UTC 'Y-m-d H:i:s')
|
||||
*/
|
||||
public static function isPurgeable( array|object $row, int $now ): bool {
|
||||
$r = (array) $row;
|
||||
if ( 'pending' !== (string) ( $r['status'] ?? '' ) || (int) ( $r['goal_id'] ?? 0 ) <= 0 ) {
|
||||
return false;
|
||||
}
|
||||
if ( '' !== trim( (string) ( $r['paypal_capture_id'] ?? '' ) ) ) {
|
||||
return false;
|
||||
}
|
||||
$created = strtotime( (string) ( $r['created_at'] ?? '' ) . ' UTC' );
|
||||
return false !== $created && $created < $now - self::MAX_AGE_DAYS * DAY_IN_SECONDS;
|
||||
}
|
||||
|
||||
/** @return int Number of rows removed. */
|
||||
public static function purge_abandoned(): int {
|
||||
global $wpdb;
|
||||
|
||||
Reference in new issue
Block a user