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
@@ -7,7 +7,9 @@ use StreamGoals\Core\Settings;
|
||||
use StreamGoals\PayPal\CaptureFinalizer;
|
||||
use StreamGoals\PayPal\Client;
|
||||
use StreamGoals\PayPal\DonationStore;
|
||||
use StreamGoals\PayPal\RateLimiter;
|
||||
use StreamGoals\PayPal\WebhookEvent;
|
||||
use StreamGoals\PayPal\WebhookGuard;
|
||||
use StreamGoals\PayPal\WpCache;
|
||||
|
||||
/** PayPal webhook receiver. Signature is verified through PayPal's API before anything is trusted. */
|
||||
@@ -34,7 +36,14 @@ final class WebhookController {
|
||||
if ( '' === $webhookId ) {
|
||||
return new \WP_Error( 'sg_webhook_unconfigured', 'Webhook is not configured.', array( 'status' => 503 ) );
|
||||
}
|
||||
if ( ! WebhookGuard::admit( new RateLimiter( new WpCache() ), DonateController::visitor_bucket() ) ) {
|
||||
return new \WP_Error( 'sg_rate_limited', 'Too many requests.', array( 'status' => 429 ) );
|
||||
}
|
||||
$raw = $req->get_body();
|
||||
$bad = WebhookGuard::check( $req->get_headers(), $raw, time() );
|
||||
if ( null !== $bad ) {
|
||||
return new \WP_Error( $bad['code'], 'Rejected.', array( 'status' => $bad['status'] ) );
|
||||
}
|
||||
if ( ! Client::fromSettings()->verifyWebhook( $req->get_headers(), $raw, $webhookId ) ) {
|
||||
return new \WP_Error( 'sg_webhook_signature', 'Invalid signature.', array( 'status' => 401 ) );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user