Modify rule S5547: Add ssl module (#3113)
This commit is contained in:
parent
5e8734386e
commit
146e2fa2ee
@ -99,6 +99,7 @@
|
|||||||
* PyJWT
|
* PyJWT
|
||||||
* python-jwt
|
* python-jwt
|
||||||
* python-jose
|
* python-jose
|
||||||
|
* ssl
|
||||||
// Docker
|
// Docker
|
||||||
* Wget
|
* Wget
|
||||||
// Cloudformation
|
// Cloudformation
|
||||||
|
30
rules/S5547/python/how-to-fix-it/ssl.adoc
Normal file
30
rules/S5547/python/how-to-fix-it/ssl.adoc
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
== How to fix it in ssl
|
||||||
|
|
||||||
|
=== Code examples
|
||||||
|
|
||||||
|
include::../../common/fix/code-rationale.adoc[]
|
||||||
|
|
||||||
|
==== Noncompliant code example
|
||||||
|
|
||||||
|
[source,python,diff-id=41,diff-type=noncompliant]
|
||||||
|
----
|
||||||
|
import ssl
|
||||||
|
|
||||||
|
ciphers = 'RC4-SHA:RC4-MD5'
|
||||||
|
ctx = ssl.create_default_context()
|
||||||
|
ctx.set_ciphers(ciphers) # Noncompliant
|
||||||
|
----
|
||||||
|
|
||||||
|
==== Compliant solution
|
||||||
|
|
||||||
|
[source,python,diff-id=41,diff-type=compliant]
|
||||||
|
----
|
||||||
|
import ssl
|
||||||
|
|
||||||
|
ctx = ssl.create_default_context()
|
||||||
|
----
|
||||||
|
|
||||||
|
=== How does this work?
|
||||||
|
|
||||||
|
It is recommended to not override the ciphers but instead, use the secure
|
||||||
|
default ciphers of the module, as they might change over time.
|
@ -16,6 +16,8 @@ include::how-to-fix-it/pycrypto.adoc[]
|
|||||||
|
|
||||||
include::how-to-fix-it/pydes.adoc[]
|
include::how-to-fix-it/pydes.adoc[]
|
||||||
|
|
||||||
|
include::how-to-fix-it/ssl.adoc[]
|
||||||
|
|
||||||
== Resources
|
== Resources
|
||||||
|
|
||||||
include::../common/resources/standards.adoc[]
|
include::../common/resources/standards.adoc[]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user