Skip to content

Commit 145eaf3

Browse files
committed
python: remove steps for container constructors
1 parent ac1df4d commit 145eaf3

File tree

5 files changed

+15
-22
lines changed

5 files changed

+15
-22
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/TaintTrackingPrivate.qll

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,6 @@ predicate containerStep(DataFlow::CfgNode nodeFrom, DataFlow::Node nodeTo) {
181181
// don't provide that right now.
182182
DataFlowPrivate::comprehensionStoreStep(nodeFrom, _, nodeTo)
183183
or
184-
// constructor call
185-
exists(DataFlow::CallCfgNode call | call = nodeTo |
186-
call = API::builtin(["list", "set", "frozenset", "dict", "tuple"]).getACall() and
187-
call.getArg(0) = nodeFrom
188-
// TODO: Properly handle defaultdict/namedtuple
189-
)
190-
or
191184
// functions operating on collections
192185
exists(DataFlow::CallCfgNode call | call = nodeTo |
193186
call = API::builtin(["sorted", "reversed", "iter", "next"]).getACall() and

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ def test_construction():
2828
)
2929

3030
ensure_tainted(
31-
list(tainted_list), # $ tainted
32-
list(tainted_tuple), # $ tainted
33-
list(tainted_set), # $ tainted
34-
list(tainted_dict.values()), # $ tainted
35-
list(tainted_dict.items()), # $ tainted
36-
37-
tuple(tainted_list), # $ tainted
38-
set(tainted_list), # $ tainted
39-
frozenset(tainted_list), # $ tainted
40-
dict(tainted_dict), # $ tainted
31+
list(tainted_list), # $ MISSING: tainted
32+
list(tainted_tuple), # $ MISSING: tainted
33+
list(tainted_set), # $ MISSING: tainted
34+
list(tainted_dict.values()), # $ MISSING: tainted
35+
list(tainted_dict.items()), # $ MISSING: tainted
36+
37+
tuple(tainted_list), # $ MISSING: tainted
38+
set(tainted_list), # $ MISSING: tainted
39+
frozenset(tainted_list), # $ MISSING: tainted
40+
dict(tainted_dict), # $ MISSING: tainted
4141
dict(k = tainted_string)["k"], # $ MISSING: tainted
4242
dict(dict(k = tainted_string))["k"], # $ MISSING: tainted
43-
dict(["k", tainted_string]), # $ tainted
43+
dict(["k", tainted_string]), # $ MISSING: tainted
4444
)
4545

4646
ensure_not_tainted(

python/ql/test/library-tests/frameworks/aiohttp/taint_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def test_taint(request: web.Request): # $ requestHandler
4242
request.cookies.keys(), # $ MISSING: tainted
4343
request.cookies.values(), # $ tainted
4444
request.cookies.items(), # $ tainted
45-
list(request.cookies), # $ tainted
45+
list(request.cookies), # $ MISSING: tainted
4646
iter(request.cookies), # $ tainted
4747

4848

python/ql/test/library-tests/frameworks/flask/taint_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_taint(name = "World!", number="0", foo="foo"): # $requestHandler route
112112
request.headers.popitem()[0], # $ tainted
113113
request.headers.popitem()[1], # $ tainted
114114
# two ways to get (k, v) lists
115-
list(request.headers), # $ tainted
115+
list(request.headers), # $ MISSING: tainted
116116
request.headers.to_wsgi_list(), # $ tainted
117117

118118
request.json, # $ tainted

python/ql/test/library-tests/frameworks/multidict/taint_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
mdp.values(), # $ tainted
1717
mdp.items(), # $ tainted
1818
mdp.copy(), # $ tainted
19-
list(mdp), # $ tainted
19+
list(mdp), # $ MISSING: tainted
2020
iter(mdp), # $ tainted
2121
)
2222

@@ -36,6 +36,6 @@
3636
ci_mdp.values(), # $ tainted
3737
ci_mdp.items(), # $ tainted
3838
ci_mdp.copy(), # $ tainted
39-
list(ci_mdp), # $ tainted
39+
list(ci_mdp), # $ MISSING: tainted
4040
iter(ci_mdp), # $ tainted
4141
)

0 commit comments

Comments
 (0)