#12838·zitadel

[Bug]: External IdP (Entra) email verified flag dropped on case-only mismatch during registration

Author: juliofihdeldevCreated Sep 29, 2026Updated Sep 29, 2026

Preflight Checklist

  • I could not find a solution in the documentation, the existing issues or discussions.

Environment

Self-hosted

Describe the problem caused by this bug

When an external IdP (e.g. Microsoft Entra ID) returns a verified email whose casing differs from the value shown/submitted on the "external account not found" registration page, the IdP-verified status is dropped and the user is forced to re-verify.

We flagged early on that emails from the Entra tenant may not match the capitalization already present in ZITADEL. Concretely, users that existed prior to SSO were stored with a lowercase domain ([email protected]), while their Entra tenant asserts a different casing ([email protected]). These are the same address, but the registration mapping compares them case-sensitively.

The relevant check in mapExternalNotFoundOptionFormDataToLoginUser (internal/api/ui/login/external_provider_handler.go):

go
isEmailVerified := linkingUser.IsEmailVerified && formData.Email == linkingUser.Email

Because formData.Email ([email protected]) != linkingUser.Email ([email protected]), isEmailVerified becomes false even though the IdP genuinely verified the address, so ZITADEL triggers an unnecessary re-verification.

To reproduce

Steps to reproduce the behavior:

  1. Configure an Entra ID (Azure AD / OIDC) IdP whose tenant returns a verified email with uppercase characters, e.g. [email protected].
  2. Have (or create) a ZITADEL user / form value using a different casing of the same address, e.g. [email protected].
  3. Log in through the IdP and reach the "external account not found" registration page.
  4. Submit the form without changing the address (other than casing already differing).
  5. Observe that the email is treated as unverified and a verification is requested, despite the IdP having verified it.

Expected behavior

Email addresses should be compared case-insensitively. A difference only in capitalization between the IdP-verified email and the submitted value must not drop the verified flag or force re-verification.

Additional Context

  • Email addresses are effectively case-insensitive for delivery, and the domain part is case-insensitive per RFC 5321.
  • The check is security-sensitive (hardened against GHSA-738m-7888-jfv8); the fix must keep sourcing the verified flag from the trusted linkingUser, only loosening the casing of the "did the user keep the same address" comparison.