x/net/idna: ToASCII() can spuriously modify NR-LDH labels #58303
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes. Confirmed the issue with Go 1.19 at https://go.dev/play/.
What operating system and processor architecture are you using (
go env
)?go env
OutputGO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOENV="/root/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.16.4" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1145048540=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Specifying idna.MapForLookup() or idna.ValidateForRegistration() for idna.Profile.New() and then call Profile.ToASCII() with a domain name that only consists of NR-LDH labels but with an upper case alphabet.
https://go.dev/play/p/7cAWHtgbm2u
What did you expect to see?
For both cases:
because the label in question is an NR-LDH label and the restrictions and validation rules for U-labels and A-labels shouldn't apply.
What did you see instead?
If idna.MapForLookup() was specified, the upper case character was downcased. If idna.ValidateForRegistration() was specified, ToASCII() returned an error.
The text was updated successfully, but these errors were encountered: