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

Skip to content

Commit af20c3e

Browse files
committed
Python: Make new taint tracking tests runnable again
since the files was called `collection`, that conflicted with import system :|
1 parent bd21fc5 commit af20c3e

9 files changed

Lines changed: 191 additions & 199 deletions

File tree

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
| collections.py:16 | ok | test_access | tainted_list.copy() |
2-
| string.py:17 | ok | str_methods | ts.casefold() |
3-
| string.py:19 | ok | str_methods | ts.format_map(..) |
4-
| string.py:20 | ok | str_methods | "{unsafe}".format_map(..) |
5-
| string.py:31 | fail | binary_decode_encode | base64.a85encode(..) |
6-
| string.py:32 | fail | binary_decode_encode | base64.a85decode(..) |
7-
| string.py:35 | fail | binary_decode_encode | base64.b85encode(..) |
8-
| string.py:36 | fail | binary_decode_encode | base64.b85decode(..) |
9-
| string.py:39 | fail | binary_decode_encode | base64.encodebytes(..) |
10-
| string.py:40 | fail | binary_decode_encode | base64.decodebytes(..) |
11-
| string.py:48 | ok | f_strings | Fstring |
12-
| unpacking.py:18 | ok | extended_unpacking | first |
13-
| unpacking.py:18 | ok | extended_unpacking | last |
14-
| unpacking.py:18 | ok | extended_unpacking | rest |
15-
| unpacking.py:23 | ok | also_allowed | a |
16-
| unpacking.py:31 | ok | also_allowed | b |
17-
| unpacking.py:31 | ok | also_allowed | c |
18-
| unpacking.py:39 | ok | nested | x |
19-
| unpacking.py:39 | ok | nested | xs |
20-
| unpacking.py:39 | ok | nested | ys |
1+
| collections_.py:16 | ok | test_access | tainted_list.copy() |
2+
| collections_.py:24 | ok | list_clear | tainted_list |
3+
| collections_.py:27 | fail | list_clear | tainted_list |
4+
| string_.py:17 | ok | str_methods | ts.casefold() |
5+
| string_.py:19 | ok | str_methods | ts.format_map(..) |
6+
| string_.py:20 | ok | str_methods | "{unsafe}".format_map(..) |
7+
| string_.py:31 | fail | binary_decode_encode | base64.a85encode(..) |
8+
| string_.py:32 | fail | binary_decode_encode | base64.a85decode(..) |
9+
| string_.py:35 | fail | binary_decode_encode | base64.b85encode(..) |
10+
| string_.py:36 | fail | binary_decode_encode | base64.b85decode(..) |
11+
| string_.py:39 | fail | binary_decode_encode | base64.encodebytes(..) |
12+
| string_.py:40 | fail | binary_decode_encode | base64.decodebytes(..) |
13+
| string_.py:48 | ok | f_strings | Fstring |
14+
| unpacking_.py:18 | ok | extended_unpacking | first |
15+
| unpacking_.py:18 | ok | extended_unpacking | last |
16+
| unpacking_.py:18 | ok | extended_unpacking | rest |
17+
| unpacking_.py:23 | ok | also_allowed | a |
18+
| unpacking_.py:31 | ok | also_allowed | b |
19+
| unpacking_.py:31 | ok | also_allowed | c |
20+
| unpacking_.py:39 | ok | nested | x |
21+
| unpacking_.py:39 | ok | nested | xs |
22+
| unpacking_.py:39 | ok | nested | ys |

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/collections.py renamed to python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/collections_.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ def test_access():
1717
)
1818

1919

20+
def list_clear():
21+
tainted_string = TAINTED_STRING
22+
tainted_list = [tainted_string]
23+
24+
ensure_tainted(tainted_list)
25+
26+
tainted_list.clear()
27+
ensure_not_tainted(tainted_list)
28+
2029
# Make tests runable
2130

2231
test_access()
32+
list_clear()

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/string.py renamed to python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/string_.py

File renamed without changes.

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/unpacking.py renamed to python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep-py3/unpacking_.py

File renamed without changes.

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/TestTaint.expected

Lines changed: 155 additions & 157 deletions
Large diffs are not rendered by default.

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/collections.py renamed to python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/collections_.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,6 @@ def test_defaultdict(key, x): # TODO: defaultdict currently not handled
117117
ensure_tainted(v)
118118

119119

120-
def list_clear():
121-
tainted_string = TAINTED_STRING
122-
tainted_list = [tainted_string]
123-
124-
ensure_tainted(tainted_list)
125-
126-
tainted_list.clear()
127-
ensure_not_tainted(tainted_list)
128-
129-
130120
def list_index_assign():
131121
tainted_string = TAINTED_STRING
132122
my_list = ["safe"]
@@ -164,3 +154,7 @@ def list_append():
164154
test_dict_access("name")
165155
test_named_tuple()
166156
test_defaultdict("key", "key")
157+
158+
list_index_assign()
159+
list_index_aug_assign()
160+
list_append()

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/json.py renamed to python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/json_.py

File renamed without changes.

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/string.py renamed to python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/string_.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,6 @@ def binary_decode_encode():
133133
base64.b16encode(tb),
134134
base64.b16decode(base64.b16encode(tb)),
135135

136-
# # New in Python 3.4
137-
# base64.a85encode(tb),
138-
# base64.a85decode(base64.a85encode(tb)),
139-
140-
# # New in Python 3.4
141-
# base64.b85encode(tb),
142-
# base64.b85decode(base64.b85encode(tb)),
143-
144-
# # New in Python 3.1
145-
# base64.encodebytes(tb),
146-
# base64.decodebytes(base64.encodebytes(tb)),
147-
148136
# deprecated since Python 3.1, but still works
149137
base64.encodestring(tb),
150138
base64.decodestring(base64.encodestring(tb)),

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/unpacking.py renamed to python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/unpacking_.py

File renamed without changes.

0 commit comments

Comments
 (0)