node-js-libs/cli

'host' option typechecking too strict

tikonen opened this issue · 1 comments

I think the host typechecking is too strict as it checks for valid top level domains. Special hostnames that are often used internally are not accepted as domainnames.

ip-10-249-9-141.eu-west-1.compute.internal
foomachine
localhost

etc..

It should be enough to check that the hostname is either IP or otherwise valid hostname. Top level domain enforcing is not needed in my opinion.

I had the same issue over in my validator library.

tl;dr allowing hostnames like this through is (almost) the same as letting arbitrary strings through. I wasn't game on changing a validator and breaking backwards compat so the end result was if you plan on letting hosts/urls without a tld to just expect string input and check yourself.