mirror of
https://github.com/github/codeql.git
synced 2026-06-06 05:57:07 +02:00
Python: Make sure all imprecise taint bubbles up
This commit is contained in:
committed by
Owen Mansel-Chan
parent
3275c814bd
commit
f669a4f3bf
@@ -4244,8 +4244,15 @@ module StdlibPrivate {
|
||||
)
|
||||
// TODO: Once we have DictKeyContent, we need to transform that into ListElementContent
|
||||
) and
|
||||
output = "ReturnValue.ListElement" and
|
||||
preservesValue = true
|
||||
(
|
||||
//Element content is mutated into list element content
|
||||
output = "ReturnValue.ListElement" and
|
||||
preservesValue = true
|
||||
or
|
||||
// Since list content is imprecise, we also taint the list.
|
||||
output = "ReturnValue" and
|
||||
preservesValue = false
|
||||
)
|
||||
or
|
||||
input = "Argument[0]" and
|
||||
output = "ReturnValue" and
|
||||
|
||||
@@ -27,14 +27,11 @@ def test_construction():
|
||||
tainted_dict, # $ tainted
|
||||
)
|
||||
|
||||
# There are no implicit reads for list content as it is imprecise
|
||||
# Therefore, list content stemming from precise content does not end up on the list itself.
|
||||
ensure_tainted(
|
||||
list(tainted_list), # $ tainted
|
||||
list(tainted_tuple)[0], # $ tainted
|
||||
list(tainted_tuple), # $ tainted
|
||||
list(tainted_set), # $ tainted
|
||||
list(tainted_dict.values())[0], # $ tainted
|
||||
list(tainted_dict.items())[0], # $ tainted
|
||||
list(tainted_dict.values()), # $ tainted
|
||||
|
||||
tuple(tainted_list), # $ tainted
|
||||
set(tainted_list), # $ tainted
|
||||
@@ -46,7 +43,8 @@ def test_construction():
|
||||
)
|
||||
|
||||
ensure_not_tainted(
|
||||
dict(k = tainted_string)["k1"]
|
||||
dict(k = tainted_string)["k1"],
|
||||
list(tainted_dict.items()),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user