Skip to content

Commit

Permalink
Modify rule S5547: Add ssl module (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrik-buchwald-sonarsource authored Nov 13, 2023
1 parent 5e87343 commit 146e2fa
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/header_names/allowed_framework_names.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
* PyJWT
* python-jwt
* python-jose
* ssl
// Docker
* Wget
// Cloudformation
Expand Down
30 changes: 30 additions & 0 deletions rules/S5547/python/how-to-fix-it/ssl.adoc
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions rules/S5547/python/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ include::how-to-fix-it/pycrypto.adoc[]

include::how-to-fix-it/pydes.adoc[]

include::how-to-fix-it/ssl.adoc[]

== Resources

include::../common/resources/standards.adoc[]
Expand Down

0 comments on commit 146e2fa

Please sign in to comment.