We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19c6c99 commit e4f6e4fCopy full SHA for e4f6e4f
pymongo/ssl_match_hostname.py
@@ -8,9 +8,16 @@ class CertificateError(ValueError):
8
pass
9
10
11
-def _dnsname_to_pat(dn):
+def _dnsname_to_pat(dn, max_wildcards=1):
12
pats = []
13
for frag in dn.split(r'.'):
14
+ if frag.count('*') > max_wildcards:
15
+ # Issue #17980: avoid denials of service by refusing more
16
+ # than one wildcard per fragment. A survery of established
17
+ # policy among SSL implementations showed it to be a
18
+ # reasonable choice.
19
+ raise CertificateError(
20
+ "too many wildcards in certificate DNS name: " + repr(dn))
21
if frag == '*':
22
# When '*' is a fragment by itself, it matches a non-empty dotless
23
# fragment.
0 commit comments