From c4306fa3f82aa432995d609f00ad8a3d1af2d4ee Mon Sep 17 00:00:00 2001 From: Kamruzzaman Date: Wed, 7 Oct 2026 09:15:19 +0600 Subject: [PATCH] fix: harden license refresh and reset cached validity - Require manage_options and a nonce on the license refresh AJAX handler. - Reset the cached is_valid() result after check_license_status() updates the stored license, so callers in the same request see the new status. --- src/License.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/License.php b/src/License.php index b442c9d..a4320f0 100644 --- a/src/License.php +++ b/src/License.php @@ -185,6 +185,10 @@ protected function send_request( $license_key, $route ) { * License Refresh Endpoint */ public function refresh_license_api() { + if ( ! current_user_can( 'manage_options' ) || ! check_ajax_referer( $this->client->name, '_nonce', false ) ) { + wp_send_json_error( [ 'message' => 'Unauthorized.' ], 403 ); + } + $this->check_license_status(); wp_send_json_success( @@ -367,6 +371,8 @@ public function check_license_status() { } update_option( $this->option_key, $license, false ); + + $this->is_valid_license = null; } }