Repository navigation
fix: validate IPv6 literals that have a zone in URI.Parse - #2535
Merged
erikdubbelboer merged 4 commits intoNov 8, 2026
Merged
Conversation
parseHost returned early for hosts with a %25 zone and never called validateIPv6Literal, so "[abc%25en0]", "[gggg::1%25en0]", "[1.2.3.4%25en0]" and "[::1%25]" were accepted while the same hosts without a zone were rejected.
erikdubbelboer
requested changes
Nov 8, 2026
A zone may contain an escaped ']' (RFC 6874), so after unescaping the first ']' can be part of the zone.
erikdubbelboer
requested changes
Nov 8, 2026
oracleValid still used the first ']' as the closing bracket, so FuzzValidateIPv6Literal disagreed with validateIPv6Literal on inputs like "[::]]" and "[fe80::1%]en0]:8080". Use the last ']' and add both as seeds.
erikdubbelboer
requested changes
Nov 8, 2026
| return nil, err | ||
| } | ||
| return append(host1, append(host2, host3...)...), nil | ||
| host = append(host1, append(host2, host3...)...) |
Collaborator
There was a problem hiding this comment.
Please fix the lint error and then it can be merged.
Contributor
Author
There was a problem hiding this comment.
Fixed in 3a6bd02: the joined host is now appended onto host1 and returned, so appendAssign no longer fires. The other failing check, TestServerTimeoutHandlerKeepAliveDeadlineCleared on 1.27.x, is in the server timeout code and doesn't touch URI parsing.
gocritic appendAssign flagged host = append(host1, ...).
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A host with a
%25zone skips IPv6 validation:parseHostreturns early from the zone branch and never callsvalidateIPv6Literal, sohttp://[abc%25en0]/,http://[gggg::1%25en0]/,http://[1.2.3.4%25en0]/andhttp://[::1%25]/all parse without an error. The same hosts without a zone are rejected, and so is every one of them innet/url.This validates the unescaped host in the zone branch too. Valid hosts such as
[fe80::1%25en0]:8080still parse. Added both kinds to the existing URI tests.