Skip to content

Commit e737146

Browse files
author
Woo
committed
Updates to 1.9.4
1 parent 8136f2a commit e737146

File tree

701 files changed

+738
-703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

701 files changed

+738
-703
lines changed

changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
*** Xero Integration ***
22

3+
2025-02-10 - version 1.9.4
4+
* Fix - Improve logging around `refresh_access_token` to avoid invalid request connection status errors.
5+
* Dev - Bump WooCommerce "tested up to" version 9.7.
6+
* Dev - Bump WooCommerce minimum supported version to 9.5.
7+
* Dev - Bump WordPress minimum supported version to 6.6.
8+
39
2025-01-13 - version 1.9.3
410
* Fix - Resolved PHP notice caused by loading localization code too early on WordPress 6.7.
511

includes/class-wc-xr-data-encryption.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ public function encrypt( string $value ): string {
128128
$key = sodium_crypto_generichash( $this->key, '', SODIUM_CRYPTO_SECRETBOX_KEYBYTES );
129129
$nonce = random_bytes( SODIUM_CRYPTO_SECRETBOX_NONCEBYTES );
130130
} catch ( Exception $e ) {
131+
$logger = new WC_XR_Oauth20_Logger();
132+
$logger->write( 'Error generating key or nonce during encryption.' );
133+
$logger->write( 'Exception: ' . $e->getMessage() );
134+
$logger->write( 'Trace: ' . $e->getTraceAsString() );
135+
131136
// Return the original value if fail to generate nonce and key.
132137
return $value;
133138
}
@@ -136,6 +141,11 @@ public function encrypt( string $value ): string {
136141
$encrypted = sodium_crypto_secretbox( $value . $this->salt, $nonce, $key );
137142
return sodium_bin2base64( $nonce . $encrypted, SODIUM_BASE64_VARIANT_ORIGINAL );
138143
} catch ( Exception $e ) {
144+
$logger = new WC_XR_Oauth20_Logger();
145+
$logger->write( 'Error encrypting the unencrypted string during encryption.' );
146+
$logger->write( 'Exception: ' . $e->getMessage() );
147+
$logger->write( 'Trace: ' . $e->getTraceAsString() );
148+
139149
// Return false if encryption fails.
140150
return false;
141151
}
@@ -159,17 +169,30 @@ public function decrypt( string $encrypted ): string {
159169
$nonce = mb_substr( $decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit' );
160170
$encrypted_result = mb_substr( $decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit' );
161171
} catch ( Exception $e ) {
172+
$logger = new WC_XR_Oauth20_Logger();
173+
$logger->write( 'Error decrypting the encrypted string during decoding.' );
174+
$logger->write( 'Exception: ' . $e->getMessage() );
175+
$logger->write( 'Trace: ' . $e->getTraceAsString() );
176+
162177
// Return the original value if fail to get decoded value or nonce and key.
163178
return $encrypted;
164179
}
165180

166181
try {
167182
$value = sodium_crypto_secretbox_open( $encrypted_result, $nonce, $key );
168183
if ( ! $value || substr( $value, - strlen( $this->salt ) ) !== $this->salt ) {
184+
$logger = new WC_XR_Oauth20_Logger();
185+
$logger->write( 'Decryption failed or the decrypted string is invalid. The string does not end with the expected salt.' );
186+
169187
return false;
170188
}
171189
return substr( $value, 0, - strlen( $this->salt ) );
172190
} catch ( Exception $e ) {
191+
$logger = new WC_XR_Oauth20_Logger();
192+
$logger->write( 'Error decrypting the encrypted string during decryption.' );
193+
$logger->write( 'Exception: ' . $e->getMessage() );
194+
$logger->write( 'Trace: ' . $e->getTraceAsString() );
195+
173196
return false;
174197
}
175198
}

includes/class-wc-xr-oauth20-storage.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,17 @@ public static function get_data() {
9292
// Decrypt token only if value is non-empty. Default value of token is NULL.
9393
if ( $xero_oauth_options['token'] ) {
9494
$xero_oauth_options['token'] = $wc_xr_data_encryption->decrypt( $xero_oauth_options['token'] );
95+
} else {
96+
$logger = new WC_XR_Oauth20_Logger();
97+
$logger->write( 'The token is empty' );
9598
}
9699

97100
// Decrypt refresh_token only if value is non-empty. Default value of refresh_token is NULL.
98101
if ( $xero_oauth_options['refresh_token'] ) {
99102
$xero_oauth_options['refresh_token'] = $wc_xr_data_encryption->decrypt( $xero_oauth_options['refresh_token'] );
103+
} else {
104+
$logger = new WC_XR_Oauth20_Logger();
105+
$logger->write( 'The refresh_token is empty' );
100106
}
101107

102108
return $xero_oauth_options;

languages/woocommerce-xero.pot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# This file is distributed under the same license as the WooCommerce Xero Integration package.
33
msgid ""
44
msgstr ""
5-
"Project-Id-Version: WooCommerce Xero Integration 1.9.3\n"
5+
"Project-Id-Version: WooCommerce Xero Integration 1.9.4\n"
66
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-xero\n"
7-
"POT-Creation-Date: 2025-01-13 14:57:51+00:00\n"
7+
"POT-Creation-Date: 2025-02-10 14:38:49+00:00\n"
88
"MIME-Version: 1.0\n"
99
"Content-Type: text/plain; charset=utf-8\n"
1010
"Content-Transfer-Encoding: 8bit\n"

lib/packages/firebase/php-jwt/src/BeforeValidException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 13-January-2025 using Strauss.
5+
* Modified by woocommerce on 10-February-2025 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/CachedKeySet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 13-January-2025 using Strauss.
5+
* Modified by woocommerce on 10-February-2025 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/ExpiredException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 13-January-2025 using Strauss.
5+
* Modified by woocommerce on 10-February-2025 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/JWK.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 13-January-2025 using Strauss.
5+
* Modified by woocommerce on 10-February-2025 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/JWT.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 13-January-2025 using Strauss.
5+
* Modified by woocommerce on 10-February-2025 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88

lib/packages/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @license BSD-3-Clause
44
*
5-
* Modified by woocommerce on 13-January-2025 using Strauss.
5+
* Modified by woocommerce on 10-February-2025 using Strauss.
66
* @see https://github.com/BrianHenryIE/strauss
77
*/
88
namespace Automattic\WooCommerce\Xero\Vendor\Firebase\JWT;

0 commit comments

Comments
 (0)