Skip to content
Permalink
Browse files

fix: validate ipv6 hosts correctly

fix #2270
  • Loading branch information...
korhaliv committed May 27, 2019
1 parent 90dbcd8 commit e80cfbb6c8ab182fb395beaa8eb7d94747ee21a5
Showing with 2 additions and 1 deletion.
  1. +2 −1 utils/validateHost.js
@@ -3,6 +3,7 @@ import { promisify } from 'util'
import isFQDN from 'validator/lib/isFQDN'
import isIP from 'validator/lib/isIP'
import isPort from 'validator/lib/isPort'
import splitHostname from '@zap/utils/splitHostname'

const dnsLookup = promisify(dns.lookup)

@@ -19,7 +20,7 @@ const validateHost = async host => {
}

try {
const [lndHost, lndPort] = host.split(':')
const { host: lndHost, port: lndPort } = splitHostname(host)

// If the hostname starts with a number, ensure that it is a valid IP address.
if (!isFQDN(lndHost, { require_tld: false }) && !isIP(lndHost)) {

0 comments on commit e80cfbb

Please sign in to comment.
You can’t perform that action at this time.