-
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
net/netip: ParseAddr should reject invalid zone #71362
Comments
I think this should be a bug not a proposal.
referring to RFC3986 https://datatracker.ietf.org/doc/html/rfc3986#section-2.3
a lone |
Change https://go.dev/cl/642896 mentions this issue: |
Note that as far as I can see the C program does not accept any zone ID at all. |
Sorry, the above C program cannot be used as one of the validation programs, because even a normal IPv6 address with a zone ID cannot be resolved.Thank you for your correction. |
From CL 642896, windows contains a builtin "Loopback Pseudo-Interface 1" (contains spaces) |
The python docs point to RFC 4007.
That points to |
I personally believe that the pct-encoding in RFC6874 refers to the special characters in the URI's host, which should be represented in pct-encoded form. If we only consider the ParseAddr function, it should not take encoding into account. Because url.Parse already decodes pct-encoded characters. |
Looks like python only checks for I don't think java is a good reference, it rejects any scope / zone that isn't a numeric: https://codapi.org/embed/?sandbox=java&code=data%3A%3Bbase64%2ClZHBSsNAEIbveYohICQIoXrIoaGHioK5SLGIoHiYbrbtaDK77E5jg%2BTdJbbUNMSDc1h295%2F959sZqqxxAu9YY8Jakpy1pPOicNr7LKAR9U%2Fx6TEfvVw2LLi%2F2ytthQxnQWB3q5IUqBK9h3xRpy%2BGdX67QOe1g68AjgleUEhBbaiAComjpTjizesboNv4uMs8xpoYSzjIQLZOn0m2nSvMILyeTNIprlQxnV5daJ6E2emduKbn0kXvi0C9%2FayvJBstN80DVjrqF4uzMytaQ0Rndl6QlTZr6Lc5HhB0sWy86CoxO0msI5aSzwrBJYSQC5AH5J8OAh7JwgFEG5yOLSgUtYXodzr8weaT742X03xAD4H%2BAQPENZZUANlRojY4rO03 I still think we can choose to not validate it at all. |
Proposal Details
I have the following use case:
https://go.dev/play/p/soSl7hzPhJx
output:
When running with Go 1.23, it considers the last % as the IPv6 zone ID. However, when parsing the same address in other languages, it considers the parameter as an invalid IP, for example:
1.C Language
gcc version
and output:
2. java
java -version
openjdk version "1.8.0_392"
output:
2006:abcd::1%% It is a invalid ip address.
3. python
python version
Python 3.9.11 (main, Jul 18 2024, 15:21:06)
output:
False
why Go language behaves differently when parsing IPv6 zone IDs compared to other languages as shown above? Thank you.
The text was updated successfully, but these errors were encountered: