forked from p15670423/monkey
Island: Get rid of unsafe config options' check in new configuration resource
This commit is contained in:
parent
8c14423c4e
commit
15615e08c4
|
@ -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?
|
|
||||||
if request_contents["unsafeOptionsVerified"]:
|
|
||||||
schema = AgentConfigurationSchema()
|
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)
|
configuration_object = schema.loads(configuration_json)
|
||||||
self._agent_configuration_repository.store_configuration(
|
self._agent_configuration_repository.store_configuration(
|
||||||
configuration_object
|
configuration_object
|
||||||
) # check error handling
|
) # check error handling
|
||||||
return ResponseContents().form_response()
|
return ResponseContents().form_response()
|
||||||
else:
|
except InvalidConfigurationError: # don't need this probably either; if invalid, schema should raise error (catch marshmallow exception and return 400)
|
||||||
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. "
|
||||||
|
|
Loading…
Reference in New Issue