Katie Horn has uploaded a new change for review.
https://gerrit.wikimedia.org/r/86760
Change subject: Security tightening, part 1
......................................................................
Security tightening, part 1
Change-Id: I79393149e67f9365ba5a9e5ee076b0c49eba2f25
---
M extras/custom_filters/filters/minfraud/ccfd/HTTPBase.php
M extras/extras.body.php
M gateway_common/DonationData.php
M gateway_common/gateway.adapter.php
M globalcollect_gateway/globalcollect_gateway.body.php
M globalcollect_gateway/globalcollect_resultswitcher.body.php
M payflowpro_gateway/api_payflowpro_gateway.php
M payflowpro_gateway/payflowpro_gateway.body.php
8 files changed, 15 insertions(+), 27 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/60/86760/1
diff --git a/extras/custom_filters/filters/minfraud/ccfd/HTTPBase.php
b/extras/custom_filters/filters/minfraud/ccfd/HTTPBase.php
index b4eb94b..378d201 100644
--- a/extras/custom_filters/filters/minfraud/ccfd/HTTPBase.php
+++ b/extras/custom_filters/filters/minfraud/ccfd/HTTPBase.php
@@ -192,8 +192,8 @@
function readIpAddressFromWeb() {
//check if the curl module exists
- $url = "http://www.maxmind.com/app/ws_ipaddr";
- if (extension_loaded('curl')) {
+ $url = "https://www.maxmind.com/app/ws_ipaddr";
+ if (extension_loaded('curl')) {
// open curl
$ch = curl_init();
@@ -304,9 +304,9 @@
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
- //this option lets you store the result in a string
+ //this option lets you store the result in a string
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
diff --git a/extras/extras.body.php b/extras/extras.body.php
index 7939e82..82b85b1 100644
--- a/extras/extras.body.php
+++ b/extras/extras.body.php
@@ -93,7 +93,7 @@
* @return bool
*/
public function compare_hash( $hash, $data ) {
- if ( $hash == $this->generate_hash( $data ) ) {
+ if ( $hash === $this->generate_hash( $data ) ) {
return TRUE;
}
diff --git a/gateway_common/DonationData.php b/gateway_common/DonationData.php
index 3d4314a..cf8d2aa 100644
--- a/gateway_common/DonationData.php
+++ b/gateway_common/DonationData.php
@@ -986,7 +986,7 @@
//and reset the token for next time.
$this->token_refreshAllTokenEverything();
}
- return $val == $sessionSaltedToken;
+ return $val === $sessionSaltedToken;
}
/**
diff --git a/gateway_common/gateway.adapter.php
b/gateway_common/gateway.adapter.php
index dd0e7cc..c5f4231 100644
--- a/gateway_common/gateway.adapter.php
+++ b/gateway_common/gateway.adapter.php
@@ -1138,7 +1138,7 @@
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_TIMEOUT => self::getGlobal( 'Timeout' ),
CURLOPT_FOLLOWLOCATION => 0,
- CURLOPT_SSL_VERIFYPEER => 0,
+ CURLOPT_SSL_VERIFYPEER => 1,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_FORBID_REUSE => true,
CURLOPT_POST => 1,
diff --git a/globalcollect_gateway/globalcollect_gateway.body.php
b/globalcollect_gateway/globalcollect_gateway.body.php
index bf43589..8728e2e 100644
--- a/globalcollect_gateway/globalcollect_gateway.body.php
+++ b/globalcollect_gateway/globalcollect_gateway.body.php
@@ -234,7 +234,7 @@
if ( isset( $data[ $field ] ) ) {
$return .= Xml::openElement( 'tr', array() );
$return .= Xml::tags( 'td', array( 'style' =>
'text-align:right; font-weight:bold; padding-right:0.5em;' ), $this->msg(
$meta['translation'] )->escaped() );
- $return .= Xml::tags( 'td', array( 'style' =>
'padding-left:0.5em;' ), $data[ $field ] );
+ $return .= Xml::tags( 'td', array ('style' =>
'padding-left:0.5em;'), htmlspecialchars( $data[$field], ENT_QUOTES ) );
$return .= Xml::closeElement( 'tr' );
}
}
@@ -282,7 +282,7 @@
if ( isset( $data[ $field ] ) ) {
$return .= Xml::openElement( 'tr', array() );
$return .= Xml::tags( 'th', array(),
$this->msg( $meta['translation'] )->escaped() );
- $return .= Xml::tags( 'td', array(), $data[
$field ] );
+ $return .= Xml::tags( 'td', array (),
htmlspecialchars( $data[$field], ENT_QUOTES ) );
$return .= Xml::closeElement( 'tr' );
}
}
diff --git a/globalcollect_gateway/globalcollect_resultswitcher.body.php
b/globalcollect_gateway/globalcollect_resultswitcher.body.php
index e41d380..0056af5 100644
--- a/globalcollect_gateway/globalcollect_resultswitcher.body.php
+++ b/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -150,22 +150,10 @@
$displayData = $this->adapter->getData_Unstaged_Escaped();
$failpage = $this->adapter->getFailPage();
- if ( $failpage ) {
- return $failpage;
- } else {
- // Get the page we're going to send them back to.
- $referrer = $displayData['referrer'];
- $returnto = htmlspecialchars_decode( $referrer ); //
escape for security
-
- // Set the response as failure so that an error message
will be displayed when the form reloads.
- $this->adapter->addData( array( 'response' => 'failure'
) );
-
- // Store their data in the session.
- $this->adapter->addDonorDataToSession();
-
- // Return the referrer URL
- return $returnto;
+ if ( !$failpage ) {
+ throw new MWException( __FUNCTION__ . ': No declined
result page defined. Please define a FailPage global for ' .
$this->adapter->getGatewayIdentifier() );
}
+ return $failpage;
}
function popout_if_iframe() {
diff --git a/payflowpro_gateway/api_payflowpro_gateway.php
b/payflowpro_gateway/api_payflowpro_gateway.php
index bde2069..3bb361d 100644
--- a/payflowpro_gateway/api_payflowpro_gateway.php
+++ b/payflowpro_gateway/api_payflowpro_gateway.php
@@ -81,7 +81,7 @@
if ( isset( $params[ 'dispatch' ] ) && strlen( $params[
'dispatch' ] ) ) {
$method = $this->getDispatchMethod( $params[ 'dispatch'
] );
if ( !in_array( $method, $this->validDispatchMethods )
|| !method_exists( $this, $method ) ) {
- $this->dieUsage( "Invalid dispatch method
<<<$method>>> passed to the Donation Interface Gateway API.", 'unknown_method'
);
+ $this->dieUsage( "Invalid dispatch method <<<"
. htmlspecialchars( $method, ENT_QUOTES ) . ">>> passed to the Donation
Interface Gateway API.", 'unknown_method' );
}
// make sure we have tracking data for
get_required_dynamic_form_elements
diff --git a/payflowpro_gateway/payflowpro_gateway.body.php
b/payflowpro_gateway/payflowpro_gateway.body.php
index abd66a9..aeabfd2 100644
--- a/payflowpro_gateway/payflowpro_gateway.body.php
+++ b/payflowpro_gateway/payflowpro_gateway.body.php
@@ -129,7 +129,7 @@
$this->getOutput()->redirect( $thankyoupage );
} else {
// display response message
- $this->getOutput()->addHTML( '<h3
class="response_message">' . $responseMsg . '</h3>' );
+ $this->getOutput()->addHTML( '<h3
class="response_message">' . htmlspecialchars( $responseMsg, ENT_QUOTES ) .
'</h3>' );
// translate country code into text
$countries = GatewayForm::getCountries();
@@ -162,7 +162,7 @@
$declinedDefault = $this->msg( 'php-response-declined'
)->escaped();
// display response message
- $this->getOutput()->addHTML( '<h3
class="response_message">' . $declinedDefault . ' ' . $responseMsg . '</h3>' );
+ $this->getOutput()->addHTML( '<h3
class="response_message">' . $declinedDefault . ' ' . htmlspecialchars(
$responseMsg, ENT_QUOTES ) . '</h3>' );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/86760
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79393149e67f9365ba5a9e5ee076b0c49eba2f25
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Katie Horn <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits