Skip to content

Commit a83da41

Browse files
committed
Merge branch 'trunk' into fix/SQUARE-150-no-title-display
2 parents 1f266bd + 58336ce commit a83da41

File tree

6 files changed

+95
-15
lines changed

6 files changed

+95
-15
lines changed

changelog.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
*** WooCommerce Square Changelog ***
22

3+
= 5.1.2 - 2025-12-10 =
4+
* Security - Resolve CVE-2025-13457.
5+
* Dev - Bump WooCommerce "tested up to" version 10.4.
6+
* Dev - Bump WordPress "tested up to" version 6.9.
7+
38
= 5.1.1 - 2025-11-03 =
49
* Fix - Missing attribute names after Product Import.
510
* Fix - Update for PHP 8.4 compatibility.
@@ -18,11 +23,17 @@
1823
* Dev - Bump WooCommerce "tested up to" version 10.2.
1924
* Dev - Bump WooCommerce minimum supported version to 10.0.
2025

26+
= 5.0.1 - 2025-12-10 =
27+
* Security - Resolve CVE-2025-13457 for version 5.0.
28+
2129
= 5.0.0 - 2025-09-10 =
2230
* Add - Order fulfillment sync between WooCommerce and Square orders for those that opt-in.
2331
* Fix - Ensure inventory sync isn’t interrupted in case of a category insert failure.
2432
* Fix - Accurately count attribute values – 250 values, not characters.
2533

34+
= 4.9.9 - 2025-12-10 =
35+
* Security - Resolve CVE-2025-13457 for version 4.9.
36+
2637
= 4.9.8 - 2025-08-21 =
2738
* Fix - Ensure there is no fatal error on the product page when the product price is blank.
2839
* Fix - Corrected variation option assignment logic to prevent mismatched item option IDs during manual syncs to Square.
@@ -89,6 +100,9 @@
89100
* Dev - Updates to E2E tests setup.
90101
* Dev - Update all third-party actions our workflows rely on to use versions based on specific commit hashes.
91102

103+
= 4.8.8 - 2025-12-10 =
104+
* Security - Resolve CVE-2025-13457 for version 4.8.
105+
92106
= 4.8.7 - 2025-03-06 =
93107
* Add - Support for syncing the "Mark as Sold Out" field value during inventory sync.
94108
* Fix - Ensure payment methods display the correct buttons and statuses in the new WooCommerce Payments settings.
@@ -153,6 +167,9 @@
153167
* Dev - Bump WooCommerce "tested up to" version 9.2.
154168
* Dev - Bump WooCommerce minimum supported version to 9.0.
155169

170+
= 4.7.4 - 2025-12-10 =
171+
* Security - Resolve CVE-2025-13457 for version 4.7.
172+
156173
= 4.7.3 - 2024-08-19 =
157174
* Fix - Inconsistency in the height of Express Payment Button and compliance with the new Woo Express Payment Method Styling API.
158175
* Fix - Ensure the "Uncaught TypeError" JavaScript console error does not occur for out-of-stock products.
@@ -177,6 +194,9 @@
177194
* Dev - Bump WooCommerce minimum supported version to 8.8.
178195
* Dev - Bump WordPress minimum supported version to 6.4.
179196

197+
= 4.6.4 - 2025-12-10 =
198+
* Security - Resolve CVE-2025-13457 for version 4.6.
199+
180200
= 4.6.3 - 2024-06-17 =
181201
* Add - ESLint GitHub Action workflow to enforce ESLint rules on pull requests.
182202
* Dev - Bump Square PHP SDK version from `29.0.0.20230720` to `35.1.0.20240320`.
@@ -211,6 +231,9 @@
211231
* Fix - npm ERR! Missing script: "test:e2e".
212232
* Fix - Issue with Square payment gateway being shown for unsupported currencies.
213233

234+
= 4.5.2 - 2025-12-10 =
235+
* Security - Resolve CVE-2025-13457 for version 4.5.
236+
214237
= 4.5.1 - 2024-02-27 =
215238
* Fix - Address the repetitive creation of `wc_square_init_payment_token_migration` actions in the payment token migration process.
216239
* Dev - Bump WooCommerce "tested up to" version 8.6.
@@ -224,6 +247,9 @@
224247
* Dev - Bump WordPress minimum supported version to 6.3.
225248
* Fix - Issue with syncing products that have a description more than 4096 characters.
226249

250+
= 4.4.2 - 2025-12-10 =
251+
* Security - Resolve CVE-2025-13457 for version 4.4.
252+
227253
= 4.4.1 - 2024-01-18 =
228254
* Fix - Resolved the issue of double-counted inventory drops when WooPayments is used as the payment processor.
229255
* Dev - Bump WooCommerce "tested up to" version 8.4.
@@ -246,6 +272,9 @@
246272
* Dev - Add Playwright e2e coverage for Cart Block and Checkout Block.
247273
* Tweak - Admin settings colour to match admin theme colour scheme.
248274

275+
= 4.3.2 - 2025-12-10 =
276+
* Security - Resolve CVE-2025-13457 for version 4.3.
277+
249278
= 4.3.1 - 2023-11-06 =
250279
* Fix - Fatal error caused when the Action Scheduler API method `as_has_scheduled_action` is used for migrating payment tokens.
251280
* Fix - Missing payment token and customer ID in subscription orders when HPOS is enabled.
@@ -261,6 +290,9 @@
261290
* Dev - Bump WooCommerce minimum supported version to 7.9.
262291
* Dev - Bump woocommerce-sniffs to 1.0.0.
263292

293+
= 4.2.3 - 2025-12-10 =
294+
* Security - Resolve CVE-2025-13457 for version 4.2.
295+
264296
= 4.2.2 - 2023-10-11 =
265297
* Dev - Update PHPCS and PHPCompatibility GitHub Actions.
266298
* Tweak - Timing of the Apple Pay domain registration warning message.

includes/Gateway.php

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public function __construct() {
118118
add_action( 'wp_ajax_nopriv_wc_' . $this->get_id() . '_log_js_data', array( $this, 'log_js_data' ) );
119119

120120
add_action( 'wp_ajax_wc_' . $this->get_id() . '_get_token_by_id', array( $this, 'get_token_by_id' ) );
121-
add_action( 'wp_ajax_nopriv_wc_' . $this->get_id() . '_get_token_by_id', array( $this, 'get_token_by_id' ) );
122121

123122
// store the Square item variation ID to order items
124123
add_action( 'woocommerce_new_order_item', array( $this, 'store_new_order_item_square_meta' ), 10, 3 );
@@ -179,20 +178,52 @@ public function get_description() {
179178
public function get_token_by_id() {
180179
$nonce = isset( $_GET['nonce'] ) ? sanitize_text_field( wp_unslash( $_GET['nonce'] ) ) : false;
181180

182-
if ( ! wp_verify_nonce( $nonce, 'payment_token_nonce' ) ) {
183-
wp_send_json_error( esc_html__( 'Nonce verification failed.', 'woocommerce-square' ) );
181+
if ( ! wp_verify_nonce( $nonce, 'payment_token_nonce' ) || ! is_user_logged_in() ) {
182+
wp_send_json_error( esc_html__( 'Verification failed.', 'woocommerce-square' ), \WP_Http::UNAUTHORIZED );
184183
}
185184

186185
$token_id = isset( $_GET['token_id'] ) ? absint( wp_unslash( $_GET['token_id'] ) ) : false;
187186

188187
if ( ! $token_id ) {
189-
wp_send_json_error( esc_html__( 'Token ID missing.', 'woocommerce-square' ) );
188+
wp_send_json_error( esc_html__( 'Token ID missing.', 'woocommerce-square' ), \WP_Http::BAD_REQUEST );
190189
}
191190

192191
$token_obj = \WC_Payment_Tokens::get( $token_id );
193192

193+
/*
194+
* Verify token belongs to this gateway.
195+
*
196+
* This ajax endpoint is for retrieving Square payment tokens only.
197+
*/
198+
if ( is_object( $token_obj ) && $this->get_id() !== $token_obj->get_gateway_id() ) {
199+
wp_send_json_error( esc_html__( 'Verification failed.', 'woocommerce-square' ), \WP_Http::FORBIDDEN );
200+
}
201+
202+
/*
203+
* Ensure user has permission to access token.
204+
*
205+
* Store administrators can request any token but other users can only
206+
* access tokens belonging to their own account.
207+
*/
208+
if (
209+
! current_user_can( 'manage_woocommerce' )
210+
&& (
211+
is_null( $token_obj )
212+
|| get_current_user_id() !== $token_obj->get_user_id()
213+
)
214+
) {
215+
wp_send_json_error( esc_html__( 'Verification failed.', 'woocommerce-square' ), \WP_Http::FORBIDDEN );
216+
}
217+
218+
/*
219+
* Show invalid Token ID to store admins only.
220+
*
221+
* The condition above will present a generic "validation failed" message to other
222+
* users, this will only provide the details of why validation failed to store
223+
* admins to avoid information disclosure.
224+
*/
194225
if ( is_null( $token_obj ) ) {
195-
wp_send_json_error( esc_html__( 'No payment token exists for this ID.', 'woocommerce-square' ) );
226+
wp_send_json_error( esc_html__( 'No payment token exists for this ID.', 'woocommerce-square' ), \WP_Http::NOT_FOUND );
196227
}
197228

198229
wp_send_json_success( $token_obj->get_token() );

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "git://github.com/woocommerce/woocommerce-square.git"
88
},
99
"title": "WooCommerce Square",
10-
"version": "5.1.1",
10+
"version": "5.1.2",
1111
"homepage": "https://woocommerce.com/products/woocommerce-square/",
1212
"scripts": {
1313
"build": "composer install --no-dev && npm run build:webpack && npm run makepot && npm run archive",

readme.txt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
=== WooCommerce Square ===
22
Contributors: woocommerce, automattic
33
Tags: credit card, square, woocommerce, inventory sync
4-
Requires at least: 6.5
4+
Requires at least: 6.7
55
Tested up to: 6.9
66
Requires PHP: 7.4
7-
Stable tag: 5.1.1
7+
Stable tag: 5.1.2
88
License: GPL-3.0-or-later
99
License URI: https://www.gnu.org/licenses/gpl-3.0.html
1010

@@ -72,6 +72,11 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
7272

7373
== Changelog ==
7474

75+
= 5.1.2 - 2025-12-10 =
76+
* Security - Resolve CVE-2025-13457.
77+
* Dev - Bump WooCommerce "tested up to" version 10.4.
78+
* Dev - Bump WordPress "tested up to" version 6.9.
79+
7580
= 5.1.1 - 2025-11-03 =
7681
* Fix - Missing attribute names after Product Import.
7782
* Fix - Update for PHP 8.4 compatibility.
@@ -90,11 +95,17 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
9095
* Dev - Bump WooCommerce "tested up to" version 10.2.
9196
* Dev - Bump WooCommerce minimum supported version to 10.0.
9297

98+
= 5.0.1 - 2025-12-10 =
99+
* Security - Resolve CVE-2025-13457 for version 5.0.
100+
93101
= 5.0.0 - 2025-09-10 =
94102
* Add - Order fulfillment sync between WooCommerce and Square orders for those that opt-in.
95103
* Fix - Ensure inventory sync isn’t interrupted in case of a category insert failure.
96104
* Fix - Accurately count attribute values – 250 values, not characters.
97105

106+
= 4.9.9 - 2025-12-10 =
107+
* Security - Resolve CVE-2025-13457 for version 4.9.
108+
98109
= 4.9.8 - 2025-08-21 =
99110
* Fix - Ensure there is no fatal error on the product page when the product price is blank.
100111
* Fix - Corrected variation option assignment logic to prevent mismatched item option IDs during manual syncs to Square.
@@ -161,6 +172,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
161172
* Dev - Updates to E2E tests setup.
162173
* Dev - Update all third-party actions our workflows rely on to use versions based on specific commit hashes.
163174

175+
= 4.8.8 - 2025-12-10 =
176+
* Security - Resolve CVE-2025-13457 for version 4.8.
177+
164178
= 4.8.7 - 2025-03-06 =
165179
* Add - Support for syncing the "Mark as Sold Out" field value during inventory sync.
166180
* Fix - Ensure payment methods display the correct buttons and statuses in the new WooCommerce Payments settings.
@@ -229,6 +243,9 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
229243

230244
== Upgrade Notice ==
231245

246+
= 5.1.2 =
247+
Security release affecting versions 4.2 upward, please update promptly. Minor releases are available on wordpress.org.
248+
232249
= 3.5.0 =
233250
* Note that this version bumps the minimum PHP version from 7.2 to 7.4.
234251

woocommerce-square.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
/**
33
* Plugin Name: WooCommerce Square
44
* Requires Plugins: woocommerce
5-
* Version: 5.1.1
5+
* Version: 5.1.2
66
* Plugin URI: https://woocommerce.com/products/square/
7-
* Requires at least: 6.5
7+
* Requires at least: 6.7
88
* Tested up to: 6.9
99
* Requires PHP: 7.4
1010
* PHP tested up to: 8.4
@@ -22,14 +22,14 @@
2222
* @copyright Copyright (c) 2019, Automattic, Inc.
2323
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0 or later
2424
*
25-
* WC requires at least: 10.1
25+
* WC requires at least: 10.2
2626
* WC tested up to: 10.4
2727
*/
2828

2929
defined( 'ABSPATH' ) || exit;
3030

3131
if ( ! defined( 'WC_SQUARE_PLUGIN_VERSION' ) ) {
32-
define( 'WC_SQUARE_PLUGIN_VERSION', '5.1.1' ); // WRCS: DEFINED_VERSION.
32+
define( 'WC_SQUARE_PLUGIN_VERSION', '5.1.2' ); // WRCS: DEFINED_VERSION.
3333
}
3434

3535
if ( ! defined( 'WC_SQUARE_PLUGIN_URL' ) ) {
@@ -63,7 +63,7 @@ class WooCommerce_Square_Loader {
6363
const MINIMUM_WP_VERSION = '6.7';
6464

6565
/** minimum WooCommerce version required by this plugin */
66-
const MINIMUM_WC_VERSION = '10.1';
66+
const MINIMUM_WC_VERSION = '10.2';
6767

6868
/**
6969
* SkyVerge plugin framework version used by this plugin

0 commit comments

Comments
 (0)