Skip to content

Commit 798db91

Browse files
committed
Python: Add more urlsplit tests
1 parent 31ff652 commit 798db91

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

python/ql/test/library-tests/taint/namedtuple/TestTaint.expected

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
| test.py:13 | test_basic | urlsplit_res | [externally controlled string] |
66
| test.py:20 | test_sanitizer | Attribute | NO TAINT |
77
| test.py:23 | test_sanitizer | Subscript | NO TAINT |
8-
| test.py:33 | test_namedtuple | a | NO TAINT |
9-
| test.py:33 | test_namedtuple | b | NO TAINT |
10-
| test.py:33 | test_namedtuple | c | NO TAINT |
11-
| test.py:33 | test_namedtuple | d | NO TAINT |
8+
| test.py:26 | test_sanitizer | Attribute | NO TAINT |
9+
| test.py:29 | test_sanitizer | Attribute | externally controlled string |
10+
| test.py:32 | test_sanitizer | Attribute | externally controlled string |
11+
| test.py:42 | test_namedtuple | a | NO TAINT |
12+
| test.py:42 | test_namedtuple | b | NO TAINT |
13+
| test.py:42 | test_namedtuple | c | NO TAINT |
14+
| test.py:42 | test_namedtuple | d | NO TAINT |

python/ql/test/library-tests/taint/namedtuple/test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ def test_sanitizer():
2222
if urlsplit_res[2] == "OK":
2323
test(urlsplit_res[0])
2424

25+
if urlsplit_res.netloc == "OK":
26+
test(urlsplit_res.path) # FN
27+
28+
if urlsplit_res.netloc in ["OK"]:
29+
test(urlsplit_res.netloc) # FP
30+
31+
if urlsplit_res.netloc in ["OK", non_constant()]:
32+
test(urlsplit_res.netloc) # should be tainted
33+
2534
def test_namedtuple():
2635
tainted_string = TAINTED_STRING
2736
Point = namedtuple('Point', ['x', 'y'])

0 commit comments

Comments
 (0)