Changeset 3807496
- Timestamp:
- 11/17/2026 01:34:05 PM (less than one hour ago)
- Location:
- woocommerce-shipstation-integration
- Files:
-
- 2 added
- 24 edited
- 1 copied
-
tags/5.4.2 (copied) (copied from woocommerce-shipstation-integration/trunk )
-
tags/5.4.2/changelog.txt (modified) (1 diff)
-
tags/5.4.2/includes/api/rest/class-api-controller.php (modified) (2 diffs)
-
tags/5.4.2/includes/class-api-user.php (added)
-
tags/5.4.2/includes/class-auth-controller.php (modified) (14 diffs)
-
tags/5.4.2/includes/class-main.php (modified) (2 diffs)
-
tags/5.4.2/includes/class-wc-shipstation-integration.php (modified) (5 diffs)
-
tags/5.4.2/languages/woocommerce-shipstation.pot (modified) (33 diffs)
-
tags/5.4.2/readme.txt (modified) (2 diffs)
-
tags/5.4.2/templates/api-key-list.php (modified) (6 diffs)
-
tags/5.4.2/uninstall.php (modified) (3 diffs)
-
tags/5.4.2/vendor/composer/installed.php (modified) (2 diffs)
-
tags/5.4.2/vendor/composer/jetpack_autoload_classmap.php (modified) (1 diff)
-
tags/5.4.2/woocommerce-shipstation.php (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/api/rest/class-api-controller.php (modified) (2 diffs)
-
trunk/includes/class-api-user.php (added)
-
trunk/includes/class-auth-controller.php (modified) (14 diffs)
-
trunk/includes/class-main.php (modified) (2 diffs)
-
trunk/includes/class-wc-shipstation-integration.php (modified) (5 diffs)
-
trunk/languages/woocommerce-shipstation.pot (modified) (33 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/templates/api-key-list.php (modified) (6 diffs)
-
trunk/uninstall.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/vendor/composer/jetpack_autoload_classmap.php (modified) (1 diff)
-
trunk/woocommerce-shipstation.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-shipstation-integration/tags/5.4.2/changelog.txt
r3795802 r3807496 1 1 *** ShipStation for WooCommerce *** 2 3 = 5.4.2 - 2026-11-17 = 4 * Fix - Security update. 5 * Tweak - Plugin-generated API keys now belong to a new ShipStation API user with limited permissions. Existing plugin keys move to it and keep working with ShipStation, but no longer reach orders, products or customers on other WooCommerce REST API routes. 2 6 3 7 = 5.4.1 - 2026-11-11 = -
woocommerce-shipstation-integration/tags/5.4.2/includes/api/rest/class-api-controller.php
r3795802 r3807496 12 12 } 13 13 14 use WooCommerce\Shipping\ShipStation\API_User; 14 15 use WooCommerce\Shipping\ShipStation\Auth_Controller; 15 16 use WooCommerce\Shipping\ShipStation\Connection_Log; … … 235 236 $proxied_row = $row; 236 237 } 238 239 // A key owned by the ShipStation API user must keep working after that 240 // user lost its role on this site. 241 API_User::repair_current_user(); 237 242 238 243 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Public hook name retained for backward compatibility. -
woocommerce-shipstation-integration/tags/5.4.2/includes/class-auth-controller.php
r3723614 r3807496 50 50 * Plaintext prefix prepended to every plugin-generated consumer_secret. 51 51 * 52 * Stored verbatim in `consumer_secret char(43)`, so this prefix is the 53 * single source of truth for "did this plugin create this row?", used by 54 * the inline credentials section, the settings-tab key list, and the per-row 55 * delete ({@see delete_plugin_key_row()}) to identify our rows without 56 * false-positive risk against merchant-created keys. 52 * Stored verbatim in `consumer_secret char(43)`, so this prefix tells which 53 * rows this plugin minted, without false-positive risk against 54 * merchant-created keys. The inline credentials section, the settings-tab 55 * key list and the per-row delete ({@see delete_plugin_key_row()}) use it. 56 * The key list and the delete also accept unprefixed rows from before 5.0.8 57 * that the ShipStation API user key sync moved or left alone 58 * ({@see API_User::get_moved_key_ids()}, {@see API_User::get_skipped_key_ids()}). 57 59 * 58 60 * Length budget: prefix (8) + `wc_rand_hash()` tail (35) = 43, exactly … … 319 321 320 322 /** 321 * Return the first admin user ID to assign as the API key owner.322 *323 * WooCommerce REST auth runs every request under the key owner's capabilities.324 * Tying the key to the triggering user is unsafe: that user may later lose their325 * role or be deleted, causing every REST endpoint to return rest_forbidden.326 * Using the first administrator keeps the key stable.327 *328 * @return int329 */330 private function get_admin_user_id(): int {331 // Try site-level administrators first (works on single site and multisite).332 $admins = get_users(333 array(334 'role' => 'administrator',335 'number' => 1,336 'orderby' => 'ID',337 'order' => 'ASC',338 'fields' => 'ID',339 'count_total' => false,340 )341 );342 343 if ( ! empty( $admins ) ) {344 return (int) $admins[0];345 }346 347 // On multisite, fall back to the first network super admin.348 // get_users() only queries site-level roles, so super admins who haven't349 // been explicitly added to this site won't appear in the query above.350 if ( is_multisite() ) {351 $super_admins = get_super_admins();352 $user = ! empty( $super_admins ) ? get_user_by( 'login', $super_admins[0] ) : false;353 354 if ( $user ) {355 return $user->ID;356 }357 }358 359 return get_current_user_id();360 }361 362 /**363 323 * Generate new WooCommerce REST API credentials for the direct key set. 364 324 * … … 396 356 global $wpdb; 397 357 358 // The key belongs to the ShipStation API user, never to an administrator 359 // or to the person generating it. No user, no key. 360 $owner_id = API_User::ensure(); 361 if ( is_wp_error( $owner_id ) ) { 362 Logger::error( 'Failed to create the ShipStation API user, so no API key was generated: ' . $owner_id->get_error_message() ); 363 return array(); 364 } 365 398 366 // 8-char prefix + 35-char random tail = 43 chars total, exactly 399 367 // matching WC's default key shape and fitting `consumer_secret char(43)`. … … 403 371 404 372 $data = array( 405 'user_id' => $ this->get_admin_user_id(),373 'user_id' => $owner_id, 406 374 'description' => $description, 407 375 'permissions' => 'read_write', … … 698 666 * 699 667 * Rows are identified by the set prefixes on the plaintext 700 * `consumer_secret`; merchant-created keys never appear here. Powers the 701 * settings-tab key list from which the merchant retires old pairs. 702 * 703 * @since 5.2.0 704 * 705 * @return array[] Each: ['key_id' => int, 'transports' => string[], 'transport_last_seen' => array<string,string>, 'description' => string, 'truncated_key' => string, 'last_access' => string|null]. 668 * `consumer_secret`, plus the keys from before 5.0.8 that were moved to the 669 * ShipStation API user or left alone because their owner could not use 670 * them, which have no prefix. Other merchant-created keys never appear here. 671 * A hand-made key described "ShipStation Integration" can be among the 672 * moved or skipped rows, because the one-time move cannot tell it apart. 673 * Powers the settings-tab key list from which the merchant retires old pairs. 674 * 675 * @since 5.2.0 676 * 677 * @return array[] Each: ['key_id' => int, 'user_id' => int, 'transports' => string[], 'transport_last_seen' => array<string,string>, 'description' => string, 'truncated_key' => string, 'last_access' => string|null, 'is_prefixed' => bool]. 706 678 */ 707 679 public static function get_plugin_key_rows(): array { 708 680 global $wpdb; 709 681 710 $rows = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 711 $wpdb->prepare( 712 "SELECT key_id, description, truncated_key, last_access FROM {$wpdb->prefix}woocommerce_api_keys WHERE consumer_secret LIKE %s OR consumer_secret LIKE %s ORDER BY key_id DESC", 713 $wpdb->esc_like( self::API_SECRET_PREFIX ) . '%', 714 $wpdb->esc_like( self::WPCOM_API_SECRET_PREFIX ) . '%' 682 // Keys from before 5.0.8 the key sync moved or left alone. A store manager 683 // cannot revoke a moved one on WooCommerce's REST API screen once the API 684 // user owns it, and a key left alone is listed so it can be marked refused. 685 $synced_ids = array_values( array_unique( array_merge( API_User::get_moved_key_ids(), API_User::get_skipped_key_ids() ) ) ); 686 $synced_sql = ''; 687 if ( array() !== $synced_ids ) { 688 $synced_sql = ' OR key_id IN (' . implode( ',', array_fill( 0, count( $synced_ids ), '%d' ) ) . ')'; 689 } 690 691 // phpcs:ignore WordPress.DB.DirectDatabaseQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter -- $synced_sql is a generated list of %d tokens consumed by prepare(); every id is bound. 692 $rows = $wpdb->get_results( 693 $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- Two prefixes, then one id per %d in $synced_sql. 694 "SELECT key_id, user_id, description, truncated_key, last_access, consumer_secret FROM {$wpdb->prefix}woocommerce_api_keys WHERE consumer_secret LIKE %s OR consumer_secret LIKE %s{$synced_sql} ORDER BY key_id DESC", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $synced_sql holds only %d placeholders. 695 array_merge( 696 array( 697 $wpdb->esc_like( self::API_SECRET_PREFIX ) . '%', 698 $wpdb->esc_like( self::WPCOM_API_SECRET_PREFIX ) . '%', 699 ), 700 $synced_ids 701 ) 715 702 ), 716 703 ARRAY_A … … 720 707 return array(); 721 708 } 709 710 // A recorded id on another key is a new key that got a deleted key's id. 711 $rows = array_values( 712 array_filter( 713 $rows, 714 static function ( $row ) { 715 return self::is_plugin_secret( (string) ( $row['consumer_secret'] ?? '' ) ) 716 || API_User::is_recorded_key( (int) $row['key_id'], (string) ( $row['truncated_key'] ?? '' ) ); 717 } 718 ) 719 ); 722 720 723 721 $key_ids = array(); … … 735 733 $result[] = array( 736 734 'key_id' => $key_id, 735 'user_id' => (int) ( $row['user_id'] ?? 0 ), 737 736 // Observed transports the key has actually authenticated over — 738 737 // the honest basis for the "Type" column ('wpcom'/'direct'/both). … … 744 743 'truncated_key' => isset( $row['truncated_key'] ) ? (string) $row['truncated_key'] : '', 745 744 'last_access' => isset( $row['last_access'] ) ? $row['last_access'] : null, 745 // The secret itself is not passed on. 746 'is_prefixed' => self::is_plugin_secret( (string) ( $row['consumer_secret'] ?? '' ) ), 746 747 ); 747 748 } … … 751 752 752 753 /** 754 * Whether the current user may delete a key row through the plugin's key list. 755 * 756 * A prefixed row is the plugin's. A row from before 5.0.8 is deletable while 757 * the ShipStation API user owns it after the move. A row the key sync left 758 * alone may still work on other routes as its owner, so it follows 759 * WooCommerce's revoke rule: the current user can edit the owner, which 760 * includes the owner itself. A key whose owner was deleted works nowhere, so 761 * anyone who manages the key list may delete it. 762 * 763 * @internal The row values must come from the database, as in {@see delete_plugin_key_row()}. 764 * 765 * @since 5.4.2 766 * 767 * @param int $key_id Row id. 768 * @param int $owner_id Row owner. 769 * @param bool $is_prefixed Whether the row's consumer secret has a plugin prefix. 770 * 771 * @return bool 772 */ 773 public static function current_user_may_delete_key_row( int $key_id, int $owner_id, bool $is_prefixed ): bool { 774 if ( $is_prefixed ) { 775 return true; 776 } 777 778 $api_user_id = API_User::get_user_id(); 779 if ( $api_user_id > 0 && $owner_id === $api_user_id && in_array( $key_id, API_User::get_moved_key_ids(), true ) ) { 780 return true; 781 } 782 783 if ( in_array( $key_id, API_User::get_skipped_key_ids(), true ) ) { 784 return ! get_userdata( $owner_id ) || current_user_can( 'edit_user', $owner_id ); 785 } 786 787 return false; 788 } 789 790 /** 753 791 * Delete one plugin-generated key row by id. 754 792 * 755 * The WHERE clause re-checks the set prefixes, so a merchant-created row 756 * can never be deleted through this path no matter what id is posted. 793 * Checks {@see current_user_may_delete_key_row()} first, so a row that is 794 * neither prefixed nor recorded by the API user key sync can never be 795 * deleted through this path no matter what id is posted, and the delete is 796 * bound to the owner that was checked. 757 797 * 758 798 * @since 5.2.0 … … 765 805 global $wpdb; 766 806 807 $row = $wpdb->get_row( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 808 $wpdb->prepare( "SELECT user_id, consumer_secret, truncated_key FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d", $key_id ) 809 ); 810 if ( '' !== $wpdb->last_error ) { 811 Logger::error( 'Failed to delete ShipStation API key row. DB error: ' . $wpdb->last_error ); 812 return false; 813 } 814 if ( ! $row ) { 815 return false; 816 } 817 818 // An unprefixed row is the plugin's only while the key sync recorded this very key. 819 $is_prefixed = self::is_plugin_secret( (string) $row->consumer_secret ); 820 if ( ! $is_prefixed && ! API_User::is_recorded_key( $key_id, (string) $row->truncated_key ) ) { 821 return false; 822 } 823 if ( ! self::current_user_may_delete_key_row( $key_id, (int) $row->user_id, $is_prefixed ) ) { 824 return false; 825 } 826 767 827 $result = $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 768 828 $wpdb->prepare( 769 "DELETE FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d AND ( consumer_secret LIKE %s OR consumer_secret LIKE %s )",829 "DELETE FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d AND user_id = %d", 770 830 $key_id, 771 $wpdb->esc_like( self::API_SECRET_PREFIX ) . '%', 772 $wpdb->esc_like( self::WPCOM_API_SECRET_PREFIX ) . '%' 831 (int) $row->user_id 773 832 ) 774 833 ); … … 781 840 if ( $result > 0 ) { 782 841 self::forget_key_meta( $key_id ); 842 API_User::forget_key( $key_id ); 783 843 } 784 844 … … 891 951 if ( ! current_user_can( 'manage_woocommerce' ) ) { 892 952 wp_die( esc_html__( 'You do not have sufficient permissions.', 'woocommerce-shipstation-integration' ) ); 953 } 954 955 // The key acts with the API user's capabilities, so its creator must hold 956 // each of them. A custom role can reach this screen with only the first. 957 foreach ( API_User::CAPABILITIES as $capability ) { 958 // phpcs:ignore WordPress.WP.Capabilities.Undetermined -- WooCommerce core capabilities, listed in API_User::CAPABILITIES. 959 if ( ! current_user_can( $capability ) ) { 960 Logger::info( sprintf( 'ShipStation API keys were not generated for user ID %d, who lacks the %s capability.', get_current_user_id(), $capability ) ); 961 wp_send_json_error( 962 array( 963 'message' => __( 'Your account cannot generate ShipStation API keys. It needs permission to manage WooCommerce and to manage product categories, tags and attributes. Ask an administrator to generate them.', 'woocommerce-shipstation-integration' ), 964 ) 965 ); 966 return; 967 } 968 } 969 970 // Checked here, before the key insert, so the merchant is told that the 971 // user, not the database, is the problem. 972 $api_user = API_User::ensure(); 973 if ( is_wp_error( $api_user ) ) { 974 Logger::error( 'Failed to set up the ShipStation API user, so no API key was generated: ' . $api_user->get_error_message() ); 975 976 switch ( $api_user->get_error_code() ) { 977 case 'shipstation_api_user_busy': 978 $message = __( 'Another request is setting up the ShipStation API user. Wait a moment, then try again.', 'woocommerce-shipstation-integration' ); 979 break; 980 case 'shipstation_api_user_role': 981 $message = __( 'The ShipStation API user could not get the permissions it needs, so no keys were generated. A role editor plugin may be removing them. See the ShipStation log under WooCommerce > Status > Logs.', 'woocommerce-shipstation-integration' ); 982 break; 983 default: 984 $message = __( 'The ShipStation API user could not be created, so no keys were generated. Another plugin may be blocking new user accounts. See the ShipStation log under WooCommerce > Status > Logs for the reason.', 'woocommerce-shipstation-integration' ); 985 } 986 987 wp_send_json_error( array( 'message' => $message ) ); 988 return; 893 989 } 894 990 … … 961 1057 962 1058 if ( $key_id <= 0 || ! self::delete_plugin_key_row( $key_id ) ) { 963 wp_send_json_error( 964 array( 'message' => __( 'This key could not be deleted. It may have been removed already.', 'woocommerce-shipstation-integration' ) ) 965 ); 1059 global $wpdb; 1060 1061 // The row is still there, so the delete was refused or failed, not too late. 1062 $row = $key_id > 0 ? $wpdb->get_row( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 1063 $wpdb->prepare( "SELECT truncated_key, consumer_secret FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d", $key_id ) 1064 ) : null; 1065 $still_there = null !== $row; 1066 1067 // A refused row the key list shows belongs to an owner the current user cannot edit. 1068 $is_listed = $still_there && API_User::is_recorded_key( $key_id, (string) $row->truncated_key ); 1069 1070 if ( ! $still_there ) { 1071 $message = __( 'This key could not be deleted. It may have been removed already.', 'woocommerce-shipstation-integration' ); 1072 } elseif ( self::is_plugin_secret( (string) $row->consumer_secret ) ) { 1073 // A prefixed row is never refused, so the delete itself failed. 1074 $message = __( 'This key could not be deleted. Try again, and see the ShipStation log under WooCommerce > Status > Logs if it keeps failing.', 'woocommerce-shipstation-integration' ); 1075 } elseif ( $is_listed ) { 1076 $message = __( 'You cannot delete this key here. Someone who can edit its owner can revoke it under WooCommerce > Settings > Advanced > REST API.', 'woocommerce-shipstation-integration' ); 1077 } else { 1078 $message = __( 'You cannot delete this key here. It is not in the ShipStation key list.', 'woocommerce-shipstation-integration' ); 1079 } 1080 1081 wp_send_json_error( array( 'message' => $message ) ); 966 1082 return; 967 1083 } … … 1142 1258 global $wpdb; 1143 1259 1260 // A store nobody signs in to gets its keys moved here. After that, put 1261 // the role back and reclaim keys whose API user was deleted. 1262 API_User::maybe_sync(); 1263 $synced = API_User::sync_keys(); 1264 if ( is_wp_error( $synced ) ) { 1265 Logger::error( 'Could not repair the ShipStation API user: ' . $synced->get_error_message() ); 1266 } 1267 1144 1268 // Give any untracked plugin key a mint baseline so legacy never-used keys 1145 1269 // become prunable rather than lingering forever. -
woocommerce-shipstation-integration/tags/5.4.2/includes/class-main.php
r3795802 r3807496 79 79 public function __construct() { 80 80 add_action( 'plugins_loaded', array( $this, 'init' ) ); 81 82 // Registered here, not in init(), so the ShipStation API user stays 83 // protected while WooCommerce is inactive. 84 require_once WC_SHIPSTATION_ABSPATH . 'includes/class-api-user.php'; 85 API_User::register_protection(); 81 86 add_filter( 'woocommerce_integrations', array( $this, 'load_integration' ) ); 82 87 add_action( 'woocommerce_api_wc_shipstation', array( $this, 'load_api' ) ); … … 137 142 // schedules the recurring action on `init`. 138 143 Auth_Controller::register_orphan_prune(); 144 145 // Move this site's existing API keys to the ShipStation API user, once, 146 // on an admin request or in the daily key job. 147 API_User::register(); 139 148 140 149 add_action( 'before_woocommerce_init', array( $this, 'before_woocommerce_init' ) ); -
woocommerce-shipstation-integration/tags/5.4.2/includes/class-wc-shipstation-integration.php
r3795802 r3807496 13 13 use WooCommerce\Shipping\ShipStation\Enum_Helper; 14 14 use WooCommerce\Shipping\ShipStation\Logger; 15 use WooCommerce\Shipping\ShipStation\API_User; 15 16 use WooCommerce\Shipping\ShipStation\Auth_Controller; 16 17 use WooCommerce\Shipping\ShipStation\Connection_Log; … … 1678 1679 // protects and the most likely live credential, so it alone is flagged 1679 1680 // "(newest)" and never carries an auto-remove countdown. 1680 $newest_key_id = isset( $rows[0]['key_id'] ) ? (int) $rows[0]['key_id'] : 0; 1681 // The list also holds unprefixed keys from before 5.0.8, which the prune 1682 // never looks at, so the newest is the newest prefixed row. 1683 $newest_key_id = 0; 1684 foreach ( $rows as $row ) { 1685 if ( ! empty( $row['is_prefixed'] ) ) { 1686 $newest_key_id = (int) $row['key_id']; 1687 break; 1688 } 1689 } 1681 1690 1682 1691 // Order by "Last seen": the freshly-generated New key is always pinned to … … 1724 1733 ob_start(); 1725 1734 1735 // Repair the API user before listing its keys: put its role back, and on 1736 // multisite, or after a delete made without WooCommerce active, give the 1737 // keys of a deleted API user to its replacement. 1738 $synced = API_User::sync_keys(); 1739 if ( is_wp_error( $synced ) ) { 1740 Logger::error( 'Could not repair the ShipStation API user: ' . $synced->get_error_message() ); 1741 } 1742 $api_user_id = API_User::get_user_id(); 1743 $api_user = $api_user_id > 0 ? get_userdata( $api_user_id ) : false; 1744 1726 1745 list( $key_rows, $newest_key_id ) = self::get_sorted_plugin_key_rows(); 1727 1746 … … 1744 1763 $rows_for_key = isset( $connections_by_key[ (int) $key_row['key_id'] ] ) ? $connections_by_key[ (int) $key_row['key_id'] ] : array(); 1745 1764 $key_rows[ $index ]['rollup_status'] = Connection_Log::key_rollup_status( $rows_for_key, $active_window, $transport_enabled, $current_host, $is_wpcom_connected ); 1765 $key_rows[ $index ]['can_delete'] = Auth_Controller::current_user_may_delete_key_row( (int) $key_row['key_id'], (int) $key_row['user_id'], ! empty( $key_row['is_prefixed'] ) ); 1766 } 1767 1768 // Refused keys among the listed rows, matched by fingerprint, so a new key 1769 // that got a skipped key's id is not marked refused. 1770 // Among them, a key whose owner still holds manage_product_terms passes 1771 // the order and inventory routes, so ShipStation still imports with it. 1772 $skipped_key_ids = array(); 1773 $usable_skipped_key_ids = array(); 1774 foreach ( $key_rows as $key_row ) { 1775 if ( in_array( (int) $key_row['key_id'], API_User::get_skipped_key_ids(), true ) && API_User::is_recorded_key( (int) $key_row['key_id'], (string) $key_row['truncated_key'] ) ) { 1776 $skipped_key_ids[] = (int) $key_row['key_id']; 1777 1778 // phpcs:ignore WordPress.WP.Capabilities.Unknown -- WooCommerce core capability. 1779 if ( get_userdata( (int) $key_row['user_id'] ) && user_can( (int) $key_row['user_id'], 'manage_product_terms' ) ) { 1780 $usable_skipped_key_ids[] = (int) $key_row['key_id']; 1781 } 1782 } 1746 1783 } 1747 1784 … … 1749 1786 'api-key-list.php', 1750 1787 array( 1751 'rows' => $key_rows, 1752 'active_window' => $active_window, 1753 'transport_enabled' => $transport_enabled, 1754 'date_format' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), 1755 'newest_key_id' => $newest_key_id, 1788 'rows' => $key_rows, 1789 'active_window' => $active_window, 1790 'transport_enabled' => $transport_enabled, 1791 'date_format' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), 1792 'newest_key_id' => $newest_key_id, 1793 'api_user_login' => $api_user ? $api_user->user_login : '', 1794 'api_user_id' => $api_user ? $api_user_id : 0, 1795 'api_user_errors' => API_User::get_errors(), 1796 'skipped_key_ids' => $skipped_key_ids, 1797 'usable_skipped_key_ids' => $usable_skipped_key_ids, 1756 1798 ), 1757 1799 '', -
woocommerce-shipstation-integration/tags/5.4.2/languages/woocommerce-shipstation.pot
r3795802 r3807496 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: ShipStation for WooCommerce 5.4. 1\n"5 "Project-Id-Version: ShipStation for WooCommerce 5.4.2\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "https://wordpress.org/support/plugin/woocommerce-shipstation\n" 8 "POT-Creation-Date: 2026-11-1 1 07:27:21+00:00\n"8 "POT-Creation-Date: 2026-11-17 13:33:20+00:00\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=utf-8\n" … … 144 144 msgstr "" 145 145 146 #: includes/api/rest/class-api-controller.php:2 87146 #: includes/api/rest/class-api-controller.php:292 147 147 msgid "Invalid ShipStation credentials." 148 148 msgstr "" … … 375 375 376 376 #: includes/checkout/class-checkout-rates-options.php:637 377 #: includes/class-wc-shipstation-integration.php:145 8377 #: includes/class-wc-shipstation-integration.php:1459 378 378 #: vendor/automattic/jetpack-connection/src/class-users-connection-admin.php:90 379 379 msgid "Connected" … … 416 416 417 417 #: includes/checkout/class-checkout-rates-options.php:678 418 #: includes/class-wc-shipstation-integration.php:162 8418 #: includes/class-wc-shipstation-integration.php:1629 419 419 msgid "Active" 420 420 msgstr "" … … 463 463 msgstr "" 464 464 465 #: includes/class-auth-controller.php:270 465 #: includes/class-api-user.php:606 466 msgid "This account is used by the ShipStation connection and cannot sign in." 467 msgstr "" 468 469 #: includes/class-api-user.php:802 470 msgid "" 471 "The ShipStation API user was left out. It cannot be deleted, removed from a " 472 "site or given another role, because ShipStation connects through it." 473 msgstr "" 474 475 #: includes/class-api-user.php:1199 includes/class-api-user.php:1204 476 #: includes/class-auth-controller.php:331 477 msgid "ShipStation Integration" 478 msgstr "" 479 480 #: includes/class-auth-controller.php:272 466 481 msgid "Copied!" 467 482 msgstr "" 468 483 469 #: includes/class-auth-controller.php:27 1484 #: includes/class-auth-controller.php:273 470 485 #: templates/partials/credential-field.php:43 471 486 msgid "Show" 472 487 msgstr "" 473 488 474 #: includes/class-auth-controller.php:27 2489 #: includes/class-auth-controller.php:274 475 490 msgid "Hide" 476 491 msgstr "" 477 492 478 #: includes/class-auth-controller.php:27 3493 #: includes/class-auth-controller.php:275 479 494 msgid "Could not generate new keys. Please try again." 480 495 msgstr "" 481 496 482 #: includes/class-auth-controller.php:27 4497 #: includes/class-auth-controller.php:276 483 498 msgid "" 484 499 "Generate a new set of REST API keys? Existing keys stay valid until you " … … 487 502 msgstr "" 488 503 489 #: includes/class-auth-controller.php:27 6504 #: includes/class-auth-controller.php:278 490 505 msgid "" 491 506 "Dangerously disconnect from WordPress.com? No direct ShipStation connection " … … 494 509 msgstr "" 495 510 496 #: includes/class-auth-controller.php:371 497 msgid "ShipStation Integration" 498 msgstr "" 499 500 #: includes/class-auth-controller.php:887 501 #: includes/class-auth-controller.php:952 511 #: includes/class-auth-controller.php:947 512 #: includes/class-auth-controller.php:1048 502 513 #: includes/class-global-connection-banner.php:139 503 514 msgid "Security check failed" 504 515 msgstr "" 505 516 506 #: includes/class-auth-controller.php: 892507 #: includes/class-auth-controller.php: 957517 #: includes/class-auth-controller.php:952 518 #: includes/class-auth-controller.php:1053 508 519 #: includes/class-global-connection-banner.php:144 509 520 #: includes/class-wpcom-connection.php:1278 … … 511 522 msgstr "" 512 523 513 #: includes/class-auth-controller.php:898 524 #: includes/class-auth-controller.php:963 525 msgid "" 526 "Your account cannot generate ShipStation API keys. It needs permission to " 527 "manage WooCommerce and to manage product categories, tags and attributes. " 528 "Ask an administrator to generate them." 529 msgstr "" 530 531 #: includes/class-auth-controller.php:978 532 msgid "" 533 "Another request is setting up the ShipStation API user. Wait a moment, then " 534 "try again." 535 msgstr "" 536 537 #: includes/class-auth-controller.php:981 538 msgid "" 539 "The ShipStation API user could not get the permissions it needs, so no keys " 540 "were generated. A role editor plugin may be removing them. See the " 541 "ShipStation log under WooCommerce > Status > Logs." 542 msgstr "" 543 544 #: includes/class-auth-controller.php:984 545 msgid "" 546 "The ShipStation API user could not be created, so no keys were generated. " 547 "Another plugin may be blocking new user accounts. See the ShipStation log " 548 "under WooCommerce > Status > Logs for the reason." 549 msgstr "" 550 551 #: includes/class-auth-controller.php:994 514 552 msgid "" 515 553 "Another request is currently generating REST API keys. Please refresh the " … … 517 555 msgstr "" 518 556 519 #: includes/class-auth-controller.php: 916557 #: includes/class-auth-controller.php:1012 520 558 msgid "" 521 559 "Failed to generate API credentials. Please try again or contact your " … … 523 561 msgstr "" 524 562 525 #: includes/class-auth-controller.php: 964563 #: includes/class-auth-controller.php:1071 526 564 msgid "This key could not be deleted. It may have been removed already." 527 565 msgstr "" 528 566 529 #: includes/class-auth-controller.php:1210 567 #: includes/class-auth-controller.php:1074 568 msgid "" 569 "This key could not be deleted. Try again, and see the ShipStation log under " 570 "WooCommerce > Status > Logs if it keeps failing." 571 msgstr "" 572 573 #: includes/class-auth-controller.php:1076 574 msgid "" 575 "You cannot delete this key here. Someone who can edit its owner can revoke " 576 "it under WooCommerce > Settings > Advanced > REST API." 577 msgstr "" 578 579 #: includes/class-auth-controller.php:1078 580 msgid "You cannot delete this key here. It is not in the ShipStation key list." 581 msgstr "" 582 583 #: includes/class-auth-controller.php:1334 530 584 msgid "View ShipStation connection details" 531 585 msgstr "" … … 610 664 msgstr "" 611 665 612 #: includes/class-main.php: 97666 #: includes/class-main.php:102 613 667 #. translators: %s WC download URL link. 614 668 msgid "" … … 617 671 msgstr "" 618 672 619 #: includes/class-main.php: 599673 #: includes/class-main.php:608 620 674 msgid "Settings" 621 675 msgstr "" 622 676 623 #: includes/class-main.php:60 0677 #: includes/class-main.php:609 624 678 msgid "Support" 625 679 msgstr "" 626 680 627 #: includes/class-main.php:6 01681 #: includes/class-main.php:610 628 682 msgid "Docs" 629 683 msgstr "" … … 730 784 msgstr "" 731 785 732 #: includes/class-wc-shipstation-integration.php:23 2786 #: includes/class-wc-shipstation-integration.php:233 733 787 #: includes/class-wc-shipstation-privacy.php:24 734 788 #: includes/data/data-settings.php:55 includes/data/data-settings.php:61 … … 739 793 msgstr "" 740 794 741 #: includes/class-wc-shipstation-integration.php:23 3795 #: includes/class-wc-shipstation-integration.php:234 742 796 msgid "" 743 797 "ShipStation allows you to retrieve & manage orders, then print labels " … … 745 799 msgstr "" 746 800 747 #: includes/class-wc-shipstation-integration.php:36 1801 #: includes/class-wc-shipstation-integration.php:362 748 802 msgid "Choose which order statuses to export to ShipStation." 749 803 msgstr "" 750 804 751 #: includes/class-wc-shipstation-integration.php:36 2805 #: includes/class-wc-shipstation-integration.php:363 752 806 msgid "Each selected status must also be mapped to a ShipStation status." 753 807 msgstr "" 754 808 755 #: includes/class-wc-shipstation-integration.php:36 3809 #: includes/class-wc-shipstation-integration.php:364 756 810 msgid "" 757 811 "Mappings are managed below or in your ShipStation account (depending on " … … 759 813 msgstr "" 760 814 761 #: includes/class-wc-shipstation-integration.php:366 815 #: includes/class-wc-shipstation-integration.php:367 816 #: includes/class-wc-shipstation-integration.php:967 817 msgid "All statuses are selected for export." 818 msgstr "" 819 820 #: includes/class-wc-shipstation-integration.php:369 762 821 #: includes/class-wc-shipstation-integration.php:966 763 msgid "All statuses are selected for export."764 msgstr ""765 766 #: includes/class-wc-shipstation-integration.php:368767 #: includes/class-wc-shipstation-integration.php:965768 822 msgid "Excluded from export:" 769 823 msgstr "" 770 824 771 #: includes/class-wc-shipstation-integration.php:38 0825 #: includes/class-wc-shipstation-integration.php:381 772 826 #. translators: %s: comma-separated list of WC order status names 773 827 msgid "" … … 776 830 msgstr "" 777 831 778 #: includes/class-wc-shipstation-integration.php:47 1832 #: includes/class-wc-shipstation-integration.php:472 779 833 msgid "" 780 834 "Settings saved, but some selected export statuses are not mapped to a " … … 782 836 msgstr "" 783 837 784 #: includes/class-wc-shipstation-integration.php:96 7838 #: includes/class-wc-shipstation-integration.php:968 785 839 msgid "Selected for export but not mapped to a ShipStation status:" 786 840 msgstr "" 787 841 788 #: includes/class-wc-shipstation-integration.php:96 8842 #: includes/class-wc-shipstation-integration.php:969 789 843 msgid "Map them below so their orders are exported correctly." 790 844 msgstr "" 791 845 792 #: includes/class-wc-shipstation-integration.php:97 1846 #: includes/class-wc-shipstation-integration.php:972 793 847 msgid "" 794 848 "Delete this API key pair? Any ShipStation connection still using it will " … … 796 850 msgstr "" 797 851 798 #: includes/class-wc-shipstation-integration.php:97 2852 #: includes/class-wc-shipstation-integration.php:973 799 853 #: vendor/automattic/jetpack-connection/src/class-connection-notice.php:236 800 854 msgid "Something went wrong. Please try again." 801 855 msgstr "" 802 856 803 #: includes/class-wc-shipstation-integration.php:100 7857 #: includes/class-wc-shipstation-integration.php:1008 804 858 msgid "This feature requires WooCommerce 9.7.0 or higher." 805 859 msgstr "" 806 860 807 #: includes/class-wc-shipstation-integration.php:107 6861 #: includes/class-wc-shipstation-integration.php:1077 808 862 #: includes/data/data-settings.php:169 809 863 msgid "Enable WordPress.com Transport" 810 864 msgstr "" 811 865 812 #: includes/class-wc-shipstation-integration.php:11 19866 #: includes/class-wc-shipstation-integration.php:1120 813 867 msgid "" 814 868 "Routes ShipStation traffic to your store through WordPress.com, providing a " … … 817 871 msgstr "" 818 872 819 #: includes/class-wc-shipstation-integration.php:113 1873 #: includes/class-wc-shipstation-integration.php:1132 820 874 #. translators: %s: the constant or filter name (wrapped in a <code> tag) that 821 875 #. is forcing the setting on. … … 825 879 msgstr "" 826 880 827 #: includes/class-wc-shipstation-integration.php:135 7881 #: includes/class-wc-shipstation-integration.php:1358 828 882 msgid "" 829 883 "You're turning on WordPress.com Transport. After you save, update your " … … 833 887 msgstr "" 834 888 835 #: includes/class-wc-shipstation-integration.php:13 59889 #: includes/class-wc-shipstation-integration.php:1360 836 890 msgid "" 837 891 "You're turning off WordPress.com Transport. ShipStation has a recent direct " … … 843 897 msgstr "" 844 898 845 #: includes/class-wc-shipstation-integration.php:136 0899 #: includes/class-wc-shipstation-integration.php:1361 846 900 msgid "" 847 901 "You're turning off WordPress.com Transport. After you save, update your " … … 851 905 msgstr "" 852 906 853 #: includes/class-wc-shipstation-integration.php:137 4907 #: includes/class-wc-shipstation-integration.php:1375 854 908 msgid "Credentials" 855 909 msgstr "" 856 910 857 #: includes/class-wc-shipstation-integration.php:138 8911 #: includes/class-wc-shipstation-integration.php:1389 858 912 msgid "Connections" 859 913 msgstr "" 860 914 861 #: includes/class-wc-shipstation-integration.php:14 09915 #: includes/class-wc-shipstation-integration.php:1410 862 916 msgid "API Keys" 863 917 msgstr "" 864 918 865 #: includes/class-wc-shipstation-integration.php:146 1919 #: includes/class-wc-shipstation-integration.php:1462 866 920 msgid "Action needed" 867 921 msgstr "" 868 922 869 #: includes/class-wc-shipstation-integration.php:146 4923 #: includes/class-wc-shipstation-integration.php:1465 870 924 msgid "Not connected yet" 871 925 msgstr "" 872 926 873 #: includes/class-wc-shipstation-integration.php:149 3927 #: includes/class-wc-shipstation-integration.php:1494 874 928 msgid "" 875 929 "ShipStation hasn't connected yet. Copy the values below into ShipStation to " … … 877 931 msgstr "" 878 932 879 #: includes/class-wc-shipstation-integration.php:149 8933 #: includes/class-wc-shipstation-integration.php:1499 880 934 msgid "" 881 935 "ShipStation hasn't synced in over a day, so new orders may not be " … … 885 939 msgstr "" 886 940 887 #: includes/class-wc-shipstation-integration.php:150 3941 #: includes/class-wc-shipstation-integration.php:1504 888 942 msgid "" 889 943 "Your store's web address changed, so the route ShipStation saved no longer " … … 892 946 msgstr "" 893 947 894 #: includes/class-wc-shipstation-integration.php:150 4948 #: includes/class-wc-shipstation-integration.php:1505 895 949 msgid "Show the Store URL" 896 950 msgstr "" 897 951 898 #: includes/class-wc-shipstation-integration.php:150 8952 #: includes/class-wc-shipstation-integration.php:1509 899 953 msgid "" 900 954 "WordPress.com is disconnected, so ShipStation can't reach your store " … … 903 957 msgstr "" 904 958 905 #: includes/class-wc-shipstation-integration.php:15 09959 #: includes/class-wc-shipstation-integration.php:1510 906 960 msgid "Reconnect WordPress.com" 907 961 msgstr "" 908 962 909 #: includes/class-wc-shipstation-integration.php:151 3963 #: includes/class-wc-shipstation-integration.php:1514 910 964 msgid "" 911 965 "WordPress.com transport is off, so your store is turning away the proxied " … … 914 968 msgstr "" 915 969 916 #: includes/class-wc-shipstation-integration.php:151 4970 #: includes/class-wc-shipstation-integration.php:1515 917 971 msgid "Review transport setting" 918 972 msgstr "" 919 973 920 #: includes/class-wc-shipstation-integration.php:156 1974 #: includes/class-wc-shipstation-integration.php:1562 921 975 msgid "" 922 976 "The WordPress.com connection package is unavailable. Reinstall plugin " … … 924 978 msgstr "" 925 979 926 #: includes/class-wc-shipstation-integration.php:16 29980 #: includes/class-wc-shipstation-integration.php:1630 927 981 msgid "Inactive" 928 982 msgstr "" 929 983 930 #: includes/class-wc-shipstation-integration.php:163 0984 #: includes/class-wc-shipstation-integration.php:1631 931 985 msgid "Rejected" 932 986 msgstr "" 933 987 934 #: includes/class-wc-shipstation-integration.php:163 1988 #: includes/class-wc-shipstation-integration.php:1632 935 989 msgid "Disconnected" 936 990 msgstr "" 937 991 938 #: includes/class-wc-shipstation-integration.php:163 2992 #: includes/class-wc-shipstation-integration.php:1633 939 993 msgid "Mismatch" 940 994 msgstr "" 941 995 942 #: includes/class-wc-shipstation-integration.php:163 3996 #: includes/class-wc-shipstation-integration.php:1634 943 997 msgid "Deleted" 944 998 msgstr "" 945 999 946 #: includes/class-wc-shipstation-integration.php:163 41000 #: includes/class-wc-shipstation-integration.php:1635 947 1001 msgid "New" 948 1002 msgstr "" 949 1003 950 #: includes/class-wc-shipstation-integration.php:163 51004 #: includes/class-wc-shipstation-integration.php:1636 951 1005 msgid "Unused" 952 1006 msgstr "" 953 1007 954 #: includes/class-wc-shipstation-integration.php:18 331008 #: includes/class-wc-shipstation-integration.php:1875 955 1009 msgid "Action failed. Please refresh the page and retry." 956 1010 msgstr "" 957 1011 958 #: includes/class-wc-shipstation-integration.php:18 381012 #: includes/class-wc-shipstation-integration.php:1880 959 1013 msgid "Cheatin’ huh?" 960 1014 msgstr "" 961 1015 962 #: includes/class-wc-shipstation-integration.php:1 8601016 #: includes/class-wc-shipstation-integration.php:1902 963 1017 msgid "ShipStation logo" 964 1018 msgstr "" 965 1019 966 #: includes/class-wc-shipstation-integration.php:1 8701020 #: includes/class-wc-shipstation-integration.php:1912 967 1021 #. translators: %s: ShipStation URL 968 1022 msgid "" … … 972 1026 msgstr "" 973 1027 974 #: includes/class-wc-shipstation-integration.php:1 8851028 #: includes/class-wc-shipstation-integration.php:1927 975 1029 msgid "" 976 1030 "After logging in, add WooCommerce as a selling channel in ShipStation. Use " … … 979 1033 msgstr "" 980 1034 981 #: includes/class-wc-shipstation-integration.php:19 021035 #: includes/class-wc-shipstation-integration.php:1944 982 1036 #. translators: %1$s: ShipStation plugin settings URL, %2$s: ShipStation 983 1037 #. documentation URL … … 1240 1294 msgstr "" 1241 1295 1242 #: templates/api-key-list.php:31 1296 #: templates/api-key-list.php:56 1297 msgid "" 1298 "ShipStation requests are refused until the ShipStation API user has its " 1299 "permissions back. A role editor plugin may be removing them." 1300 msgstr "" 1301 1302 #: templates/api-key-list.php:58 1303 msgid "" 1304 "Some ShipStation API keys could not be moved to the ShipStation API user. " 1305 "They still belong to their previous owner and keep working. The plugin " 1306 "tries again in about an hour." 1307 msgstr "" 1308 1309 #: templates/api-key-list.php:60 1310 msgid "" 1311 "Some ShipStation API keys could not be moved to the ShipStation API user. " 1312 "The plugin tries again later." 1313 msgstr "" 1314 1315 #: templates/api-key-list.php:71 1316 msgid "See the ShipStation log under WooCommerce > Status > Logs for details." 1317 msgstr "" 1318 1319 #: templates/api-key-list.php:76 1243 1320 msgid "No plugin-generated API keys yet." 1244 1321 msgstr "" 1245 1322 1246 #: templates/api-key-list.php: 36templates/observed-connections.php:1131323 #: templates/api-key-list.php:81 templates/observed-connections.php:113 1247 1324 msgid "Key" 1248 1325 msgstr "" 1249 1326 1250 #: templates/api-key-list.php: 37templates/observed-connections.php:1121327 #: templates/api-key-list.php:82 templates/observed-connections.php:112 1251 1328 msgid "Transport" 1252 1329 msgstr "" 1253 1330 1254 #: templates/api-key-list.php: 38templates/observed-connections.php:1151331 #: templates/api-key-list.php:83 templates/observed-connections.php:115 1255 1332 msgid "Last sync" 1256 1333 msgstr "" 1257 1334 1258 #: templates/api-key-list.php:147 1335 #: templates/api-key-list.php:171 1336 msgid "" 1337 "ShipStation refuses this key: its owner was deleted or lacks a permission " 1338 "ShipStation needs. Delete this key." 1339 msgstr "" 1340 1341 #: templates/api-key-list.php:173 1342 msgid "" 1343 "ShipStation refuses this key: its owner was deleted or lacks a permission " 1344 "ShipStation needs. You cannot delete it here. Someone who can edit its " 1345 "owner can revoke it under WooCommerce > Settings > Advanced > REST API." 1346 msgstr "" 1347 1348 #: templates/api-key-list.php:175 1349 msgid "" 1350 "Not moved to the ShipStation API user: its owner lacks a permission " 1351 "ShipStation needs, so ShipStation refuses some requests with this key." 1352 msgstr "" 1353 1354 #: templates/api-key-list.php:177 1355 msgid "Not moved to the ShipStation API user yet." 1356 msgstr "" 1357 1358 #: templates/api-key-list.php:223 1259 1359 msgid "Both" 1260 1360 msgstr "" 1261 1361 1262 #: templates/api-key-list.php: 149templates/observed-connections.php:1481362 #: templates/api-key-list.php:225 templates/observed-connections.php:148 1263 1363 #: templates/observed-connections.php:271 1264 1364 msgid "WordPress.com" 1265 1365 msgstr "" 1266 1366 1267 #: templates/api-key-list.php: 151templates/observed-connections.php:1491367 #: templates/api-key-list.php:227 templates/observed-connections.php:149 1268 1368 msgid "Direct" 1269 1369 msgstr "" 1270 1370 1271 #: templates/api-key-list.php: 1581371 #: templates/api-key-list.php:234 1272 1372 msgid "Not detected yet — shown once ShipStation connects through this key." 1273 1373 msgstr "" 1274 1374 1275 #: templates/api-key-list.php: 1751375 #: templates/api-key-list.php:251 1276 1376 msgid "Not connecting lately — delete if unused in ShipStation." 1277 1377 msgstr "" 1278 1378 1279 #: templates/api-key-list.php: 1781379 #: templates/api-key-list.php:254 1280 1380 msgid "Never" 1281 1381 msgstr "" 1282 1382 1283 #: templates/api-key-list.php: 1851383 #: templates/api-key-list.php:261 1284 1384 msgid "auto-deletes in" 1285 1385 msgstr "" 1286 1386 1287 #: templates/api-key-list.php: 1901387 #: templates/api-key-list.php:266 1288 1388 #. translators: %s: absolute date/time the key auto-deletes. 1289 1389 msgid "auto-deletes on %s" 1290 1390 msgstr "" 1291 1391 1292 #: templates/api-key-list.php: 1961392 #: templates/api-key-list.php:272 1293 1393 msgid "auto-deletes on the next cleanup." 1294 1394 msgstr "" 1295 1395 1296 #: templates/api-key-list.php:2 021396 #: templates/api-key-list.php:279 1297 1397 msgid "Delete" 1298 1398 msgstr "" 1299 1399 1300 #: templates/api-key-list.php:2 021400 #: templates/api-key-list.php:279 1301 1401 msgid "Delete this API key pair" 1302 1402 msgstr "" 1303 1403 1304 #: templates/api-key-list.php:2 111404 #: templates/api-key-list.php:289 1305 1405 msgid "" 1306 1406 "Delete keys you no longer use in ShipStation — fewer keys, less risk. A " 1307 1407 "deleted key stops working immediately." 1408 msgstr "" 1409 1410 #: templates/api-key-list.php:296 1411 #. translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. 1412 msgid "" 1413 "None of these keys belong to the ShipStation API user %s. It is a system " 1414 "account for this connection and cannot sign in. Do not delete it: " 1415 "ShipStation cannot connect without it." 1416 msgstr "" 1417 1418 #: templates/api-key-list.php:299 1419 #. translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. 1420 msgid "" 1421 "These keys belong to the ShipStation API user %s, except where noted. It is " 1422 "a system account for this connection and cannot sign in. Do not delete it: " 1423 "ShipStation cannot connect without it." 1424 msgstr "" 1425 1426 #: templates/api-key-list.php:302 1427 #. translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. 1428 msgid "" 1429 "These keys belong to the ShipStation API user %s. It is a system account " 1430 "for this connection and cannot sign in. Do not delete it: ShipStation " 1431 "cannot connect without it." 1308 1432 msgstr "" 1309 1433 -
woocommerce-shipstation-integration/tags/5.4.2/readme.txt
r3795802 r3807496 8 8 Requires PHP: 7.4 9 9 Requires Plugins: woocommerce 10 Stable tag: 5.4. 110 Stable tag: 5.4.2 11 11 License: GPLv3 12 12 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 74 74 75 75 == Changelog == 76 77 = 5.4.2 - 2026-11-17 = 78 * Fix - Security update. 79 * Tweak - Plugin-generated API keys now belong to a new ShipStation API user with limited permissions. Existing plugin keys move to it and keep working with ShipStation, but no longer reach orders, products or customers on other WooCommerce REST API routes. 76 80 77 81 = 5.4.1 - 2026-11-11 = -
woocommerce-shipstation-integration/tags/5.4.2/templates/api-key-list.php
r3586059 r3807496 17 17 * @var string $date_format Combined WP date+time format for absolute fallbacks. 18 18 * @var int $newest_key_id Key id of the prune-protected newest row. 19 * @var string $api_user_login Login of the ShipStation API user that owns the keys, or '' when there is none. 20 * @var int $api_user_id Id of the ShipStation API user, or 0 when there is none. 21 * @var array{move:string,repair:string} $api_user_errors Error codes of the last failed one-time key move ('move') and repair ('repair'), '' where it worked. 22 * @var int[] $skipped_key_ids Keys left alone because their owner could not use them. 23 * @var int[] $usable_skipped_key_ids Keys among them whose owner still passes the order and inventory routes. 19 24 */ 20 25 … … 28 33 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 29 34 ?> 35 <?php 36 $move_error = (string) ( $api_user_errors['move'] ?? '' ); 37 $repair_error = (string) ( $api_user_errors['repair'] ?? '' ); 38 $api_user_id = (int) $api_user_id; 39 $skipped_key_ids = array_map( 'intval', (array) $skipped_key_ids ); 40 41 // A key left alone whose owner still holds manage_product_terms keeps 42 // importing orders: only the routes that check manage_woocommerce refuse it. 43 $usable_skipped_key_ids = array_map( 'intval', (array) $usable_skipped_key_ids ); 44 45 // Without its permissions the API user's keys are refused. The keys it does 46 // not own yet still work as their previous owner. 47 $api_user_owns_a_key = false; 48 foreach ( $rows as $row ) { 49 if ( $api_user_id > 0 && isset( $row['user_id'] ) && (int) $row['user_id'] === $api_user_id ) { 50 $api_user_owns_a_key = true; 51 break; 52 } 53 } 54 55 if ( $api_user_owns_a_key && ( 'shipstation_api_user_role' === $move_error || 'shipstation_api_user_role' === $repair_error ) ) { 56 $api_user_notice = __( 'ShipStation requests are refused until the ShipStation API user has its permissions back. A role editor plugin may be removing them.', 'woocommerce-shipstation-integration' ); 57 } elseif ( '' !== $move_error ) { 58 $api_user_notice = __( 'Some ShipStation API keys could not be moved to the ShipStation API user. They still belong to their previous owner and keep working. The plugin tries again in about an hour.', 'woocommerce-shipstation-integration' ); 59 } elseif ( '' !== $repair_error ) { 60 $api_user_notice = __( 'Some ShipStation API keys could not be moved to the ShipStation API user. The plugin tries again later.', 'woocommerce-shipstation-integration' ); 61 } else { 62 $api_user_notice = ''; 63 } 64 65 $has_key_notes = false; 66 ?> 67 <?php if ( '' !== $api_user_notice ) : ?> 68 <div class="notice notice-error inline"> 69 <p> 70 <?php echo esc_html( $api_user_notice ); ?> 71 <?php esc_html_e( 'See the ShipStation log under WooCommerce > Status > Logs for details.', 'woocommerce-shipstation-integration' ); ?> 72 </p> 73 </div> 74 <?php endif; ?> 30 75 <?php if ( array() === $rows ) : ?> 31 76 <p><?php esc_html_e( 'No plugin-generated API keys yet.', 'woocommerce-shipstation-integration' ); ?></p> … … 81 126 } 82 127 } 128 // ShipStation refuses a key the sync left alone, even when its owner 129 // still uses it elsewhere, so it never reads as working or just made. 130 // The exception is a key whose owner still passes the order routes. 131 $is_skipped = in_array( (int) $row['key_id'], $skipped_key_ids, true ); 132 $is_refused = $is_skipped && ! in_array( (int) $row['key_id'], $usable_skipped_key_ids, true ); 133 if ( $is_refused && in_array( $pill_modifier, array( 'active', 'new' ), true ) ) { 134 $pill_modifier = 'rejected'; 135 $is_active = false; 136 $is_new = false; 137 } 83 138 $pill_label = $pill_labels[ $pill_modifier ]; 139 $can_delete = (bool) ( $row['can_delete'] ?? true ); 84 140 85 141 // Provisional (dimmed) treatment for everything not active. The … … 103 159 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- key_pill() escapes internally. 104 160 echo WC_ShipStation_Integration::key_pill( $pill_modifier, $pill_label ); 105 ?> 161 162 // A key the ShipStation API user does not own: refused, or not moved yet. 163 // A refused key is marked even when no API user exists yet. 164 $is_not_moved = $api_user_id > 0 && isset( $row['user_id'] ) && (int) $row['user_id'] !== $api_user_id; 165 if ( $is_skipped || $is_not_moved ) : 166 $has_key_notes = true; 167 ?> 168 <p class="description"> 169 <?php 170 if ( $is_refused && $can_delete ) { 171 esc_html_e( 'ShipStation refuses this key: its owner was deleted or lacks a permission ShipStation needs. Delete this key.', 'woocommerce-shipstation-integration' ); 172 } elseif ( $is_refused ) { 173 esc_html_e( 'ShipStation refuses this key: its owner was deleted or lacks a permission ShipStation needs. You cannot delete it here. Someone who can edit its owner can revoke it under WooCommerce > Settings > Advanced > REST API.', 'woocommerce-shipstation-integration' ); 174 } elseif ( $is_skipped ) { 175 esc_html_e( 'Not moved to the ShipStation API user: its owner lacks a permission ShipStation needs, so ShipStation refuses some requests with this key.', 'woocommerce-shipstation-integration' ); 176 } else { 177 esc_html_e( 'Not moved to the ShipStation API user yet.', 'woocommerce-shipstation-integration' ); 178 } 179 ?> 180 </p> 181 <?php endif; ?> 106 182 </td> 107 183 <?php … … 200 276 </td> 201 277 <td class="shipstation-api-key-actions shipstation-api-key-col"> 278 <?php if ( $can_delete ) : ?> 202 279 <button type="button" class="shipstation-delete-api-key" data-key-id="<?php echo esc_attr( (string) $row['key_id'] ); ?>" title="<?php esc_attr_e( 'Delete', 'woocommerce-shipstation-integration' ); ?>" aria-label="<?php esc_attr_e( 'Delete this API key pair', 'woocommerce-shipstation-integration' ); ?>"> 203 280 <span class="dashicons dashicons-trash"></span> 204 281 </button> 282 <?php endif; ?> 205 283 </td> 206 284 </tr> … … 211 289 <?php esc_html_e( 'Delete keys you no longer use in ShipStation — fewer keys, less risk. A deleted key stops working immediately.', 'woocommerce-shipstation-integration' ); ?> 212 290 </p> 291 <?php if ( '' !== $api_user_login ) : ?> 292 <p class="description"> 293 <?php 294 if ( ! $api_user_owns_a_key ) { 295 /* translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. */ 296 $owner_line = esc_html__( 'None of these keys belong to the ShipStation API user %s. It is a system account for this connection and cannot sign in. Do not delete it: ShipStation cannot connect without it.', 'woocommerce-shipstation-integration' ); 297 } elseif ( $has_key_notes ) { 298 /* translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. */ 299 $owner_line = esc_html__( 'These keys belong to the ShipStation API user %s, except where noted. It is a system account for this connection and cannot sign in. Do not delete it: ShipStation cannot connect without it.', 'woocommerce-shipstation-integration' ); 300 } else { 301 /* translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. */ 302 $owner_line = esc_html__( 'These keys belong to the ShipStation API user %s. It is a system account for this connection and cannot sign in. Do not delete it: ShipStation cannot connect without it.', 'woocommerce-shipstation-integration' ); 303 } 304 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above; the login is escaped here. 305 printf( $owner_line, '<code>' . esc_html( $api_user_login ) . '</code>' ); 306 ?> 307 </p> 308 <?php endif; ?> 213 309 <?php endif; ?> -
woocommerce-shipstation-integration/tags/5.4.2/uninstall.php
r3723614 r3807496 8 8 * authenticate with), nor the pre-SHIPSTN-142 plugin options (auth key, 9 9 * settings, activation-notice flag), which historically were left in place on 10 * uninstall. 10 * uninstall. The ShipStation API user that owns those keys is left too, with 11 * its role, its cached id (network option woocommerce_shipstation_api_user_id), 12 * the ids of deleted API users (network option 13 * woocommerce_shipstation_api_user_former_ids) and the record of each moved 14 * key's previous owner (woocommerce_shipstation_api_user_state), so a 15 * reinstall, of this version or an older one, keeps the connection and the 16 * move can be reversed by hand. Without the plugin the user is no longer 17 * locked: an administrator can sign it in, change its role or delete it. 11 18 * 12 19 * @package WC_ShipStation … … 27 34 * - Auth_Controller::KEY_META_OPTION / GEN_LOCK_OPTION 28 35 * - WPCOM_Connection::DISCONNECT_INTENT_OPTION / CONNECTED_URL_OPTION 36 * - API_User::SYNCED_OPTION 29 37 * 30 38 * @return void … … 46 54 'woocommerce_shipstation_last_success_ts', 47 55 'woocommerce_shipstation_global_banner_dismissed_at', 56 'woocommerce_shipstation_api_user_synced', 48 57 ); 49 58 -
woocommerce-shipstation-integration/tags/5.4.2/vendor/composer/installed.php
r3795802 r3807496 4 4 'pretty_version' => 'dev-trunk', 5 5 'version' => 'dev-trunk', 6 'reference' => ' f3cb6ebbd57a6d4dad8eaf57333228e929d5f967',6 'reference' => 'bef3afc1f34762ac8aff3f144942ecb305e6ec2e', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 113 113 'pretty_version' => 'dev-trunk', 114 114 'version' => 'dev-trunk', 115 'reference' => ' f3cb6ebbd57a6d4dad8eaf57333228e929d5f967',115 'reference' => 'bef3afc1f34762ac8aff3f144942ecb305e6ec2e', 116 116 'type' => 'wordpress-plugin', 117 117 'install_path' => __DIR__ . '/../../', -
woocommerce-shipstation-integration/tags/5.4.2/vendor/composer/jetpack_autoload_classmap.php
r3795802 r3807496 403 403 'path' => $baseDir . '/tests/bootstrap.php' 404 404 ), 405 'WooCommerce\\Shipping\\ShipStation\\Tests\\Unit\\API_User_Test' => array( 406 'version' => 'dev-trunk', 407 'path' => $baseDir . '/tests/Unit/API_User_Test.php' 408 ), 405 409 'WooCommerce\\Shipping\\ShipStation\\Tests\\Unit\\Ajax_Die_Rig_Trait' => array( 406 410 'version' => 'dev-trunk', -
woocommerce-shipstation-integration/tags/5.4.2/woocommerce-shipstation.php
r3795802 r3807496 3 3 * Plugin Name: ShipStation for WooCommerce 4 4 * Plugin URI: https://woocommerce.com/products/shipstation-integration/ 5 * Version: 5.4. 15 * Version: 5.4.2 6 6 * Description: Power your entire shipping operation from one platform. 7 7 * Author: WooCommerce … … 39 39 } 40 40 41 define( 'WC_SHIPSTATION_VERSION', '5.4. 1' ); // WRCS: DEFINED_VERSION.41 define( 'WC_SHIPSTATION_VERSION', '5.4.2' ); // WRCS: DEFINED_VERSION. 42 42 43 43 // Composer + Jetpack autoloader. Ships with the production zip; may be absent in -
woocommerce-shipstation-integration/trunk/changelog.txt
r3795802 r3807496 1 1 *** ShipStation for WooCommerce *** 2 3 = 5.4.2 - 2026-11-17 = 4 * Fix - Security update. 5 * Tweak - Plugin-generated API keys now belong to a new ShipStation API user with limited permissions. Existing plugin keys move to it and keep working with ShipStation, but no longer reach orders, products or customers on other WooCommerce REST API routes. 2 6 3 7 = 5.4.1 - 2026-11-11 = -
woocommerce-shipstation-integration/trunk/includes/api/rest/class-api-controller.php
r3795802 r3807496 12 12 } 13 13 14 use WooCommerce\Shipping\ShipStation\API_User; 14 15 use WooCommerce\Shipping\ShipStation\Auth_Controller; 15 16 use WooCommerce\Shipping\ShipStation\Connection_Log; … … 235 236 $proxied_row = $row; 236 237 } 238 239 // A key owned by the ShipStation API user must keep working after that 240 // user lost its role on this site. 241 API_User::repair_current_user(); 237 242 238 243 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Public hook name retained for backward compatibility. -
woocommerce-shipstation-integration/trunk/includes/class-auth-controller.php
r3723614 r3807496 50 50 * Plaintext prefix prepended to every plugin-generated consumer_secret. 51 51 * 52 * Stored verbatim in `consumer_secret char(43)`, so this prefix is the 53 * single source of truth for "did this plugin create this row?", used by 54 * the inline credentials section, the settings-tab key list, and the per-row 55 * delete ({@see delete_plugin_key_row()}) to identify our rows without 56 * false-positive risk against merchant-created keys. 52 * Stored verbatim in `consumer_secret char(43)`, so this prefix tells which 53 * rows this plugin minted, without false-positive risk against 54 * merchant-created keys. The inline credentials section, the settings-tab 55 * key list and the per-row delete ({@see delete_plugin_key_row()}) use it. 56 * The key list and the delete also accept unprefixed rows from before 5.0.8 57 * that the ShipStation API user key sync moved or left alone 58 * ({@see API_User::get_moved_key_ids()}, {@see API_User::get_skipped_key_ids()}). 57 59 * 58 60 * Length budget: prefix (8) + `wc_rand_hash()` tail (35) = 43, exactly … … 319 321 320 322 /** 321 * Return the first admin user ID to assign as the API key owner.322 *323 * WooCommerce REST auth runs every request under the key owner's capabilities.324 * Tying the key to the triggering user is unsafe: that user may later lose their325 * role or be deleted, causing every REST endpoint to return rest_forbidden.326 * Using the first administrator keeps the key stable.327 *328 * @return int329 */330 private function get_admin_user_id(): int {331 // Try site-level administrators first (works on single site and multisite).332 $admins = get_users(333 array(334 'role' => 'administrator',335 'number' => 1,336 'orderby' => 'ID',337 'order' => 'ASC',338 'fields' => 'ID',339 'count_total' => false,340 )341 );342 343 if ( ! empty( $admins ) ) {344 return (int) $admins[0];345 }346 347 // On multisite, fall back to the first network super admin.348 // get_users() only queries site-level roles, so super admins who haven't349 // been explicitly added to this site won't appear in the query above.350 if ( is_multisite() ) {351 $super_admins = get_super_admins();352 $user = ! empty( $super_admins ) ? get_user_by( 'login', $super_admins[0] ) : false;353 354 if ( $user ) {355 return $user->ID;356 }357 }358 359 return get_current_user_id();360 }361 362 /**363 323 * Generate new WooCommerce REST API credentials for the direct key set. 364 324 * … … 396 356 global $wpdb; 397 357 358 // The key belongs to the ShipStation API user, never to an administrator 359 // or to the person generating it. No user, no key. 360 $owner_id = API_User::ensure(); 361 if ( is_wp_error( $owner_id ) ) { 362 Logger::error( 'Failed to create the ShipStation API user, so no API key was generated: ' . $owner_id->get_error_message() ); 363 return array(); 364 } 365 398 366 // 8-char prefix + 35-char random tail = 43 chars total, exactly 399 367 // matching WC's default key shape and fitting `consumer_secret char(43)`. … … 403 371 404 372 $data = array( 405 'user_id' => $ this->get_admin_user_id(),373 'user_id' => $owner_id, 406 374 'description' => $description, 407 375 'permissions' => 'read_write', … … 698 666 * 699 667 * Rows are identified by the set prefixes on the plaintext 700 * `consumer_secret`; merchant-created keys never appear here. Powers the 701 * settings-tab key list from which the merchant retires old pairs. 702 * 703 * @since 5.2.0 704 * 705 * @return array[] Each: ['key_id' => int, 'transports' => string[], 'transport_last_seen' => array<string,string>, 'description' => string, 'truncated_key' => string, 'last_access' => string|null]. 668 * `consumer_secret`, plus the keys from before 5.0.8 that were moved to the 669 * ShipStation API user or left alone because their owner could not use 670 * them, which have no prefix. Other merchant-created keys never appear here. 671 * A hand-made key described "ShipStation Integration" can be among the 672 * moved or skipped rows, because the one-time move cannot tell it apart. 673 * Powers the settings-tab key list from which the merchant retires old pairs. 674 * 675 * @since 5.2.0 676 * 677 * @return array[] Each: ['key_id' => int, 'user_id' => int, 'transports' => string[], 'transport_last_seen' => array<string,string>, 'description' => string, 'truncated_key' => string, 'last_access' => string|null, 'is_prefixed' => bool]. 706 678 */ 707 679 public static function get_plugin_key_rows(): array { 708 680 global $wpdb; 709 681 710 $rows = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 711 $wpdb->prepare( 712 "SELECT key_id, description, truncated_key, last_access FROM {$wpdb->prefix}woocommerce_api_keys WHERE consumer_secret LIKE %s OR consumer_secret LIKE %s ORDER BY key_id DESC", 713 $wpdb->esc_like( self::API_SECRET_PREFIX ) . '%', 714 $wpdb->esc_like( self::WPCOM_API_SECRET_PREFIX ) . '%' 682 // Keys from before 5.0.8 the key sync moved or left alone. A store manager 683 // cannot revoke a moved one on WooCommerce's REST API screen once the API 684 // user owns it, and a key left alone is listed so it can be marked refused. 685 $synced_ids = array_values( array_unique( array_merge( API_User::get_moved_key_ids(), API_User::get_skipped_key_ids() ) ) ); 686 $synced_sql = ''; 687 if ( array() !== $synced_ids ) { 688 $synced_sql = ' OR key_id IN (' . implode( ',', array_fill( 0, count( $synced_ids ), '%d' ) ) . ')'; 689 } 690 691 // phpcs:ignore WordPress.DB.DirectDatabaseQuery, PluginCheck.Security.DirectDB.UnescapedDBParameter -- $synced_sql is a generated list of %d tokens consumed by prepare(); every id is bound. 692 $rows = $wpdb->get_results( 693 $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- Two prefixes, then one id per %d in $synced_sql. 694 "SELECT key_id, user_id, description, truncated_key, last_access, consumer_secret FROM {$wpdb->prefix}woocommerce_api_keys WHERE consumer_secret LIKE %s OR consumer_secret LIKE %s{$synced_sql} ORDER BY key_id DESC", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- $synced_sql holds only %d placeholders. 695 array_merge( 696 array( 697 $wpdb->esc_like( self::API_SECRET_PREFIX ) . '%', 698 $wpdb->esc_like( self::WPCOM_API_SECRET_PREFIX ) . '%', 699 ), 700 $synced_ids 701 ) 715 702 ), 716 703 ARRAY_A … … 720 707 return array(); 721 708 } 709 710 // A recorded id on another key is a new key that got a deleted key's id. 711 $rows = array_values( 712 array_filter( 713 $rows, 714 static function ( $row ) { 715 return self::is_plugin_secret( (string) ( $row['consumer_secret'] ?? '' ) ) 716 || API_User::is_recorded_key( (int) $row['key_id'], (string) ( $row['truncated_key'] ?? '' ) ); 717 } 718 ) 719 ); 722 720 723 721 $key_ids = array(); … … 735 733 $result[] = array( 736 734 'key_id' => $key_id, 735 'user_id' => (int) ( $row['user_id'] ?? 0 ), 737 736 // Observed transports the key has actually authenticated over — 738 737 // the honest basis for the "Type" column ('wpcom'/'direct'/both). … … 744 743 'truncated_key' => isset( $row['truncated_key'] ) ? (string) $row['truncated_key'] : '', 745 744 'last_access' => isset( $row['last_access'] ) ? $row['last_access'] : null, 745 // The secret itself is not passed on. 746 'is_prefixed' => self::is_plugin_secret( (string) ( $row['consumer_secret'] ?? '' ) ), 746 747 ); 747 748 } … … 751 752 752 753 /** 754 * Whether the current user may delete a key row through the plugin's key list. 755 * 756 * A prefixed row is the plugin's. A row from before 5.0.8 is deletable while 757 * the ShipStation API user owns it after the move. A row the key sync left 758 * alone may still work on other routes as its owner, so it follows 759 * WooCommerce's revoke rule: the current user can edit the owner, which 760 * includes the owner itself. A key whose owner was deleted works nowhere, so 761 * anyone who manages the key list may delete it. 762 * 763 * @internal The row values must come from the database, as in {@see delete_plugin_key_row()}. 764 * 765 * @since 5.4.2 766 * 767 * @param int $key_id Row id. 768 * @param int $owner_id Row owner. 769 * @param bool $is_prefixed Whether the row's consumer secret has a plugin prefix. 770 * 771 * @return bool 772 */ 773 public static function current_user_may_delete_key_row( int $key_id, int $owner_id, bool $is_prefixed ): bool { 774 if ( $is_prefixed ) { 775 return true; 776 } 777 778 $api_user_id = API_User::get_user_id(); 779 if ( $api_user_id > 0 && $owner_id === $api_user_id && in_array( $key_id, API_User::get_moved_key_ids(), true ) ) { 780 return true; 781 } 782 783 if ( in_array( $key_id, API_User::get_skipped_key_ids(), true ) ) { 784 return ! get_userdata( $owner_id ) || current_user_can( 'edit_user', $owner_id ); 785 } 786 787 return false; 788 } 789 790 /** 753 791 * Delete one plugin-generated key row by id. 754 792 * 755 * The WHERE clause re-checks the set prefixes, so a merchant-created row 756 * can never be deleted through this path no matter what id is posted. 793 * Checks {@see current_user_may_delete_key_row()} first, so a row that is 794 * neither prefixed nor recorded by the API user key sync can never be 795 * deleted through this path no matter what id is posted, and the delete is 796 * bound to the owner that was checked. 757 797 * 758 798 * @since 5.2.0 … … 765 805 global $wpdb; 766 806 807 $row = $wpdb->get_row( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 808 $wpdb->prepare( "SELECT user_id, consumer_secret, truncated_key FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d", $key_id ) 809 ); 810 if ( '' !== $wpdb->last_error ) { 811 Logger::error( 'Failed to delete ShipStation API key row. DB error: ' . $wpdb->last_error ); 812 return false; 813 } 814 if ( ! $row ) { 815 return false; 816 } 817 818 // An unprefixed row is the plugin's only while the key sync recorded this very key. 819 $is_prefixed = self::is_plugin_secret( (string) $row->consumer_secret ); 820 if ( ! $is_prefixed && ! API_User::is_recorded_key( $key_id, (string) $row->truncated_key ) ) { 821 return false; 822 } 823 if ( ! self::current_user_may_delete_key_row( $key_id, (int) $row->user_id, $is_prefixed ) ) { 824 return false; 825 } 826 767 827 $result = $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 768 828 $wpdb->prepare( 769 "DELETE FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d AND ( consumer_secret LIKE %s OR consumer_secret LIKE %s )",829 "DELETE FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d AND user_id = %d", 770 830 $key_id, 771 $wpdb->esc_like( self::API_SECRET_PREFIX ) . '%', 772 $wpdb->esc_like( self::WPCOM_API_SECRET_PREFIX ) . '%' 831 (int) $row->user_id 773 832 ) 774 833 ); … … 781 840 if ( $result > 0 ) { 782 841 self::forget_key_meta( $key_id ); 842 API_User::forget_key( $key_id ); 783 843 } 784 844 … … 891 951 if ( ! current_user_can( 'manage_woocommerce' ) ) { 892 952 wp_die( esc_html__( 'You do not have sufficient permissions.', 'woocommerce-shipstation-integration' ) ); 953 } 954 955 // The key acts with the API user's capabilities, so its creator must hold 956 // each of them. A custom role can reach this screen with only the first. 957 foreach ( API_User::CAPABILITIES as $capability ) { 958 // phpcs:ignore WordPress.WP.Capabilities.Undetermined -- WooCommerce core capabilities, listed in API_User::CAPABILITIES. 959 if ( ! current_user_can( $capability ) ) { 960 Logger::info( sprintf( 'ShipStation API keys were not generated for user ID %d, who lacks the %s capability.', get_current_user_id(), $capability ) ); 961 wp_send_json_error( 962 array( 963 'message' => __( 'Your account cannot generate ShipStation API keys. It needs permission to manage WooCommerce and to manage product categories, tags and attributes. Ask an administrator to generate them.', 'woocommerce-shipstation-integration' ), 964 ) 965 ); 966 return; 967 } 968 } 969 970 // Checked here, before the key insert, so the merchant is told that the 971 // user, not the database, is the problem. 972 $api_user = API_User::ensure(); 973 if ( is_wp_error( $api_user ) ) { 974 Logger::error( 'Failed to set up the ShipStation API user, so no API key was generated: ' . $api_user->get_error_message() ); 975 976 switch ( $api_user->get_error_code() ) { 977 case 'shipstation_api_user_busy': 978 $message = __( 'Another request is setting up the ShipStation API user. Wait a moment, then try again.', 'woocommerce-shipstation-integration' ); 979 break; 980 case 'shipstation_api_user_role': 981 $message = __( 'The ShipStation API user could not get the permissions it needs, so no keys were generated. A role editor plugin may be removing them. See the ShipStation log under WooCommerce > Status > Logs.', 'woocommerce-shipstation-integration' ); 982 break; 983 default: 984 $message = __( 'The ShipStation API user could not be created, so no keys were generated. Another plugin may be blocking new user accounts. See the ShipStation log under WooCommerce > Status > Logs for the reason.', 'woocommerce-shipstation-integration' ); 985 } 986 987 wp_send_json_error( array( 'message' => $message ) ); 988 return; 893 989 } 894 990 … … 961 1057 962 1058 if ( $key_id <= 0 || ! self::delete_plugin_key_row( $key_id ) ) { 963 wp_send_json_error( 964 array( 'message' => __( 'This key could not be deleted. It may have been removed already.', 'woocommerce-shipstation-integration' ) ) 965 ); 1059 global $wpdb; 1060 1061 // The row is still there, so the delete was refused or failed, not too late. 1062 $row = $key_id > 0 ? $wpdb->get_row( // phpcs:ignore WordPress.DB.DirectDatabaseQuery 1063 $wpdb->prepare( "SELECT truncated_key, consumer_secret FROM {$wpdb->prefix}woocommerce_api_keys WHERE key_id = %d", $key_id ) 1064 ) : null; 1065 $still_there = null !== $row; 1066 1067 // A refused row the key list shows belongs to an owner the current user cannot edit. 1068 $is_listed = $still_there && API_User::is_recorded_key( $key_id, (string) $row->truncated_key ); 1069 1070 if ( ! $still_there ) { 1071 $message = __( 'This key could not be deleted. It may have been removed already.', 'woocommerce-shipstation-integration' ); 1072 } elseif ( self::is_plugin_secret( (string) $row->consumer_secret ) ) { 1073 // A prefixed row is never refused, so the delete itself failed. 1074 $message = __( 'This key could not be deleted. Try again, and see the ShipStation log under WooCommerce > Status > Logs if it keeps failing.', 'woocommerce-shipstation-integration' ); 1075 } elseif ( $is_listed ) { 1076 $message = __( 'You cannot delete this key here. Someone who can edit its owner can revoke it under WooCommerce > Settings > Advanced > REST API.', 'woocommerce-shipstation-integration' ); 1077 } else { 1078 $message = __( 'You cannot delete this key here. It is not in the ShipStation key list.', 'woocommerce-shipstation-integration' ); 1079 } 1080 1081 wp_send_json_error( array( 'message' => $message ) ); 966 1082 return; 967 1083 } … … 1142 1258 global $wpdb; 1143 1259 1260 // A store nobody signs in to gets its keys moved here. After that, put 1261 // the role back and reclaim keys whose API user was deleted. 1262 API_User::maybe_sync(); 1263 $synced = API_User::sync_keys(); 1264 if ( is_wp_error( $synced ) ) { 1265 Logger::error( 'Could not repair the ShipStation API user: ' . $synced->get_error_message() ); 1266 } 1267 1144 1268 // Give any untracked plugin key a mint baseline so legacy never-used keys 1145 1269 // become prunable rather than lingering forever. -
woocommerce-shipstation-integration/trunk/includes/class-main.php
r3795802 r3807496 79 79 public function __construct() { 80 80 add_action( 'plugins_loaded', array( $this, 'init' ) ); 81 82 // Registered here, not in init(), so the ShipStation API user stays 83 // protected while WooCommerce is inactive. 84 require_once WC_SHIPSTATION_ABSPATH . 'includes/class-api-user.php'; 85 API_User::register_protection(); 81 86 add_filter( 'woocommerce_integrations', array( $this, 'load_integration' ) ); 82 87 add_action( 'woocommerce_api_wc_shipstation', array( $this, 'load_api' ) ); … … 137 142 // schedules the recurring action on `init`. 138 143 Auth_Controller::register_orphan_prune(); 144 145 // Move this site's existing API keys to the ShipStation API user, once, 146 // on an admin request or in the daily key job. 147 API_User::register(); 139 148 140 149 add_action( 'before_woocommerce_init', array( $this, 'before_woocommerce_init' ) ); -
woocommerce-shipstation-integration/trunk/includes/class-wc-shipstation-integration.php
r3795802 r3807496 13 13 use WooCommerce\Shipping\ShipStation\Enum_Helper; 14 14 use WooCommerce\Shipping\ShipStation\Logger; 15 use WooCommerce\Shipping\ShipStation\API_User; 15 16 use WooCommerce\Shipping\ShipStation\Auth_Controller; 16 17 use WooCommerce\Shipping\ShipStation\Connection_Log; … … 1678 1679 // protects and the most likely live credential, so it alone is flagged 1679 1680 // "(newest)" and never carries an auto-remove countdown. 1680 $newest_key_id = isset( $rows[0]['key_id'] ) ? (int) $rows[0]['key_id'] : 0; 1681 // The list also holds unprefixed keys from before 5.0.8, which the prune 1682 // never looks at, so the newest is the newest prefixed row. 1683 $newest_key_id = 0; 1684 foreach ( $rows as $row ) { 1685 if ( ! empty( $row['is_prefixed'] ) ) { 1686 $newest_key_id = (int) $row['key_id']; 1687 break; 1688 } 1689 } 1681 1690 1682 1691 // Order by "Last seen": the freshly-generated New key is always pinned to … … 1724 1733 ob_start(); 1725 1734 1735 // Repair the API user before listing its keys: put its role back, and on 1736 // multisite, or after a delete made without WooCommerce active, give the 1737 // keys of a deleted API user to its replacement. 1738 $synced = API_User::sync_keys(); 1739 if ( is_wp_error( $synced ) ) { 1740 Logger::error( 'Could not repair the ShipStation API user: ' . $synced->get_error_message() ); 1741 } 1742 $api_user_id = API_User::get_user_id(); 1743 $api_user = $api_user_id > 0 ? get_userdata( $api_user_id ) : false; 1744 1726 1745 list( $key_rows, $newest_key_id ) = self::get_sorted_plugin_key_rows(); 1727 1746 … … 1744 1763 $rows_for_key = isset( $connections_by_key[ (int) $key_row['key_id'] ] ) ? $connections_by_key[ (int) $key_row['key_id'] ] : array(); 1745 1764 $key_rows[ $index ]['rollup_status'] = Connection_Log::key_rollup_status( $rows_for_key, $active_window, $transport_enabled, $current_host, $is_wpcom_connected ); 1765 $key_rows[ $index ]['can_delete'] = Auth_Controller::current_user_may_delete_key_row( (int) $key_row['key_id'], (int) $key_row['user_id'], ! empty( $key_row['is_prefixed'] ) ); 1766 } 1767 1768 // Refused keys among the listed rows, matched by fingerprint, so a new key 1769 // that got a skipped key's id is not marked refused. 1770 // Among them, a key whose owner still holds manage_product_terms passes 1771 // the order and inventory routes, so ShipStation still imports with it. 1772 $skipped_key_ids = array(); 1773 $usable_skipped_key_ids = array(); 1774 foreach ( $key_rows as $key_row ) { 1775 if ( in_array( (int) $key_row['key_id'], API_User::get_skipped_key_ids(), true ) && API_User::is_recorded_key( (int) $key_row['key_id'], (string) $key_row['truncated_key'] ) ) { 1776 $skipped_key_ids[] = (int) $key_row['key_id']; 1777 1778 // phpcs:ignore WordPress.WP.Capabilities.Unknown -- WooCommerce core capability. 1779 if ( get_userdata( (int) $key_row['user_id'] ) && user_can( (int) $key_row['user_id'], 'manage_product_terms' ) ) { 1780 $usable_skipped_key_ids[] = (int) $key_row['key_id']; 1781 } 1782 } 1746 1783 } 1747 1784 … … 1749 1786 'api-key-list.php', 1750 1787 array( 1751 'rows' => $key_rows, 1752 'active_window' => $active_window, 1753 'transport_enabled' => $transport_enabled, 1754 'date_format' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), 1755 'newest_key_id' => $newest_key_id, 1788 'rows' => $key_rows, 1789 'active_window' => $active_window, 1790 'transport_enabled' => $transport_enabled, 1791 'date_format' => get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), 1792 'newest_key_id' => $newest_key_id, 1793 'api_user_login' => $api_user ? $api_user->user_login : '', 1794 'api_user_id' => $api_user ? $api_user_id : 0, 1795 'api_user_errors' => API_User::get_errors(), 1796 'skipped_key_ids' => $skipped_key_ids, 1797 'usable_skipped_key_ids' => $usable_skipped_key_ids, 1756 1798 ), 1757 1799 '', -
woocommerce-shipstation-integration/trunk/languages/woocommerce-shipstation.pot
r3795802 r3807496 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: ShipStation for WooCommerce 5.4. 1\n"5 "Project-Id-Version: ShipStation for WooCommerce 5.4.2\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "https://wordpress.org/support/plugin/woocommerce-shipstation\n" 8 "POT-Creation-Date: 2026-11-1 1 07:27:21+00:00\n"8 "POT-Creation-Date: 2026-11-17 13:33:20+00:00\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=utf-8\n" … … 144 144 msgstr "" 145 145 146 #: includes/api/rest/class-api-controller.php:2 87146 #: includes/api/rest/class-api-controller.php:292 147 147 msgid "Invalid ShipStation credentials." 148 148 msgstr "" … … 375 375 376 376 #: includes/checkout/class-checkout-rates-options.php:637 377 #: includes/class-wc-shipstation-integration.php:145 8377 #: includes/class-wc-shipstation-integration.php:1459 378 378 #: vendor/automattic/jetpack-connection/src/class-users-connection-admin.php:90 379 379 msgid "Connected" … … 416 416 417 417 #: includes/checkout/class-checkout-rates-options.php:678 418 #: includes/class-wc-shipstation-integration.php:162 8418 #: includes/class-wc-shipstation-integration.php:1629 419 419 msgid "Active" 420 420 msgstr "" … … 463 463 msgstr "" 464 464 465 #: includes/class-auth-controller.php:270 465 #: includes/class-api-user.php:606 466 msgid "This account is used by the ShipStation connection and cannot sign in." 467 msgstr "" 468 469 #: includes/class-api-user.php:802 470 msgid "" 471 "The ShipStation API user was left out. It cannot be deleted, removed from a " 472 "site or given another role, because ShipStation connects through it." 473 msgstr "" 474 475 #: includes/class-api-user.php:1199 includes/class-api-user.php:1204 476 #: includes/class-auth-controller.php:331 477 msgid "ShipStation Integration" 478 msgstr "" 479 480 #: includes/class-auth-controller.php:272 466 481 msgid "Copied!" 467 482 msgstr "" 468 483 469 #: includes/class-auth-controller.php:27 1484 #: includes/class-auth-controller.php:273 470 485 #: templates/partials/credential-field.php:43 471 486 msgid "Show" 472 487 msgstr "" 473 488 474 #: includes/class-auth-controller.php:27 2489 #: includes/class-auth-controller.php:274 475 490 msgid "Hide" 476 491 msgstr "" 477 492 478 #: includes/class-auth-controller.php:27 3493 #: includes/class-auth-controller.php:275 479 494 msgid "Could not generate new keys. Please try again." 480 495 msgstr "" 481 496 482 #: includes/class-auth-controller.php:27 4497 #: includes/class-auth-controller.php:276 483 498 msgid "" 484 499 "Generate a new set of REST API keys? Existing keys stay valid until you " … … 487 502 msgstr "" 488 503 489 #: includes/class-auth-controller.php:27 6504 #: includes/class-auth-controller.php:278 490 505 msgid "" 491 506 "Dangerously disconnect from WordPress.com? No direct ShipStation connection " … … 494 509 msgstr "" 495 510 496 #: includes/class-auth-controller.php:371 497 msgid "ShipStation Integration" 498 msgstr "" 499 500 #: includes/class-auth-controller.php:887 501 #: includes/class-auth-controller.php:952 511 #: includes/class-auth-controller.php:947 512 #: includes/class-auth-controller.php:1048 502 513 #: includes/class-global-connection-banner.php:139 503 514 msgid "Security check failed" 504 515 msgstr "" 505 516 506 #: includes/class-auth-controller.php: 892507 #: includes/class-auth-controller.php: 957517 #: includes/class-auth-controller.php:952 518 #: includes/class-auth-controller.php:1053 508 519 #: includes/class-global-connection-banner.php:144 509 520 #: includes/class-wpcom-connection.php:1278 … … 511 522 msgstr "" 512 523 513 #: includes/class-auth-controller.php:898 524 #: includes/class-auth-controller.php:963 525 msgid "" 526 "Your account cannot generate ShipStation API keys. It needs permission to " 527 "manage WooCommerce and to manage product categories, tags and attributes. " 528 "Ask an administrator to generate them." 529 msgstr "" 530 531 #: includes/class-auth-controller.php:978 532 msgid "" 533 "Another request is setting up the ShipStation API user. Wait a moment, then " 534 "try again." 535 msgstr "" 536 537 #: includes/class-auth-controller.php:981 538 msgid "" 539 "The ShipStation API user could not get the permissions it needs, so no keys " 540 "were generated. A role editor plugin may be removing them. See the " 541 "ShipStation log under WooCommerce > Status > Logs." 542 msgstr "" 543 544 #: includes/class-auth-controller.php:984 545 msgid "" 546 "The ShipStation API user could not be created, so no keys were generated. " 547 "Another plugin may be blocking new user accounts. See the ShipStation log " 548 "under WooCommerce > Status > Logs for the reason." 549 msgstr "" 550 551 #: includes/class-auth-controller.php:994 514 552 msgid "" 515 553 "Another request is currently generating REST API keys. Please refresh the " … … 517 555 msgstr "" 518 556 519 #: includes/class-auth-controller.php: 916557 #: includes/class-auth-controller.php:1012 520 558 msgid "" 521 559 "Failed to generate API credentials. Please try again or contact your " … … 523 561 msgstr "" 524 562 525 #: includes/class-auth-controller.php: 964563 #: includes/class-auth-controller.php:1071 526 564 msgid "This key could not be deleted. It may have been removed already." 527 565 msgstr "" 528 566 529 #: includes/class-auth-controller.php:1210 567 #: includes/class-auth-controller.php:1074 568 msgid "" 569 "This key could not be deleted. Try again, and see the ShipStation log under " 570 "WooCommerce > Status > Logs if it keeps failing." 571 msgstr "" 572 573 #: includes/class-auth-controller.php:1076 574 msgid "" 575 "You cannot delete this key here. Someone who can edit its owner can revoke " 576 "it under WooCommerce > Settings > Advanced > REST API." 577 msgstr "" 578 579 #: includes/class-auth-controller.php:1078 580 msgid "You cannot delete this key here. It is not in the ShipStation key list." 581 msgstr "" 582 583 #: includes/class-auth-controller.php:1334 530 584 msgid "View ShipStation connection details" 531 585 msgstr "" … … 610 664 msgstr "" 611 665 612 #: includes/class-main.php: 97666 #: includes/class-main.php:102 613 667 #. translators: %s WC download URL link. 614 668 msgid "" … … 617 671 msgstr "" 618 672 619 #: includes/class-main.php: 599673 #: includes/class-main.php:608 620 674 msgid "Settings" 621 675 msgstr "" 622 676 623 #: includes/class-main.php:60 0677 #: includes/class-main.php:609 624 678 msgid "Support" 625 679 msgstr "" 626 680 627 #: includes/class-main.php:6 01681 #: includes/class-main.php:610 628 682 msgid "Docs" 629 683 msgstr "" … … 730 784 msgstr "" 731 785 732 #: includes/class-wc-shipstation-integration.php:23 2786 #: includes/class-wc-shipstation-integration.php:233 733 787 #: includes/class-wc-shipstation-privacy.php:24 734 788 #: includes/data/data-settings.php:55 includes/data/data-settings.php:61 … … 739 793 msgstr "" 740 794 741 #: includes/class-wc-shipstation-integration.php:23 3795 #: includes/class-wc-shipstation-integration.php:234 742 796 msgid "" 743 797 "ShipStation allows you to retrieve & manage orders, then print labels " … … 745 799 msgstr "" 746 800 747 #: includes/class-wc-shipstation-integration.php:36 1801 #: includes/class-wc-shipstation-integration.php:362 748 802 msgid "Choose which order statuses to export to ShipStation." 749 803 msgstr "" 750 804 751 #: includes/class-wc-shipstation-integration.php:36 2805 #: includes/class-wc-shipstation-integration.php:363 752 806 msgid "Each selected status must also be mapped to a ShipStation status." 753 807 msgstr "" 754 808 755 #: includes/class-wc-shipstation-integration.php:36 3809 #: includes/class-wc-shipstation-integration.php:364 756 810 msgid "" 757 811 "Mappings are managed below or in your ShipStation account (depending on " … … 759 813 msgstr "" 760 814 761 #: includes/class-wc-shipstation-integration.php:366 815 #: includes/class-wc-shipstation-integration.php:367 816 #: includes/class-wc-shipstation-integration.php:967 817 msgid "All statuses are selected for export." 818 msgstr "" 819 820 #: includes/class-wc-shipstation-integration.php:369 762 821 #: includes/class-wc-shipstation-integration.php:966 763 msgid "All statuses are selected for export."764 msgstr ""765 766 #: includes/class-wc-shipstation-integration.php:368767 #: includes/class-wc-shipstation-integration.php:965768 822 msgid "Excluded from export:" 769 823 msgstr "" 770 824 771 #: includes/class-wc-shipstation-integration.php:38 0825 #: includes/class-wc-shipstation-integration.php:381 772 826 #. translators: %s: comma-separated list of WC order status names 773 827 msgid "" … … 776 830 msgstr "" 777 831 778 #: includes/class-wc-shipstation-integration.php:47 1832 #: includes/class-wc-shipstation-integration.php:472 779 833 msgid "" 780 834 "Settings saved, but some selected export statuses are not mapped to a " … … 782 836 msgstr "" 783 837 784 #: includes/class-wc-shipstation-integration.php:96 7838 #: includes/class-wc-shipstation-integration.php:968 785 839 msgid "Selected for export but not mapped to a ShipStation status:" 786 840 msgstr "" 787 841 788 #: includes/class-wc-shipstation-integration.php:96 8842 #: includes/class-wc-shipstation-integration.php:969 789 843 msgid "Map them below so their orders are exported correctly." 790 844 msgstr "" 791 845 792 #: includes/class-wc-shipstation-integration.php:97 1846 #: includes/class-wc-shipstation-integration.php:972 793 847 msgid "" 794 848 "Delete this API key pair? Any ShipStation connection still using it will " … … 796 850 msgstr "" 797 851 798 #: includes/class-wc-shipstation-integration.php:97 2852 #: includes/class-wc-shipstation-integration.php:973 799 853 #: vendor/automattic/jetpack-connection/src/class-connection-notice.php:236 800 854 msgid "Something went wrong. Please try again." 801 855 msgstr "" 802 856 803 #: includes/class-wc-shipstation-integration.php:100 7857 #: includes/class-wc-shipstation-integration.php:1008 804 858 msgid "This feature requires WooCommerce 9.7.0 or higher." 805 859 msgstr "" 806 860 807 #: includes/class-wc-shipstation-integration.php:107 6861 #: includes/class-wc-shipstation-integration.php:1077 808 862 #: includes/data/data-settings.php:169 809 863 msgid "Enable WordPress.com Transport" 810 864 msgstr "" 811 865 812 #: includes/class-wc-shipstation-integration.php:11 19866 #: includes/class-wc-shipstation-integration.php:1120 813 867 msgid "" 814 868 "Routes ShipStation traffic to your store through WordPress.com, providing a " … … 817 871 msgstr "" 818 872 819 #: includes/class-wc-shipstation-integration.php:113 1873 #: includes/class-wc-shipstation-integration.php:1132 820 874 #. translators: %s: the constant or filter name (wrapped in a <code> tag) that 821 875 #. is forcing the setting on. … … 825 879 msgstr "" 826 880 827 #: includes/class-wc-shipstation-integration.php:135 7881 #: includes/class-wc-shipstation-integration.php:1358 828 882 msgid "" 829 883 "You're turning on WordPress.com Transport. After you save, update your " … … 833 887 msgstr "" 834 888 835 #: includes/class-wc-shipstation-integration.php:13 59889 #: includes/class-wc-shipstation-integration.php:1360 836 890 msgid "" 837 891 "You're turning off WordPress.com Transport. ShipStation has a recent direct " … … 843 897 msgstr "" 844 898 845 #: includes/class-wc-shipstation-integration.php:136 0899 #: includes/class-wc-shipstation-integration.php:1361 846 900 msgid "" 847 901 "You're turning off WordPress.com Transport. After you save, update your " … … 851 905 msgstr "" 852 906 853 #: includes/class-wc-shipstation-integration.php:137 4907 #: includes/class-wc-shipstation-integration.php:1375 854 908 msgid "Credentials" 855 909 msgstr "" 856 910 857 #: includes/class-wc-shipstation-integration.php:138 8911 #: includes/class-wc-shipstation-integration.php:1389 858 912 msgid "Connections" 859 913 msgstr "" 860 914 861 #: includes/class-wc-shipstation-integration.php:14 09915 #: includes/class-wc-shipstation-integration.php:1410 862 916 msgid "API Keys" 863 917 msgstr "" 864 918 865 #: includes/class-wc-shipstation-integration.php:146 1919 #: includes/class-wc-shipstation-integration.php:1462 866 920 msgid "Action needed" 867 921 msgstr "" 868 922 869 #: includes/class-wc-shipstation-integration.php:146 4923 #: includes/class-wc-shipstation-integration.php:1465 870 924 msgid "Not connected yet" 871 925 msgstr "" 872 926 873 #: includes/class-wc-shipstation-integration.php:149 3927 #: includes/class-wc-shipstation-integration.php:1494 874 928 msgid "" 875 929 "ShipStation hasn't connected yet. Copy the values below into ShipStation to " … … 877 931 msgstr "" 878 932 879 #: includes/class-wc-shipstation-integration.php:149 8933 #: includes/class-wc-shipstation-integration.php:1499 880 934 msgid "" 881 935 "ShipStation hasn't synced in over a day, so new orders may not be " … … 885 939 msgstr "" 886 940 887 #: includes/class-wc-shipstation-integration.php:150 3941 #: includes/class-wc-shipstation-integration.php:1504 888 942 msgid "" 889 943 "Your store's web address changed, so the route ShipStation saved no longer " … … 892 946 msgstr "" 893 947 894 #: includes/class-wc-shipstation-integration.php:150 4948 #: includes/class-wc-shipstation-integration.php:1505 895 949 msgid "Show the Store URL" 896 950 msgstr "" 897 951 898 #: includes/class-wc-shipstation-integration.php:150 8952 #: includes/class-wc-shipstation-integration.php:1509 899 953 msgid "" 900 954 "WordPress.com is disconnected, so ShipStation can't reach your store " … … 903 957 msgstr "" 904 958 905 #: includes/class-wc-shipstation-integration.php:15 09959 #: includes/class-wc-shipstation-integration.php:1510 906 960 msgid "Reconnect WordPress.com" 907 961 msgstr "" 908 962 909 #: includes/class-wc-shipstation-integration.php:151 3963 #: includes/class-wc-shipstation-integration.php:1514 910 964 msgid "" 911 965 "WordPress.com transport is off, so your store is turning away the proxied " … … 914 968 msgstr "" 915 969 916 #: includes/class-wc-shipstation-integration.php:151 4970 #: includes/class-wc-shipstation-integration.php:1515 917 971 msgid "Review transport setting" 918 972 msgstr "" 919 973 920 #: includes/class-wc-shipstation-integration.php:156 1974 #: includes/class-wc-shipstation-integration.php:1562 921 975 msgid "" 922 976 "The WordPress.com connection package is unavailable. Reinstall plugin " … … 924 978 msgstr "" 925 979 926 #: includes/class-wc-shipstation-integration.php:16 29980 #: includes/class-wc-shipstation-integration.php:1630 927 981 msgid "Inactive" 928 982 msgstr "" 929 983 930 #: includes/class-wc-shipstation-integration.php:163 0984 #: includes/class-wc-shipstation-integration.php:1631 931 985 msgid "Rejected" 932 986 msgstr "" 933 987 934 #: includes/class-wc-shipstation-integration.php:163 1988 #: includes/class-wc-shipstation-integration.php:1632 935 989 msgid "Disconnected" 936 990 msgstr "" 937 991 938 #: includes/class-wc-shipstation-integration.php:163 2992 #: includes/class-wc-shipstation-integration.php:1633 939 993 msgid "Mismatch" 940 994 msgstr "" 941 995 942 #: includes/class-wc-shipstation-integration.php:163 3996 #: includes/class-wc-shipstation-integration.php:1634 943 997 msgid "Deleted" 944 998 msgstr "" 945 999 946 #: includes/class-wc-shipstation-integration.php:163 41000 #: includes/class-wc-shipstation-integration.php:1635 947 1001 msgid "New" 948 1002 msgstr "" 949 1003 950 #: includes/class-wc-shipstation-integration.php:163 51004 #: includes/class-wc-shipstation-integration.php:1636 951 1005 msgid "Unused" 952 1006 msgstr "" 953 1007 954 #: includes/class-wc-shipstation-integration.php:18 331008 #: includes/class-wc-shipstation-integration.php:1875 955 1009 msgid "Action failed. Please refresh the page and retry." 956 1010 msgstr "" 957 1011 958 #: includes/class-wc-shipstation-integration.php:18 381012 #: includes/class-wc-shipstation-integration.php:1880 959 1013 msgid "Cheatin’ huh?" 960 1014 msgstr "" 961 1015 962 #: includes/class-wc-shipstation-integration.php:1 8601016 #: includes/class-wc-shipstation-integration.php:1902 963 1017 msgid "ShipStation logo" 964 1018 msgstr "" 965 1019 966 #: includes/class-wc-shipstation-integration.php:1 8701020 #: includes/class-wc-shipstation-integration.php:1912 967 1021 #. translators: %s: ShipStation URL 968 1022 msgid "" … … 972 1026 msgstr "" 973 1027 974 #: includes/class-wc-shipstation-integration.php:1 8851028 #: includes/class-wc-shipstation-integration.php:1927 975 1029 msgid "" 976 1030 "After logging in, add WooCommerce as a selling channel in ShipStation. Use " … … 979 1033 msgstr "" 980 1034 981 #: includes/class-wc-shipstation-integration.php:19 021035 #: includes/class-wc-shipstation-integration.php:1944 982 1036 #. translators: %1$s: ShipStation plugin settings URL, %2$s: ShipStation 983 1037 #. documentation URL … … 1240 1294 msgstr "" 1241 1295 1242 #: templates/api-key-list.php:31 1296 #: templates/api-key-list.php:56 1297 msgid "" 1298 "ShipStation requests are refused until the ShipStation API user has its " 1299 "permissions back. A role editor plugin may be removing them." 1300 msgstr "" 1301 1302 #: templates/api-key-list.php:58 1303 msgid "" 1304 "Some ShipStation API keys could not be moved to the ShipStation API user. " 1305 "They still belong to their previous owner and keep working. The plugin " 1306 "tries again in about an hour." 1307 msgstr "" 1308 1309 #: templates/api-key-list.php:60 1310 msgid "" 1311 "Some ShipStation API keys could not be moved to the ShipStation API user. " 1312 "The plugin tries again later." 1313 msgstr "" 1314 1315 #: templates/api-key-list.php:71 1316 msgid "See the ShipStation log under WooCommerce > Status > Logs for details." 1317 msgstr "" 1318 1319 #: templates/api-key-list.php:76 1243 1320 msgid "No plugin-generated API keys yet." 1244 1321 msgstr "" 1245 1322 1246 #: templates/api-key-list.php: 36templates/observed-connections.php:1131323 #: templates/api-key-list.php:81 templates/observed-connections.php:113 1247 1324 msgid "Key" 1248 1325 msgstr "" 1249 1326 1250 #: templates/api-key-list.php: 37templates/observed-connections.php:1121327 #: templates/api-key-list.php:82 templates/observed-connections.php:112 1251 1328 msgid "Transport" 1252 1329 msgstr "" 1253 1330 1254 #: templates/api-key-list.php: 38templates/observed-connections.php:1151331 #: templates/api-key-list.php:83 templates/observed-connections.php:115 1255 1332 msgid "Last sync" 1256 1333 msgstr "" 1257 1334 1258 #: templates/api-key-list.php:147 1335 #: templates/api-key-list.php:171 1336 msgid "" 1337 "ShipStation refuses this key: its owner was deleted or lacks a permission " 1338 "ShipStation needs. Delete this key." 1339 msgstr "" 1340 1341 #: templates/api-key-list.php:173 1342 msgid "" 1343 "ShipStation refuses this key: its owner was deleted or lacks a permission " 1344 "ShipStation needs. You cannot delete it here. Someone who can edit its " 1345 "owner can revoke it under WooCommerce > Settings > Advanced > REST API." 1346 msgstr "" 1347 1348 #: templates/api-key-list.php:175 1349 msgid "" 1350 "Not moved to the ShipStation API user: its owner lacks a permission " 1351 "ShipStation needs, so ShipStation refuses some requests with this key." 1352 msgstr "" 1353 1354 #: templates/api-key-list.php:177 1355 msgid "Not moved to the ShipStation API user yet." 1356 msgstr "" 1357 1358 #: templates/api-key-list.php:223 1259 1359 msgid "Both" 1260 1360 msgstr "" 1261 1361 1262 #: templates/api-key-list.php: 149templates/observed-connections.php:1481362 #: templates/api-key-list.php:225 templates/observed-connections.php:148 1263 1363 #: templates/observed-connections.php:271 1264 1364 msgid "WordPress.com" 1265 1365 msgstr "" 1266 1366 1267 #: templates/api-key-list.php: 151templates/observed-connections.php:1491367 #: templates/api-key-list.php:227 templates/observed-connections.php:149 1268 1368 msgid "Direct" 1269 1369 msgstr "" 1270 1370 1271 #: templates/api-key-list.php: 1581371 #: templates/api-key-list.php:234 1272 1372 msgid "Not detected yet — shown once ShipStation connects through this key." 1273 1373 msgstr "" 1274 1374 1275 #: templates/api-key-list.php: 1751375 #: templates/api-key-list.php:251 1276 1376 msgid "Not connecting lately — delete if unused in ShipStation." 1277 1377 msgstr "" 1278 1378 1279 #: templates/api-key-list.php: 1781379 #: templates/api-key-list.php:254 1280 1380 msgid "Never" 1281 1381 msgstr "" 1282 1382 1283 #: templates/api-key-list.php: 1851383 #: templates/api-key-list.php:261 1284 1384 msgid "auto-deletes in" 1285 1385 msgstr "" 1286 1386 1287 #: templates/api-key-list.php: 1901387 #: templates/api-key-list.php:266 1288 1388 #. translators: %s: absolute date/time the key auto-deletes. 1289 1389 msgid "auto-deletes on %s" 1290 1390 msgstr "" 1291 1391 1292 #: templates/api-key-list.php: 1961392 #: templates/api-key-list.php:272 1293 1393 msgid "auto-deletes on the next cleanup." 1294 1394 msgstr "" 1295 1395 1296 #: templates/api-key-list.php:2 021396 #: templates/api-key-list.php:279 1297 1397 msgid "Delete" 1298 1398 msgstr "" 1299 1399 1300 #: templates/api-key-list.php:2 021400 #: templates/api-key-list.php:279 1301 1401 msgid "Delete this API key pair" 1302 1402 msgstr "" 1303 1403 1304 #: templates/api-key-list.php:2 111404 #: templates/api-key-list.php:289 1305 1405 msgid "" 1306 1406 "Delete keys you no longer use in ShipStation — fewer keys, less risk. A " 1307 1407 "deleted key stops working immediately." 1408 msgstr "" 1409 1410 #: templates/api-key-list.php:296 1411 #. translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. 1412 msgid "" 1413 "None of these keys belong to the ShipStation API user %s. It is a system " 1414 "account for this connection and cannot sign in. Do not delete it: " 1415 "ShipStation cannot connect without it." 1416 msgstr "" 1417 1418 #: templates/api-key-list.php:299 1419 #. translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. 1420 msgid "" 1421 "These keys belong to the ShipStation API user %s, except where noted. It is " 1422 "a system account for this connection and cannot sign in. Do not delete it: " 1423 "ShipStation cannot connect without it." 1424 msgstr "" 1425 1426 #: templates/api-key-list.php:302 1427 #. translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. 1428 msgid "" 1429 "These keys belong to the ShipStation API user %s. It is a system account " 1430 "for this connection and cannot sign in. Do not delete it: ShipStation " 1431 "cannot connect without it." 1308 1432 msgstr "" 1309 1433 -
woocommerce-shipstation-integration/trunk/readme.txt
r3795802 r3807496 8 8 Requires PHP: 7.4 9 9 Requires Plugins: woocommerce 10 Stable tag: 5.4. 110 Stable tag: 5.4.2 11 11 License: GPLv3 12 12 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 74 74 75 75 == Changelog == 76 77 = 5.4.2 - 2026-11-17 = 78 * Fix - Security update. 79 * Tweak - Plugin-generated API keys now belong to a new ShipStation API user with limited permissions. Existing plugin keys move to it and keep working with ShipStation, but no longer reach orders, products or customers on other WooCommerce REST API routes. 76 80 77 81 = 5.4.1 - 2026-11-11 = -
woocommerce-shipstation-integration/trunk/templates/api-key-list.php
r3586059 r3807496 17 17 * @var string $date_format Combined WP date+time format for absolute fallbacks. 18 18 * @var int $newest_key_id Key id of the prune-protected newest row. 19 * @var string $api_user_login Login of the ShipStation API user that owns the keys, or '' when there is none. 20 * @var int $api_user_id Id of the ShipStation API user, or 0 when there is none. 21 * @var array{move:string,repair:string} $api_user_errors Error codes of the last failed one-time key move ('move') and repair ('repair'), '' where it worked. 22 * @var int[] $skipped_key_ids Keys left alone because their owner could not use them. 23 * @var int[] $usable_skipped_key_ids Keys among them whose owner still passes the order and inventory routes. 19 24 */ 20 25 … … 28 33 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 29 34 ?> 35 <?php 36 $move_error = (string) ( $api_user_errors['move'] ?? '' ); 37 $repair_error = (string) ( $api_user_errors['repair'] ?? '' ); 38 $api_user_id = (int) $api_user_id; 39 $skipped_key_ids = array_map( 'intval', (array) $skipped_key_ids ); 40 41 // A key left alone whose owner still holds manage_product_terms keeps 42 // importing orders: only the routes that check manage_woocommerce refuse it. 43 $usable_skipped_key_ids = array_map( 'intval', (array) $usable_skipped_key_ids ); 44 45 // Without its permissions the API user's keys are refused. The keys it does 46 // not own yet still work as their previous owner. 47 $api_user_owns_a_key = false; 48 foreach ( $rows as $row ) { 49 if ( $api_user_id > 0 && isset( $row['user_id'] ) && (int) $row['user_id'] === $api_user_id ) { 50 $api_user_owns_a_key = true; 51 break; 52 } 53 } 54 55 if ( $api_user_owns_a_key && ( 'shipstation_api_user_role' === $move_error || 'shipstation_api_user_role' === $repair_error ) ) { 56 $api_user_notice = __( 'ShipStation requests are refused until the ShipStation API user has its permissions back. A role editor plugin may be removing them.', 'woocommerce-shipstation-integration' ); 57 } elseif ( '' !== $move_error ) { 58 $api_user_notice = __( 'Some ShipStation API keys could not be moved to the ShipStation API user. They still belong to their previous owner and keep working. The plugin tries again in about an hour.', 'woocommerce-shipstation-integration' ); 59 } elseif ( '' !== $repair_error ) { 60 $api_user_notice = __( 'Some ShipStation API keys could not be moved to the ShipStation API user. The plugin tries again later.', 'woocommerce-shipstation-integration' ); 61 } else { 62 $api_user_notice = ''; 63 } 64 65 $has_key_notes = false; 66 ?> 67 <?php if ( '' !== $api_user_notice ) : ?> 68 <div class="notice notice-error inline"> 69 <p> 70 <?php echo esc_html( $api_user_notice ); ?> 71 <?php esc_html_e( 'See the ShipStation log under WooCommerce > Status > Logs for details.', 'woocommerce-shipstation-integration' ); ?> 72 </p> 73 </div> 74 <?php endif; ?> 30 75 <?php if ( array() === $rows ) : ?> 31 76 <p><?php esc_html_e( 'No plugin-generated API keys yet.', 'woocommerce-shipstation-integration' ); ?></p> … … 81 126 } 82 127 } 128 // ShipStation refuses a key the sync left alone, even when its owner 129 // still uses it elsewhere, so it never reads as working or just made. 130 // The exception is a key whose owner still passes the order routes. 131 $is_skipped = in_array( (int) $row['key_id'], $skipped_key_ids, true ); 132 $is_refused = $is_skipped && ! in_array( (int) $row['key_id'], $usable_skipped_key_ids, true ); 133 if ( $is_refused && in_array( $pill_modifier, array( 'active', 'new' ), true ) ) { 134 $pill_modifier = 'rejected'; 135 $is_active = false; 136 $is_new = false; 137 } 83 138 $pill_label = $pill_labels[ $pill_modifier ]; 139 $can_delete = (bool) ( $row['can_delete'] ?? true ); 84 140 85 141 // Provisional (dimmed) treatment for everything not active. The … … 103 159 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- key_pill() escapes internally. 104 160 echo WC_ShipStation_Integration::key_pill( $pill_modifier, $pill_label ); 105 ?> 161 162 // A key the ShipStation API user does not own: refused, or not moved yet. 163 // A refused key is marked even when no API user exists yet. 164 $is_not_moved = $api_user_id > 0 && isset( $row['user_id'] ) && (int) $row['user_id'] !== $api_user_id; 165 if ( $is_skipped || $is_not_moved ) : 166 $has_key_notes = true; 167 ?> 168 <p class="description"> 169 <?php 170 if ( $is_refused && $can_delete ) { 171 esc_html_e( 'ShipStation refuses this key: its owner was deleted or lacks a permission ShipStation needs. Delete this key.', 'woocommerce-shipstation-integration' ); 172 } elseif ( $is_refused ) { 173 esc_html_e( 'ShipStation refuses this key: its owner was deleted or lacks a permission ShipStation needs. You cannot delete it here. Someone who can edit its owner can revoke it under WooCommerce > Settings > Advanced > REST API.', 'woocommerce-shipstation-integration' ); 174 } elseif ( $is_skipped ) { 175 esc_html_e( 'Not moved to the ShipStation API user: its owner lacks a permission ShipStation needs, so ShipStation refuses some requests with this key.', 'woocommerce-shipstation-integration' ); 176 } else { 177 esc_html_e( 'Not moved to the ShipStation API user yet.', 'woocommerce-shipstation-integration' ); 178 } 179 ?> 180 </p> 181 <?php endif; ?> 106 182 </td> 107 183 <?php … … 200 276 </td> 201 277 <td class="shipstation-api-key-actions shipstation-api-key-col"> 278 <?php if ( $can_delete ) : ?> 202 279 <button type="button" class="shipstation-delete-api-key" data-key-id="<?php echo esc_attr( (string) $row['key_id'] ); ?>" title="<?php esc_attr_e( 'Delete', 'woocommerce-shipstation-integration' ); ?>" aria-label="<?php esc_attr_e( 'Delete this API key pair', 'woocommerce-shipstation-integration' ); ?>"> 203 280 <span class="dashicons dashicons-trash"></span> 204 281 </button> 282 <?php endif; ?> 205 283 </td> 206 284 </tr> … … 211 289 <?php esc_html_e( 'Delete keys you no longer use in ShipStation — fewer keys, less risk. A deleted key stops working immediately.', 'woocommerce-shipstation-integration' ); ?> 212 290 </p> 291 <?php if ( '' !== $api_user_login ) : ?> 292 <p class="description"> 293 <?php 294 if ( ! $api_user_owns_a_key ) { 295 /* translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. */ 296 $owner_line = esc_html__( 'None of these keys belong to the ShipStation API user %s. It is a system account for this connection and cannot sign in. Do not delete it: ShipStation cannot connect without it.', 'woocommerce-shipstation-integration' ); 297 } elseif ( $has_key_notes ) { 298 /* translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. */ 299 $owner_line = esc_html__( 'These keys belong to the ShipStation API user %s, except where noted. It is a system account for this connection and cannot sign in. Do not delete it: ShipStation cannot connect without it.', 'woocommerce-shipstation-integration' ); 300 } else { 301 /* translators: %s: user login, e.g. shipstation-a1b2c3d4e5f6. */ 302 $owner_line = esc_html__( 'These keys belong to the ShipStation API user %s. It is a system account for this connection and cannot sign in. Do not delete it: ShipStation cannot connect without it.', 'woocommerce-shipstation-integration' ); 303 } 304 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above; the login is escaped here. 305 printf( $owner_line, '<code>' . esc_html( $api_user_login ) . '</code>' ); 306 ?> 307 </p> 308 <?php endif; ?> 213 309 <?php endif; ?> -
woocommerce-shipstation-integration/trunk/uninstall.php
r3723614 r3807496 8 8 * authenticate with), nor the pre-SHIPSTN-142 plugin options (auth key, 9 9 * settings, activation-notice flag), which historically were left in place on 10 * uninstall. 10 * uninstall. The ShipStation API user that owns those keys is left too, with 11 * its role, its cached id (network option woocommerce_shipstation_api_user_id), 12 * the ids of deleted API users (network option 13 * woocommerce_shipstation_api_user_former_ids) and the record of each moved 14 * key's previous owner (woocommerce_shipstation_api_user_state), so a 15 * reinstall, of this version or an older one, keeps the connection and the 16 * move can be reversed by hand. Without the plugin the user is no longer 17 * locked: an administrator can sign it in, change its role or delete it. 11 18 * 12 19 * @package WC_ShipStation … … 27 34 * - Auth_Controller::KEY_META_OPTION / GEN_LOCK_OPTION 28 35 * - WPCOM_Connection::DISCONNECT_INTENT_OPTION / CONNECTED_URL_OPTION 36 * - API_User::SYNCED_OPTION 29 37 * 30 38 * @return void … … 46 54 'woocommerce_shipstation_last_success_ts', 47 55 'woocommerce_shipstation_global_banner_dismissed_at', 56 'woocommerce_shipstation_api_user_synced', 48 57 ); 49 58 -
woocommerce-shipstation-integration/trunk/vendor/composer/installed.php
r3795802 r3807496 4 4 'pretty_version' => 'dev-trunk', 5 5 'version' => 'dev-trunk', 6 'reference' => ' f3cb6ebbd57a6d4dad8eaf57333228e929d5f967',6 'reference' => 'bef3afc1f34762ac8aff3f144942ecb305e6ec2e', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 113 113 'pretty_version' => 'dev-trunk', 114 114 'version' => 'dev-trunk', 115 'reference' => ' f3cb6ebbd57a6d4dad8eaf57333228e929d5f967',115 'reference' => 'bef3afc1f34762ac8aff3f144942ecb305e6ec2e', 116 116 'type' => 'wordpress-plugin', 117 117 'install_path' => __DIR__ . '/../../', -
woocommerce-shipstation-integration/trunk/vendor/composer/jetpack_autoload_classmap.php
r3795802 r3807496 403 403 'path' => $baseDir . '/tests/bootstrap.php' 404 404 ), 405 'WooCommerce\\Shipping\\ShipStation\\Tests\\Unit\\API_User_Test' => array( 406 'version' => 'dev-trunk', 407 'path' => $baseDir . '/tests/Unit/API_User_Test.php' 408 ), 405 409 'WooCommerce\\Shipping\\ShipStation\\Tests\\Unit\\Ajax_Die_Rig_Trait' => array( 406 410 'version' => 'dev-trunk', -
woocommerce-shipstation-integration/trunk/woocommerce-shipstation.php
r3795802 r3807496 3 3 * Plugin Name: ShipStation for WooCommerce 4 4 * Plugin URI: https://woocommerce.com/products/shipstation-integration/ 5 * Version: 5.4. 15 * Version: 5.4.2 6 6 * Description: Power your entire shipping operation from one platform. 7 7 * Author: WooCommerce … … 39 39 } 40 40 41 define( 'WC_SHIPSTATION_VERSION', '5.4. 1' ); // WRCS: DEFINED_VERSION.41 define( 'WC_SHIPSTATION_VERSION', '5.4.2' ); // WRCS: DEFINED_VERSION. 42 42 43 43 // Composer + Jetpack autoloader. Ships with the production zip; may be absent in
Note:
See TracChangeset
for help on using the changeset viewer.