Bugzilla – Attachment 152097 Details for
Bug 30649
Vendor EDI account passwords should be encrypted in the database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30649: (follow-up) Improve database update
Bug-30649-follow-up-Improve-database-update.patch (text/plain), 2.07 KB, created by
Martin Renvoize (ashimema)
on 2023-06-07 11:43:19 UTC
(
hide
)
Description:
Bug 30649: (follow-up) Improve database update
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-06-07 11:43:19 UTC
Size:
2.07 KB
patch
obsolete
>From 6584aba475e6000a0f496b8d0fddcc68d19ef887 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 7 Jun 2023 12:42:01 +0100 >Subject: [PATCH] Bug 30649: (follow-up) Improve database update > >This patch implements the proposed switch to use the standard DB handle >and only require Koha::Encryption if necessary. >--- > installer/data/mysql/db_revs/221200041.pl | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > >diff --git a/installer/data/mysql/db_revs/221200041.pl b/installer/data/mysql/db_revs/221200041.pl >index ad933e316e..44777c040f 100755 >--- a/installer/data/mysql/db_revs/221200041.pl >+++ b/installer/data/mysql/db_revs/221200041.pl >@@ -1,7 +1,7 @@ > use Modern::Perl; > > return { >- bug_number => "30649", >+ bug_number => "30649", > description => "Increase the vendor EDI account password field to 256 characters", > up => sub { > my ($args) = @_; >@@ -10,16 +10,17 @@ return { > ALTER TABLE vendor_edi_accounts CHANGE COLUMN `password` `password` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL > }); > >- require Koha::Encryption; >- my $e = Koha::Encryption->new; >- >- my $schema = Koha::Database->new()->schema(); >- my $rs = $schema->resultset('VendorEdiAccount')->search(); >- while ( my $a = $rs->next() ) { >- my $password = $a->password; >- $password = $e->encrypt_hex($password); >- $a->password($password); >- $a->update(); >+ my $edi_vendors = >+ $dbh->selectall_arrayref( "SELECT * FROM vendor_edit_accounts", { Slice => {} } ); >+ if (@$edi_vendors) { >+ require Koha::Encryption; >+ my $e = Koha::Encryption->new; >+ for my $edi_vendor (@$edi_vendors) { >+ my $id = $edi_vendor->{id}; >+ my $password = $edi_vendor->{password}; >+ $password = $e->encrypt_hex($password); >+ $dbh->do("UPDATE edi_vendor_accounts SET password = $password WHERE id = $id"); >+ } > } > }, > }; >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 30649
:
134298
|
134300
|
134301
|
134302
|
142056
|
142057
|
142820
|
142989
|
144323
|
144324
|
144325
| 152097