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
Test and Release / test (push) Successful in 1m23s
Test and Release / release (push) Successful in 5s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-15 14:07:44 -08:00
1 parent 68bd917660
commit 473fe192cd
28 files changed
+747 -34

No files matched your search

+23
View File
@@ -54,6 +54,29 @@ final class ClientIp {
return $fromHeader ?? $remote ?? 'unknown';
}
/**
* Rate-limit BUCKET KEY for a resolved address (never use it as the "real" IP): IPv4 unchanged, IPv4-mapped IPv6
* becomes its IPv4, any other IPv6 collapses to its /64 (one subscriber/host can rotate freely inside a /64),
* 'unknown' stays, anything unparsable becomes 'unknown'.
*/
public static function bucketKey( string $ip ): string {
$ip = trim( $ip );
if ( 'unknown' === $ip || false === filter_var( $ip, FILTER_VALIDATE_IP ) ) {
return 'unknown';
}
if ( false === filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 ) ) {
return $ip;
}
$bin = inet_pton( $ip );
if ( false === $bin || 16 !== strlen( $bin ) ) {
return 'unknown';
}
if ( str_repeat( "\0", 10 ) . "\xff\xff" === substr( $bin, 0, 12 ) ) {
return (string) inet_ntop( substr( $bin, 12 ) );
}
return bin2hex( substr( $bin, 0, 8 ) ) . '/64';
}
private static function valid( mixed $v ): ?string {
if ( ! is_string( $v ) ) {
return null;