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 @@ -4157,8 +4157,15 @@ module StdlibPrivate {
41574157 )
41584158 // TODO: Once we have DictKeyContent, we need to transform that into ListElementContent
41594159 ) and
4160- output = "ReturnValue.ListElement" and
4161- preservesValue = true
4160+ (
4161+ //Element content is mutated into list element content
4162+ output = "ReturnValue.ListElement" and
4163+ preservesValue = true
4164+ or
4165+ // Since list content is imprecise, we also taint the list.
4166+ output = "ReturnValue" and
4167+ preservesValue = false
4168+ )
41624169 or
41634170 input = "Argument[0]" and
41644171 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