Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12b36b2

Browse files
committed
Python: Highlight that safe or also_safe doesn't clear taint :(
1 parent 1a52f17 commit 12b36b2

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
| test_string_eq.py:18 | ok | const_eq_clears_taint | ts |
33
| test_string_eq.py:20 | ok | const_eq_clears_taint | ts |
44
| test_string_eq.py:27 | fail | const_eq_clears_taint2 | ts |
5-
| test_string_eq.py:33 | ok | non_const_eq_preserves_taint | ts |
6-
| test_string_eq.py:35 | ok | non_const_eq_preserves_taint | ts |
7-
| test_string_eq.py:45 | fail | const_eq_through_func | ts |
8-
| test_string_eq.py:47 | ok | const_eq_through_func | ts |
9-
| test_string_eq.py:49 | ok | const_eq_through_func | ts |
5+
| test_string_eq.py:33 | fail | const_eq_clears_taint3 | ts |
6+
| test_string_eq.py:35 | ok | const_eq_clears_taint3 | ts |
7+
| test_string_eq.py:41 | ok | non_const_eq_preserves_taint | ts |
8+
| test_string_eq.py:43 | ok | non_const_eq_preserves_taint | ts |
9+
| test_string_eq.py:53 | fail | const_eq_through_func | ts |
10+
| test_string_eq.py:55 | ok | const_eq_through_func | ts |
11+
| test_string_eq.py:57 | ok | const_eq_through_func | ts |

python/ql/test/experimental/dataflow/tainttracking/commonSanitizer/test_string_eq.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ def const_eq_clears_taint2():
2727
ensure_not_tainted(ts)
2828

2929

30+
def const_eq_clears_taint3():
31+
ts = TAINTED_STRING
32+
if ts == "safe" or ts == "also_safe":
33+
ensure_not_tainted(ts)
34+
else:
35+
ensure_tainted(ts)
36+
37+
3038
def non_const_eq_preserves_taint(x="foo"):
3139
ts = TAINTED_STRING
3240
if ts == ts:
@@ -53,4 +61,5 @@ def const_eq_through_func():
5361

5462
const_eq_clears_taint()
5563
const_eq_clears_taint2()
64+
const_eq_clears_taint3()
5665
non_const_eq_preserves_taint()

0 commit comments

Comments
 (0)