|
| 1 | +From 157d68b686ec5a5b4bfa8c871128f3e8406932f8 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Damien Neil < [email protected]> |
| 3 | +Date: Wed, 26 Feb 2025 16:08:57 -0800 |
| 4 | +Subject: [PATCH] all: updated vendored x/net with security fix |
| 5 | + |
| 6 | +Fixes CVE-2025-22870 |
| 7 | + |
| 8 | +(cherry picked from commit 25177ecde0922c50753c043579d17828b7ee88e7) |
| 9 | + |
| 10 | +[bcressey: backport to Go 1.22] |
| 11 | +Signed-off-by: Ben Cressey < [email protected]> |
| 12 | +--- |
| 13 | + src/cmd/internal/moddeps/moddeps_test.go | 1 + |
| 14 | + src/vendor/golang.org/x/net/http/httpproxy/proxy.go | 10 ++++++++-- |
| 15 | + 2 files changed, 9 insertions(+), 2 deletions(-) |
| 16 | + |
| 17 | +diff --git a/src/cmd/internal/moddeps/moddeps_test.go b/src/cmd/internal/moddeps/moddeps_test.go |
| 18 | +index 3d4c99eecb..ffaa16ce9c 100644 |
| 19 | +--- a/src/cmd/internal/moddeps/moddeps_test.go |
| 20 | ++++ b/src/cmd/internal/moddeps/moddeps_test.go |
| 21 | +@@ -33,6 +33,7 @@ import ( |
| 22 | + // See issues 36852, 41409, and 43687. |
| 23 | + // (Also see golang.org/issue/27348.) |
| 24 | + func TestAllDependencies(t *testing.T) { |
| 25 | ++ t.Skip("TODO(#71985) 1.23.7 contains unreleased changes from vendored modules") |
| 26 | + goBin := testenv.GoToolPath(t) |
| 27 | + |
| 28 | + // Ensure that all packages imported within GOROOT |
| 29 | +diff --git a/src/vendor/golang.org/x/net/http/httpproxy/proxy.go b/src/vendor/golang.org/x/net/http/httpproxy/proxy.go |
| 30 | +index c3bd9a1eeb..864961c75b 100644 |
| 31 | +--- a/src/vendor/golang.org/x/net/http/httpproxy/proxy.go |
| 32 | ++++ b/src/vendor/golang.org/x/net/http/httpproxy/proxy.go |
| 33 | +@@ -14,6 +14,7 @@ import ( |
| 34 | + "errors" |
| 35 | + "fmt" |
| 36 | + "net" |
| 37 | ++ "net/netip" |
| 38 | + "net/url" |
| 39 | + "os" |
| 40 | + "strings" |
| 41 | +@@ -180,8 +181,10 @@ func (cfg *config) useProxy(addr string) bool { |
| 42 | + if host == "localhost" { |
| 43 | + return false |
| 44 | + } |
| 45 | +- ip := net.ParseIP(host) |
| 46 | +- if ip != nil { |
| 47 | ++ nip, err := netip.ParseAddr(host) |
| 48 | ++ var ip net.IP |
| 49 | ++ if err == nil { |
| 50 | ++ ip = net.IP(nip.AsSlice()) |
| 51 | + if ip.IsLoopback() { |
| 52 | + return false |
| 53 | + } |
| 54 | +@@ -363,6 +366,9 @@ type domainMatch struct { |
| 55 | + } |
| 56 | + |
| 57 | + func (m domainMatch) match(host, port string, ip net.IP) bool { |
| 58 | ++ if ip != nil { |
| 59 | ++ return false |
| 60 | ++ } |
| 61 | + if strings.HasSuffix(host, m.host) || (m.matchHost && host == m.host[1:]) { |
| 62 | + return m.port == "" || m.port == port |
| 63 | + } |
| 64 | +-- |
| 65 | +2.48.1 |
| 66 | + |
0 commit comments