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

+17 -8
View File
@@ -30,18 +30,27 @@ final class OverlayController {
) );
}
/** Lazily generates the token (32 hex chars) on first use. */
public static function token(): string {
/** Read-only. The stored token, or '' when none is configured. Safe for public requests. */
public static function current_token(): string {
$token = (string) Settings::get( 'overlay_token', '' );
if ( strlen( $token ) < 32 ) {
$token = bin2hex( random_bytes( 16 ) );
Settings::update( array( 'overlay_token' => $token ) );
}
return $token;
return strlen( $token ) >= 32 ? $token : '';
}
/**
* Token for the admin screens; generates one (a DB write) if missing, but ONLY for a user who can manage options.
* Public requests must never reach this; they use verify_token(), which never writes.
*/
public static function ensure_token(): string {
if ( ! current_user_can( 'manage_options' ) ) {
return '';
}
return Settings::ensure_overlay_token();
}
/** Read-only compare; with no token configured nothing matches (callers answer 404). */
public static function verify_token( string $given ): bool {
return hash_equals( self::token(), $given );
$token = self::current_token();
return '' !== $token && hash_equals( $token, $given );
}
public static function handle( \WP_REST_Request $req ): \WP_REST_Response|\WP_Error {