Python: TaintTracking: Move tests of py3 string methods

This commit is contained in:
Rasmus Wriedt Larsen
2020-08-25 13:06:27 +02:00
parent cf121cc4d0
commit 2dbf83b579
4 changed files with 73 additions and 64 deletions

View File

@@ -1,7 +1,10 @@
| test.py:28 | fail | binary_decode_encode | base64.a85encode(..) |
| test.py:29 | fail | binary_decode_encode | base64.a85decode(..) |
| test.py:32 | fail | binary_decode_encode | base64.b85encode(..) |
| test.py:33 | fail | binary_decode_encode | base64.b85decode(..) |
| test.py:36 | fail | binary_decode_encode | base64.encodebytes(..) |
| test.py:37 | fail | binary_decode_encode | base64.decodebytes(..) |
| test.py:45 | ok | f_strings | Fstring |
| test.py:26 | ok | str_methods | ts.casefold() |
| test.py:28 | ok | str_methods | ts.format_map(..) |
| test.py:29 | fail | str_methods | "{unsafe}".format_map(..) |
| test.py:40 | fail | binary_decode_encode | base64.a85encode(..) |
| test.py:41 | fail | binary_decode_encode | base64.a85decode(..) |
| test.py:44 | fail | binary_decode_encode | base64.b85encode(..) |
| test.py:45 | fail | binary_decode_encode | base64.b85decode(..) |
| test.py:48 | fail | binary_decode_encode | base64.encodebytes(..) |
| test.py:49 | fail | binary_decode_encode | base64.decodebytes(..) |
| test.py:57 | ok | f_strings | Fstring |

View File

@@ -18,6 +18,18 @@ def ensure_not_tainted(*args):
# Actual tests
def str_methods():
print("\n# str_methods")
ts = TAINTED_STRING
tb = TAINTED_BYTES
ensure_tainted(
ts.casefold(),
ts.format_map({}),
"{unsafe}".format_map({"unsafe": ts}),
)
def binary_decode_encode():
print("\n#percent_fmt")
tb = TAINTED_BYTES
@@ -47,5 +59,6 @@ def f_strings():
# Make tests runable
str_methods()
binary_decode_encode()
f_strings()