File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
lib/semmle/python/frameworks
test/library-tests/dataflow/tainttracking/defaultAdditionalTaintStep Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -4319,8 +4319,15 @@ module StdlibPrivate {
4319
4319
)
4320
4320
// TODO: Once we have DictKeyContent, we need to transform that into ListElementContent
4321
4321
) 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
+ )
4324
4331
or
4325
4332
input = "Argument[0]" and
4326
4333
output = "ReturnValue" and
Original file line number Diff line number Diff line change @@ -27,14 +27,11 @@ def test_construction():
27
27
tainted_dict , # $ tainted
28
28
)
29
29
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.
32
30
ensure_tainted (
33
31
list (tainted_list ), # $ tainted
34
- list (tainted_tuple )[ 0 ] , # $ tainted
32
+ list (tainted_tuple ), # $ tainted
35
33
list (tainted_set ), # $ tainted
36
- list (tainted_dict .values ())[0 ], # $ tainted
37
- list (tainted_dict .items ())[0 ], # $ tainted
34
+ list (tainted_dict .values ()), # $ tainted
38
35
39
36
tuple (tainted_list ), # $ tainted
40
37
set (tainted_list ), # $ tainted
@@ -46,7 +43,8 @@ def test_construction():
46
43
)
47
44
48
45
ensure_not_tainted (
49
- dict (k = tainted_string )["k1" ]
46
+ dict (k = tainted_string )["k1" ],
47
+ list (tainted_dict .items ()),
50
48
)
51
49
52
50
You can’t perform that action at this time.
0 commit comments