File tree 2 files changed +33
-0
lines changed
python/ql/test/experimental/meta/inline-taint-test-demo
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ argumentToEnsureNotTaintedNotMarkedAsSpurious
3
3
untaintedArgumentToEnsureTaintedNotMarkedAsMissing
4
4
| taint_test.py:32:9:32:25 | taint_test.py:32 | ERROR, you should add `# $ MISSING: tainted` annotation | should_be_tainted |
5
5
| taint_test.py:37:24:37:40 | taint_test.py:37 | ERROR, you should add `# $ MISSING: tainted` annotation | should_be_tainted |
6
+ argumentToEnsureNotTaintedWithReadsNotMarkedAsSpurious
7
+ untaintedArgumentToEnsureTaintedWithReadsNotMarkedAsMissing
8
+ spuriousReadStepsPossible
9
+ | taint_test.py:68:9:68:10 | ControlFlowNode for tt | taint_test.py:76:9:76:13 | ControlFlowNode for Subscript |
6
10
testFailures
7
11
| taint_test.py:41:20:41:21 | ts | Fixed missing result:tainted= |
8
12
failures
Original file line number Diff line number Diff line change @@ -47,3 +47,32 @@ def bad_usage():
47
47
ensure_not_tainted (
48
48
should_not_be_tainted # $ tainted
49
49
)
50
+
51
+
52
+ def implicit_reads ():
53
+ tt = (TAINTED_STRING ,)
54
+
55
+ # Normal use
56
+ ensure_tainted (
57
+ tt [0 ], # $ tainted
58
+ )
59
+
60
+ # We have precise content, so the tuple itself is not tainted
61
+ ensure_not_tainted (
62
+ tt ,
63
+ tt [1 ],
64
+ )
65
+
66
+ # We can see the tuple tainted at sinks due to implicit reads
67
+ ensure_tainted_with_reads (
68
+ tt , # $ tainted
69
+ )
70
+
71
+ # We should not see other elements of the tuple being tainted
72
+ # but the implicit reads of the previous test allows the taint
73
+ # to flow to the tuple and then to the subscript.
74
+ # We can see a warning about this in the expected output under
75
+ # `spuriousReadStepsPossible`.
76
+ ensure_not_tainted (
77
+ tt [1 ], # $ SPURIOUS:tainted
78
+ )
You can’t perform that action at this time.
0 commit comments