new: [security setting] disable admin file management

- for compliance reasons, disable the upload of images for the various logos / decorations
- setting can be enabled/disabled via CLI only
pull/8778/head
iglocska 2022-11-22 13:24:46 +01:00
parent d73151a5cf
commit 6393e993bf
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
3 changed files with 22 additions and 6 deletions

View File

@ -1075,6 +1075,9 @@ class ServersController extends AppController
$this->set('correlation_metrics', $correlation_metrics);
}
if ($tab === 'files') {
if (!empty(Configure::read('Security.disable_instance_file_uploads'))) {
throw new MethodNotAllowedException(__('This functionality is disabled.'));
}
$files = $this->Server->grabFiles();
$this->set('files', $files);
}
@ -1624,6 +1627,9 @@ class ServersController extends AppController
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
}
if (!empty(Configure::read('Security.disable_instance_file_uploads'))) {
throw new MethodNotAllowedException(__('Feature disabled.'));
}
$validItems = $this->Server->getFileRules();
// Check if there were problems with the file upload

View File

@ -6523,6 +6523,15 @@ class Server extends AppModel
'test' => 'testBool',
'type' => 'boolean',
'null' => true
],
'disable_instance_file_uploads' => [
'level' => self::SETTING_RECOMMENDED,
'description' => __('When enabled, the "Manage files" menu is disabled on the server settings. You can still copy files via ssh to the appropriate location and link them using MISP.settings.'),
'value' => false,
'test' => 'testBool',
'type' => 'boolean',
'null' => true,
'cli_only' => true
]
),
'SecureAuth' => array(

View File

@ -50,12 +50,13 @@
),
'active' => $active_tab === 'diagnostics'
);
$data['children'][0]['children'][] = array(
'url' => $baseurl . '/servers/serverSettings/files',
'text' => __('Manage files'),
'active' => $active_tab === 'files'
);
if (empty(Configure::read('Security.disable_instance_file_uploads'))) {
$data['children'][0]['children'][] = array(
'url' => $baseurl . '/servers/serverSettings/files',
'text' => __('Manage files'),
'active' => $active_tab === 'files'
);
}
$data['children'][0]['children'][] = array(
'url' => $baseurl . '/servers/serverSettings/workers',
'title' => __('Workers'),