Plugin Directory

Changeset 3811759


Ignore:
Timestamp:
11/19/2026 02:32:24 PM (63 minutes ago)
Author:
webtoffee
Message:

2.7.0

  • [Compatibility] - Tested OK with WordPress 7.2-RC2
  • [Compatibility] - Tested OK with WooCommerce 11.3.0
  • [Fix] - Security: hardened product and review import to prevent stored XSS via crafted CSV columns that trigger placeholder re-expansion. Review imports now also pass through the comment content kses filter. Reported by crow via Wordfence.
Location:
product-import-export-for-woo
Files:
454 added
6 edited

Legend:

Unmodified
Added
Removed
  • product-import-export-for-woo/trunk/admin/modules/import/import.php

    r3800287 r3811759  
    13801380        protected function evaluate_data($key, $value, $data_row, $mapping_fields, $input_date_format)
    13811381        {
    1382                 $value=$this->add_input_file_data($key, $value, $data_row, $mapping_fields, $input_date_format,true);
     1382                /*
     1383                 * Security: build the deferred-token replacement map from the ORIGINAL
     1384                 * mapping expression before the first pass runs.  After the first pass
     1385                 * the string may contain {token} strings injected from CSV data; those
     1386                 * must never be expanded.  Using strtr() ensures substituted text is
     1387                 * not re-scanned.  (ISCS-514)
     1388                 */
     1389                $deferred_map = $this->build_deferred_replacement_map($value, $data_row, $mapping_fields, $input_date_format);
     1390
     1391                $value=$this->add_input_file_data($key, $value, $data_row, $mapping_fields, $input_date_format);
    13831392                $value=$this->do_arithmetic($value);
    1384                 if(!Wt_Iew_IE_Basic_Helper::wt_string_is_json($value) && !is_serialized($value)){
    1385             $value = $this->add_input_file_data($key, $value, $data_row, $mapping_fields, $input_date_format);
    1386         }
     1393
     1394                if(!empty($deferred_map) && !Wt_Iew_IE_Basic_Helper::wt_string_is_json($value) && !is_serialized($value)){
     1395                        $value = strtr($value, $deferred_map);
     1396                }
     1397
    13871398                $data_row=null;
    13881399                unset($data_row);
    13891400                return $value;
     1401        }
     1402
     1403        /**
     1404         * Scan $template for deferred {token} placeholders and return a map
     1405         * of token-string => resolved value.  Only tokens listed in
     1406         * skip_from_evaluation_array are included.
     1407         *
     1408         * @since 2.6.10
     1409         */
     1410        private function build_deferred_replacement_map($template, $data_row, $mapping_fields, $input_date_format)
     1411        {
     1412                $re = '/\{([^}]+)\}/m';
     1413                $matches = array();
     1414                preg_match_all($re, $template, $matches, PREG_SET_ORDER, 0);
     1415
     1416                $map = array();
     1417                foreach ($matches as $match) {
     1418                        if (!is_array($match) || count($match) <= 1) {
     1419                                continue;
     1420                        }
     1421
     1422                        $data_key = trim($match[1]);
     1423
     1424                        if (!in_array($data_key, $this->skip_from_evaluation_array)) {
     1425                                continue;
     1426                        }
     1427
     1428                        /* Handle date formatting ({field@format}). */
     1429                        $data_key_arr = explode('@', $data_key);
     1430                        $data_format  = '';
     1431                        if (count($data_key_arr) == 2) {
     1432                                $data_key    = $data_key_arr[0];
     1433                                $data_format = $data_key_arr[1];
     1434                        }
     1435
     1436                        // phpcs:ignore WordPress.CodeAnalysis.AssignmentInCondition.Found -- Preserving existing behavior.
     1437                        if (isset($mapping_fields[$data_key]) && isset($mapping_fields[$data_key][2]) && $mapping_fields[$data_key][2] = 'date') {
     1438                                if ($data_format == '') {
     1439                                        $data_format = $input_date_format;
     1440                                }
     1441                        }
     1442
     1443                        $output_val = isset($data_row[$data_key]) ? $data_row[$data_key] : '';
     1444
     1445                        /* Date conversion. */
     1446                        if (trim($data_format) != '' && trim($output_val) != '') {
     1447                                if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
     1448                                        $date_obj = DateTime::createFromFormat($data_format, $output_val);
     1449                                        if ($date_obj) {
     1450                                                $output_val = $date_obj->format('Y-m-d H:i:s');
     1451                                        }
     1452                                } else {
     1453                                        $output_val = gmdate('Y-m-d H:i:s', strtotime(trim(str_replace('/', '-', str_replace('-', '', $output_val)))));
     1454                                }
     1455                        }
     1456
     1457                        /* Decimal formatting. */
     1458                        if (in_array($data_key, $this->decimal_columns)) {
     1459                                $output_val = wt_format_decimal($output_val);
     1460                        }
     1461
     1462                        $map[$match[0]] = $output_val;
     1463                }
     1464
     1465                return $map;
    13901466        }
    13911467        protected function do_arithmetic($str)
    … …  
    14451521                return $val;
    14461522        }
    1447                 protected function add_input_file_data($key, $str, $data_row, $mapping_fields, $input_date_format, $skip_from_evaluation = false)
     1523                protected function add_input_file_data($key, $str, $data_row, $mapping_fields, $input_date_format)
    14481524                {
    14491525                        // phpcs:ignore Squiz.PHP.DiscouragedFunctions.Discouraged -- Required for processing large import files
    … …  
    14971573                                        }
    14981574
    1499                                         $is_need_to_replace = false;
    1500                                         if ($skip_from_evaluation) {   /* check whether skip or not */
    1501                                                 if (!in_array($value[1], $this->skip_from_evaluation_array)) {      /*  current item dont skip */
    1502                                                         $is_need_to_replace = true;
    1503                                                 }
    1504                                         } else { /* no needed to skip, so add all items to find and replace list */
    1505                                                 $is_need_to_replace = true;
    1506                                         }
     1575                                        /* Replace non-deferred tokens only; deferred tokens are handled
     1576                                           separately in evaluate_data() via build_deferred_replacement_map(). */
     1577                                        $is_need_to_replace = !in_array($value[1], $this->skip_from_evaluation_array);
    15071578                                        if ($is_need_to_replace) {
    15081579                                                if (in_array($value[1], $this->decimal_columns)) { /* check if it is a decimal column , if yes, format it */
    … …  
    15171588                        $data_row = null;
    15181589                        unset($data_row);
    1519                         return str_replace($find, $replace, $str);
     1590                        /* strtr() replaces in parallel and never re-scans substituted text,
     1591                           preventing cascading token expansion within a single pass (ISCS-514). */
     1592                        if (!empty($find)) {
     1593                                return strtr($str, array_combine($find, $replace));
     1594                        }
     1595                        return $str;
    15201596                }
    15211597                public function get_skip_from_evaluation()
  • product-import-export-for-woo/trunk/admin/modules/product_review/import/import.php

    r3446863 r3811759  
    442442                    }
    443443                }else{
     444                    /*
     445                     * wp_insert_comment() does not run wp_filter_comment() internally,
     446                     * so content and author are stored raw unless we filter here.
     447                     * Mirror the update branch (wp_update_comment, which filters) to
     448                     * keep the comment kses allowlist enforced on new imported reviews.
     449                     */
     450                    $postdata = wp_filter_comment($postdata);
    444451                    $post_id = wp_insert_comment($postdata, true);
    445452                }
    … …  
    528535        if (!$posts_that_exist) {
    529536            // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
    530             $inserted_id = $wpdb->insert('wp_comments', array('comment_ID' =>  $id, 'comment_type' => 'review'));
     537            $inserted_id = $wpdb->insert($wpdb->comments, array('comment_ID' =>  $id, 'comment_type' => 'review'));
    531538            if($inserted_id ){
    532539                $return = $id;
  • product-import-export-for-woo/trunk/changelog.txt

    r3800287 r3811759  
    11
    22== Changelog ==
     3
     4= 2.7.0 2026-11-19 =
     5* [Compatibility] - Tested OK with WordPress 7.2-RC2
     6* [Compatibility] - Tested OK with WooCommerce 11.3.0
     7* [Fix] - Security: hardened product and review import to prevent stored XSS via crafted CSV columns that trigger placeholder re-expansion. Review imports now also pass through the comment content kses filter. Reported by crow via Wordfence.
    38
    49= 2.6.9 2026-11-13 =
  • product-import-export-for-woo/trunk/includes/class-wt-import-export-for-woo.php

    r3800287 r3811759  
    8585                                $this->version = WT_P_IEW_VERSION;
    8686                        } else {
    87                                 $this->version = '2.6.9';
     87                                $this->version = '2.7.0';
    8888                        }       
    8989                        $this->plugin_name = 'wt-import-export-for-woo-basic';
  • product-import-export-for-woo/trunk/product-import-export-for-woo.php

    r3800287 r3811759  
    66  Author: WebToffee
    77  Author URI: https://www.webtoffee.com/product/product-import-export-woocommerce/
    8   Version: 2.6.9
     8  Version: 2.7.0
    99  License:           GPLv3
    1010  License URI:       https://www.gnu.org/licenses/gpl-3.0.html
    1111  Text Domain: product-import-export-for-woo
    1212  Domain Path: /languages
    13   WC tested up to: 11.2.2
     13  WC tested up to: 11.3
    1414  Requires at least: 3.0
    1515  Requires PHP: 7.4
    … …  
    5454 * Rename this for your plugin and update it as you release new versions.
    5555 */
    56 define( 'WT_P_IEW_VERSION', '2.6.9' );
     56define( 'WT_P_IEW_VERSION', '2.7.0' );
    5757
    5858/**
  • product-import-export-for-woo/trunk/readme.txt

    r3800287 r3811759  
    33Tags: product export, product import, CSV import export, woocommerce product import, export woocommerce products
    44Requires at least: 3.0
    5 Tested up to: 7.1.4
     5Tested up to: 7.2
    66Requires PHP: 7.4
    7 Stable tag: 2.6.9
     7Stable tag: 2.7.0
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
    … …  
    6363* The plugin <strong>stores all the past imports and exports</strong> and <strong>lets you re-run</strong> them when needed.
    6464* <strong>Easy debugging:</strong> View and download import log for debugging purpose.
    65 &#9989; Tested OK with WordPress 7.1.4
    66 &#9989; Tested OK with WooCommerce 11.2.2
     65&#9989; Tested OK with WordPress 7.2
     66&#9989; Tested OK with WooCommerce 11.3
    6767&#9989; Tested OK with PHP 8.3
    6868
    … …  
    253253== Changelog ==
    254254
    255 = 2.6.9 2026-11-13 =
    256 * [Fix] - Security: hardened CSV export to prevent row injection on re-import via crafted order data. Reported by J Rose (Cavid Gulaliyev).
    257 * [Update] - Bumped minimum PHP requirement to 7.4.
    258 * [Compatibility] – Tested OK with WordPress 7.1.4.
    259 * [Compatibility] – Tested OK with WooCommerce 11.3.0.
     255= 2.7.0 2026-11-19 =
     256* [Compatibility] - Tested OK with WordPress 7.2-RC2
     257* [Compatibility] - Tested OK with WooCommerce 11.3.0
     258* [Fix] - Security: hardened product and review import to prevent stored XSS via crafted CSV columns that trigger placeholder re-expansion. Review imports now also pass through the comment content kses filter. Reported by crow via Wordfence.
    260259
    261260[See changelog for all versions](https://plugins.svn.wordpress.org/product-import-export-for-woo/trunk/changelog.txt)
    … …  
    263262== Upgrade Notice ==
    264263
    265 = 2.6.9 =
    266 * [Fix] - Security: hardened CSV export to prevent row injection on re-import via crafted order data. Reported by J Rose (Cavid Gulaliyev).
    267 * [Update] - Bumped minimum PHP requirement to 7.4.
    268 * [Compatibility] – Tested OK with WordPress 7.1.4
    269 * [Compatibility] – Tested OK with WooCommerce 11.3.0.
     264= 2.7.0 =
     265* [Compatibility] - Tested OK with WordPress 7.2-RC2
     266* [Compatibility] - Tested OK with WooCommerce 11.3.0
     267* [Fix] - Security: hardened product and review import to prevent stored XSS via crafted CSV columns that trigger placeholder re-expansion. Review imports now also pass through the comment content kses filter. Reported by crow via Wordfence.
Note: See TracChangeset for help on using the changeset viewer.