From 15615e08c47e619a8d2b0adab0adcb7711fb227d Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 21 Jun 2022 14:51:40 -0700 Subject: [PATCH] Island: Get rid of unsafe config options' check in new configuration resource --- .../cc/resources/configuration.py | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/monkey/monkey_island/cc/resources/configuration.py b/monkey/monkey_island/cc/resources/configuration.py index 710db13aa..24185eee9 100644 --- a/monkey/monkey_island/cc/resources/configuration.py +++ b/monkey/monkey_island/cc/resources/configuration.py @@ -49,24 +49,13 @@ class AgentConfiguration(AbstractResource): AgentConfiguration._remove_metadata_from_config(configuration_json) try: - # Q: encryption is moving to the frontend; also check this in the frontend? - if request_contents["unsafeOptionsVerified"]: - schema = AgentConfigurationSchema() - # Q: in what format/schema are we getting the config from the Island? - # Q: when does flattening the config go away? - configuration_object = schema.loads(configuration_json) - self._agent_configuration_repository.store_configuration( - configuration_object - ) # check error handling - return ResponseContents().form_response() - else: - return ResponseContents( - config=json.dumps(configuration_json), - # Q: do we still need a separate config schema like this? - # config_schema=ConfigService.get_config_schema(), - import_status=ImportStatuses.UNSAFE_OPTION_VERIFICATION_REQUIRED, - ).form_response() - except InvalidConfigurationError: + schema = AgentConfigurationSchema() + configuration_object = schema.loads(configuration_json) + self._agent_configuration_repository.store_configuration( + configuration_object + ) # check error handling + return ResponseContents().form_response() + except InvalidConfigurationError: # don't need this probably either; if invalid, schema should raise error (catch marshmallow exception and return 400) return ResponseContents( import_status=ImportStatuses.INVALID_CONFIGURATION, message="Invalid configuration supplied. "