Fixed string type issues in the security checks.
Review Request #10660 — Created Aug. 15, 2019 and submitted — Latest diff uploaded
The security checks logic was mixing byte and Unicode strings, resulting
in the server executable file test always failing on Python 3. There
were two parts that were broken:
We were passing Unicode strings to
zlib.compress()
, instead of byte
strings.We were reading file attachment data back from storage as a Unicode
string and then potentially comparing against a byte string.We now assert that all test data are byte strings, pass the right type
tozlib.compress()
, and read the data back from storage as a byte
string, ensuring we're using the same string type everywhere.
Tested the Security Checks page on Python 2.7 and 3.7.