2023-06-20 17:36:01 +02:00
|
|
|
== How to fix it in Python Standard Library
|
|
|
|
|
|
|
|
=== Code examples
|
|
|
|
|
|
|
|
==== Noncompliant code example
|
|
|
|
|
2023-08-21 15:22:49 +02:00
|
|
|
[source,python,diff-id=21,diff-type=noncompliant]
|
2023-06-20 17:36:01 +02:00
|
|
|
----
|
|
|
|
import ssl
|
|
|
|
|
|
|
|
ssl.SSLContext(ssl.PROTOCOL_SSLv3) # Noncompliant
|
|
|
|
----
|
|
|
|
|
|
|
|
==== Compliant solution
|
|
|
|
|
2023-08-21 15:22:49 +02:00
|
|
|
[source,python,diff-id=21,diff-type=compliant]
|
2023-06-20 17:36:01 +02:00
|
|
|
----
|
|
|
|
import ssl
|
|
|
|
|
2024-02-29 12:36:15 +01:00
|
|
|
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
|
|
|
|
context.minimum_version = ssl.TLSVersion.TLSv1_2
|
2023-06-20 17:36:01 +02:00
|
|
|
----
|
|
|
|
|
|
|
|
=== How does this work?
|
|
|
|
|
|
|
|
include::../../common/fix/fix.adoc[]
|