mirror of https://github.com/nodejs/node.git
tls: localhost is valid against identity-check
parent
8ba189b8d3
commit
0cf235410d
|
@ -85,10 +85,6 @@ function checkServerIdentity(host, cert) {
|
||||||
// Add trailing dot (make hostnames uniform)
|
// Add trailing dot (make hostnames uniform)
|
||||||
if (!/\.$/.test(host)) host += '.';
|
if (!/\.$/.test(host)) host += '.';
|
||||||
|
|
||||||
// Host names with less than one dots are considered too broad,
|
|
||||||
// and should not be allowed
|
|
||||||
if (!/^.+\..+$/.test(host)) return /$./;
|
|
||||||
|
|
||||||
// The same applies to hostname with more than one wildcard,
|
// The same applies to hostname with more than one wildcard,
|
||||||
// if hostname has wildcard when wildcards are not allowed,
|
// if hostname has wildcard when wildcards are not allowed,
|
||||||
// or if there are less than two dots after wildcard (i.e. *.com or *d.com)
|
// or if there are less than two dots after wildcard (i.e. *.com or *d.com)
|
||||||
|
|
|
@ -180,6 +180,13 @@ var tests = [
|
||||||
},
|
},
|
||||||
result: false
|
result: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
host: 'localhost', cert: {
|
||||||
|
subjectaltname: 'DNS:a.com',
|
||||||
|
subject: { CN: 'localhost' }
|
||||||
|
},
|
||||||
|
result: true
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
tests.forEach(function(test, i) {
|
tests.forEach(function(test, i) {
|
||||||
|
|
Loading…
Reference in New Issue