Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/learning-management-system/addons/elementor-integration/Helper.php
+++ b/learning-management-system/addons/elementor-integration/Helper.php
@@ -629,14 +629,6 @@
'isLocked' => false,
'settings' => array(),
'elements' => array(),
- 'widgetType' => 'masteriyo-course-archive-view-mode',
- ),
- array(
- 'elType' => 'widget',
- 'isInner' => false,
- 'isLocked' => false,
- 'settings' => array(),
- 'elements' => array(),
'widgetType' => 'masteriyo-course-list',
),
array(
--- a/learning-management-system/addons/stripe/StripeAddon.php
+++ b/learning-management-system/addons/stripe/StripeAddon.php
@@ -20,6 +20,7 @@
use StripeAccount;
use StripeExceptionUnexpectedValueException;
use StripeExceptionSignatureVerificationException;
+use StripeWebhook;
defined( 'ABSPATH' ) || exit;
@@ -567,6 +568,7 @@
$sig_header = isset( $_SERVER['HTTP_STRIPE_SIGNATURE'] ) ? $_SERVER['HTTP_STRIPE_SIGNATURE'] : null;
$payload = @file_get_contents( 'php://input' ); // phpcs:disable WordPress.PHP.NoSilencedErrors.Discouraged
$event = null;
+ $order = null;
$webhook_secret = Setting::get_webhook_secret();
if ( empty( $payload ) ) {
@@ -574,11 +576,11 @@
throw new Exception( esc_html__( 'Payload is empty.', 'learning-management-system' ), 400 );
}
- if ( empty( $sig_header ) || empty( $webhook_secret ) ) {
- $event = StripeEvent::constructFrom(
- json_decode( $payload, true )
- );
- } else { // phpcs:ignore Universal.ControlStructures.DisallowLonelyIf.Found
+ if ( ! empty( $webhook_secret ) ) {
+ if ( empty( $sig_header ) ) {
+ masteriyo_get_logger()->error( 'Stripe webhook: Stripe-Signature header is missing.', array( 'source' => 'payment-stripe' ) );
+ throw new Exception( esc_html__( 'Stripe-Signature header is missing.', 'learning-management-system' ), 400 );
+ }
/**
* Filters whether to validate the webhook secret or not.
@@ -586,12 +588,13 @@
* @since 1.14.0
*/
if ( apply_filters( 'masteriyo_stripe_validate_webhook', true ) ) {
- $event = StripeEvent::constructFrom(
- json_decode( $payload, true ),
- $sig_header,
- $webhook_secret
- );
+ $event = Webhook::constructEvent( $payload, $sig_header, $webhook_secret );
+ } else {
+ $event = StripeEvent::constructFrom( json_decode( $payload, true ) );
}
+ } else {
+ masteriyo_get_logger()->warning( 'Stripe webhook: no webhook secret configured, skipping signature verification.', array( 'source' => 'payment-stripe' ) );
+ $event = StripeEvent::constructFrom( json_decode( $payload, true ) );
}
if ( ! $event ) {
@@ -618,16 +621,20 @@
wp_send_json_success( $result );
} catch ( UnexpectedValueException $e ) {
masteriyo_get_logger()->error( $e->getMessage(), array( 'source' => 'payment-stripe' ) );
- $order->add_order_note(
- esc_html__( 'Stripe invalid event type.', 'learning-management-system' )
- );
+ if ( $order ) {
+ $order->add_order_note(
+ esc_html__( 'Stripe invalid event type.', 'learning-management-system' )
+ );
+ }
wp_send_json_error( array( 'message' => $e->getMessage() ), $e->getCode() );
} catch ( SignatureVerificationException $e ) {
masteriyo_get_logger()->error( $e->getMessage(), array( 'source' => 'payment-stripe' ) );
- $order->add_order_note(
- esc_html__( 'Stripe webhook signature verification failed.', 'learning-management-system' )
- );
+ if ( $order ) {
+ $order->add_order_note(
+ esc_html__( 'Stripe webhook signature verification failed.', 'learning-management-system' )
+ );
+ }
wp_send_json_error( array( 'message' => $e->getMessage() ), $e->getCode() );
} catch ( Exception $e ) {
--- a/learning-management-system/lms.php
+++ b/learning-management-system/lms.php
@@ -5,7 +5,7 @@
* Description: A Complete WordPress LMS plugin to create and sell online courses in no time.
* Author: Masteriyo
* Author URI: https://masteriyo.com
- * Version: 2.1.5
+ * Version: 2.1.6
* Requires at least: 6.5
* Requires PHP: 7.4
* Text Domain: learning-management-system
@@ -46,7 +46,7 @@
}
if ( ! defined( 'MASTERIYO_VERSION' ) ) {
- define( 'MASTERIYO_VERSION', '2.1.5' );
+ define( 'MASTERIYO_VERSION', '2.1.6' );
}
if ( ! defined( 'MASTERIYO_PLUGIN_FILE' ) ) {
--- a/learning-management-system/uninstall.php
+++ b/learning-management-system/uninstall.php
@@ -20,7 +20,7 @@
defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
defined( 'MASTERIYO_SLUG' ) || define( 'MASTERIYO_SLUG', 'learning-management-system' );
-defined( 'MASTERIYO_VERSION' ) || define( 'MASTERIYO_VERSION', '2.1.5' );
+defined( 'MASTERIYO_VERSION' ) || define( 'MASTERIYO_VERSION', '2.1.6' );
defined( 'MASTERIYO_PLUGIN_FILE' ) || define( 'MASTERIYO_PLUGIN_FILE', __FILE__ );
defined( 'MASTERIYO_PLUGIN_BASENAME' ) || define( 'MASTERIYO_PLUGIN_BASENAME', plugin_basename( MASTERIYO_PLUGIN_FILE ) );
defined( 'MASTERIYO_PLUGIN_DIR' ) || define( 'MASTERIYO_PLUGIN_DIR', dirname( MASTERIYO_PLUGIN_FILE ) );
--- a/learning-management-system/vendor/composer/installed.php
+++ b/learning-management-system/vendor/composer/installed.php
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'masteriyo/masteriyo',
- 'pretty_version' => '2.1.5',
- 'version' => '2.1.5.0',
+ 'pretty_version' => '2.1.6',
+ 'version' => '2.1.6.0',
'reference' => null,
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
@@ -110,8 +110,8 @@
'dev_requirement' => false,
),
'masteriyo/masteriyo' => array(
- 'pretty_version' => '2.1.5',
- 'version' => '2.1.5.0',
+ 'pretty_version' => '2.1.6',
+ 'version' => '2.1.6.0',
'reference' => null,
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',