Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

🐛(backend) harden email matching against ambiguous cases

lebaudantoined370a4db1093
diff --git a/src/backend/core/authentication/backends.py b/src/backend/core/authentication/backends.py
index 9e2ada71..7ce8799c 100644
--- a/src/backend/core/authentication/backends.py
+++ b/src/backend/core/authentication/backends.py
@@ -96,7 +96,11 @@ class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend):
except User.DoesNotExist:
if email and settings.OIDC_FALLBACK_TO_EMAIL_FOR_IDENTIFICATION:
try:
- return User.objects.get(email=email)
+ return User.objects.get(email__iexact=email)
except User.DoesNotExist:
pass
+ except User.MultipleObjectsReturned as e:
+ raise SuspiciousOperation(
+ _("Multiple user accounts share a common email.")
+ ) from e
return None