| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dfbbfbb commit 7165254
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,6 +70,48 @@ const tests = [ | |||
| 70 | 70 | error: 'Host: a.com. is not cert\'s CN: .a.com' | |
| 71 | 71 | }, | |
| 72 | 72 | ||
| 73 | + // IP address in CN. Technically allowed but so rare that we reject | ||
| 74 | + // it anyway. If we ever do start allowing them, we should take care | ||
| 75 | + // to only allow public (non-internal, non-reserved) IP addresses, | ||
| 76 | + // because that's what the spec mandates. | ||
| 77 | + { | ||
| 78 | + host: '8.8.8.8', | ||
| 79 | + cert: { subject: { CN: '8.8.8.8' } }, | ||
| 80 | + error: 'IP: 8.8.8.8 is not in the cert\'s list: ' | ||
| 81 | + }, | ||
| 82 | + | ||
| 83 | + // The spec suggests that a "DNS:" Subject Alternative Name containing an | ||
| 84 | + // IP address is valid but it seems so suspect that we currently reject it. | ||
| 85 | + { | ||
| 86 | + host: '8.8.8.8', | ||
| 87 | + cert: { subject: { CN: '8.8.8.8' }, subjectaltname: 'DNS:8.8.8.8' }, | ||
| 88 | + error: 'IP: 8.8.8.8 is not in the cert\'s list: ' | ||
| 89 | + }, | ||
| 90 | + | ||
| 91 | + // Likewise for "URI:" Subject Alternative Names. | ||
| 92 | + // See also https://github.com/nodejs/node/issues/8108. | ||
| 93 | + { | ||
| 94 | + host: '8.8.8.8', | ||
| 95 | + cert: { subject: { CN: '8.8.8.8' }, subjectaltname: 'URI:http://8.8.8.8/' }, | ||
| 96 | + error: 'IP: 8.8.8.8 is not in the cert\'s list: ' | ||
| 97 | + }, | ||
| 98 | + | ||
| 99 | + // An "IP Address:" Subject Alternative Name however is acceptable. | ||
| 100 | + { | ||
| 101 | + host: '8.8.8.8', | ||
| 102 | + cert: { subject: { CN: '8.8.8.8' }, subjectaltname: 'IP Address:8.8.8.8' } | ||
| 103 | + }, | ||
| 104 | + | ||
| 105 | + // But not when it's a CIDR. | ||
| 106 | + { | ||
| 107 | + host: '8.8.8.8', | ||
| 108 | + cert: { | ||
| 109 | + subject: { CN: '8.8.8.8' }, | ||
| 110 | + subjectaltname: 'IP Address:8.8.8.0/24' | ||
| 111 | + }, | ||
| 112 | + error: 'IP: 8.8.8.8 is not in the cert\'s list: ' | ||
| 113 | + }, | ||
| 114 | + | ||
| 73 | 115 | // Wildcards in CN | |
| 74 | 116 | { host: 'b.a.com', cert: { subject: { CN: '*.a.com' } } }, | |
| 75 | 117 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments