jhthorsen / json-validator

:cop: Validate data against a JSON schema
https://metacpan.org/release/JSON-Validator
57 stars 59 forks source link

Email format validation is SCARY #68

Closed rolosworld closed 7 years ago

rolosworld commented 7 years ago

Test code: https://pastebin.com/Ya07Qv9e

Results:

' or email='a@a.a: JSON::Validator | -
a@' or email='a.a: JSON::Validator | -
a@a.' or email='a: JSON::Validator | -
' or email='a@' or email='a.' or email='a: JSON::Validator | -
 @a.a: - | -
a..a@a.a: JSON::Validator | -
a.@a.a: - | -
.a@a.a: JSON::Validator | -
a@.a.a: - | -
a@a..a: JSON::Validator | -
a@a.a.: JSON::Validator | -
.a@a.a.: JSON::Validator | -
a@a.a: JSON::Validator | Email::Valid
email@example.com: JSON::Validator | Email::Valid
firstname.lastname@example.com: JSON::Validator | Email::Valid
email@subdomain.example.com: JSON::Validator | Email::Valid
firstname+lastname@example.com: JSON::Validator | Email::Valid
email@123.123.123.123: JSON::Validator | Email::Valid
email@[123.123.123.123]: JSON::Validator | Email::Valid
"email"@example.com: JSON::Validator | Email::Valid
1234567890@example.com: JSON::Validator | Email::Valid
email@example-one.com: JSON::Validator | Email::Valid
_______@example.com: JSON::Validator | Email::Valid
email@example.name: JSON::Validator | Email::Valid
email@example.museum: JSON::Validator | Email::Valid
email@example.co.jp: JSON::Validator | Email::Valid
firstname-lastname@example.com: JSON::Validator | Email::Valid
much."more\ unusual"@example.com: JSON::Validator | Email::Valid
very.unusual."@".unusual.com@example.com: JSON::Validator | Email::Valid
very."(),:;<>[]".VERY."very@\\\ \"very".unusual@strange.example.com: JSON::Validator | Email::Valid
plainaddress: - | -
#@%^%#$@#$@#.com: JSON::Validator | -
@example.com: - | -
Joe Smith <email@example.com>: JSON::Validator | Email::Valid
email.example.com: - | -
email@example@example.com: JSON::Validator | -
.email@example.com: JSON::Validator | -
email.@example.com: - | -
email..email@example.com: JSON::Validator | -
あいうえお@example.com: - | -
email@example.com (Joe Smith): JSON::Validator | Email::Valid
email@example: JSON::Validator | -
email@-example.com: JSON::Validator | -
email@example.web: JSON::Validator | Email::Valid
email@111.222.333.44444: JSON::Validator | Email::Valid
email@example..com: JSON::Validator | -
Abc..123@example.com: JSON::Validator | -
"(),:;<>[\]@example.com: - | -
just"not"right@example.com: JSON::Validator | -
this\ is\"really\"not\\allowed@example.com: JSON::Validator | -
jhthorsen commented 7 years ago

I cannot see any obvious bug reported, nor action requested, so I'm closing this issue.

Please open a PR if you want to improve the email validation.