Skip to content

Commit 8997799

Browse files
authored
Merge pull request #1 from RasmusWL/RasmusWL-python-more-complete-dataflow-tests
Small fixups to your PR to my PR
2 parents 5f3eda0 + b958c3b commit 8997799

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

python/ql/test/experimental/dataflow/regression/dataflow.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
| test.py:76:9:76:14 | ControlFlowNode for SOURCE | test.py:78:10:78:10 | ControlFlowNode for t |
1111
| test.py:128:13:128:18 | ControlFlowNode for SOURCE | test.py:132:14:132:14 | ControlFlowNode for t |
1212
| test.py:159:10:159:15 | ControlFlowNode for SOURCE | test.py:160:14:160:14 | ControlFlowNode for t |
13-
| test.py:163:9:163:14 | ControlFlowNode for SOURCE | test.py:165:10:165:10 | ControlFlowNode for s |
13+
| test.py:163:9:163:14 | ControlFlowNode for SOURCE | test.py:165:12:165:12 | ControlFlowNode for s |
1414
| test.py:178:9:178:14 | ControlFlowNode for SOURCE | test.py:180:14:180:14 | ControlFlowNode for t |
15-
| test.py:178:9:178:14 | ControlFlowNode for SOURCE | test.py:182:14:182:14 | ControlFlowNode for t |
16-
| test.py:178:9:178:14 | ControlFlowNode for SOURCE | test.py:184:14:184:14 | ControlFlowNode for t |
15+
| test.py:178:9:178:14 | ControlFlowNode for SOURCE | test.py:182:16:182:16 | ControlFlowNode for t |
16+
| test.py:178:9:178:14 | ControlFlowNode for SOURCE | test.py:184:16:184:16 | ControlFlowNode for t |
1717
| test.py:178:9:178:14 | ControlFlowNode for SOURCE | test.py:186:14:186:14 | ControlFlowNode for t |
1818
| test.py:195:9:195:14 | ControlFlowNode for SOURCE | test.py:197:14:197:14 | ControlFlowNode for t |
1919
| test.py:195:9:195:14 | ControlFlowNode for SOURCE | test.py:199:14:199:14 | ControlFlowNode for t |

python/ql/test/experimental/dataflow/regression/test.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def test7(cond):
4040
if cond:
4141
SINK(t)
4242

43-
def source2(arg):
44-
return source(arg)
43+
def source2():
44+
return source()
4545

4646
def sink2(arg):
4747
sink(arg)
@@ -50,7 +50,7 @@ def sink3(cond, arg):
5050
if cond:
5151
sink(arg)
5252

53-
def test8(cond): # This flow is shadowed by previous tests, perhaps do a path query
53+
def test8(cond): # This test currently adds nothing, as we only track SOURCE -> SINK, and previous tests already add flow from line 10 to line 13
5454
t = source2()
5555
sink2(t)
5656

@@ -201,8 +201,8 @@ def flow_through_type_test_if_no_class():
201201
def flow_in_iteration():
202202
t = ITERABLE_SOURCE # Seems to not be sunk anywhere
203203
for i in t:
204-
i
205-
return i
204+
SINK(i)
205+
SINK(i)
206206

207207
def flow_in_generator():
208208
seq = [SOURCE]
@@ -212,22 +212,3 @@ def flow_in_generator():
212212
def flow_from_generator():
213213
for x in flow_in_generator():
214214
SINK(x) # Flow not found
215-
216-
def const_eq_clears_taint():
217-
tainted = SOURCE
218-
if tainted == "safe":
219-
SINK(tainted) # safe # FP
220-
SINK(tainted) # unsafe
221-
222-
def const_eq_clears_taint2():
223-
tainted = SOURCE
224-
if tainted != "safe":
225-
return
226-
SINK(tainted) # safe # FP
227-
228-
def non_const_eq_preserves_taint(x):
229-
tainted = SOURCE
230-
if tainted == tainted:
231-
SINK(tainted) # unsafe
232-
if tainted == x:
233-
SINK(tainted) # unsafe

0 commit comments

Comments
 (0)