]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1813629: Prevent Auth plugins from authenticating usernames with unicode variants
authorDave Miller <justdave@bugzilla.org>
Thu, 29 Aug 2024 11:06:04 +0000 (07:06 -0400)
committerDave Miller <github@justdave.net>
Tue, 3 Sep 2024 14:39:49 +0000 (10:39 -0400)
Co-authored-by: David Lawrence <dkl@mozilla.com>
Bugzilla/User.pm

index b33c39748413f1d5148358e5baf7dee153f9dbcd..63faac0320c9490808cc3773888b9ba9eb2aca94 100644 (file)
@@ -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 {