Bugzilla – Attachment 124727 Details for
Bug 28772
Any user that can work with reports can see API keys of any other user
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28772: Make validate_secret return 1|0
Bug-28772-Make-validatesecret-return-10.patch (text/plain), 1.40 KB, created by
Jonathan Druart
on 2021-09-10 08:35:12 UTC
(
hide
)
Description:
Bug 28772: Make validate_secret return 1|0
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-09-10 08:35:12 UTC
Size:
1.40 KB
patch
obsolete
>From c930db2665705562b0d59093348016e9db8ba3eb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 10 Sep 2021 10:34:41 +0200 >Subject: [PATCH] Bug 28772: Make validate_secret return 1|0 > >Not an empty string >--- > Koha/ApiKey.pm | 2 +- > t/db_dependent/Koha/ApiKey.t | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/ApiKey.pm b/Koha/ApiKey.pm >index 4b938136091..28b2c5f42ce 100644 >--- a/Koha/ApiKey.pm >+++ b/Koha/ApiKey.pm >@@ -80,7 +80,7 @@ sub validate_secret { > > my $digest = Koha::AuthUtils::hash_password( $secret, $self->secret ); > >- return $self->secret eq $digest; >+ return ( $self->secret eq $digest ) ? 1 : 0; > } > > =head3 plain_text_secret >diff --git a/t/db_dependent/Koha/ApiKey.t b/t/db_dependent/Koha/ApiKey.t >index 228f0961c9f..d9f46fce880 100755 >--- a/t/db_dependent/Koha/ApiKey.t >+++ b/t/db_dependent/Koha/ApiKey.t >@@ -130,8 +130,8 @@ subtest 'validate_secret() tests' => sub { > > my $secret = $api_key->plain_text_secret; > >- ok( $api_key->validate_secret( $secret ), 'Valid secret returns true' ); >- ok( !$api_key->validate_secret( 'Wrong secret' ), 'Invalid secret returns false' ); >+ is( $api_key->validate_secret( $secret ), 1, 'Valid secret returns true' ); >+ is( $api_key->validate_secret( 'Wrong secret' ), 0, 'Invalid secret returns false' ); > > $schema->storage->txn_rollback; > }; >-- >2.25.1
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 28772
:
124195
|
124247
|
124248
|
124249
|
124250
|
124251
|
124487
|
124488
|
124489
|
124490
|
124491
|
124691
|
124692
|
124693
|
124694
|
124695
|
124696
|
124697
|
124698
|
124699
|
124700
|
124701
|
124702
|
124703
|
124704
|
124705
| 124727 |
125088
|
125112
|
125116
|
125118
|
125128