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
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
declare( strict_types=1 );
|
||||
|
||||
namespace StreamGoals\Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use StreamGoals\PayPal\RequestId;
|
||||
|
||||
final class RequestIdTest extends TestCase {
|
||||
|
||||
public function test_stable_per_donation_and_within_paypal_limit(): void {
|
||||
$a = RequestId::make( 'order', 42, '2026-01-01 10:00:00', 'salt' );
|
||||
$this->assertSame( $a, RequestId::make( 'order', 42, '2026-01-01 10:00:00', 'salt' ) );
|
||||
$this->assertLessThanOrEqual( 108, strlen( $a ) );
|
||||
$this->assertMatchesRegularExpression( '/^sg-order-[0-9a-f]{64}$/', $a );
|
||||
}
|
||||
|
||||
public function test_reused_auto_increment_id_gets_a_different_key(): void {
|
||||
$this->assertNotSame( RequestId::make( 'order', 42, '2026-01-01 10:00:00', 's' ), RequestId::make( 'order', 42, '2026-01-02 10:00:00', 's' ) );
|
||||
}
|
||||
|
||||
public function test_not_derivable_without_the_salt_and_kinds_differ(): void {
|
||||
$this->assertNotSame( RequestId::make( 'order', 42, 't', 'salt1' ), RequestId::make( 'order', 42, 't', 'salt2' ) );
|
||||
$this->assertNotSame( RequestId::make( 'order', 42, 't', 's' ), RequestId::make( 'capture', 42, 't', 's' ) );
|
||||
$this->assertStringNotContainsString( 'sg-order-42', RequestId::make( 'order', 42, 't', 's' ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user