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

Add IDN TLD support #2278

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions policy/pa.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,20 @@ func (pa *AuthorityImpl) WillingToIssue(id core.AcmeIdentifier) error {
}
}

unicodeDomain := domain
if features.Enabled(features.IDNASupport) {
var err error
unicodeDomain, err = idna.ToUnicode(domain)
if err != nil {
return errMalformedIDN
}
}
// Names must end in an ICANN TLD, but they must not be equal to an ICANN TLD.
icannTLD, err := extractDomainIANASuffix(domain)
icannTLD, err := extractDomainIANASuffix(unicodeDomain)
if err != nil {
return errNonPublic
}
if icannTLD == domain {
if icannTLD == unicodeDomain {
return errICANNTLD
}

Expand Down
8 changes: 8 additions & 0 deletions policy/pa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ func TestWillingToIssue(t *testing.T) {
// Valid encoding
err = pa.WillingToIssue(core.AcmeIdentifier{Type: core.IdentifierDNS, Value: "www.xn--mnich-kva.com"})
test.AssertNotError(t, err, "WillingToIssue failed on a properly formed IDN")
// IDN public suffix
err = pa.WillingToIssue(core.AcmeIdentifier{Type: core.IdentifierDNS, Value: "www.example.xn--fiqs8s"})
test.AssertNotError(t, err, "WillingToIssue failed on a domain with a properly formed IDN public suffix")
// Domain is punycoded ICANN TLD
err = pa.WillingToIssue(core.AcmeIdentifier{Type: core.IdentifierDNS, Value: "xn--d1at.xn--90a3ac"})
if err != errICANNTLD {
t.Error("Punycoded ICANN TLD identifier was not correctly forbidden", err)
}
features.Reset()

// Test domains that are equal to public suffixes
Expand Down