Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underscore in domain is accepted #5

Closed
orlitzky opened this issue Jun 10, 2013 · 5 comments
Closed

Underscore in domain is accepted #5

orlitzky opened this issue Jun 10, 2013 · 5 comments
Assignees
Milestone

Comments

@orlitzky
Copy link

Prelude> :m + Text.Email.Validate Data.ByteString.UTF8
Prelude Text.Email.Validate Data.ByteString.UTF8> isValid $ fromString "local@exam_ple.com"
True

While underscores are legal in DNS, they're disallowed for hostnames. So you can't have either an 'A' or an 'MX' record for a name with an underscore in it, and thus no address with an underscore in it will be deliverable.

This is a gray area with respect to RFC5322, but I think it's best to reject them since in practice the addresses are invalid. A quote from the RFC:

Note: A liberal syntax for the domain portion of addr-spec is
given here. However, the domain portion contains addressing
information specified by and used in other protocols (e.g.,
[RFC1034], [RFC1035], [RFC1123], [RFC5321]). It is therefore
incumbent upon implementations to conform to the syntax of
addresses for the context in which they are used.

@Porges
Copy link
Owner

Porges commented Jun 16, 2013

This is basically the same thing as issue #2; RFC5322 is very loose with regards to domain names. My eventual intention is to add stronger validation for this based upon another package rather than including the code in email-validate, as domain parsing/validation has more widespread usages.

@orlitzky
Copy link
Author

Ok, sounds good. I just wanted to mention it because email-validate was failing the underscore test I developed for an old ruby validator I wrote. I left that test commented out for now.

@Porges Porges added this to the v2.1 milestone Feb 3, 2015
@Porges Porges self-assigned this Feb 3, 2015
@Porges Porges modified the milestones: v2.2, v2.1 Apr 22, 2015
@Porges Porges modified the milestones: v2.3, v2.2 Jan 14, 2016
@Porges Porges closed this as completed in 070763d Jan 27, 2016
@orlitzky
Copy link
Author

Thanks! I'll update my tests.

@Porges
Copy link
Owner

Porges commented Jan 27, 2016

Note this is not yet published to hackage. I'm thinking that it is going to be 3.0 as it breaks compatibility with existing addresses.

@orlitzky
Copy link
Author

Not a problem. I have a tool email-validator that uses email-validate for its syntax checks (which are a huge part of the program). I have no other reason to make a version bump, so I can wait and then update the version bounds to make sure my test suite passes.

On a related note, I also wrote a domain name parser in the meantime for harbl but I never finished the project. It's not dead per se, I just have other things to do... The goal is to parse DNS blacklist names which are essentially domain names. Someday, if I finish it, I can try to split out the domain name parsing into a library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants