diff --git a/monkey/monkey_island/cc/models/report/report_dal.py b/monkey/monkey_island/cc/models/report/report_dal.py index 3b7ca65e9..76c43bae6 100644 --- a/monkey/monkey_island/cc/models/report/report_dal.py +++ b/monkey/monkey_island/cc/models/report/report_dal.py @@ -29,7 +29,8 @@ def save_report(report_dict: dict): def get_report() -> dict: report_dict = Report.objects.first().to_mongo() - return _decode_dot_char_before_mongo_insert(decrypt_dict(sensitive_fields, report_dict)) + decrypted = decrypt_dict(sensitive_fields, report_dict) + return _decode_dot_char_before_mongo_insert(decrypted) # TODO remove this unnecessary encoding. I think these are legacy methods from back in the day diff --git a/monkey/monkey_island/cc/server_utils/encryption/field_encryptors/string_list_encryptor.py b/monkey/monkey_island/cc/server_utils/encryption/field_encryptors/string_list_encryptor.py index 9adf733a4..bf2555016 100644 --- a/monkey/monkey_island/cc/server_utils/encryption/field_encryptors/string_list_encryptor.py +++ b/monkey/monkey_island/cc/server_utils/encryption/field_encryptors/string_list_encryptor.py @@ -6,9 +6,9 @@ from . import IFieldEncryptor class StringListEncryptor(IFieldEncryptor): @staticmethod - def encrypt(value: List[str]): - return [get_datastore_encryptor().encrypt(string.encode()) for string in value] + def encrypt(value: List[str]) -> List[str]: + return [get_datastore_encryptor().encrypt(string.encode()).decode() for string in value] @staticmethod - def decrypt(value: List[bytes]): - return [get_datastore_encryptor().decrypt(bytes_).decode() for bytes_ in value] + def decrypt(value: List[str]) -> List[str]: + return [get_datastore_encryptor().decrypt(string.encode()).decode() for string in value]