Skip to content

Commit 5506365

Browse files
committed
Python: Split cleartext tests
1 parent c096461 commit 5506365

File tree

9 files changed

+16
-12
lines changed

9 files changed

+16
-12
lines changed

python/ql/test/query-tests/Security/CWE-312/CleartextLogging.expected renamed to python/ql/test/query-tests/Security/CWE-312-CleartextLogging/CleartextLogging.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
edges
2-
| password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password |
3-
| password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password |
42
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
53
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
6-
| test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key |
74
#select
85
| test.py:8:35:8:42 | password | test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password | Sensitive data returned by $@ is logged here. | test.py:7:16:7:29 | get_password() | a call returning a password |
96
| test.py:14:30:14:39 | get_cert() | test.py:14:30:14:39 | a certificate or key | test.py:14:30:14:39 | a certificate or key | Sensitive data returned by $@ is logged here. | test.py:14:30:14:39 | get_cert() | a call returning a certificate or key |

python/ql/test/query-tests/Security/CWE-312/test.py renamed to python/ql/test/query-tests/Security/CWE-312-CleartextLogging/test.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,3 @@ def log_cert():
1515

1616
def print_password():
1717
print(get_password())
18-
19-
def write_cert(filename):
20-
cert = get_cert()
21-
with open(filename, "w") as file:
22-
file.write(cert)

python/ql/test/query-tests/Security/CWE-312/CleartextStorage.expected renamed to python/ql/test/query-tests/Security/CWE-312-CleartextStorage/CleartextStorage.expected

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ edges
33
| password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password |
44
| password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password |
55
| password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password |
6-
| test.py:7:16:7:29 | a password | test.py:8:35:8:42 | a password |
7-
| test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key |
8-
| test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key |
6+
| test.py:10:12:10:21 | a certificate or key | test.py:12:20:12:23 | a certificate or key |
7+
| test.py:10:12:10:21 | a certificate or key | test.py:12:20:12:23 | a certificate or key |
98
#select
109
| password_in_cookie.py:9:33:9:40 | password | password_in_cookie.py:7:16:7:43 | a password | password_in_cookie.py:9:33:9:40 | a password | Sensitive data from $@ is stored here. | password_in_cookie.py:7:16:7:43 | Attribute() | a request parameter containing a password |
1110
| password_in_cookie.py:16:33:16:40 | password | password_in_cookie.py:14:16:14:43 | a password | password_in_cookie.py:16:33:16:40 | a password | Sensitive data from $@ is stored here. | password_in_cookie.py:14:16:14:43 | Attribute() | a request parameter containing a password |
12-
| test.py:22:20:22:23 | cert | test.py:20:12:20:21 | a certificate or key | test.py:22:20:22:23 | a certificate or key | Sensitive data from $@ is stored here. | test.py:20:12:20:21 | get_cert() | a call returning a certificate or key |
11+
| test.py:12:20:12:23 | cert | test.py:10:12:10:21 | a certificate or key | test.py:12:20:12:23 | a certificate or key | Sensitive data from $@ is stored here. | test.py:10:12:10:21 | get_cert() | a call returning a certificate or key |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
semmle-extractor-options: -p ../lib/ --max-import-depth=3
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#Don't import logging; it transitively imports a lot of stuff
2+
3+
def get_password():
4+
pass
5+
6+
def get_cert():
7+
pass
8+
9+
def write_cert(filename):
10+
cert = get_cert()
11+
with open(filename, "w") as file:
12+
file.write(cert)

0 commit comments

Comments
 (0)