Repository navigation
Description
Summary
IDN targets are converted with a hand-written RFC 3492 encoder after a plain strings.ToLower, with no Unicode normalization. A domain pasted in decomposed form (for example café as e + U+0301, common in text copied from macOS) encodes to a different xn-- label than the registered name, so subenum scans a domain that does not exist and reports nothing. golang.org/x/net is already a direct dependency, and its idna package does full UTS #46 mapping.
Where
internal/validate/validate.go:157-165(NormalizeDomain:strings.ToLower, thentoASCII)internal/validate/punycode.go:29(toASCII) and:57(punycodeEncode)docs/ROADMAP.md:73-74: "IDN targets use a plain RFC 3492 Punycode encoder, not full UTS Release linux/amd64 binary is dynamically linked, contradicting the "single static binary" claim #46 mapping, so a domain must be typed in its usual lowercase form."go.mod:golang.org/x/net v0.62.0is already required
Details
s = strings.ToLower(strings.TrimRight(s, "."))
if !isASCII(s) {
ascii, ierr := toASCII(s)ToLower does not apply NFC, compatibility mapping (full-width letters), or UTS #46's disallowed-character checks. Full stops are handled separately (#281), so this is the remaining part of the known limitation.
Impact
Users targeting internationalized domains can get an empty result with exit 0 and no warning, because the scan ran against the wrong apex. The roadmap lists this as a known limitation, not a tracked task.
Suggested fix
Replace toASCII with idna.Lookup.ToASCII (or a idna.New(idna.MapForLookup(), idna.BidiRule(), ...) profile) from golang.org/x/net/idna, keep the existing "using the punycode form" note, and delete punycode.go. Note: x/net/idna imports golang.org/x/text, so go.mod gains that module. Per the repo's rules it must keep the go 1.26.0 directive and pass govulncheck in CI. Then drop the limitation from docs/ROADMAP.md.
Acceptance criteria
- NFC and NFD spellings of the same name normalize to the same
xn--form (table test ininternal/validate). - Full-width ASCII input (
example.com) maps toexample.com. - Disallowed code points return a clear error.
- The ROADMAP known-limitation line is removed.
Getting started
- Relevant files:
internal/validate/validate.go,internal/validate/punycode.go,go.mod - How to run tests:
go test ./internal/validate/
Filed by repo-audit/feature-ideas at 090df0a. Severity: low. Effort: S. audit-key: enhancement|internal/validate/validate.go|NormalizeDomain-uts46
Activity
TMHSDigital commentedon Nov 18, 2026
Fixed in f967e6a. Non-ASCII labels now go through
golang.org/x/net/idna(lookup profile: nontransitional UTS #46 with the bidi rule) before Punycode, replacing the hand-written encoder. ASCII labels are left alone, so_dmarcand a*wildcard still pass. A disallowed code point is an error naming the label.go.modgainsgolang.org/x/text(indirect, via x/net/idna); thego 1.26.0directive is unchanged,go mod tidy -diffis clean and govulncheck v1.9.0 reports no vulnerabilities. The ROADMAP known-limitation line is removed.Verified:
TestToASCIInow includes NFC and NFD spellings ofcafé(bothxn--caf-dma), full-widthexample.comtoexample.com, and the_dmarc/*pass-through;TestNormalizeDomainIDNMappingchecks the same end to end plus errors for a C1 control and a bidi mark. CI green.chore(release): v0.11.0