* Separated the configuration functions to support both island's and monkey's needs

* Removed space char from the default value of the aws keys
* Changed the submit function in the JS to point to the right endpoint
This commit is contained in:
maor.rayzin 2018-11-27 17:32:46 +02:00
parent 9e6b2b2d26
commit 0a6b3a12fa
2 changed files with 10 additions and 6 deletions

View File

@ -649,19 +649,19 @@ SCHEMA = {
'title': 'AWS account ID', 'title': 'AWS account ID',
'type': 'string', 'type': 'string',
'description': 'Your AWS account ID that is subscribed to security hub feeds', 'description': 'Your AWS account ID that is subscribed to security hub feeds',
'default': " " 'default': ""
}, },
'aws_access_key_id': { 'aws_access_key_id': {
'title': 'AWS access key ID', 'title': 'AWS access key ID',
'type': 'string', 'type': 'string',
'description': 'Your AWS public access key ID, can be found in the IAM user interface in the AWS console.', 'description': 'Your AWS public access key ID, can be found in the IAM user interface in the AWS console.',
'default': " " 'default': ""
}, },
'aws_secret_access_key': { 'aws_secret_access_key': {
'title': 'AWS secret access key', 'title': 'AWS secret access key',
'type': 'string', 'type': 'string',
'description': 'Your AWS secret access key id, you can get this after creating a public access key in the console.', 'description': 'Your AWS secret access key id, you can get this after creating a public access key in the console.',
'default': " " 'default': ""
} }
} }
} }
@ -1107,11 +1107,15 @@ class ConfigService:
ConfigService._encrypt_or_decrypt_config(config, False) ConfigService._encrypt_or_decrypt_config(config, False)
@staticmethod @staticmethod
def decrypt_flat_config(flat_config): def decrypt_flat_config(flat_config, is_island=False):
""" """
Same as decrypt_config but for a flat configuration Same as decrypt_config but for a flat configuration
""" """
keys = [config_arr_as_array[2] for config_arr_as_array in (ENCRYPTED_CONFIG_ARRAYS + ENCRYPTED_CONFIG_STRINGS)] if is_island:
keys = [config_arr_as_array[2] for config_arr_as_array in
(ENCRYPTED_CONFIG_ARRAYS + ENCRYPTED_CONFIG_STRINGS)]
else:
keys = [config_arr_as_array[2] for config_arr_as_array in ENCRYPTED_CONFIG_ARRAYS]
for key in keys: for key in keys:
if isinstance(flat_config[key], collections.Sequence) and not isinstance(flat_config[key], string_types): if isinstance(flat_config[key], collections.Sequence) and not isinstance(flat_config[key], string_types):
# Check if we are decrypting ssh key pair # Check if we are decrypting ssh key pair

View File

@ -44,7 +44,7 @@ class ConfigurePageComponent extends AuthComponent {
onSubmit = ({formData}) => { onSubmit = ({formData}) => {
this.currentFormData = formData; this.currentFormData = formData;
this.updateConfigSection(); this.updateConfigSection();
this.authFetch('/api/configuration', this.authFetch('/api/configuration/island',
{ {
method: 'POST', method: 'POST',
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},