]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.25] net/url: enforce stricter parsing of bracketed IPv6 hostnames
authorEthan Lee <ethanalee@google.com>
Fri, 29 Aug 2025 17:35:55 +0000 (17:35 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 7 Oct 2025 18:02:12 +0000 (11:02 -0700)
commit9fd3ac8a10272afd90312fef5d379de7d688a58e
tree8f1a41caa7e03f9244dc32a83d0a0193dd9ee939
parent5d7a787aa2b486f77537eeaed9c38c940a7182b8
[release-branch.go1.25] net/url: enforce stricter parsing of bracketed IPv6 hostnames

- Previously, url.Parse did not enforce validation of hostnames within
  square brackets.
- RFC 3986 stipulates that only IPv6 hostnames can be embedded within
  square brackets in a URL.
- Now, the parsing logic should strictly enforce that only IPv6
  hostnames can be resolved when in square brackets. IPv4, IPv4-mapped
  addresses and other input will be rejected.
- Update url_test to add test cases that cover the above scenarios.

Thanks to Enze Wang, Jingcheng Yang and Zehui Miao of Tsinghua
University for reporting this issue.

Fixes CVE-2025-47912
For #75678
Fixes #75713

Change-Id: Iaa41432bf0ee86de95a39a03adae5729e4deb46c
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2680
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/2988
Commit-Queue: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/709847
TryBot-Bypass: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
src/go/build/deps_test.go
src/net/url/url.go
src/net/url/url_test.go