-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
Milestone
Description
Description
When adding a user to a team, the system checks if the user already exists in the database. If found via LDAP, a temporary user is created and invited. However, LDAP may return emails with mixed or uppercase characters (e.g. John.Doe@Company.com), and these are stored as-is in the database.
Later, when looking up the user via findUserByAttributes (TeamController.scala L1045), the query uses a case-sensitive match, so it fails to find the user if the stored email differs in case from the search input.
Steps to reproduce
- A user is created from LDAP with email
John.Doe@Company.com - Try to add this user to a team by searching for
john.doe@company.com findUserByAttributesreturns null — user not found
Proposed fix
- Normalize emails to lowercase on write — Whenever an email is stored (user creation, LDAP sync, etc.), convert it to lowercase first. Per RFC 5321, the local part of an email can be case-sensitive in theory, but in practice no major provider enforces this, and lowercase normalization is the industry standard.
- Make
findUserByAttributescase-insensitive — Use a case-insensitive comparison (e.g.LOWER()/ILIKEin PostgreSQL) for email lookups, so existing data with mixed case is still matched correctly.
Reactions are currently unavailable