File tree Expand file tree Collapse file tree
lib/semmle/python/frameworks
test/library-tests/dataflow/tainttracking/defaultAdditionalTaintStep Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4319,8 +4319,15 @@ module StdlibPrivate {
43194319 )
43204320 // TODO: Once we have DictKeyContent, we need to transform that into ListElementContent
43214321 ) and
4322- output = "ReturnValue.ListElement" and
4323- preservesValue = true
4322+ (
4323+ //Element content is mutated into list element content
4324+ output = "ReturnValue.ListElement" and
4325+ preservesValue = true
4326+ or
4327+ // Since list content is imprecise, we also taint the list.
4328+ output = "ReturnValue" and
4329+ preservesValue = false
4330+ )
43244331 or
43254332 input = "Argument[0]" and
43264333 output = "ReturnValue" and
Original file line number Diff line number Diff line change @@ -27,14 +27,11 @@ def test_construction():
2727 tainted_dict , # $ tainted
2828 )
2929
30- # There are no implicit reads for list content as it is imprecise
31- # Therefore, list content stemming from precise content does not end up on the list itself.
3230 ensure_tainted (
3331 list (tainted_list ), # $ tainted
34- list (tainted_tuple )[ 0 ] , # $ tainted
32+ list (tainted_tuple ), # $ tainted
3533 list (tainted_set ), # $ tainted
36- list (tainted_dict .values ())[0 ], # $ tainted
37- list (tainted_dict .items ())[0 ], # $ tainted
34+ list (tainted_dict .values ()), # $ tainted
3835
3936 tuple (tainted_list ), # $ tainted
4037 set (tainted_list ), # $ tainted
@@ -46,7 +43,8 @@ def test_construction():
4643 )
4744
4845 ensure_not_tainted (
49- dict (k = tainted_string )["k1" ]
46+ dict (k = tainted_string )["k1" ],
47+ list (tainted_dict .items ()),
5048 )
5149
5250
You can’t perform that action at this time.
0 commit comments