Skip to content

Commit 38daeb4

Browse files
yoffRasmusWL
andauthored
Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <[email protected]>
1 parent a006a92 commit 38daeb4

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

python/ql/src/Security/CWE-327/FluentApiModel.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class InsecureContextConfiguration extends DataFlow::Configuration {
6565
* Holds if `conectionCreation` marks the creation of a connetion based on the contex
6666
* found at `contextOrigin` and allowing `insecure_version`.
6767
*
68-
* `specific` is true iff the context is configured for a specific protocol version rather
69-
* than for a family of protocols.
68+
* `specific` is true iff the context is configured for a specific protocol version (`ssl.PROTOCOL_TLSv1_2`) rather
69+
* than for a family of protocols (`ssl.PROTOCOL_TLS`).
7070
*/
7171
predicate unsafe_connection_creation_with_context(
7272
DataFlow::Node connectionCreation, ProtocolVersion insecure_version, DataFlow::Node contextOrigin,

python/ql/src/Security/CWE-327/Ssl.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ class UnspecificSSLContextCreation extends SSLContextCreation, UnspecificContext
149149
or
150150
// Case: No protocol arguemnt is present.
151151
not exists(this.getProtocol()) and
152-
// The default argument is TLS and the SSL versions are turned off by default.
152+
// The default argument is TLS and the SSL versions are turned off by default since Python 3.6
153+
// see https://docs.python.org/3.6/library/ssl.html#ssl.SSLContext
153154
result in ["TLSv1", "TLSv1_1", "TLSv1_2", "TLSv1_3"]
154155
}
155156
}

python/ql/test/query-tests/Security/CWE-327/ssl_fluent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def test_fluent_tls_safe():
4949

5050
def test_fluent_ssl():
5151
hostname = 'www.python.org'
52+
# notice that `ssl.PROTOCOL_SSLv23` is just a deprecated alias for `ssl.PROTOCOL_TLS`.
53+
# Therefore, we only have this one test using PROTOCOL_SSLv23, to show that we handle this alias correctly.
5254
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
5355

5456
with socket.create_connection((hostname, 443)) as sock:

0 commit comments

Comments
 (0)