Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/idna: ToASCII() can spuriously modify NR-LDH labels #58303

Open
jinmeiib opened this issue Feb 3, 2023 · 1 comment
Open

x/net/idna: ToASCII() can spuriously modify NR-LDH labels #58303

jinmeiib opened this issue Feb 3, 2023 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jinmeiib
Copy link

jinmeiib commented Feb 3, 2023

What version of Go are you using (go version)?

$ go version
go version go1.16.4 linux/amd64

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 Output
$ go env
GO111MODULE="" 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:

  • I would expect ToASCII() doesn't change the input domain name including the character case
  • I would also expect ToASCII() doesn't return an error

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.

@mknyszek
Copy link
Contributor

mknyszek commented Feb 3, 2023

CC @neild

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 3, 2023
@mknyszek mknyszek added this to the Unreleased milestone Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants