-
Notifications
You must be signed in to change notification settings - Fork 559
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
ProxyAgent URI parser and validator is broken #2841
Comments
The leading 0 in an ipv4 octet means that the number is a octal value. Thats why 026 is converted to decimal 22. The same with 085. The notation is defined somewhere in the tcp/ip specification. Maybe we should use isIPv4 from node:net and validate the IP if somebody passes octal notation?! |
Hey @timursevimli! Under the hood, ProxyAgent uses the Node implementation of the WHATWG URL object (reference). Unfortunately, the inconsistent behaviours you experienced can be replicated in the JS console of any browser or in any Node.js environment. For example: const url3 = new URL('http://085.26.146.169:8080');
const url4 = new URL('http://85.026.0146.169:8080'); |
@Uzlopak I can work on this. In your opinion, it would be better to update |
Thanks for the advice. I already use the However, it seems to me that this check could be included in the |
Given that WHATWG |
Closed by #2893 |
Bug Description
Checking the string uri in the ProxyAgent class does not work consistently. It may consider some non-existent IP addresses valid and sometimes not valid. In addition, in some cases it can change the IP address that was transmitted via string uri to ProxyAgent.
Reproducible By
Environment
macOS Sonoma 14.3.1, Node.js v20.11.0, undici@6.6.2
Additional
Example of error output using
proxyUri3
variableExample of error output using
proxyUri4
variableThe text was updated successfully, but these errors were encountered: