Skip to content

internal/export/idna: reject non-ASCII in xn-- labels - #73

Open
cristiangirlea wants to merge 1 commit into
golang:masterfrom
cristiangirlea:fix-idna-non-ascii-ace
Open

cristiangirlea wants to merge 1 commit into
golang:masterfrom
cristiangirlea:fix-idna-non-ascii-ace

Conversation

@cristiangirlea

Copy link
Copy Markdown

decode copied the basic code points of a Punycode string without
checking that they are ASCII, so a label such as "xn--が-" decoded to
"が" and converted to the valid A-label "xn--v8j". RFC 3492 section
6.2 makes such input invalid, and UTS #46 processing step 4 records
an error for an xn-- label that contains non-ASCII.

Reject non-ASCII input in decode.

The new tests fail before the fix. internal/export/idna passes on
linux/amd64, including the UTS #46 conformance test with -long, and
on linux/386 and with -race. With the change copied to x/net/idna,
the example from the issue now returns an error.

Fixes golang/go#81116

decode copied the basic code points of a Punycode string without
checking that they are ASCII, so a label such as "xn--が-" decoded to
"が" and converted to the valid A-label "xn--v8j". RFC 3492 section
6.2 makes such input invalid, and UTS golang#46 processing step 4 records
an error for an xn-- label that contains non-ASCII.

Reject non-ASCII input in decode.

The new tests fail before the fix. internal/export/idna passes on
linux/amd64, including the UTS golang#46 conformance test with -long, and
on linux/386 and with -race. With the change copied to x/net/idna,
the example from the issue now returns an error.

Fixes golang/go#81116
@gopherbot

Copy link
Copy Markdown
Contributor

This PR (HEAD: 807682b) has been imported to Gerrit for code review.

Please visit Gerrit at https://go-review.googlesource.com/c/text/+/839845.

Important tips:

  • Don't comment on this PR. All discussion takes place in Gerrit.
  • You need a Gmail or other Google account to log in to Gerrit.
  • To change your code in response to feedback:
    • Push a new commit to the branch used by your GitHub PR.
    • A new "patch set" will then appear in Gerrit.
    • Respond to each comment by marking as Done in Gerrit if implemented as suggested. You can alternatively write a reply.
    • Critical: you must click the blue Reply button near the top to publish your Gerrit responses.
    • Multiple commits in the PR will be squashed by GerritBot.
  • The title and description of the GitHub PR are used to construct the final commit message.
    • Edit these as needed via the GitHub web interface (not via Gerrit or git).
    • You should word wrap the PR description at ~76 characters unless you need longer lines (e.g., for tables or URLs).
  • See the Sending a change via GitHub and Reviews sections of the Contribution Guide as well as the FAQ for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x/net/idna: non-ASCII accepted in xn-- labels

2 participants