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

Skip to content

Commit e0cfe81

Browse files
committed
Python: Update comments for new taint tests
I see I didn't keep them up to date as I implemented things
1 parent cda88a5 commit e0cfe81

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_collections.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_construction():
1616
tainted_string = TAINTED_STRING
1717
tainted_list = [tainted_string]
1818
tainted_tuple = (tainted_string,)
19-
tainted_set = {tainted_string} # TODO: set currently not handled
19+
tainted_set = {tainted_string}
2020
tainted_dict = {'key': tainted_string}
2121

2222
ensure_tainted(
@@ -30,13 +30,13 @@ def test_construction():
3030
ensure_tainted(
3131
list(tainted_list),
3232
list(tainted_tuple),
33-
list(tainted_set), # TODO: set currently not handled
33+
list(tainted_set),
3434
list(tainted_dict.values()),
35-
list(tainted_dict.items()), # TODO: dict.items() currently not handled
35+
list(tainted_dict.items()),
3636

3737
tuple(tainted_list),
3838
set(tainted_list),
39-
frozenset(tainted_list), # TODO: frozenset constructor currently not handled
39+
frozenset(tainted_list),
4040
)
4141

4242

@@ -75,7 +75,7 @@ def test_dict_access(x):
7575

7676
for v in tainted_dict.values():
7777
ensure_tainted(v)
78-
for k, v in tainted_dict.items(): # TODO: dict.items() currently not handled
78+
for k, v in tainted_dict.items():
7979
ensure_tainted(v)
8080

8181

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_unpacking.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ def contrived_1():
5151
tainted_list = TAINTED_LIST[0:3]
5252
no_taint_list = [1,2,3]
5353

54-
# We don't handle this case currently, since we mark `d`, `e` and `f` as tainted.
5554
(a, b, c), (d, e, f) = tainted_list, no_taint_list
5655
ensure_tainted(a, b, c)
57-
ensure_not_tainted(d, e, f)
56+
ensure_not_tainted(d, e, f) # FP: we mark `d`, `e` and `f` as tainted.
5857

5958

6059
def contrived_2():
6160
# A contrived example. Don't know why anyone would ever actually do this.
6261

63-
# We currently only handle taint nested 2 levels.
64-
[[[ (a,b,c) ]]] = [[[ TAINTED_LIST[0:3] ]]]
62+
# Old taint tracking was only able to handle taint nested 2 levels in sequences,
63+
# so would not mark a, b, c as tainted
64+
[[[ (a, b, c) ]]] = [[[ TAINTED_LIST[0:3] ]]]
6565
ensure_tainted(a, b, c)
6666

6767

0 commit comments

Comments
 (0)