Skip to content

Commit a82936c

Browse files
committed
Python: Enable test for sanitizer-guard and logic expressions
`not` is not working properly, but otherwise pretty good
1 parent b3d3d6e commit a82936c

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

python/ql/test/experimental/dataflow/tainttracking/customSanitizer/TestTaint.expected

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_taint
44
| test.py:38 | ok | test_custom_sanitizer_guard | s |
55
| test.py:40 | ok | test_custom_sanitizer_guard | s |
66
| test.py:51 | ok | test_escape | s2 |
7-
| test_logical.py:30 | fail | test_basic | s |
7+
| test_logical.py:30 | ok | test_basic | s |
88
| test_logical.py:32 | ok | test_basic | s |
99
| test_logical.py:35 | ok | test_basic | s |
1010
| test_logical.py:37 | fail | test_basic | s |
@@ -14,10 +14,10 @@ test_taint
1414
| test_logical.py:53 | ok | test_or | s |
1515
| test_logical.py:57 | ok | test_or | s |
1616
| test_logical.py:59 | ok | test_or | s |
17-
| test_logical.py:67 | fail | test_and | s |
17+
| test_logical.py:67 | ok | test_and | s |
1818
| test_logical.py:69 | ok | test_and | s |
1919
| test_logical.py:73 | ok | test_and | s |
20-
| test_logical.py:75 | fail | test_and | s |
20+
| test_logical.py:75 | ok | test_and | s |
2121
| test_logical.py:79 | ok | test_and | s |
2222
| test_logical.py:81 | fail | test_and | s |
2323
| test_logical.py:89 | fail | test_tricky | s |
@@ -27,13 +27,22 @@ test_taint
2727
| test_logical.py:105 | ok | test_nesting_not | s |
2828
| test_logical.py:107 | fail | test_nesting_not | s |
2929
| test_logical.py:116 | ok | test_nesting_not_with_and_true | s |
30-
| test_logical.py:118 | fail | test_nesting_not_with_and_true | s |
31-
| test_logical.py:121 | fail | test_nesting_not_with_and_true | s |
30+
| test_logical.py:118 | ok | test_nesting_not_with_and_true | s |
31+
| test_logical.py:121 | ok | test_nesting_not_with_and_true | s |
3232
| test_logical.py:123 | ok | test_nesting_not_with_and_true | s |
3333
| test_logical.py:126 | ok | test_nesting_not_with_and_true | s |
34-
| test_logical.py:128 | fail | test_nesting_not_with_and_true | s |
34+
| test_logical.py:128 | ok | test_nesting_not_with_and_true | s |
3535
isSanitizer
3636
| TestTaintTrackingConfiguration | test.py:21:39:21:39 | ControlFlowNode for s |
3737
| TestTaintTrackingConfiguration | test.py:50:10:50:29 | ControlFlowNode for emulated_escaping() |
3838
isSanitizerGuard
3939
| TestTaintTrackingConfiguration | test.py:35:8:35:26 | ControlFlowNode for emulated_is_safe() |
40+
| TestTaintTrackingConfiguration | test_logical.py:29:8:29:17 | ControlFlowNode for is_safe() |
41+
| TestTaintTrackingConfiguration | test_logical.py:44:8:44:17 | ControlFlowNode for is_safe() |
42+
| TestTaintTrackingConfiguration | test_logical.py:50:12:50:21 | ControlFlowNode for is_safe() |
43+
| TestTaintTrackingConfiguration | test_logical.py:66:8:66:17 | ControlFlowNode for is_safe() |
44+
| TestTaintTrackingConfiguration | test_logical.py:72:12:72:21 | ControlFlowNode for is_safe() |
45+
| TestTaintTrackingConfiguration | test_logical.py:92:8:92:17 | ControlFlowNode for is_safe() |
46+
| TestTaintTrackingConfiguration | test_logical.py:115:12:115:21 | ControlFlowNode for is_safe() |
47+
| TestTaintTrackingConfiguration | test_logical.py:120:16:120:25 | ControlFlowNode for is_safe() |
48+
| TestTaintTrackingConfiguration | test_logical.py:125:20:125:29 | ControlFlowNode for is_safe() |

python/ql/test/experimental/dataflow/tainttracking/customSanitizer/TestTaint.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import experimental.dataflow.tainttracking.TestTaintLib
22

33
class IsSafeCheck extends DataFlow::BarrierGuard {
4-
IsSafeCheck() { this.(CallNode).getNode().getFunc().(Name).getId() = "emulated_is_safe" }
4+
IsSafeCheck() {
5+
this.(CallNode).getNode().getFunc().(Name).getId() in ["is_safe", "emulated_is_safe"]
6+
}
57

68
override predicate checks(ControlFlowNode node, boolean branch) {
79
node = this.(CallNode).getAnArg() and

0 commit comments

Comments
 (0)