Page MenuHomePhabricator

D8282.id19706.diff
No OneTemporary

D8282.id19706.diff

Index: src/applications/diffusion/panel/DiffusionSetPasswordPanel.php
===================================================================
--- src/applications/diffusion/panel/DiffusionSetPasswordPanel.php
+++ src/applications/diffusion/panel/DiffusionSetPasswordPanel.php
@@ -178,11 +178,13 @@
->setLabel(pht('Best Available Algorithm'))
->setValue(PhabricatorPasswordHasher::getBestAlgorithmName()));
- if (PhabricatorPasswordHasher::canUpgradeHash($hash_envelope)) {
- $errors[] = pht(
- 'The strength of your stored VCS password hash can be upgraded. '.
- 'To upgrade, either: use the password to authenticate with a '.
- 'repository; or change your password.');
+ if (strlen($hash_envelope->openEnvelope())) {
+ if (PhabricatorPasswordHasher::canUpgradeHash($hash_envelope)) {
+ $errors[] = pht(
+ 'The strength of your stored VCS password hash can be upgraded. '.
+ 'To upgrade, either: use the password to authenticate with a '.
+ 'repository; or change your password.');
+ }
}
$object_box = id(new PHUIObjectBoxView())
Index: src/applications/settings/panel/PhabricatorSettingsPanelPassword.php
===================================================================
--- src/applications/settings/panel/PhabricatorSettingsPanelPassword.php
+++ src/applications/settings/panel/PhabricatorSettingsPanelPassword.php
@@ -113,11 +113,13 @@
}
$hash_envelope = new PhutilOpaqueEnvelope($user->getPasswordHash());
- if (PhabricatorPasswordHasher::canUpgradeHash($hash_envelope)) {
- $errors[] = pht(
- 'The strength of your stored password hash can be upgraded. '.
- 'To upgrade, either: log out and log in using your password; or '.
- 'change your password.');
+ if (strlen($hash_envelope->openEnvelope())) {
+ if (PhabricatorPasswordHasher::canUpgradeHash($hash_envelope)) {
+ $errors[] = pht(
+ 'The strength of your stored password hash can be upgraded. '.
+ 'To upgrade, either: log out and log in using your password; or '.
+ 'change your password.');
+ }
}
$len_caption = null;
Index: src/infrastructure/util/password/PhabricatorPasswordHasher.php
===================================================================
--- src/infrastructure/util/password/PhabricatorPasswordHasher.php
+++ src/infrastructure/util/password/PhabricatorPasswordHasher.php
@@ -333,6 +333,11 @@
* @task hashing
*/
public static function canUpgradeHash(PhutilOpaqueEnvelope $hash) {
+ if (!strlen($hash->openEnvelope())) {
+ throw new Exception(
+ pht('Expected a password hash, received nothing!'));
+ }
+
$current_hasher = self::getHasherForHash($hash);
$best_hasher = self::getBestHasher();

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 24, 10:38 AM (6 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7707983
Default Alt Text
D8282.id19706.diff (2 KB)

Event Timeline