-
Notifications
You must be signed in to change notification settings - Fork 43
Discrepancy between IPv4 and IPv6 #180
Comments
Oh, those are some cool edge-cases! I think there are a few different things going on here. The original DNS RFC specified that domains could use Anyway, the examples Ideally we wouldn't even have We could still stand for a better API to handle warnings/errors, and parse addresses to make it easier to run DNS queries against the domain name. I guess it probably makes sense to skip the |
I agree that numbers can be part of domain names, but when it's only numbers and dots shouldn't it be considered an ip and validated as is? It doesn't need a DNS check for that. |
When it's only numbers and dots it won't (or shouldn't, at least) be considered an IP address. We don't really decide how the mail transfer agent handles the address in that case. If it's wrapped in square brackets, that's a different story, and most MTAs should deliver it as an IP address. |
So you're saying that something like |
We handle that case with the You could set the default Joi |
And I'm pretty sure it's not actually up to the MTA to decide - I believe they're required to treat |
If I set it to 1, something like |
For sure. |
Correct me if I'm wrong, but here's your contention as I understand it. You expect The RFCs (in particular, I'm referencing RFC 5321) specify that the part after the On a related note, my interpretation of the Apologies if this was already clear to you, but I wanted to make sure. If I've misunderstood your concern, could you help me understand? |
Your assumption is correct. I expected it to work because I already emailed such an address, but maybe the client interpreted it with brackets ? My expectations are that any email that validates should be emailable if it exists, is there any setting that would fit that description ? Is there a way to deny IPs (with or without brackets, nobody uses those) ? Indeed I don't think a TLD can only have numbers in its extension part, so I'm surprised an IP would be considered as a valid domain here. |
This is super surprising to me. I'd be interested to see the relevant subset of the mail envelope headers.
Well, that's what it currently does. The crux of the issue seems to be the "if it exists" part, because
With brackets it would seem that
Syntactically, it can. Policy-wise, ICANN forbids it. As a result, I haven't directly implemented support for specifically forbidding numeric TLDs, although the I know this isn't the answer you're looking for, but we need a better isemail API because the error-level-based version doesn't provide tight enough control for your use-case. |
I'm not asking for a DNS or reachability check, just for a purely theoretical emailability. -- Let's get back to the original issue for a moment. The default (no option) isn't really satisfactory for joi because it allows stuff like So far I was going to go for |
|
Just to be sure, suitable default options would be |
Assuming you want to allow {
errorLevel: Isemail.diagnoses.rfc5321TLD,
excludeDiagnoses: [
Isemail.diagnoses.rfc5321QuotedString, // for "marsup"@example.com
Isemail.diagnoses.rfc5321AddressLiteral, // for marsup@[0.0.0.0]
],
minDomainAtoms: 2
} |
I don't think quotes and IPs are common cases, which is why I didn't exclude anything. Was it already possible before? |
I was going based on this comment. Personally I think all three forms should be accepted by email address validators. |
Sure, I was thinking about joi's defaults, which have somewhat different expectations than a general purpose email validator. |
I'm not sure I follow. I think joi should allow these email address forms by default, and also think it's reasonable to forbid |
No problem Eli, I'm lacking time to explain and work on it as well. Some day I'll have time to create sane defaults but for now people will have to figure it out by themselves :) |
Hi!
While doing a change on joi to default on
minDomainAtoms=2
, I noticed a weird thing in the unit tests.Apparently
joe@[IPv6:2a00:1450:4001:c02::1b]
is not valid with that option. So I thought it could make sense, or at least it's not a hugely common use case to have an IP as domain, but then I noticed[email protected]
is valid under the same conditions. So are[email protected]
and[email protected]
, since they're not a full IPv4 nor a valid domain, I don't think they should validate.I'm not sure what to make of this. Would you consider it a bug ?
The text was updated successfully, but these errors were encountered: