From 5821d71ade05204f7446703aac21b93333bdb873 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 14 Sep 2022 08:57:07 -0400 Subject: [PATCH] Island: Omit the mongo object ID from credentials query results --- .../cc/repository/mongo_credentials_repository.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py index 237f052e4..3fdc306a8 100644 --- a/monkey/monkey_island/cc/repository/mongo_credentials_repository.py +++ b/monkey/monkey_island/cc/repository/mongo_credentials_repository.py @@ -55,9 +55,8 @@ class MongoCredentialsRepository(ICredentialsRepository): def _get_credentials_from_collection(self, collection) -> Sequence[Credentials]: try: collection_result = [] - list_collection_result = list(collection.find({})) + list_collection_result = list(collection.find({}, {MONGO_OBJECT_ID_KEY: False})) for encrypted_credentials in list_collection_result: - del encrypted_credentials[MONGO_OBJECT_ID_KEY] plaintext_credentials = self._decrypt_credentials_mapping(encrypted_credentials) collection_result.append(Credentials(**plaintext_credentials))