From 4c01cf01d9ec9a7557bb3d7c632170badc5d5126 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 9 Sep 2021 08:51:02 -0300 Subject: [PATCH] Bug 28772: Do not hash secrets twice Content-Type: text/plain; charset=utf-8 Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy --- installer/data/mysql/atomicupdate/bug_28772_api_keys.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_28772_api_keys.pl b/installer/data/mysql/atomicupdate/bug_28772_api_keys.pl index 1e38409018..2baf5bf788 100755 --- a/installer/data/mysql/atomicupdate/bug_28772_api_keys.pl +++ b/installer/data/mysql/atomicupdate/bug_28772_api_keys.pl @@ -25,8 +25,10 @@ return { }); foreach my $api_key (@$results) { - my $digest = Koha::AuthUtils::hash_password( $api_key->{secret} ); - $sth->execute( $digest, $api_key->{client_id} ); + unless ( $api_key->{secret} =~ m/^\$2a\$08\$/ ) { + my $digest = Koha::AuthUtils::hash_password( $api_key->{secret} ); + $sth->execute( $digest, $api_key->{client_id} ); + } } }, } -- 2.20.1