File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 12
12
13
13
class Context :
14
14
def __enter__ (self ):
15
- return TAINTED_STRING
15
+ return ""
16
16
17
17
def __exit__ (self , exc_type , exc , tb ):
18
18
pass
@@ -23,6 +23,33 @@ def test_with():
23
23
with ctx as tainted :
24
24
ensure_tainted (tainted ) # $ tainted
25
25
26
+ class Context_taint :
27
+ def __enter__ (self ):
28
+ return TAINTED_STRING
29
+
30
+ def __exit__ (self , exc_type , exc , tb ):
31
+ pass
32
+
33
+ def test_with_taint ():
34
+ ctx = Context_taint ()
35
+ with ctx as tainted :
36
+ ensure_tainted (tainted ) # $ MISSING: tainted
37
+
38
+
39
+ class Context_arg :
40
+ def __init__ (self , arg ):
41
+ self .arg = arg
42
+
43
+ def __enter__ (self ):
44
+ return self .arg
45
+
46
+ def __exit__ (self , exc_type , exc , tb ):
47
+ pass
48
+
49
+ def test_with_arg ():
50
+ ctx = Context_arg (TAINTED_STRING )
51
+ with ctx as tainted :
52
+ ensure_tainted (tainted ) # $ tainted
26
53
27
54
class Iter :
28
55
def __iter__ (self ):
@@ -42,4 +69,6 @@ def test_for():
42
69
# Make tests runable
43
70
44
71
test_with ()
72
+ test_with_taint ()
73
+ test_with_arg ()
45
74
test_for ()
You can’t perform that action at this time.
0 commit comments