From: Dave Miller Date: Thu, 29 Aug 2024 11:06:04 +0000 (-0400) Subject: Bug 1813629: Prevent Auth plugins from authenticating usernames with unicode variants X-Git-Tag: bugzilla-5.2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=718c0e1c6d965ffe3c7e2586b22b0e205697392f;p=thirdparty%2Fbugzilla.git Bug 1813629: Prevent Auth plugins from authenticating usernames with unicode variants Co-authored-by: David Lawrence --- diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index b33c39748..63faac032 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -131,7 +131,19 @@ sub new { $_[0] = $param; } } - return $class->SUPER::new(@_); + + $user = $class->SUPER::new(@_); + + # MySQL considers some non-ascii characters such as umlauts to equal + # ascii characters returning a user when it should not. + if ($user && ref $param eq 'HASH' && exists $param->{name}) { + my $login = $param->{name}; + if (lc $login ne lc $user->login) { + $user = undef; + } + } + + return $user; } sub super_user {