From 6e821c5bbcfa10b691eca4c41cf01c4dd22516c5 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Thu, 28 Jul 2022 13:06:20 +0300 Subject: [PATCH] Island: Remove POST in propagation credentials endpoint Post is not used, because configuration credentials are put all at once and stolen credentials are added via telemetry --- .../cc/resources/propagation_credentials.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/monkey/monkey_island/cc/resources/propagation_credentials.py b/monkey/monkey_island/cc/resources/propagation_credentials.py index f3cd05132..f1ae01c81 100644 --- a/monkey/monkey_island/cc/resources/propagation_credentials.py +++ b/monkey/monkey_island/cc/resources/propagation_credentials.py @@ -28,30 +28,13 @@ class PropagationCredentials(AbstractResource): return propagation_credentials, HTTPStatus.OK - def post(self, collection=None): - credentials = [Credentials.from_mapping(c) for c in request.json] - - if collection == _configured_collection: - self._credentials_repository.save_configured_credentials(credentials) - elif collection == _stolen_collection: - self._credentials_repository.save_stolen_credentials(credentials) - elif collection is None: - return {}, HTTPStatus.METHOD_NOT_ALLOWED - else: - return {}, HTTPStatus.NOT_FOUND - - return {}, HTTPStatus.NO_CONTENT - def put(self, collection=None): credentials = [Credentials.from_mapping(c) for c in request.json] if collection == _configured_collection: self._credentials_repository.remove_configured_credentials() self._credentials_repository.save_configured_credentials(credentials) - elif collection == _stolen_collection: - self._credentials_repository.remove_stolen_credentials() - self._credentials_repository.save_stolen_credentials(credentials) - elif collection is None: + elif collection is None or collection == _stolen_collection: return {}, HTTPStatus.METHOD_NOT_ALLOWED else: return {}, HTTPStatus.NOT_FOUND