Skip to content

Commit

Permalink
Merge pull request #232 from alma/feature/ecom-1474-woocommerce-xss-s…
Browse files Browse the repository at this point in the history
…ecurity-issue

XSS security issue in shortcode widget
  • Loading branch information
Benjamin-Freoua-Alma authored Mar 7, 2024
2 parents 5afd04a + 1bc5682 commit 9920ad7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

v5.2.1
------
* fix: shortcode widget for XSS injection

v5.2.0
------
* feature : HPOS compatibility
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- Tested up to Wordpress: 6.3.2
- Tested up to Woocommerce: 8.2.1
- Requires PHP: 5.6
- Stable tag: 5.2.0
- Stable tag: 5.2.1
- License: GPLv3
- License URI: https://www.gnu.org/licenses/gpl-3.0.html
- Support: [email protected]
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: payments, BNPL, woocommerce, ecommerce, e-commerce, payment gateway, sell,
Requires at least: 4.4
Tested up to: 6.3
Requires PHP: 5.6
Stable tag: 5.2.0
Stable tag: 5.2.1
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -51,6 +51,9 @@ You can find more documentation on our [website](https://docs.almapay.com/docs/w

== Changelog ==

= 5.2.1 =
* fix: shortcode widget for XSS injection

= 5.2.0 =
* feat: Update translations
* fix: widget XSS
Expand Down
4 changes: 2 additions & 2 deletions src/alma-gateway-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Alma - Pay in installments or later for WooCommerce
* Plugin URI: https://docs.almapay.com/docs/woocommerce
* Description: Install Alma and boost your sales! It's simple and guaranteed, your cash flow is secured. 0 commitment, 0 subscription, 0 risk.
* Version: 5.2.0
* Version: 5.2.1
* Author: Alma
* Author URI: https://almapay.com
* License: GNU General Public License v3.0
Expand Down Expand Up @@ -38,7 +38,7 @@
}

if ( ! defined( 'ALMA_VERSION' ) ) {
define( 'ALMA_VERSION', '5.2.0' );
define( 'ALMA_VERSION', '5.2.1' );
}
if ( ! defined( 'ALMA_PLUGIN_FILE' ) ) {
define( 'ALMA_PLUGIN_FILE', __FILE__ );
Expand Down
12 changes: 10 additions & 2 deletions src/includes/class-alma-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function is_debug( $atts ) {
* @return string the rendered eligibility widget to inject
*/
protected function render( $shortcode_tag, $atts, $alma_content, $shortcode_content = '' ) {
$class = isset( $atts['class'] ) ? $atts['class'] : '';
$class = isset( $atts['class'] ) ? htmlspecialchars($atts['class']) : '';
$style = '';
$debug_content = '';
if ( $this->is_debug( $atts ) ) {
Expand All @@ -110,7 +110,15 @@ protected function render( $shortcode_tag, $atts, $alma_content, $shortcode_cont
$debug_content = sprintf( '<div style="%s">%s</div>', $style_title, $shortcode_tag );
}

return sprintf( '<div class="%s %s" style="%s">%s<div class="alma_wc_content">%s</div>%s</div>', $shortcode_tag, $class, $style, $debug_content, do_shortcode( $shortcode_content ), $alma_content );
return sprintf(
'<div class="%s %s" style="%s">%s<div class="alma_wc_content">%s</div>%s</div>',
$shortcode_tag,
$class,
$style,
$debug_content,
do_shortcode( $shortcode_content ),
$alma_content
);

}

Expand Down

0 comments on commit 9920ad7

Please sign in to comment.