Skip to content

Commit 79e4f1e

Browse files
committed
Python: Enable consistency check (currently fails)
1 parent 7787900 commit 79e4f1e

File tree

3 files changed

+309
-0
lines changed

3 files changed

+309
-0
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
uniqueEnclosingCallable
2+
| test.py:0:0:0:0 | Exit node for Module test | Node should have one enclosing callable but has 0. |
3+
| test.py:0:0:0:0 | GSSA Variable __name__ | Node should have one enclosing callable but has 0. |
4+
| test.py:0:0:0:0 | GSSA Variable __package__ | Node should have one enclosing callable but has 0. |
5+
| test.py:0:0:0:0 | GSSA Variable test23 | Node should have one enclosing callable but has 0. |
6+
| test.py:0:0:0:0 | GSSA Variable test24 | Node should have one enclosing callable but has 0. |
7+
| test.py:0:0:0:0 | GSSA Variable test_truth | Node should have one enclosing callable but has 0. |
8+
| test.py:0:0:0:0 | GSSA Variable test_update_extend | Node should have one enclosing callable but has 0. |
9+
| test.py:0:0:0:0 | SSA variable $ | Node should have one enclosing callable but has 0. |
10+
| test.py:6:1:6:12 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
11+
| test.py:6:5:6:9 | GSSA Variable test1 | Node should have one enclosing callable but has 0. |
12+
| test.py:9:1:9:12 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
13+
| test.py:9:1:9:12 | Exit node for Function test2 | Node should have one enclosing callable but has 0. |
14+
| test.py:9:5:9:9 | GSSA Variable test2 | Node should have one enclosing callable but has 0. |
15+
| test.py:13:1:13:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
16+
| test.py:13:5:13:10 | GSSA Variable source | Node should have one enclosing callable but has 0. |
17+
| test.py:16:1:16:14 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
18+
| test.py:16:1:16:14 | Exit node for Function sink | Node should have one enclosing callable but has 0. |
19+
| test.py:16:5:16:8 | GSSA Variable sink | Node should have one enclosing callable but has 0. |
20+
| test.py:19:1:19:12 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
21+
| test.py:19:1:19:12 | Exit node for Function test3 | Node should have one enclosing callable but has 0. |
22+
| test.py:19:5:19:9 | GSSA Variable test3 | Node should have one enclosing callable but has 0. |
23+
| test.py:23:1:23:12 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
24+
| test.py:23:1:23:12 | Exit node for Function test4 | Node should have one enclosing callable but has 0. |
25+
| test.py:23:5:23:9 | GSSA Variable test4 | Node should have one enclosing callable but has 0. |
26+
| test.py:27:1:27:12 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
27+
| test.py:27:1:27:12 | Exit node for Function test5 | Node should have one enclosing callable but has 0. |
28+
| test.py:27:5:27:9 | GSSA Variable test5 | Node should have one enclosing callable but has 0. |
29+
| test.py:31:1:31:16 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
30+
| test.py:31:1:31:16 | Exit node for Function test6 | Node should have one enclosing callable but has 0. |
31+
| test.py:31:1:31:16 | Exit node for Function test6 | Node should have one enclosing callable but has 0. |
32+
| test.py:31:5:31:9 | GSSA Variable test6 | Node should have one enclosing callable but has 0. |
33+
| test.py:39:1:39:16 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
34+
| test.py:39:1:39:16 | Exit node for Function test7 | Node should have one enclosing callable but has 0. |
35+
| test.py:39:1:39:16 | Exit node for Function test7 | Node should have one enclosing callable but has 0. |
36+
| test.py:39:5:39:9 | GSSA Variable test7 | Node should have one enclosing callable but has 0. |
37+
| test.py:47:1:47:17 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
38+
| test.py:47:1:47:17 | Exit node for Function source2 | Node should have one enclosing callable but has 0. |
39+
| test.py:47:5:47:11 | GSSA Variable source2 | Node should have one enclosing callable but has 0. |
40+
| test.py:50:1:50:15 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
41+
| test.py:50:1:50:15 | Exit node for Function sink2 | Node should have one enclosing callable but has 0. |
42+
| test.py:50:5:50:9 | GSSA Variable sink2 | Node should have one enclosing callable but has 0. |
43+
| test.py:53:1:53:21 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
44+
| test.py:53:1:53:21 | Exit node for Function sink3 | Node should have one enclosing callable but has 0. |
45+
| test.py:53:5:53:9 | GSSA Variable sink3 | Node should have one enclosing callable but has 0. |
46+
| test.py:57:1:57:16 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
47+
| test.py:57:1:57:16 | Exit node for Function test8 | Node should have one enclosing callable but has 0. |
48+
| test.py:57:5:57:9 | GSSA Variable test8 | Node should have one enclosing callable but has 0. |
49+
| test.py:62:1:62:16 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
50+
| test.py:62:1:62:16 | Exit node for Function test9 | Node should have one enclosing callable but has 0. |
51+
| test.py:62:5:62:9 | GSSA Variable test9 | Node should have one enclosing callable but has 0. |
52+
| test.py:69:1:69:17 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
53+
| test.py:69:1:69:17 | Exit node for Function test10 | Node should have one enclosing callable but has 0. |
54+
| test.py:69:5:69:10 | GSSA Variable test10 | Node should have one enclosing callable but has 0. |
55+
| test.py:76:1:76:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
56+
| test.py:76:1:76:13 | Exit node for Function hub | Node should have one enclosing callable but has 0. |
57+
| test.py:76:5:76:7 | GSSA Variable hub | Node should have one enclosing callable but has 0. |
58+
| test.py:79:1:79:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
59+
| test.py:79:1:79:13 | Exit node for Function test11 | Node should have one enclosing callable but has 0. |
60+
| test.py:79:5:79:10 | GSSA Variable test11 | Node should have one enclosing callable but has 0. |
61+
| test.py:84:1:84:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
62+
| test.py:84:1:84:13 | Exit node for Function test12 | Node should have one enclosing callable but has 0. |
63+
| test.py:84:5:84:10 | GSSA Variable test12 | Node should have one enclosing callable but has 0. |
64+
| test.py:89:8:89:13 | ControlFlowNode for ImportExpr | Node should have one enclosing callable but has 0. |
65+
| test.py:89:8:89:13 | GSSA Variable module | Node should have one enclosing callable but has 0. |
66+
| test.py:91:1:91:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
67+
| test.py:91:1:91:13 | Exit node for Function test13 | Node should have one enclosing callable but has 0. |
68+
| test.py:91:5:91:10 | GSSA Variable test13 | Node should have one enclosing callable but has 0. |
69+
| test.py:95:1:95:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
70+
| test.py:95:1:95:13 | Exit node for Function test14 | Node should have one enclosing callable but has 0. |
71+
| test.py:95:5:95:10 | GSSA Variable test14 | Node should have one enclosing callable but has 0. |
72+
| test.py:99:1:99:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
73+
| test.py:99:1:99:13 | Exit node for Function test15 | Node should have one enclosing callable but has 0. |
74+
| test.py:99:5:99:10 | GSSA Variable test15 | Node should have one enclosing callable but has 0. |
75+
| test.py:103:1:103:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
76+
| test.py:103:1:103:13 | Exit node for Function test16 | Node should have one enclosing callable but has 0. |
77+
| test.py:103:5:103:10 | GSSA Variable test16 | Node should have one enclosing callable but has 0. |
78+
| test.py:108:1:108:17 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
79+
| test.py:108:1:108:17 | Exit node for Function test20 | Node should have one enclosing callable but has 0. |
80+
| test.py:108:1:108:17 | Exit node for Function test20 | Node should have one enclosing callable but has 0. |
81+
| test.py:108:5:108:10 | GSSA Variable test20 | Node should have one enclosing callable but has 0. |
82+
| test.py:118:1:118:17 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
83+
| test.py:118:1:118:17 | Exit node for Function test21 | Node should have one enclosing callable but has 0. |
84+
| test.py:118:1:118:17 | Exit node for Function test21 | Node should have one enclosing callable but has 0. |
85+
| test.py:118:5:118:10 | GSSA Variable test21 | Node should have one enclosing callable but has 0. |
86+
| test.py:128:1:128:17 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
87+
| test.py:128:1:128:17 | Exit node for Function test22 | Node should have one enclosing callable but has 0. |
88+
| test.py:128:1:128:17 | Exit node for Function test22 | Node should have one enclosing callable but has 0. |
89+
| test.py:128:5:128:10 | GSSA Variable test22 | Node should have one enclosing callable but has 0. |
90+
| test.py:139:20:139:38 | ControlFlowNode for ImportMember | Node should have one enclosing callable but has 0. |
91+
| test.py:139:33:139:38 | GSSA Variable unsafe | Node should have one enclosing callable but has 0. |
92+
| test.py:140:1:140:12 | ControlFlowNode for SINK() | Node should have one enclosing callable but has 0. |
93+
| test.py:140:1:140:12 | GSSA Variable unsafe | Node should have one enclosing callable but has 0. |
94+
| test.py:140:6:140:11 | ControlFlowNode for unsafe | Node should have one enclosing callable but has 0. |
95+
| test.py:142:1:142:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
96+
| test.py:142:1:142:13 | Exit node for Function test23 | Node should have one enclosing callable but has 0. |
97+
| test.py:142:5:142:10 | GSSA Variable test23 | Node should have one enclosing callable but has 0. |
98+
| test.py:146:1:146:13 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
99+
| test.py:146:1:146:13 | Exit node for Function test24 | Node should have one enclosing callable but has 0. |
100+
| test.py:146:5:146:10 | GSSA Variable test24 | Node should have one enclosing callable but has 0. |
101+
| test.py:151:1:151:29 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
102+
| test.py:151:1:151:29 | Exit node for Function test_update_extend | Node should have one enclosing callable but has 0. |
103+
| test.py:151:5:151:22 | GSSA Variable test_update_extend | Node should have one enclosing callable but has 0. |
104+
| test.py:161:1:161:17 | ControlFlowNode for FunctionExpr | Node should have one enclosing callable but has 0. |
105+
| test.py:161:1:161:17 | Exit node for Function test_truth | Node should have one enclosing callable but has 0. |
106+
| test.py:161:1:161:17 | Exit node for Function test_truth | Node should have one enclosing callable but has 0. |
107+
| test.py:161:5:161:14 | GSSA Variable test_truth | Node should have one enclosing callable but has 0. |
108+
uniqueTypeBound
109+
uniqueTypeRepr
110+
uniqueNodeLocation
111+
missingLocation
112+
uniqueNodeToString
113+
missingToString
114+
parameterCallable
115+
localFlowIsLocal
116+
compatibleTypesReflexive
117+
unreachableNodeCCtx
118+
localCallNodes
119+
postIsNotPre
120+
postHasUniquePre
121+
uniquePostUpdate
122+
postIsInSameCallable
123+
reverseRead
124+
storeIsPostUpdate
125+
argHasPostUpdate
126+
| test.py:25:10:25:10 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
127+
| test.py:29:10:29:10 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
128+
| test.py:48:19:48:21 | ControlFlowNode for arg | ArgumentNode is missing PostUpdateNode. |
129+
| test.py:51:10:51:12 | ControlFlowNode for arg | ArgumentNode is missing PostUpdateNode. |
130+
| test.py:55:14:55:16 | ControlFlowNode for arg | ArgumentNode is missing PostUpdateNode. |
131+
| test.py:59:11:59:11 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
132+
| test.py:67:11:67:14 | ControlFlowNode for cond | ArgumentNode is missing PostUpdateNode. |
133+
| test.py:67:17:67:17 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
134+
| test.py:74:11:74:14 | ControlFlowNode for cond | ArgumentNode is missing PostUpdateNode. |
135+
| test.py:74:17:74:17 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
136+
| test.py:81:13:81:13 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
137+
| test.py:86:13:86:13 | ControlFlowNode for t | ArgumentNode is missing PostUpdateNode. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import experimental.dataflow.internal.DataFlowImplConsistency::Consistency
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# This is currently a copy of the integration tests.
2+
# It should contain many syntactic constructs, so should
3+
# perhaps be taken from coverage once that is done.
4+
# (We might even put the consistency check in there.)
5+
6+
def test1():
7+
SINK(SOURCE)
8+
9+
def test2():
10+
s = SOURCE
11+
SINK(s)
12+
13+
def source():
14+
return SOURCE
15+
16+
def sink(arg):
17+
SINK(arg)
18+
19+
def test3():
20+
t = source()
21+
SINK(t)
22+
23+
def test4():
24+
t = SOURCE
25+
sink(t)
26+
27+
def test5():
28+
t = source()
29+
sink(t)
30+
31+
def test6(cond):
32+
if cond:
33+
t = "Safe"
34+
else:
35+
t = SOURCE
36+
if cond:
37+
SINK(t)
38+
39+
def test7(cond):
40+
if cond:
41+
t = SOURCE
42+
else:
43+
t = "Safe"
44+
if cond:
45+
SINK(t)
46+
47+
def source2(arg):
48+
return source(arg)
49+
50+
def sink2(arg):
51+
sink(arg)
52+
53+
def sink3(cond, arg):
54+
if cond:
55+
sink(arg)
56+
57+
def test8(cond):
58+
t = source2()
59+
sink2(t)
60+
61+
#False positive
62+
def test9(cond):
63+
if cond:
64+
t = "Safe"
65+
else:
66+
t = SOURCE
67+
sink3(cond, t)
68+
69+
def test10(cond):
70+
if cond:
71+
t = SOURCE
72+
else:
73+
t = "Safe"
74+
sink3(cond, t)
75+
76+
def hub(arg):
77+
return arg
78+
79+
def test11():
80+
t = SOURCE
81+
t = hub(t)
82+
SINK(t)
83+
84+
def test12():
85+
t = "safe"
86+
t = hub(t)
87+
SINK(t)
88+
89+
import module
90+
91+
def test13():
92+
t = module.dangerous
93+
SINK(t)
94+
95+
def test14():
96+
t = module.safe
97+
SINK(t)
98+
99+
def test15():
100+
t = module.safe2
101+
SINK(t)
102+
103+
def test16():
104+
t = module.dangerous_func()
105+
SINK(t)
106+
107+
108+
def test20(cond):
109+
if cond:
110+
t = CUSTOM_SOURCE
111+
else:
112+
t = SOURCE
113+
if cond:
114+
CUSTOM_SINK(t)
115+
else:
116+
SINK(t)
117+
118+
def test21(cond):
119+
if cond:
120+
t = CUSTOM_SOURCE
121+
else:
122+
t = SOURCE
123+
if not cond:
124+
CUSTOM_SINK(t)
125+
else:
126+
SINK(t)
127+
128+
def test22(cond):
129+
if cond:
130+
t = CUSTOM_SOURCE
131+
else:
132+
t = SOURCE
133+
t = TAINT_FROM_ARG(t)
134+
if cond:
135+
CUSTOM_SINK(t)
136+
else:
137+
SINK(t)
138+
139+
from module import dangerous as unsafe
140+
SINK(unsafe)
141+
142+
def test23():
143+
with SOURCE as t:
144+
SINK(t)
145+
146+
def test24():
147+
s = SOURCE
148+
SANITIZE(s)
149+
SINK(s)
150+
151+
def test_update_extend(x, y):
152+
l = [SOURCE]
153+
d = {"key" : SOURCE}
154+
x.extend(l)
155+
y.update(d)
156+
SINK(x[0])
157+
SINK(y["key"])
158+
l2 = list(l)
159+
d2 = dict(d)
160+
161+
def test_truth():
162+
t = SOURCE
163+
if t:
164+
SINK(t)
165+
else:
166+
SINK(t) # Regression: FP here
167+
if not t:
168+
SINK(t) # Regression: FP here
169+
else:
170+
SINK(t)
171+

0 commit comments

Comments
 (0)