mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
b96ab5aadf
Summary: Fixes T4443. Plug VCS passwords into the shared key stretching. They don't use any real stretching now (I anticipated doing something like T4443 eventually) so we can just migrate them into stretching all at once. Test Plan: - Viewed VCS settings. - Used VCS password after migration. - Set VCS password. - Upgraded VCS password by using it. - Used VCS password some more. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4443 Differential Revision: https://secure.phabricator.com/D8272
27 lines
702 B
PHP
27 lines
702 B
PHP
<?php
|
|
|
|
$table = new PhabricatorRepositoryVCSPassword();
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
echo "Upgrading password hashing for VCS passwords.\n";
|
|
|
|
$best_hasher = PhabricatorPasswordHasher::getBestHasher();
|
|
foreach (new LiskMigrationIterator($table) as $password) {
|
|
$id = $password->getID();
|
|
|
|
echo "Migrating VCS password {$id}...\n";
|
|
|
|
$input_hash = $password->getPasswordHash();
|
|
$input_envelope = new PhutilOpaqueEnvelope($input_hash);
|
|
|
|
$storage_hash = $best_hasher->getPasswordHashForStorage($input_envelope);
|
|
|
|
queryfx(
|
|
$conn_w,
|
|
'UPDATE %T SET passwordHash = %s WHERE id = %d',
|
|
$table->getTableName(),
|
|
$storage_hash->openEnvelope(),
|
|
$id);
|
|
}
|
|
|
|
echo "Done.\n";
|