mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
tls: localhost is valid against identity-check
This commit is contained in:
parent
8ba189b8d3
commit
0cf235410d
@ -85,10 +85,6 @@ function checkServerIdentity(host, cert) {
|
||||
// Add trailing dot (make hostnames uniform)
|
||||
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,
|
||||
// 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)
|
||||
|
@ -180,6 +180,13 @@ var tests = [
|
||||
},
|
||||
result: false
|
||||
},
|
||||
{
|
||||
host: 'localhost', cert: {
|
||||
subjectaltname: 'DNS:a.com',
|
||||
subject: { CN: 'localhost' }
|
||||
},
|
||||
result: true
|
||||
},
|
||||
];
|
||||
|
||||
tests.forEach(function(test, i) {
|
||||
|
Loading…
Reference in New Issue
Block a user