Island: Get rid of unsafe config options' check in new configuration resource

This commit is contained in:
Shreya Malviya 2022-06-21 14:51:40 -07:00
parent 8c14423c4e
commit 15615e08c4
1 changed files with 7 additions and 18 deletions

View File

@ -49,24 +49,13 @@ class AgentConfiguration(AbstractResource):
AgentConfiguration._remove_metadata_from_config(configuration_json) AgentConfiguration._remove_metadata_from_config(configuration_json)
try: try:
# Q: encryption is moving to the frontend; also check this in the frontend? schema = AgentConfigurationSchema()
if request_contents["unsafeOptionsVerified"]: configuration_object = schema.loads(configuration_json)
schema = AgentConfigurationSchema() self._agent_configuration_repository.store_configuration(
# Q: in what format/schema are we getting the config from the Island? configuration_object
# Q: when does flattening the config go away? ) # check error handling
configuration_object = schema.loads(configuration_json) return ResponseContents().form_response()
self._agent_configuration_repository.store_configuration( except InvalidConfigurationError: # don't need this probably either; if invalid, schema should raise error (catch marshmallow exception and return 400)
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:
return ResponseContents( return ResponseContents(
import_status=ImportStatuses.INVALID_CONFIGURATION, import_status=ImportStatuses.INVALID_CONFIGURATION,
message="Invalid configuration supplied. " message="Invalid configuration supplied. "