Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/give/give.php
+++ b/give/give.php
@@ -6,7 +6,7 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: GiveWP
* Author URI: https://givewp.com/
- * Version: 4.16.2
+ * Version: 4.16.3
* Requires at least: 6.6
* Requires PHP: 7.4
* Text Domain: give
@@ -426,7 +426,7 @@
{
// Plugin version.
if (!defined('GIVE_VERSION')) {
- define('GIVE_VERSION', '4.16.2');
+ define('GIVE_VERSION', '4.16.3');
}
// Plugin Root File.
--- a/give/includes/gateways/functions.php
+++ b/give/includes/gateways/functions.php
@@ -78,13 +78,11 @@
$enabled = [];
if (!$version || $version === 2) {
- $gatewaysFromPostRequest = isset($_POST['gateways']) ? (array)$_POST['gateways'] : null;
- $enabled = array_merge($enabled, $gatewaysFromPostRequest ?? (array)give_get_option('gateways', []));
+ $enabled = array_merge($enabled, (array)give_get_option('gateways', []));
}
if (!$version || $version === 3) {
- $gatewaysFromPostRequest = isset($_POST['gateways_v3']) ? (array)$_POST['gateways_v3'] : null;
- $enabled = array_merge($enabled, $gatewaysFromPostRequest ?? (array)give_get_option('gateways_v3', []));
+ $enabled = array_merge($enabled, (array)give_get_option('gateways_v3', []));
}
$gateway_list = [];
@@ -370,19 +368,11 @@
// Get gateways setting.
$gateways_setting = [];
if (!$version || $version === 2) {
- $gatewaysFromPostRequest = isset($_POST['gateways']) ? (array)$_POST['gateways'] : null;
- $gateways_setting = array_merge(
- $gateways_setting,
- $gatewaysFromPostRequest ?? (array)give_get_option('gateways', [])
- );
+ $gateways_setting = array_merge($gateways_setting, (array)give_get_option('gateways', []));
}
if (!$version || $version === 3) {
- $gatewaysFromPostRequest = isset($_POST['gateways_v3']) ? (array)$_POST['gateways_v3'] : null;
- $gateways_setting = array_merge(
- $gateways_setting,
- $gatewaysFromPostRequest ?? (array)give_get_option('gateways_v3', [])
- );
+ $gateways_setting = array_merge($gateways_setting, (array)give_get_option('gateways_v3', []));
}
// Return from here if we do not have gateways setting.
--- a/give/src/API/REST/V3/Routes/Subscriptions/SubscriptionController.php
+++ b/give/src/API/REST/V3/Routes/Subscriptions/SubscriptionController.php
@@ -236,6 +236,7 @@
/**
* Get a subscription.
*
+ * @since 4.16.3 Return 404 for anonymous donors unless explicitly included.
* @since 4.8.0
*
* @param WP_REST_Request $request Full data about the request.
@@ -247,13 +248,17 @@
public function get_item($request)
{
$subscription = Subscription::find($request->get_param('id'));
+ $donorAnonymousMode = new DonorAnonymousMode($request->get_param('anonymousDonors'));
- if (!$subscription) {
+ // Hide anonymous donors unless explicitly included, matching the collection and donor endpoints.
+ if (
+ !$subscription
+ || ($subscription->donor && $subscription->donor->isAnonymous() && $donorAnonymousMode->isExcluded())
+ ) {
return new WP_Error('subscription_not_found', __('Subscription not found', 'give'), ['status' => 404]);
}
$includeSensitiveData = $request->get_param('includeSensitiveData');
- $donorAnonymousMode = new DonorAnonymousMode($request->get_param('anonymousDonors'));
$item = (new SubscriptionViewModel($subscription))
->anonymousMode($donorAnonymousMode)
--- a/give/src/PaymentGateways/Gateways/Stripe/Traits/CheckoutModal.php
+++ b/give/src/PaymentGateways/Gateways/Stripe/Traits/CheckoutModal.php
@@ -14,6 +14,7 @@
* @param int $formId Donation Form ID.
* @param array $args Donation Form Arguments.
*
+ * @since 4.16.3 Escaped the submit button label in the Stripe checkout modal.
* @since 2.19.0 Migrated from the legacy Give_Stripe_Checkout::showCheckoutModal implementation of the Stripe Checkout Gateway.
*
* @return string
@@ -129,7 +130,7 @@
'<input type="submit" class="%1$s" id="%2$s" value="%3$s" data-before-validation-label="%3$s" name="%4$s" data-is_legacy_form="%5$s" disabled/>',
FormUtils::isLegacyForm() ? 'give-btn give-stripe-checkout-modal-donate-button' : 'give-btn give-stripe-checkout-modal-sequoia-donate-button',
"give-stripe-checkout-modal-donate-button-{$idPrefix}",
- $display_label,
+ esc_attr($display_label),
'give_stripe_modal_donate',
FormUtils::isLegacyForm()
);
--- a/give/src/Views/Form/Templates/Classic/resources/css/variables.php
+++ b/give/src/Views/Form/Templates/Classic/resources/css/variables.php
@@ -4,6 +4,6 @@
<?php if (!empty($headerBackgroundColor)) : ?>
--give-header-background-color--for-rgb: <?= hexdec(substr($headerBackgroundColor, 1, 2)) ?>, <?= hexdec(substr($headerBackgroundColor, 3, 2)) ?>, <?= hexdec(substr($headerBackgroundColor, 5, 2)) ?>;
<?php endif; ?>
- --give-header-stats-progressbar-color: <?= $statsProgressBarColor ?>;
+ --give-header-stats-progressbar-color: <?= sanitize_hex_color($statsProgressBarColor) ?? '' ?>;
--give-primary-font: '<?= $primaryFont; ?>';
}
--- a/give/src/Views/Form/Templates/Sequoia/Actions.php
+++ b/give/src/Views/Form/Templates/Sequoia/Actions.php
@@ -223,6 +223,7 @@
/**
* Add checkout button
*
+ * @since 4.16.3 Escaped the checkout button label in the Sequoia template.
* @since 2.7.0
*/
public function getCheckoutButton()
@@ -237,7 +238,7 @@
<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="%1$s" data-before-validation-label="Donate Now">
<span class="give-loading-animation"></span>
</div>',
- $label
+ esc_attr($label)
);
}
--- a/give/src/Views/Form/Templates/Sequoia/sections/progress-bar.php
+++ b/give/src/Views/Form/Templates/Sequoia/sections/progress-bar.php
@@ -1,6 +1,8 @@
<?php
/**
+ * @since 4.16.3 Escaped the goal color when rendering the progress bar.
+ *
* @var int $formId
*/
if ($form->has_goal()) : ?>
@@ -16,8 +18,7 @@
<div class="progress-bar">
<div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="<?php
echo $goalStats['progress']; ?>">
- <span style="<?php
- echo $style; ?>"></span>
+ <span style="<?php echo esc_attr($style); ?>"></span>
</div><!-- /.give-progress-bar -->
</div>
<?php
--- a/give/templates/shortcode-goal.php
+++ b/give/templates/shortcode-goal.php
@@ -5,6 +5,8 @@
/**
* This template is used to display the goal with [give_goal]
+ *
+ * @since 4.16.3 Escaped the goal color when rendering the progress bar.
*/
/**
@@ -257,7 +259,7 @@
?>
<div class="progress-bar">
<div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="<?php echo esc_attr( $progress_bar_value ); ?>">
- <span style="<?php echo $style; ?>"></span>
+ <span style="<?php echo esc_attr( $style ); ?>"></span>
</div>
</div>
<?php endif; ?>
--- a/give/vendor/composer/installed.php
+++ b/give/vendor/composer/installed.php
@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'impress-org/give',
- 'pretty_version' => '4.16.2',
- 'version' => '4.16.2.0',
- 'reference' => '22eba7d49d574a629258cdd18ed14e0f2595eb66',
+ 'pretty_version' => '4.16.3',
+ 'version' => '4.16.3.0',
+ 'reference' => '9366b333f78080457a9cbc1065b84535ca83e2d1',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -20,9 +20,9 @@
'dev_requirement' => false,
),
'impress-org/give' => array(
- 'pretty_version' => '4.16.2',
- 'version' => '4.16.2.0',
- 'reference' => '22eba7d49d574a629258cdd18ed14e0f2595eb66',
+ 'pretty_version' => '4.16.3',
+ 'version' => '4.16.3.0',
+ 'reference' => '9366b333f78080457a9cbc1065b84535ca83e2d1',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),