Resolve IDN domains#57
Merged
Merged
Conversation
toASCII swallowed idna.ToASCII errors and fell back to the lowercased raw input, so a malformed IDN (e.g. a Bidi-rule violation like "صلa1.com") slipped past RegistrableDomain and got dispatched as a non-ASCII WHOIS/RDAP query — the exact "doomed query" the validation is meant to prevent. Make toASCII return (string, error) and surface it: NormalizeDomain now returns an error for invalid IDNs (passing IP literals through untouched, since IDNA rejects IPv6 colons), and RegistrableDomain reports its standard "not a valid domain" error on IDNA failure. All cmd entry points thread the error through so DNS/mail/TLS/HTTP/SEO/stack/whois reject malformed Unicode up front. Adds a doc comment for the exported NormalizeDomain and a rejection test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
retlehs
approved these changes
Jun 23, 2026
retlehs
left a comment
Owner
There was a problem hiding this comment.
Thank you! I pushed a follow-up so malformed IDNs are rejected cleanly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Should fix #52
Two changes has been made:
Now if I run quien on IDN domain it should give proper information:
./quien dns zwick.ελ { "A": [ "216.198.79.1" ], "AAAA": null, "CNAME": null, "HTTPS": null, "MX": [ { "Host": "spool.mail.gandi.net", "Priority": 10 }, { "Host": "fb.mail.gandi.net", "Priority": 50 } ], "NS": [ "ns-175-a.gandi.net", "ns-207-c.gandi.net", "ns-23-b.gandi.net" ], "TXT": [ "v=spf1 include:_mailcust.gandi.net ?all" ], "PTR": null, "SOA": { "PrimaryNS": "ns1.gandi.net", "AdminEmail": "hostmaster@gandi.net", "Serial": 1781136000, "Refresh": 10800, "Retry": 3600, "Expire": 604800, "MinTTL": 10800 }, "DNSSEC": false }./quien dns моревдуше.рф { "A": [ "31.31.196.17" ], "AAAA": [ "2a00:f940:2:2:1:1:0:256" ], "CNAME": null, "HTTPS": null, "MX": null, "NS": [ "ns1.hosting.reg.ru", "ns2.hosting.reg.ru" ], "TXT": null, "PTR": [ { "IP": "31.31.196.17", "Hostname": "server256.hosting.reg.ru" } ], "SOA": { "PrimaryNS": "server256.hosting.reg.ru", "AdminEmail": "support@reg.ru", "Serial": 2026021117, "Refresh": 10800, "Retry": 3600, "Expire": 604800, "MinTTL": 86400 }, "DNSSEC": false }