Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/239427

Change subject: Prevent potential DOM-based XSS
......................................................................

Prevent potential DOM-based XSS

Use .text() instead of .html() when adding content from other elements.
We validate amount and currency_code pretty heavily on the way in, but
let's put on some suspenders to go with our belt.

Change-Id: I40c9b2b70ceb1775563f303ec03579202bce200d
---
M amazon_gateway/amazon.js
M globalcollect_gateway/forms/js/webitects2nd-US.js
M globalcollect_gateway/forms/js/webitects2nd.js
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/27/239427/1

diff --git a/amazon_gateway/amazon.js b/amazon_gateway/amazon.js
index 4759df2..eb88ba2 100644
--- a/amazon_gateway/amazon.js
+++ b/amazon_gateway/amazon.js
@@ -179,7 +179,7 @@
                if ( $( '#amount_input' ).is( ':visible' ) ) {
                        $( '#amount_input' ).hide();
                        $( '#selected-amount' )
-                               .html( $( '#amount' ).val() + ' ' + $( 
'#currency_code' ).val() )
+                               .text( $( '#amount' ).val() + ' ' + $( 
'#currency_code' ).val() )
                                .show();
                }
        }
diff --git a/globalcollect_gateway/forms/js/webitects2nd-US.js 
b/globalcollect_gateway/forms/js/webitects2nd-US.js
index f35ff82..2b46f67 100644
--- a/globalcollect_gateway/forms/js/webitects2nd-US.js
+++ b/globalcollect_gateway/forms/js/webitects2nd-US.js
@@ -81,7 +81,7 @@
        if ( amount === null || isNaN( amount.val() ) || amount.val() <= 0 ) {
                // the amount is not set
                $( '#step1wrapper' ).slideDown();
-//             $( '#selected-amount' ).html( '(' + $( 
'input[name="currency_code"]' ).val() + ')' );
+//             $( '#selected-amount' ).text( '(' + $( 
'input[name="currency_code"]' ).val() + ')' );
 
        } else {
                showAmount( $( 'input[name="amount"]' ) );
diff --git a/globalcollect_gateway/forms/js/webitects2nd.js 
b/globalcollect_gateway/forms/js/webitects2nd.js
index de006a4..318344f 100644
--- a/globalcollect_gateway/forms/js/webitects2nd.js
+++ b/globalcollect_gateway/forms/js/webitects2nd.js
@@ -93,7 +93,7 @@
        if ( amount === null || isNaN( amount.val() ) || amount.val() <= 0 ) {
                // the amount is not set
                $( '#step1wrapper' ).slideDown();
-               $( '#selected-amount' ).html( '(' + $( 
'input[name="currency_code"]' ).val() + ')' );
+               $( '#selected-amount' ).text( '(' + $( 
'input[name="currency_code"]' ).val() + ')' );
        } else {
                showAmount( $( 'input[name="amount"]' ) );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/239427
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40c9b2b70ceb1775563f303ec03579202bce200d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to