Use phutil_hashes_are_identical() when comparing hashes in Phabricator
Summary: See D14025. In all cases where we compare hashes, use strict, constant-time comparisons. Test Plan: Logged in, logged out, added TOTP, ran Conduit, terminated sessions, submitted forms, changed password. Tweaked CSRF token, got rejected. Reviewers: chad Reviewed By: chad Subscribers: chenxiruanhai Differential Revision: https://secure.phabricator.com/D14026
This commit is contained in:
@@ -21,7 +21,10 @@ final class PhabricatorAuthTerminateSessionController
|
||||
|
||||
$sessions = $query->execute();
|
||||
foreach ($sessions as $key => $session) {
|
||||
if ($session->getSessionKey() == $current_key) {
|
||||
$is_current = phutil_hashes_are_identical(
|
||||
$session->getSessionKey(),
|
||||
$current_key);
|
||||
if ($is_current) {
|
||||
// Don't terminate the current login session.
|
||||
unset($sessions[$key]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user