Fix node:dns lookup CNAME filtering - #7129
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
Could an assigned reviewer please run the internal build workflow for this external contribution? The local native DNS target and TypeScript checks are included in the PR description. Thank you. |
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
|
recheck |
|
Overall, this is good but I think it needs to go a bit further. I think all the Will leave other comments inline directly |
| // A host with CNAME records registered | ||
| CNAME_HOST: 'blog.nodejs.org', | ||
| // A host whose A and AAAA responses begin with a CNAME record | ||
| CNAME_CHAIN_HOST: 'writings.hongminhee.org', |
There was a problem hiding this comment.
Needs to use a generic name, something in the example.org family, perhaps?
There was a problem hiding this comment.
Updated this to www.iana.org. The example.* hosts currently return direct A/AAAA answers, so they do not exercise the CNAME-chain case.
| type DnsOrder = 'verbatim' | 'ipv4first' | 'ipv6first'; | ||
|
|
||
| const DNS_RECORD_TYPE_A = 1; | ||
| const DNS_RECORD_TYPE_AAAA = 28; |
There was a problem hiding this comment.
Nit: these are likely better defined in internal_dns_client
There was a problem hiding this comment.
Moved the RR type mapping into internal_dns_client and now filter Answer there using the requested type. That makes the filtering apply to lookup, every implemented resolve* method, and reverse.
|
I checked the full resolver surface and moved the filtering into sendDnsRequest(), so every caller now receives only the requested RR type. The regression coverage now uses www.iana.org and exercises lookup(), resolve4(), and resolve6(). The full dns-nodejs-test@ target, including the existing tests for each implemented resolve* method, passes locally. |
|
@jasnell Thanks for the review and approval. Could you please run the internal build workflow for this external contribution when convenient? The automated check cannot run for non-org forks. |
Summary
Fixes #6886
Testing