[MediaWiki-commits] [Gerrit] mediawiki...OATHAuth[master]: Trim surrounding whitespace and seperators from tokens
jenkins-bot has submitted this change and it was merged. Change subject: Trim surrounding whitespace and seperators from tokens .. Trim surrounding whitespace and seperators from tokens Google authenticator uses a space character as a group seperator. We can thus expect users to enter such a separator and we should not fail on that. Might as well trim whitespace too, as that is another oft occuring user input mistake, that should not affect functionality. Bug: T150603 Change-Id: I7334ed5dfaf933e61831438e2f86aa979cf9f51b --- M OATHAuthKey.php 1 file changed, 5 insertions(+), 0 deletions(-) Approvals: Gergő Tisza: Looks good to me, approved jenkins-bot: Verified diff --git a/OATHAuthKey.php b/OATHAuthKey.php index 63225d3..0a4be15 100644 --- a/OATHAuthKey.php +++ b/OATHAuthKey.php @@ -98,6 +98,11 @@ Base32::decode( $this->secret['secret'] ), $this->secret['period'], -$wgOATHAuthWindowRadius, $wgOATHAuthWindowRadius ); + + // Remove any whitespace from the received token, which can be an intended group seperator + // or trimmeable whitespace + $token = preg_replace( '/\s+/', '', $token ); + // Check to see if the user's given token is in the list of tokens generated // for the time window. foreach ( $results as $window => $result ) { -- To view, visit https://gerrit.wikimedia.org/r/321998 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7334ed5dfaf933e61831438e2f86aa979cf9f51b Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: TheDJ Gerrit-Reviewer: C. Scott Ananian Gerrit-Reviewer: Gergő Tisza Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...OATHAuth[master]: Trim surrounding whitespace and seperators from tokens
TheDJ has uploaded a new change for review. https://gerrit.wikimedia.org/r/321998 Change subject: Trim surrounding whitespace and seperators from tokens .. Trim surrounding whitespace and seperators from tokens Google authenticator uses a space character as a group seperator. We can thus expect users to enter such a separator and we should not fail on that. Might as well trim whitespace too, as that is another oft occuring user input mistake, that should not affect functionality. Bug: T150603 Change-Id: I7334ed5dfaf933e61831438e2f86aa979cf9f51b --- M OATHAuthKey.php 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OATHAuth refs/changes/98/321998/1 diff --git a/OATHAuthKey.php b/OATHAuthKey.php index 63225d3..0a4be15 100644 --- a/OATHAuthKey.php +++ b/OATHAuthKey.php @@ -98,6 +98,11 @@ Base32::decode( $this->secret['secret'] ), $this->secret['period'], -$wgOATHAuthWindowRadius, $wgOATHAuthWindowRadius ); + + // Remove any whitespace from the received token, which can be an intended group seperator + // or trimmeable whitespace + $token = preg_replace( '/\s+/', '', $token ); + // Check to see if the user's given token is in the list of tokens generated // for the time window. foreach ( $results as $window => $result ) { -- To view, visit https://gerrit.wikimedia.org/r/321998 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7334ed5dfaf933e61831438e2f86aa979cf9f51b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OATHAuth Gerrit-Branch: master Gerrit-Owner: TheDJ ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits