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: Registration.ToASCII() accepts empty TLD label #47182

Open
Justin-Marks opened this issue Jul 14, 2021 · 1 comment
Open

x/net/idna: Registration.ToASCII() accepts empty TLD label #47182

Justin-Marks opened this issue Jul 14, 2021 · 1 comment
Labels
NeedsInvestigation
Milestone

Comments

@Justin-Marks
Copy link

@Justin-Marks Justin-Marks commented Jul 14, 2021

What did you do?

https://go.dev/play/p/oGhflDafvrL

package main

import (
	"fmt"

	"golang.org/x/net/idna"
)

func main() {
	// Returns an error (as expected)
	fmt.Println(idna.Registration.ToASCII("gólang.órg.."))

	// Doesn't return an error
	fmt.Println(idna.Registration.ToASCII("golang.org.."))
}

What did you expect to see?

xn--glang-0ta.xn--rg-4ja.. idna: invalid label ""
golang.org.. idna: invalid label ""

What did you see instead?

xn--glang-0ta.xn--rg-4ja.. idna: invalid label ""
golang.org.. <nil>

It appears if the domain contains an empty TLD label but contains only ASCII characters, then no error is returned. And only for the TLD (empty labels elsewhere return an error as expected).

@cherrymui cherrymui added the NeedsInvestigation label Jul 14, 2021
@cherrymui cherrymui added this to the Unreleased milestone Jul 14, 2021
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Jul 14, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

2 participants