Skip to content

fix(auth): Use ASCII-only case folding for invite and registration emails - #128720

Draft
nora-shap wants to merge 1 commit into
masterfrom
nora/auth/ID-1864
Draft

nora-shap wants to merge 1 commit into
masterfrom
nora/auth/ID-1864

Conversation

@nora-shap

Copy link
Copy Markdown
Member

Two email comparisons still used Python's Unicode-aware lowercasing. Unicode case mapping can turn some non-ASCII characters into ASCII ones (for example, U+212A lowercases to "k"), so a look-alike address could be treated as an existing one.

  • AuthIdentityHandler._email_verified_via_pending_invite compared the SSO identity email to the invited email with .lower(). It now uses emails_match, the ASCII-only helper from ref(auth): Apply consistent email matching in user service and SSO verification #127401.
  • RegistrationValidator.validate_email returned value.lower(), so a look-alike address was saved as the ASCII address it resembles. It now returns ascii_casefold(value), which lowercases only A-Z.

The duplicate-account check in validate_email intentionally keeps iexact. Postgres UPPER matches some look-alikes (for example, "ı" to "I"), and for a uniqueness check, over-matching is the safe direction: it refuses to create a look-alike twin of an existing account.

@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown

ID-1864

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant