Skip to content

Commit 52cd7f2

Browse files
Add 2 more cases
1 parent 9b4b01a commit 52cd7f2

File tree

1 file changed

+31
-1
lines changed
  • python/ql/test/library-tests/dataflow/global-or-captured-vars

1 file changed

+31
-1
lines changed

python/ql/test/library-tests/dataflow/global-or-captured-vars/test.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,34 @@ def baz7(loc_foo):
8585

8686
threading.Thread(target=bar7).start()
8787

88-
baz7(foo7)
88+
baz7(foo7)
89+
90+
# Test 8
91+
# FN - Flow is also *not* found in the above case through a direct call
92+
93+
foo8 = []
94+
95+
def bar8():
96+
time.sleep(1)
97+
ensure_tainted(foo8[0]) # $MISSING: tainted
98+
99+
def baz8(loc_foo):
100+
loc_foo.append(TAINTED_STRING)
101+
102+
baz8(foo8)
103+
bar8()
104+
105+
# Test 9
106+
# TP - Flow is found in the above case when the variable is captured rather than global
107+
108+
def test9():
109+
foo9 = []
110+
def bar9():
111+
time.sleep(1)
112+
ensure_tainted(foo9[0]) # $tainted
113+
114+
def baz9(loc_foo):
115+
loc_foo.append(TAINTED_STRING)
116+
117+
baz9(foo9)
118+
bar9()

0 commit comments

Comments
 (0)