Changeset 3841457
- Timestamp:
- 12/03/2026 02:21:50 AM (less than one hour ago)
- Location:
- lunixi
- Files:
-
- 12 edited
- 1 copied
-
tags/1.2.3 (copied) (copied from lunixi/trunk )
-
tags/1.2.3/CHANGELOG.md (modified) (1 diff)
-
tags/1.2.3/lunixi.php (modified) (2 diffs)
-
tags/1.2.3/readme.txt (modified) (3 diffs)
-
tags/1.2.3/src/Core/SecretBox.php (modified) (2 diffs)
-
tags/1.2.3/src/Core/Settings.php (modified) (2 diffs)
-
tags/1.2.3/vendor/scoped-package.json (modified) (1 diff)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/lunixi.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/Core/SecretBox.php (modified) (2 diffs)
-
trunk/src/Core/Settings.php (modified) (2 diffs)
-
trunk/vendor/scoped-package.json (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lunixi/tags/1.2.3/CHANGELOG.md
r3841374 r3841457 1 1 # Changelog 2 3 ## 1.2.3 — 2026-12-03 4 5 - Settings secrets (private key, webhook secret, automation secret) were encrypted twice on the first save of a new installation: WordPress runs the option's sanitize callback twice when `update_option()` falls through to `add_option()`, and the second pass encrypted the first pass's ciphertext. The stored secret then decrypted to ciphertext, so request signing and webhook verification failed until the merchant saved the secrets again. `SecretBox::seal()` keeps a value that is already our ciphertext, and `SecretBox::decrypt()` unwraps a value encrypted twice by earlier releases, so affected sites recover without re-entering their credentials. Reproduced and verified in WordPress Playground. 2 6 3 7 ## 1.2.2 — 2026-12-02 -
lunixi/tags/1.2.3/lunixi.php
r3841374 r3841457 5 5 * Plugin URI: https://lunixi.com/integrations/wordpress 6 6 * Description: Lunixi payments for WooCommerce: card checkout with 3D Secure, pre-authorization, refunds and signed webhooks, plus fraud, subscription, KYC and sanction screening. 7 * Version: 1.2. 27 * Version: 1.2.3 8 8 * Requires at least: 6.4 9 9 * Requires PHP: 7.4 … … 28 28 // already loaded 29 29 } 30 \define('LUNIXI_VERSION', '1.2. 2');30 \define('LUNIXI_VERSION', '1.2.3'); 31 31 \define('LUNIXI_FILE', __FILE__); 32 32 \define('LUNIXI_PATH', \plugin_dir_path(__FILE__)); -
lunixi/tags/1.2.3/readme.txt
r3841374 r3841457 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.2. 27 Stable tag: 1.2.3 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 117 117 == Changelog == 118 118 119 = 1.2.3 = 120 * Fixed: on a new installation, the private key, webhook secret and automation secret were stored incorrectly the first time the settings were saved, so payments and webhooks did not work until the settings were saved again. Sites affected by this are repaired automatically after the update. 121 119 122 = 1.2.2 = 120 123 * Fixed a fatal error when the Automation module was enabled and a Contact Form 7 form was submitted. … … 189 192 == Upgrade Notice == 190 193 194 = 1.2.3 = 195 Fixes credentials saved on a new installation; affected sites are repaired automatically. 196 191 197 = 1.2.0 = 192 198 Payments now require the buyer's details, including a TR identity number or passport number, which the checkout asks for. Orders missing a detail do not start a payment. -
lunixi/tags/1.2.3/src/Core/SecretBox.php
r3841374 r3841457 14 14 { 15 15 private const PREFIX = 'v1:'; 16 /** 17 * Encrypts a value coming from the settings form, but keeps a value that is 18 * already one of our ciphertexts. WordPress runs an option's sanitize 19 * callback twice when the option is first created (update_option() falls 20 * through to add_option(), which sanitizes again), so the second pass sees 21 * the first pass's ciphertext. Encrypting it again would store a secret 22 * that decrypts to ciphertext instead of the merchant's key. 23 */ 24 public static function seal(string $value): string 25 { 26 if ($value === '' || self::open($value) !== null) { 27 return $value; 28 } 29 return self::encrypt($value); 30 } 16 31 public static function encrypt(string $plain): string 17 32 { … … 33 48 // tolerate a value saved before encryption was enabled 34 49 } 50 $plain = self::open($stored); 51 if ($plain === null) { 52 return ''; 53 } 54 // Settings saved by 1.2.2 and earlier on a fresh install were encrypted 55 // twice (see seal()); unwrap the extra layer so those sites keep working. 56 $inner = self::open($plain); 57 return $inner ?? $plain; 58 } 59 /** Opens one of our ciphertexts; null when the value is not one (or the key changed). */ 60 private static function open(string $stored): ?string 61 { 62 if (strncmp($stored, self::PREFIX, strlen(self::PREFIX)) !== 0) { 63 return null; 64 } 35 65 // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode -- storage encoding of the libsodium ciphertext, not code. 36 66 $raw = base64_decode(substr($stored, strlen(self::PREFIX)), \true); 37 67 if ($raw === \false || strlen($raw) <= \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES) { 38 return '';68 return null; 39 69 } 40 70 $nonce = substr($raw, 0, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); 41 71 $cipher = substr($raw, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); 42 72 $plain = sodium_crypto_secretbox_open($cipher, $nonce, self::key()); 43 return $plain === \false ? '': $plain;73 return $plain === \false ? null : $plain; 44 74 } 45 75 private static function key(): string -
lunixi/tags/1.2.3/src/Core/Settings.php
r3841374 r3841457 247 247 $out = ['environment' => isset($input['environment']) && strtoupper((string) $input['environment']) === 'TEST' ? 'TEST' : 'LIVE', 'key_id' => sanitize_text_field((string) ($input['key_id'] ?? '')), 'base_url' => esc_url_raw((string) ($input['base_url'] ?? ''))]; 248 248 $privateKey = trim(sanitize_textarea_field((string) ($input['private_key'] ?? ''))); 249 $out['private_key'] = $privateKey !== '' ? \Lunixi\WP\Core\SecretBox:: encrypt($privateKey) : (string) ($existing['private_key'] ?? '');249 $out['private_key'] = $privateKey !== '' ? \Lunixi\WP\Core\SecretBox::seal($privateKey) : (string) ($existing['private_key'] ?? ''); 250 250 $webhookSecret = self::secret($input['webhook_secret'] ?? ''); 251 $out['webhook_secret'] = $webhookSecret !== '' ? \Lunixi\WP\Core\SecretBox:: encrypt($webhookSecret) : (string) ($existing['webhook_secret'] ?? '');251 $out['webhook_secret'] = $webhookSecret !== '' ? \Lunixi\WP\Core\SecretBox::seal($webhookSecret) : (string) ($existing['webhook_secret'] ?? ''); 252 252 $out['debug'] = !empty($input['debug']) ? '1' : ''; 253 253 $portalMode = (string) ($input['portal_mode'] ?? 'embed'); … … 266 266 $out['automation_integration_id'] = sanitize_text_field((string) ($input['automation_integration_id'] ?? '')); 267 267 $automationSecret = self::secret($input['automation_secret'] ?? ''); 268 $out['automation_secret'] = $automationSecret !== '' ? \Lunixi\WP\Core\SecretBox:: encrypt($automationSecret) : (string) ($existing['automation_secret'] ?? '');268 $out['automation_secret'] = $automationSecret !== '' ? \Lunixi\WP\Core\SecretBox::seal($automationSecret) : (string) ($existing['automation_secret'] ?? ''); 269 269 $out['identity_enabled'] = !empty($input['identity_enabled']) ? '1' : ''; 270 270 $out['identity_publishable_key'] = sanitize_text_field((string) ($input['identity_publishable_key'] ?? '')); -
lunixi/tags/1.2.3/vendor/scoped-package.json
r3841374 r3841457 1 1 { 2 "pluginVersion": "1.2. 2",2 "pluginVersion": "1.2.3", 3 3 "sdk": { 4 4 "name": "lunixi/php-sdk", -
lunixi/trunk/CHANGELOG.md
r3841374 r3841457 1 1 # Changelog 2 3 ## 1.2.3 — 2026-12-03 4 5 - Settings secrets (private key, webhook secret, automation secret) were encrypted twice on the first save of a new installation: WordPress runs the option's sanitize callback twice when `update_option()` falls through to `add_option()`, and the second pass encrypted the first pass's ciphertext. The stored secret then decrypted to ciphertext, so request signing and webhook verification failed until the merchant saved the secrets again. `SecretBox::seal()` keeps a value that is already our ciphertext, and `SecretBox::decrypt()` unwraps a value encrypted twice by earlier releases, so affected sites recover without re-entering their credentials. Reproduced and verified in WordPress Playground. 2 6 3 7 ## 1.2.2 — 2026-12-02 -
lunixi/trunk/lunixi.php
r3841374 r3841457 5 5 * Plugin URI: https://lunixi.com/integrations/wordpress 6 6 * Description: Lunixi payments for WooCommerce: card checkout with 3D Secure, pre-authorization, refunds and signed webhooks, plus fraud, subscription, KYC and sanction screening. 7 * Version: 1.2. 27 * Version: 1.2.3 8 8 * Requires at least: 6.4 9 9 * Requires PHP: 7.4 … … 28 28 // already loaded 29 29 } 30 \define('LUNIXI_VERSION', '1.2. 2');30 \define('LUNIXI_VERSION', '1.2.3'); 31 31 \define('LUNIXI_FILE', __FILE__); 32 32 \define('LUNIXI_PATH', \plugin_dir_path(__FILE__)); -
lunixi/trunk/readme.txt
r3841374 r3841457 5 5 Tested up to: 7.1 6 6 Requires PHP: 7.4 7 Stable tag: 1.2. 27 Stable tag: 1.2.3 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 117 117 == Changelog == 118 118 119 = 1.2.3 = 120 * Fixed: on a new installation, the private key, webhook secret and automation secret were stored incorrectly the first time the settings were saved, so payments and webhooks did not work until the settings were saved again. Sites affected by this are repaired automatically after the update. 121 119 122 = 1.2.2 = 120 123 * Fixed a fatal error when the Automation module was enabled and a Contact Form 7 form was submitted. … … 189 192 == Upgrade Notice == 190 193 194 = 1.2.3 = 195 Fixes credentials saved on a new installation; affected sites are repaired automatically. 196 191 197 = 1.2.0 = 192 198 Payments now require the buyer's details, including a TR identity number or passport number, which the checkout asks for. Orders missing a detail do not start a payment. -
lunixi/trunk/src/Core/SecretBox.php
r3841374 r3841457 14 14 { 15 15 private const PREFIX = 'v1:'; 16 /** 17 * Encrypts a value coming from the settings form, but keeps a value that is 18 * already one of our ciphertexts. WordPress runs an option's sanitize 19 * callback twice when the option is first created (update_option() falls 20 * through to add_option(), which sanitizes again), so the second pass sees 21 * the first pass's ciphertext. Encrypting it again would store a secret 22 * that decrypts to ciphertext instead of the merchant's key. 23 */ 24 public static function seal(string $value): string 25 { 26 if ($value === '' || self::open($value) !== null) { 27 return $value; 28 } 29 return self::encrypt($value); 30 } 16 31 public static function encrypt(string $plain): string 17 32 { … … 33 48 // tolerate a value saved before encryption was enabled 34 49 } 50 $plain = self::open($stored); 51 if ($plain === null) { 52 return ''; 53 } 54 // Settings saved by 1.2.2 and earlier on a fresh install were encrypted 55 // twice (see seal()); unwrap the extra layer so those sites keep working. 56 $inner = self::open($plain); 57 return $inner ?? $plain; 58 } 59 /** Opens one of our ciphertexts; null when the value is not one (or the key changed). */ 60 private static function open(string $stored): ?string 61 { 62 if (strncmp($stored, self::PREFIX, strlen(self::PREFIX)) !== 0) { 63 return null; 64 } 35 65 // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode -- storage encoding of the libsodium ciphertext, not code. 36 66 $raw = base64_decode(substr($stored, strlen(self::PREFIX)), \true); 37 67 if ($raw === \false || strlen($raw) <= \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES) { 38 return '';68 return null; 39 69 } 40 70 $nonce = substr($raw, 0, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); 41 71 $cipher = substr($raw, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); 42 72 $plain = sodium_crypto_secretbox_open($cipher, $nonce, self::key()); 43 return $plain === \false ? '': $plain;73 return $plain === \false ? null : $plain; 44 74 } 45 75 private static function key(): string -
lunixi/trunk/src/Core/Settings.php
r3841374 r3841457 247 247 $out = ['environment' => isset($input['environment']) && strtoupper((string) $input['environment']) === 'TEST' ? 'TEST' : 'LIVE', 'key_id' => sanitize_text_field((string) ($input['key_id'] ?? '')), 'base_url' => esc_url_raw((string) ($input['base_url'] ?? ''))]; 248 248 $privateKey = trim(sanitize_textarea_field((string) ($input['private_key'] ?? ''))); 249 $out['private_key'] = $privateKey !== '' ? \Lunixi\WP\Core\SecretBox:: encrypt($privateKey) : (string) ($existing['private_key'] ?? '');249 $out['private_key'] = $privateKey !== '' ? \Lunixi\WP\Core\SecretBox::seal($privateKey) : (string) ($existing['private_key'] ?? ''); 250 250 $webhookSecret = self::secret($input['webhook_secret'] ?? ''); 251 $out['webhook_secret'] = $webhookSecret !== '' ? \Lunixi\WP\Core\SecretBox:: encrypt($webhookSecret) : (string) ($existing['webhook_secret'] ?? '');251 $out['webhook_secret'] = $webhookSecret !== '' ? \Lunixi\WP\Core\SecretBox::seal($webhookSecret) : (string) ($existing['webhook_secret'] ?? ''); 252 252 $out['debug'] = !empty($input['debug']) ? '1' : ''; 253 253 $portalMode = (string) ($input['portal_mode'] ?? 'embed'); … … 266 266 $out['automation_integration_id'] = sanitize_text_field((string) ($input['automation_integration_id'] ?? '')); 267 267 $automationSecret = self::secret($input['automation_secret'] ?? ''); 268 $out['automation_secret'] = $automationSecret !== '' ? \Lunixi\WP\Core\SecretBox:: encrypt($automationSecret) : (string) ($existing['automation_secret'] ?? '');268 $out['automation_secret'] = $automationSecret !== '' ? \Lunixi\WP\Core\SecretBox::seal($automationSecret) : (string) ($existing['automation_secret'] ?? ''); 269 269 $out['identity_enabled'] = !empty($input['identity_enabled']) ? '1' : ''; 270 270 $out['identity_publishable_key'] = sanitize_text_field((string) ($input['identity_publishable_key'] ?? '')); -
lunixi/trunk/vendor/scoped-package.json
r3841374 r3841457 1 1 { 2 "pluginVersion": "1.2. 2",2 "pluginVersion": "1.2.3", 3 3 "sdk": { 4 4 "name": "lunixi/php-sdk",
Note:
See TracChangeset
for help on using the changeset viewer.