Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/eu-order-withdrawal-button-for-woocommerce/build/static/admin-order.asset.php
+++ b/eu-order-withdrawal-button-for-woocommerce/build/static/admin-order.asset.php
@@ -1 +1,6 @@
-<?php return array('dependencies' => array(), 'version' => '593148e21e7458b99410');
+<?php return array(
+ 'dependencies' => array(
+
+ ),
+ 'version' => '593148e21e7458b99410'
+);
--- a/eu-order-withdrawal-button-for-woocommerce/build/static/admin-orders.asset.php
+++ b/eu-order-withdrawal-button-for-woocommerce/build/static/admin-orders.asset.php
@@ -1 +1,6 @@
-<?php return array('dependencies' => array(), 'version' => 'c2603b4e2c24f89ca77a');
+<?php return array(
+ 'dependencies' => array(
+
+ ),
+ 'version' => '0b51a796fe5d7507e391'
+);
--- a/eu-order-withdrawal-button-for-woocommerce/build/static/admin-styles.asset.php
+++ b/eu-order-withdrawal-button-for-woocommerce/build/static/admin-styles.asset.php
@@ -1 +1,6 @@
-<?php return array('dependencies' => array(), 'version' => 'fa60deb124630b158e91');
+<?php return array(
+ 'dependencies' => array(
+
+ ),
+ 'version' => 'e5174fe9abdaa8b78b4a'
+);
--- a/eu-order-withdrawal-button-for-woocommerce/build/static/form-styles.asset.php
+++ b/eu-order-withdrawal-button-for-woocommerce/build/static/form-styles.asset.php
@@ -1 +1,6 @@
-<?php return array('dependencies' => array(), 'version' => '3ca5712d733bbf9c60c5');
+<?php return array(
+ 'dependencies' => array(
+
+ ),
+ 'version' => '3c38956a2173cbebec8e'
+);
--- a/eu-order-withdrawal-button-for-woocommerce/build/static/order-withdrawal.asset.php
+++ b/eu-order-withdrawal-button-for-woocommerce/build/static/order-withdrawal.asset.php
@@ -1 +1,6 @@
-<?php return array('dependencies' => array(), 'version' => '67035eae885a7302c61a');
+<?php return array(
+ 'dependencies' => array(
+
+ ),
+ 'version' => '67035eae885a7302c61a'
+);
--- a/eu-order-withdrawal-button-for-woocommerce/build/static/orders-styles.asset.php
+++ b/eu-order-withdrawal-button-for-woocommerce/build/static/orders-styles.asset.php
@@ -1 +1,6 @@
-<?php return array('dependencies' => array(), 'version' => '23caa558dc674d99a453');
+<?php return array(
+ 'dependencies' => array(
+
+ ),
+ 'version' => 'd3f2a261eec0c7426234'
+);
--- a/eu-order-withdrawal-button-for-woocommerce/eu-order-withdrawal-button-for-woocommerce.php
+++ b/eu-order-withdrawal-button-for-woocommerce/eu-order-withdrawal-button-for-woocommerce.php
@@ -7,7 +7,7 @@
* Author URI: https://vendidero.com
* Text Domain: eu-order-withdrawal-button-for-woocommerce
* Domain Path: /i18n/languages/
- * Version: 2.4.6
+ * Version: 2.4.7
* Requires at least: 5.4
* Requires PHP: 7.4
* License: GPLv3
--- a/eu-order-withdrawal-button-for-woocommerce/includes/eu-owb-core-functions.php
+++ b/eu-order-withdrawal-button-for-woocommerce/includes/eu-owb-core-functions.php
@@ -975,7 +975,7 @@
$original_status = $withdrawal->get_original_status();
if ( $withdrawal->get_id() > 0 ) {
- $withdrawal->add_order_note( sprintf( _x( 'Customer requested an update to the original withdrawal: %1$s', 'owb', 'eu-order-withdrawal-button-for-woocommerce' ), wp_kses_post( '<pre><code>' . (string) $withdrawal ) . '</code></pre>' ) );
+ $withdrawal->add_order_note( sprintf( _x( 'Customer requested an update to the original withdrawal: %1$s', 'owb', 'eu-order-withdrawal-button-for-woocommerce' ), '<pre><code>' . esc_html( (string) $withdrawal ) . '</code></pre>' ) );
}
}
}
@@ -1813,6 +1813,39 @@
return 'yes' === VendideroOrderWithdrawalButtonPackage::get_setting( 'enable_additional_information' );
}
+/**
+ * Sanitize a withdrawal note for output within the admin preview modal.
+ * Only allows basic formatting tags without attributes (except safe link attributes) to prevent
+ * injected markup (e.g. data-* attributes or custom classes) from being interpreted by admin scripts.
+ *
+ * @param string $content
+ *
+ * @return string
+ */
+function eu_owb_kses_withdrawal_note( $content ) {
+ $allowed_html = array(
+ 'a' => array(
+ 'href' => true,
+ 'title' => true,
+ 'target' => true,
+ 'rel' => true,
+ ),
+ 'br' => array(),
+ 'p' => array(),
+ 'pre' => array(),
+ 'code' => array(),
+ 'strong' => array(),
+ 'b' => array(),
+ 'em' => array(),
+ 'i' => array(),
+ 'ul' => array(),
+ 'ol' => array(),
+ 'li' => array(),
+ );
+
+ return wp_kses( $content, apply_filters( 'eu_owb_woocommerce_withdrawal_note_allowed_html', $allowed_html ) );
+}
+
function eu_owb_wptexturize_withdrawal_additional_information( $content ) {
if ( function_exists( 'wc_wptexturize_order_note' ) ) {
return wc_wptexturize_order_note( $content );
--- a/eu-order-withdrawal-button-for-woocommerce/src/Admin/WithdrawalTable.php
+++ b/eu-order-withdrawal-button-for-woocommerce/src/Admin/WithdrawalTable.php
@@ -1067,7 +1067,7 @@
$note_html .= '<ul class="order_notes withdrawal-notes">';
foreach ( $notes as $note ) {
- $content = wp_kses_post( $note->content );
+ $content = eu_owb_kses_withdrawal_note( $note->content );
$content = eu_owb_wptexturize_withdrawal_additional_information( $content );
$note_html .= '<li class="note system-note" rel="' . absint( $note->id ) . '"><div class="note_content">' . wpautop( $content ) . '</div><p class="meta"> <abbr class="exact-date" title="' . esc_attr( $note->date_created->date( 'Y-m-d H:i:s' ) ) . '">' . esc_html( sprintf( _x( '%1$s at %2$s', 'owb', 'eu-order-withdrawal-button-for-woocommerce' ), $note->date_created->date_i18n( wc_date_format() ), $note->date_created->date_i18n( wc_time_format() ) ) ) . '</abbr></p></li>';
--- a/eu-order-withdrawal-button-for-woocommerce/src/Package.php
+++ b/eu-order-withdrawal-button-for-woocommerce/src/Package.php
@@ -16,7 +16,7 @@
*
* @var string
*/
- const VERSION = '2.4.6';
+ const VERSION = '2.4.7';
protected static $localized_scripts = array();
--- a/eu-order-withdrawal-button-for-woocommerce/vendor/autoload.php
+++ b/eu-order-withdrawal-button-for-woocommerce/vendor/autoload.php
@@ -14,10 +14,7 @@
echo $err;
}
}
- trigger_error(
- $err,
- E_USER_ERROR
- );
+ throw new RuntimeException($err);
}
require_once __DIR__ . '/composer/autoload_real.php';
--- a/eu-order-withdrawal-button-for-woocommerce/vendor/composer/InstalledVersions.php
+++ b/eu-order-withdrawal-button-for-woocommerce/vendor/composer/InstalledVersions.php
@@ -27,12 +27,23 @@
class InstalledVersions
{
/**
+ * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
+ * @internal
+ */
+ private static $selfDir = null;
+
+ /**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
+ * @var bool
+ */
+ private static $installedIsLocalDir;
+
+ /**
* @var bool|null
*/
private static $canGetVendors;
@@ -309,6 +320,24 @@
{
self::$installed = $data;
self::$installedByVendor = array();
+
+ // when using reload, we disable the duplicate protection to ensure that self::$installed data is
+ // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
+ // so we have to assume it does not, and that may result in duplicate data being returned when listing
+ // all installed packages for example
+ self::$installedIsLocalDir = false;
+ }
+
+ /**
+ * @return string
+ */
+ private static function getSelfDir()
+ {
+ if (self::$selfDir === null) {
+ self::$selfDir = strtr(__DIR__, '\', '/');
+ }
+
+ return self::$selfDir;
}
/**
@@ -322,19 +351,27 @@
}
$installed = array();
+ $copiedLocalDir = false;
if (self::$canGetVendors) {
+ $selfDir = self::getSelfDir();
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
+ $vendorDir = strtr($vendorDir, '\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
- $installed[] = self::$installedByVendor[$vendorDir] = $required;
- if (null === self::$installed && strtr($vendorDir.'/composer', '\', '/') === strtr(__DIR__, '\', '/')) {
- self::$installed = $installed[count($installed) - 1];
+ self::$installedByVendor[$vendorDir] = $required;
+ $installed[] = $required;
+ if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
+ self::$installed = $required;
+ self::$installedIsLocalDir = true;
}
}
+ if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
+ $copiedLocalDir = true;
+ }
}
}
@@ -350,7 +387,7 @@
}
}
- if (self::$installed !== array()) {
+ if (self::$installed !== array() && !$copiedLocalDir) {
$installed[] = self::$installed;
}
--- a/eu-order-withdrawal-button-for-woocommerce/vendor/composer/autoload_static.php
+++ b/eu-order-withdrawal-button-for-woocommerce/vendor/composer/autoload_static.php
@@ -7,22 +7,22 @@
class ComposerStaticInitf00f92da1265e878a2577856041dee10
{
public static $prefixLengthsPsr4 = array (
- 'V' =>
+ 'V' =>
array (
'Vendidero\OrderWithdrawalButton\' => 32,
),
- 'A' =>
+ 'A' =>
array (
'Automattic\Jetpack\Autoloader\' => 30,
),
);
public static $prefixDirsPsr4 = array (
- 'Vendidero\OrderWithdrawalButton\' =>
+ 'Vendidero\OrderWithdrawalButton\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
- 'Automattic\Jetpack\Autoloader\' =>
+ 'Automattic\Jetpack\Autoloader\' =>
array (
0 => __DIR__ . '/..' . '/automattic/jetpack-autoloader/src',
),
--- a/eu-order-withdrawal-button-for-woocommerce/vendor/composer/installed.php
+++ b/eu-order-withdrawal-button-for-woocommerce/vendor/composer/installed.php
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'vendidero/eu-order-withdrawal-button-for-woocommerce',
- 'pretty_version' => '2.4.6',
- 'version' => '2.4.6.0',
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
'reference' => null,
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
@@ -20,8 +20,8 @@
'dev_requirement' => false,
),
'vendidero/eu-order-withdrawal-button-for-woocommerce' => array(
- 'pretty_version' => '2.4.6',
- 'version' => '2.4.6.0',
+ 'pretty_version' => 'dev-main',
+ 'version' => 'dev-main',
'reference' => null,
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
--- a/eu-order-withdrawal-button-for-woocommerce/vendor/composer/jetpack_autoload_classmap.php
+++ b/eu-order-withdrawal-button-for-woocommerce/vendor/composer/jetpack_autoload_classmap.php
@@ -75,63 +75,63 @@
'path' => $vendorDir . '/automattic/jetpack-autoloader/src/class-shutdown-handler.php'
),
'Vendidero\OrderWithdrawalButton\Admin\Admin' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Admin/Admin.php'
),
'Vendidero\OrderWithdrawalButton\Admin\Privacy' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Admin/Privacy.php'
),
'Vendidero\OrderWithdrawalButton\Admin\WithdrawalTable' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Admin/WithdrawalTable.php'
),
'Vendidero\OrderWithdrawalButton\Ajax' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Ajax.php'
),
'Vendidero\OrderWithdrawalButton\Compatibility\Compatibility' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Compatibility/Compatibility.php'
),
'Vendidero\OrderWithdrawalButton\Compatibility\WPML' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Compatibility/WPML.php'
),
'Vendidero\OrderWithdrawalButton\DataStores\WithdrawalItem' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/DataStores/WithdrawalItem.php'
),
'Vendidero\OrderWithdrawalButton\DataStores\WithdrawalOrder' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/DataStores/WithdrawalOrder.php'
),
'Vendidero\OrderWithdrawalButton\DataStores\WithdrawalOrderCPT' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/DataStores/WithdrawalOrderCPT.php'
),
'Vendidero\OrderWithdrawalButton\EmailTranslationHelper' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/EmailTranslationHelper.php'
),
'Vendidero\OrderWithdrawalButton\Install' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Install.php'
),
'Vendidero\OrderWithdrawalButton\Package' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Package.php'
),
'Vendidero\OrderWithdrawalButton\Settings' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/Settings.php'
),
'Vendidero\OrderWithdrawalButton\WithdrawalItem' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/WithdrawalItem.php'
),
'Vendidero\OrderWithdrawalButton\WithdrawalOrder' => array(
- 'version' => '2.4.6.0',
+ 'version' => 'dev-main',
'path' => $baseDir . '/src/WithdrawalOrder.php'
),
'Version_Loader' => array(