-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.py
More file actions
96 lines (53 loc) · 1.39 KB
/
test.py
File metadata and controls
96 lines (53 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
def assign():
x = SOURCE # $ path-node
y = x # $ path-node
SINK(y) # $ path-node
def aug_assign():
x = SOURCE # $ path-node
z = ""
z += x # $ path-node
SINK(z) # $ path-node
def dont_use_rhs(cond):
# like noted in the original Ruby PR: https://github.com/github/codeql/pull/12566
x = SOURCE # $ path-node
if cond:
y = x
SINK(x) # $ path-node
def flow_through_function():
def identify(x): # $ path-node
return x # $ path-node
x = SOURCE # $ path-node
y = identify(x) # $ path-node
SINK(y) # $ path-node
def attribute():
class X: pass
x = X()
x.attr = SOURCE # $ path-node
y = x # $ path-node
SINK(y.attr) # $ path-node
def list_loop():
x = SOURCE # $ path-node
l = list()
l.append(x) # $ path-node
for y in l: # $ path-node
SINK(y) # $ path-node
def list_index():
x = SOURCE # $ path-node
l = list()
l.append(x) # $ path-node
z = l[0] # $ path-node
SINK(z) # $ path-node
def test_tuple():
x = SOURCE # $ path-node
y = ((x, 1), 2) # $ path-node
(z, _), _ = y # $ path-node
SINK(z) # $ path-node
def test_with():
x = SOURCE # $ path-node
with x as y: # $ path-node
SINK(y) # $ path-node
def test_match():
x = SOURCE # $ path-node
match x:
case y: # $ path-node
SINK(y) # $ path-node