Common: Make Credentials.Config a subclass of InfectionMonkeyModelConfig

This commit is contained in:
Mike Salvatore 2022-09-15 12:23:52 -04:00
parent 729d2beee8
commit 004a543310
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ from typing import Optional, Union
from pydantic import SecretBytes, SecretStr from pydantic import SecretBytes, SecretStr
from ..base_models import InfectionMonkeyBaseModel from ..base_models import InfectionMonkeyBaseModel, InfectionMonkeyModelConfig
from . import LMHash, NTHash, Password, SSHKeypair, Username from . import LMHash, NTHash, Password, SSHKeypair, Username
Secret = Union[Password, LMHash, NTHash, SSHKeypair] Secret = Union[Password, LMHash, NTHash, SSHKeypair]
@ -27,7 +27,7 @@ class Credentials(InfectionMonkeyBaseModel):
secret: Optional[Secret] secret: Optional[Secret]
"""Secret part of credentials, like a password or a hash""" """Secret part of credentials, like a password or a hash"""
class Config: class Config(InfectionMonkeyModelConfig):
json_encoders = { json_encoders = {
# This makes secrets dumpable to json, but not loggable # This makes secrets dumpable to json, but not loggable
SecretStr: get_plaintext, SecretStr: get_plaintext,