From 75f3fb02ee0d7e2f3dae8e40f8a67298cb81c87c Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 11 Jul 2022 15:07:16 -0400 Subject: [PATCH] Island: Remove dependency from ILockableEncryptor -> IEncryptor ILockableEncryptor adds additional constraints on when encrypt() or decrypt() can be used. If ILockableEncryptor inherits from IEncryptor, it will violate the Liskov Substitution Principle --- .../cc/server_utils/encryption/i_lockable_encryptor.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/server_utils/encryption/i_lockable_encryptor.py b/monkey/monkey_island/cc/server_utils/encryption/i_lockable_encryptor.py index f31024655..e092fba63 100644 --- a/monkey/monkey_island/cc/server_utils/encryption/i_lockable_encryptor.py +++ b/monkey/monkey_island/cc/server_utils/encryption/i_lockable_encryptor.py @@ -1,6 +1,4 @@ -from abc import abstractmethod - -from . import IEncryptor +from abc import ABC, abstractmethod # NOTE: The ILockableEncryptor introduces temporal coupling, that is, you must first unlock the # encryptor before you can use it. This is because the key material used to encrypt repository @@ -33,7 +31,7 @@ class ResetKeyError(Exception): """ -class ILockableEncryptor(IEncryptor): +class ILockableEncryptor(ABC): """ An encryptor that can be locked or unlocked.