Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e696ff

Browse files
committed
Python: Add false negative to test
1 parent d5171fc commit 9e696ff

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,13 @@ def test_fluent_ssl_safe_version():
8585
with socket.create_connection((hostname, 443)) as sock:
8686
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
8787
print(ssock.version())
88+
89+
# Taken from https://docs.python.org/3/library/ssl.html#context-creation
90+
def test_fluent_explicitly_unsafe():
91+
hostname = 'www.python.org'
92+
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
93+
context.options &= ~ssl.OP_NO_SSLv3 # This not recognized
94+
95+
with socket.create_connection((hostname, 443)) as sock:
96+
with context.wrap_socket(sock, server_hostname=hostname) as ssock: # SSLv3 not flagged here
97+
print(ssock.version())

0 commit comments

Comments
 (0)