Sign-ups with malformed international domains get through. A domain label may not start or end with a hyphen, and the email validator enforces that for ASCII domains: user@-example.com is rejected. Write the same shape w…
Sign-ups with malformed international domains get through. A domain label may not start or end with a hyphen, and the email validator enforces that for ASCII domains: user@-example.com is rejected. Write the same shape with a non-ASCII letter and it is accepted, so addresses that can never receive mail end up in the database.
from marshmallow import validate
validate.Email()("user@-münchen.de")
validate.Email()("user@münchen-.de")
Both raise ValidationError: Not a valid email address., exactly as user@-example.com and user@example-.com do.
Both are returned as valid.
user@münchen.de, user@例え.jp, δοκ.ιμή@παράδειγμα.δοκιμή, user@sub.münchen.de.user@a-ü.de.Adapted from marshmallow-code/marshmallow (MIT).
Visible test command
pytest testsThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
email-validator-accepts-bad-international-domains
Changes under src/ are evaluated.