validator.js icon indicating copy to clipboard operation
validator.js copied to clipboard

extended ascii passed isEmail validation

Open born2net opened this issue 1 year ago • 2 comments

when using email like [email protected] it passes validation of isEmail you cannot use extended characters in emails. even if I enable: allow_utf8_local_part: false these emails will also pass as valid:

ka25maj@gˇmail.com

has this never been reported?

born2net avatar Apr 23 '24 04:04 born2net

Hello. I have the same issue here. It seems the validator does not validate on DNS and is not checking if an email is RFC compliant.

iamkhusainov7 avatar May 15 '24 06:05 iamkhusainov7

Internationalized domain names (IDNs) may accept extended ASCII characters. Setting allow_utf8_local_part to false fixes the first issue, causing [email protected] to fail validation as expected. However, ka25maj@gˇmail.com would still pass as the option only affects the local part of the email.

To address this, I suggest introducing a separate allow_idn option to allow developers to specify whether IDNs are valid for their use case. By default, this should be set to false since IDNs are less common. An alternative solution is adding allow_utf8_domain, but the first solution seems more intuitive.

If the fix is deemed fit, please assign the issue to me.

aabboudi avatar Oct 05 '24 22:10 aabboudi