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 1212
1313class Context :
1414 def __enter__ (self ):
15- return TAINTED_STRING
15+ return ""
1616
1717 def __exit__ (self , exc_type , exc , tb ):
1818 pass
@@ -23,6 +23,33 @@ def test_with():
2323 with ctx as tainted :
2424 ensure_tainted (tainted ) # $ tainted
2525
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
2653
2754class Iter :
2855 def __iter__ (self ):
@@ -42,4 +69,6 @@ def test_for():
4269# Make tests runable
4370
4471test_with ()
72+ test_with_taint ()
73+ test_with_arg ()
4574test_for ()
You can’t perform that action at this time.
0 commit comments