Bugzilla – Attachment 129643 Details for
Bug 29914
check_cookie_auth not strict enough
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29914: Make check_cookie_auth compare the userid
Bug-29914-Make-checkcookieauth-compare-the-userid.patch (text/plain), 1.73 KB, created by
Jonathan Druart
on 2022-01-20 10:43:10 UTC
(
hide
)
Description:
Bug 29914: Make check_cookie_auth compare the userid
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-01-20 10:43:10 UTC
Size:
1.73 KB
patch
obsolete
>From 8c57e18b6e670e225bc3eee49cbd8bf605ebcf47 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 20 Jan 2022 10:10:05 +0100 >Subject: [PATCH] Bug 29914: Make check_cookie_auth compare the userid > >check_cookie_auth is assuming that the user is authenticated if a cookie exists >and that the login/username exists in the DB. > >So basically if you hit the login page, fill the login input with a >valid username, click "login" >=> A cookie will be generated, and the sessions table will contain a >line with this session id. >On the second hit, if the username is in the DB, it will be enough to be >considered authenticated. >--- > C4/Auth.pm | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 1cfeed48cc4..30a96c489cb 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1700,18 +1700,17 @@ sub check_cookie_auth { > $session->flush; > C4::Context->_unset_userenv($sessionID); > return ( "restricted", undef, { old_ip => $ip, new_ip => $remote_addr}); >- } else { >+ } elsif ( $userid ) { > $session->param( 'lasttime', time() ); > my $flags = defined($flagsrequired) ? haspermission( $userid, $flagsrequired ) : 1; > if ($flags) { > return ( "ok", $session ); >- } else { >- $session->delete(); >- $session->flush; >- C4::Context->_unset_userenv($sessionID); >- return ( "failed", undef ); > } > } >+ $session->delete(); >+ $session->flush; >+ C4::Context->_unset_userenv($sessionID); >+ return ( "failed", undef ); > } else { > return ( "expired", undef ); > } >-- >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 29914
:
129634
|
129643
|
129652
|
129664
|
129682
|
129693
|
129694
|
129718
|
129719
|
129720
|
129725
|
129726
|
129727
|
129728
|
129729
|
129742
|
129743