Skip to content

Commit dcbcf7e

Browse files
Add additional tests demonstrating false negative flow
1 parent e6794a9 commit dcbcf7e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import lxml.etree as ET
22
import io
3+
import typing
34

45
def ensure_tainted(*args):
56
print("ensure_tainted: ", *args)
@@ -133,6 +134,21 @@ def func(tree_arg: ET.ElementTree):
133134
)
134135

135136
func(tree2)
137+
138+
def func2(x):
139+
return x
140+
141+
def func3(x) -> ET.Element:
142+
return x
143+
144+
ensure_tainted(
145+
func2(tree), # $ tainted
146+
func2(tree).text, # $ MISSING:tainted - type tracking not tracked through flow preserving calls
147+
func3(tree).text, # $ MISSING:tainted - this includes if there is a type hint annotation on the return
148+
typing.cast(ET.ElementTree, tree), # $ tainted
149+
typing.cast(ET.ElementTree, tree).text, # $ MISSING:tainted - this includes for flow summary models
150+
151+
)
136152

137153

138154
test()

0 commit comments

Comments
 (0)