Skip to content
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

dns: type check for dns.setServers argument. #21944

Closed
wants to merge 3 commits into from

Conversation

shisama
Copy link
Contributor

@shisama shisama commented Jul 23, 2018

Added type check for argument for dns.setServers and dnsPromises.setServers.

Refs #21930

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Added type check for argument for dns.setServers and dnsPromises.setServers.
@nodejs-github-bot nodejs-github-bot added the dns Issues and PRs related to the dns subsystem. label Jul 23, 2018
const dns = require('dns');
const resolver = new dns.promises.Resolver();
const dnsPromises = dns.promises;
const promiseResolver = new dns.promises.Resolver();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be in test/internet, right? It only sets servers, not actually tries to send out DNS requests?

Copy link
Contributor Author

@shisama shisama Jul 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@addaleax Thanks for your review. Should I move this test to test/parallel or other?

Copy link
Contributor

@maclover7 maclover7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I think the new test file can be in test/parallel, not test/internet

@shisama
Copy link
Contributor Author

shisama commented Jul 23, 2018

@addaleax @maclover7 moved the test file to test/parallel.

@shisama shisama force-pushed the dns-setservers-arg-type-check branch from 718dbcd to e68ca4f Compare July 23, 2018 23:01
@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 27, 2018
@addaleax
Copy link
Member

@shisama
Copy link
Contributor Author

shisama commented Jul 28, 2018

node-test-commit-freebsd failed but I think it is not related this PR. Console Output shows the below error log.

FATAL: Unable to delete script file /tmp/jenkins6129082505701075999.sh
15:25:27 java.nio.channels.ClosedChannelException
15:25:27 	at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.onReadClosed(ChannelApplicationLayer.java:209)
15:25:27 	at org.jenkinsci.remoting.protocol.ApplicationLayer.onRecvClosed(ApplicationLayer.java:222)
15:25:27 	at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.onRecvClosed(ProtocolStack.java:832)
15:25:27 	at org.jenkinsci.remoting.protocol.FilterLayer.onRecvClosed(FilterLayer.java:287)
15:25:27 	at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.onRecvClosed(SSLEngineFilterLayer.java:181)
15:25:27 	at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.switchToNoSecure(SSLEngineFilterLayer.java:283)
15:25:27 	at org.jenkinsci.remoting.protocol.impl.SSLEngineFilterLayer.processWrite(SSLEngineFilterLayer.java:503)
15:25:27 	at 

@trivikr
Copy link
Member

trivikr commented Aug 1, 2018

Resumed build: https://ci.nodejs.org/job/node-test-pull-request/16116/

@trivikr
Copy link
Member

trivikr commented Aug 2, 2018

@trivikr
Copy link
Member

trivikr commented Aug 3, 2018

Landed in 4e1c4e8

@trivikr trivikr closed this Aug 3, 2018
trivikr pushed a commit that referenced this pull request Aug 3, 2018
Added type check for argument for dns.setServers and dnsPromises.setServers.

PR-URL: #21944
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
@Trott
Copy link
Member

Trott commented Aug 3, 2018

@nodejs/tsc @nodejs/release This should be semver-major because it introduces a two new throws? Or would that be overly cautious in this case?

@addaleax addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Aug 3, 2018
@addaleax
Copy link
Member

addaleax commented Aug 3, 2018

I think common sense says no, but our policies say yes. :/

The input values would already have been something with a forEach method and elements with match and replace methods, so it probably just improves the error message here.

@mcollina
Copy link
Member

mcollina commented Aug 4, 2018

I think this is affecting only the new, experimental, promise API. So, this could land in Node 10 (because of experimental).

@shisama
Copy link
Contributor Author

shisama commented Aug 6, 2018

@mcollina This affects dns.setServers, not only dnsPromises.setServers.

const dns = require('dns');
const host = 'google.com'
dns.resolve4(host, ip=>{
    dns.setServers([ip]);
})

10.7.0 output

> TypeError: Cannot read property 'match' of null

this output

TypeError [ERR_INVALID_ARG_TYPE]: The "servers[0]" argument must be of type string. Received type object

@shisama shisama deleted the dns-setservers-arg-type-check branch February 14, 2020 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. dns Issues and PRs related to the dns subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.