2020-06-30 14:41:58 +02:00
|
|
|
include::../description.adoc[]
|
|
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
Python https://docs.python.org/3/library/ssl.html[ssl standard] library:
|
|
|
|
|
|
|
|
----
|
|
|
|
import ssl
|
|
|
|
|
|
|
|
ctx = ssl._create_unverified_context() # Noncompliant: by default hostname verification is not done
|
|
|
|
ctx = ssl._create_stdlib_context() # Noncompliant: by default hostname verification is not done
|
|
|
|
|
|
|
|
ctx = ssl.create_default_context()
|
|
|
|
ctx.check_hostname = False # Noncompliant
|
|
|
|
|
|
|
|
ctx = ssl._create_default_https_context()
|
|
|
|
ctx.check_hostname = False # Noncompliant
|
|
|
|
----
|
|
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
Python https://docs.python.org/3/library/ssl.html[ssl standard] library:
|
|
|
|
|
|
|
|
----
|
|
|
|
import ssl
|
|
|
|
|
|
|
|
ctx = ssl._create_unverified_context()
|
|
|
|
ctx.check_hostname = True # Compliant
|
|
|
|
|
|
|
|
ctx = ssl._create_stdlib_context()
|
|
|
|
ctx.check_hostname = True # Compliant
|
|
|
|
|
|
|
|
ctx = ssl.create_default_context() # Compliant: by default hostname verification is enabled
|
|
|
|
ctx = ssl._create_default_https_context() # Compliant: by default hostname verification is enabled
|
|
|
|
----
|
|
|
|
|
|
|
|
include::../see.adoc[]
|
2021-06-02 20:44:38 +02:00
|
|
|
|
2021-06-03 09:05:38 +02:00
|
|
|
ifdef::env-github,rspecator-view[]
|
2021-06-08 15:52:13 +02:00
|
|
|
'''
|
2021-06-02 20:44:38 +02:00
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::../comments-and-links.adoc[]
|
2021-06-03 09:05:38 +02:00
|
|
|
endif::env-github,rspecator-view[]
|