Skip to content

Resolve IDN domains#57

Merged
retlehs merged 2 commits into
retlehs:mainfrom
GLobyNew:fixIDN
Jun 23, 2026
Merged

Resolve IDN domains#57
retlehs merged 2 commits into
retlehs:mainfrom
GLobyNew:fixIDN

Conversation

@GLobyNew

Copy link
Copy Markdown
Contributor

Should fix #52

Two changes has been made:

  1. I moved domain normalizer to be in resolver package.
  2. And in the same resolver i've added IDNA profile, which has method to return ASCII version of domain.

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
}

GLobyNew and others added 2 commits June 16, 2026 18:45
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 retlehs left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I pushed a follow-up so malformed IDNs are rejected cleanly

@retlehs
retlehs merged commit 4c1c2fe into retlehs:main Jun 23, 2026
1 check passed
@GLobyNew
GLobyNew deleted the fixIDN branch June 24, 2026 17:26
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

Successfully merging this pull request may close these issues.

DNS failure with IDN domain name

2 participants