Permalink
Browse files

tls: localhost is valid against identity-check

  • Loading branch information...
1 parent 8ba189b commit 0cf235410dfa621668c34b5e70c6b7fb2dab2787 @indutny committed Jul 20, 2012
Showing with 7 additions and 4 deletions.
  1. +0 −4 lib/tls.js
  2. +7 −0 test/simple/test-tls-check-server-identity.js
View
@@ -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) {

0 comments on commit 0cf2354

Please sign in to comment.