File tree Expand file tree Collapse file tree 2 files changed +30
-14
lines changed
python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep Expand file tree Collapse file tree 2 files changed +30
-14
lines changed Original file line number Diff line number Diff line change
1
+ # Add taintlib to PATH so it can be imported during runtime without any hassle
2
+ import sys ; import os ; sys .path .append (os .path .dirname (os .path .dirname ((__file__ ))))
3
+ from taintlib import *
4
+
5
+ # This has no runtime impact, but allows autocomplete to work
6
+ from typing import TYPE_CHECKING
7
+ if TYPE_CHECKING :
8
+ from ..taintlib import *
9
+
10
+
11
+ # Actual tests
12
+
13
+ class Iter :
14
+ def __iter__ (self ):
15
+ return self
16
+
17
+ def __next__ (self ):
18
+ raise StopIteration
19
+
20
+ def test_for ():
21
+ iter = Iter ()
22
+ taint (iter )
23
+ for tainted in iter :
24
+ ensure_tainted (tainted ) # $ tainted
25
+
26
+
27
+
28
+ # Make tests runable
29
+
30
+ test_for ()
Original file line number Diff line number Diff line change @@ -51,24 +51,10 @@ def test_with_arg():
51
51
with ctx as tainted :
52
52
ensure_tainted (tainted ) # $ tainted
53
53
54
- class Iter :
55
- def __iter__ (self ):
56
- return self
57
-
58
- def __next__ (self ):
59
- raise StopIteration
60
-
61
- def test_for ():
62
- iter = Iter ()
63
- taint (iter )
64
- for tainted in iter :
65
- ensure_tainted (tainted ) # $ tainted
66
-
67
54
68
55
69
56
# Make tests runable
70
57
71
58
test_with ()
72
59
test_with_taint ()
73
60
test_with_arg ()
74
- test_for ()
You can’t perform that action at this time.
0 commit comments