From 9fb2804202f50ff2fd23e6412dceead4238385fa Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Tue, 6 Sep 2022 12:54:24 +0000 Subject: [PATCH] Agent: Use SecretStr and SecretBytes instead of SecretField SecretField is a base type for secrets, but it doesn't seem to be exported. When the agent is ran, this import fails --- monkey/infection_monkey/telemetry/telem_encoder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/infection_monkey/telemetry/telem_encoder.py b/monkey/infection_monkey/telemetry/telem_encoder.py index 224e14133..ec060b250 100644 --- a/monkey/infection_monkey/telemetry/telem_encoder.py +++ b/monkey/infection_monkey/telemetry/telem_encoder.py @@ -1,6 +1,6 @@ import json -from pydantic import BaseModel, SecretField +from pydantic import BaseModel, SecretBytes, SecretStr from common import OperatingSystem @@ -11,6 +11,6 @@ class TelemetryJSONEncoder(json.JSONEncoder): return obj.name if issubclass(type(obj), BaseModel): return obj.dict(simplify=True) - if issubclass(type(obj), SecretField): + if issubclass(type(obj), (SecretStr, SecretBytes)): return obj.get_secret_value() return json.JSONEncoder.default(self, obj)