From c8f131e6b0f8b1b46baac2d2494bdebc11832b4b Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Wed, 7 Sep 2022 08:45:26 +0000 Subject: [PATCH] Common: Small style improvements in credentials.py --- monkey/common/credentials/credentials.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/common/credentials/credentials.py b/monkey/common/credentials/credentials.py index 09d869876..dcd011d01 100644 --- a/monkey/common/credentials/credentials.py +++ b/monkey/common/credentials/credentials.py @@ -19,7 +19,7 @@ def get_plaintext(secret: Union[SecretStr, SecretBytes, None, str]) -> Optional[ class Credentials(InfectionMonkeyBaseModel): - """Represents a credential pair (some form of identity and a secret)""" + """Represents a credential pair (an identity and a secret)""" identity: Optional[Identity] """Identity part of credentials, like a username or an email""" @@ -30,6 +30,6 @@ class Credentials(InfectionMonkeyBaseModel): class Config: json_encoders = { # This makes secrets dumpable to json, but not loggable - SecretStr: lambda v: v.get_secret_value() if v else None, - SecretBytes: lambda v: v.get_secret_value() if v else None, + SecretStr: get_plaintext, + SecretBytes: get_plaintext, }