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

2020.example.com is a valid fqdn #68

Closed
Spone opened this issue Dec 10, 2020 · 8 comments
Closed

2020.example.com is a valid fqdn #68

Spone opened this issue Dec 10, 2020 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@Spone
Copy link

Spone commented Dec 10, 2020

Currently in strict mode:

EmailValidator.valid?("[email protected]", mode: :strict)
=> false

but 2020.example.com is indeed a valid FQDN, right?

@karlwilbur
Copy link
Member

Thanks, @Spone, good catch. I was operating on the RFC-952 spec which disallows hostnames beginning with non-alpha characters. This was definitely changed in the last 35 years (for example, RFC-1123), and I should have caught that. I do know that hostnames can consist of only numbers, but primary domains cannot be only numeric.

This example should be valid in all modes. I'll use your example above in the spec and get it fixed. I'll expect to have that done later today.

@karlwilbur karlwilbur added the bug Something isn't working label Dec 10, 2020
@karlwilbur karlwilbur self-assigned this Dec 10, 2020
karlwilbur added a commit that referenced this issue Dec 10, 2020
karlwilbur added a commit that referenced this issue Dec 10, 2020
* issue-68-numeric-subdomain-fails-validation:
  Fix regexp for numeric subdomains (fixes #68)
  [specs] Add tests for numeric subdomains
karlwilbur added a commit that referenced this issue Dec 10, 2020
* develop:
  Bump version to `2.2.1`
  Add `rubocop-rake` to dev dependencies
  Enforce domain character limit
  Allow mailbox-only addresses  in `:rfc` mode
  Fix regexp for numeric subdomains (fixes #68)
  [specs] Add tests for numeric subdomains
@karlwilbur
Copy link
Member

Fixed in v2.2.1.

Thanks, @Spone, for reporting!

@Spone
Copy link
Author

Spone commented Dec 11, 2020

Thanks a lot, I managed to catch the issue by running the validation on a production database export, so thank you anonymous user who has a uncommon email :)

@delphaber
Copy link
Contributor

delphaber commented Mar 23, 2021

I think primary domains can be only numeric. For example, the strict mode is marking emails like [email protected] as invalid, but it turns out that 163.com is a chinese service provider and so theirs email are valid 🤔 . I've created a PR to add a failing test: #70

@xiaohui-zhangxh
Copy link

I think primary domains can be only numeric. For example, the strict mode is marking emails like [email protected] as invalid, but it turns out that 163.com is a chinese service provider and so theirs email are valid 🤔 . I've created a PR to add a failing test: #70

This is true, 163.com, 139.com are most famous service provider in China, there are many emails are marked as invalid due to this issue.

@karlwilbur
Copy link
Member

Yes! Thanks for catching this. @delphaber, can you please add this as a separate issue? Specifically something like "valid numeric domains are considered invalid strict mode."

I see the failing test in your PR. Thanks! Yeah, that will help make sure that we don't break it again, but I need to get in there and fix the validation RegEx. I hope to get to that in the next couple days.

@karlwilbur
Copy link
Member

Specifically, for my own reference, RFC 1123 states:

2.1 Host Names and Numbers

The syntax of a legal Internet host name was specified in RFC-952
[DNS:4]. One aspect of host name syntax is hereby changed: the
restriction on the first character is relaxed to allow either a
letter or a digit. Host software MUST support this more liberal
syntax.

@delphaber
Copy link
Contributor

delphaber commented Apr 1, 2021

can you please add this as a separate issue? Specifically something like "valid numeric domains are considered invalid strict mode."

will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants