diff --git a/envs/monkey_zoo/blackbox/island_client/monkey_island_client.py b/envs/monkey_zoo/blackbox/island_client/monkey_island_client.py index a7009e459..d8243fcfe 100644 --- a/envs/monkey_zoo/blackbox/island_client/monkey_island_client.py +++ b/envs/monkey_zoo/blackbox/island_client/monkey_island_client.py @@ -1,7 +1,7 @@ import json import logging import time -from typing import Sequence, Union +from typing import List, Sequence, Union from bson import json_util @@ -59,9 +59,9 @@ class MonkeyIslandClient(object): assert False @avoid_race_condition - def _import_credentials(self, propagation_credentials: Credentials): + def _import_credentials(self, propagation_credentials: List[Credentials]): serialized_propagation_credentials = [ - Credentials.dict(credentials) for credentials in propagation_credentials + credentials.dict() for credentials in propagation_credentials ] response = self.requests.put_json( "/api/propagation-credentials/configured-credentials", diff --git a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py index 3affc6cb6..237f052e4 100644 --- a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py +++ b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py @@ -68,7 +68,7 @@ class MongoCredentialsRepository(ICredentialsRepository): def _save_credentials_to_collection(self, credentials: Sequence[Credentials], collection): try: for c in credentials: - encrypted_credentials = self._encrypt_credentials_mapping(c.dict()) + encrypted_credentials = self._encrypt_credentials_mapping(c.dict(simplify=True)) collection.insert_one(encrypted_credentials) except Exception as err: raise StorageError(err)