-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
dns: idna encode hostnames before resolution #25559
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
Conversation
lib/dns.js
Outdated
| throw new ERR_INVALID_CALLBACK(); | ||
| } | ||
|
|
||
| name = toASCII(name, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function can theoretically throw in
Line 335 in 2c0a751
| error('overflow'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk, if so, shouldn't we also handle it here to be lenient whether it uses icu or punycode?
All reactions
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments. I think the C++ code which does the utf-8 decoding also needs to go, it should assume ASCII, and throw on failure.
Sorry, something went wrong.
All reactions
|
|
||
| const cares = internalBinding('cares_wrap'); | ||
| const { toASCII } = internalBinding('config').hasIntl ? | ||
| internalBinding('icu') : require('punycode'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the policy here, considering punycode is deprecated?
Sorry, something went wrong.
All reactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know 🤷♂️
Sorry, something went wrong.
All reactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, we do the same thing in lib/url.js, so it's probably fine.
Sorry, something went wrong.
All reactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using punycode is the fallback if Node.js is compiled without ICU.
Sorry, something went wrong.
All reactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's only deprecated for userland.
Sorry, something went wrong.
All reactions
| throw new ERR_INVALID_CALLBACK(); | ||
| } | ||
|
|
||
| try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be needed if we were only using the ICU based toASCII?
Sorry, something went wrong.
All reactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guess is no
Sorry, something went wrong.
All reactions
|
Thanks for picking this up @santigimeno ❤️ |
All reactions
Sorry, something went wrong.
I'm not sure you can remove the |
All reactions
Sorry, something went wrong.
Isn't there an equivalent that does the job in ASCII instead? |
All reactions
Sorry, something went wrong.
I don't know, but what's the issue being ASCII a subset of UTF-8? |
All reactions
Sorry, something went wrong.
| // An accessible IPv4 DNS server | ||
| DNS6_SERVER: '2001:4860:4860::8888' | ||
| DNS6_SERVER: '2001:4860:4860::8888', | ||
| IDNA_HOST: 'españa.icom.museum' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
domaintest.みんな might be a better testing domain name, info here.
Sorry, something went wrong.
All reactions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 also, I'd say a comment is missing.
8000
Sorry, something went wrong.
All reactions
|
@santigimeno Do you have access to node-private? Because this PR is a spiritual duplicate of https://github.com/nodejs-private/node-private/pull/147 :) |
All reactions
Sorry, something went wrong.
Not really, first time I hear about that repo. Feel free to close this if it's already handled there. |
All reactions
Sorry, something went wrong.
|
@santigimeno Sorry for the delay, Santi. I've moved it to #25679. |
All reactions
Sorry, something went wrong.
|
Closing in favor of #25679. Thanks for the heads up Ben. |
All reactions
Sorry, something went wrong.
Reviewers
targos
cjihrig
jasnell
Assignees
No one assignedLabels
Projects
Milestone
No milestoneDevelopment
Successfully merging this pull request may close these issues.
DNS resolution fails for internationalized domain names
Fixes: #25558
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes