Skip to content

LDAP user lookup fails due to email case mismatch #1008

@quentinovega

Description

@quentinovega

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

  1. A user is created from LDAP with email John.Doe@Company.com
  2. Try to add this user to a team by searching for john.doe@company.com
  3. findUserByAttributes returns null — user not found

Proposed fix

  1. 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.
  2. Make findUserByAttributes case-insensitive — Use a case-insensitive comparison (e.g. LOWER() / ILIKE in PostgreSQL) for email lookups, so existing data with mixed case is still matched correctly.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions