-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/net/http/httpproxy: no_proxy no longer matches an ip suffix when used as hostname #72123
Comments
This appears to be related to #71984 and its associated CLs. |
cc @neild @golang/security |
This is for #71984, note that this was never documented to work |
Sadly, there is no standardization of behavior of Notably, most software out there always treats IP addresses as hostnames like any other for purposes of matching, according to the table on the GitLab page. Would it be reasonable to support both for IPv4? IMO this is well-supported enough in the broader ecosystem among other runtimes and programming languages, and it feels like something that should be covered in the Go 1 compatibility guarantee since this used to work. |
Notably curl doesn't support a suffix ip address match. In your case, actually specifying the full match doesn't seem to be much more work, and should result in overall more correct behaviour across a range of inputs. |
Suffix matching on IP addresses is incredibly weird. The IP hierarchy doesn't go in that direction; X.X.X.1 doesn't have any relation to Y.Y.Y.1. Prefix matching does make some sense, and we support that. I am curious whether any of the implementations that string match on IPs are also vulnerable to #71984, where an IPv6 address with a zone ID is improperly matched against a host pattern: "::1%.example.com" definitely should not match ".example.com". I see several possible approaches we could take here:
|
Sure! I’m not saying that there aren’t security implications to doing suffix matching on IP addresses. The fact is this is a fairly precedented behavior among the majority of software outside of Go.
IMO (3) would be my preferred approach. It aligns with the philosophy presented in the compatibility blog post, and this doesn’t feel like a case for not doing GODEBUG because “doing so is infeasible.” It definitely is a security risk (I hope people aren’t generally implementing a |
Go version
go version go1.24.1 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
We are leveraging
no_proxy
in our environment which includes.1
in the list. In Go 1.24.0 and 1.23.6 and prior, this matched IP addresses such as1.1.1.1
. However, in Go 1.24.1 and 1.23.7, this hostname is no longer matched.Here’s a simple repro:
What did you see happen?
In Go 1.23.6 and 1.24.0, the behavior is as so:
In Go 1.23.7 and 1.24.1, the behavior is as so:
This is a breaking change to Go. 😞
What did you expect to see?
The same behavior that worked in Go 1.23.6 and 1.24.0 should still function in 1.23.7 and 1.24.1 according to the Go compatibility promise.
The text was updated successfully, but these errors were encountered: