From 938022fc5212bec6ecfcbd47479f8f2a3e334f30 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 30 Jun 2021 14:09:26 -0400 Subject: [PATCH] Island: Allow HTML in config_schema descriptions to be renedered --- .../configuration-components/HtmlFieldDescription.js | 8 ++++++++ .../cc/ui/src/components/pages/ConfigurePage.js | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 monkey/monkey_island/cc/ui/src/components/configuration-components/HtmlFieldDescription.js diff --git a/monkey/monkey_island/cc/ui/src/components/configuration-components/HtmlFieldDescription.js b/monkey/monkey_island/cc/ui/src/components/configuration-components/HtmlFieldDescription.js new file mode 100644 index 000000000..2d8df9020 --- /dev/null +++ b/monkey/monkey_island/cc/ui/src/components/configuration-components/HtmlFieldDescription.js @@ -0,0 +1,8 @@ +import React from 'react'; + +function HtmlFieldDescription(props) { + var content_obj = {__html: props.description}; + return

; +} + +export default HtmlFieldDescription; diff --git a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js index 310555408..a5ea68107 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/ConfigurePage.js @@ -17,6 +17,7 @@ import isUnsafeOptionSelected from '../utils/SafeOptionValidator.js'; import ConfigExportModal from '../configuration-components/ExportConfigModal'; import ConfigImportModal from '../configuration-components/ImportConfigModal'; import applyUiSchemaManipulators from '../configuration-components/UISchemaManipulators.tsx'; +import HtmlFieldDescription from '../configuration-components/HtmlFieldDescription.js'; const ATTACK_URL = '/api/attack'; const CONFIG_URL = '/api/configuration/island'; @@ -411,6 +412,7 @@ class ConfigurePageComponent extends AuthComponent { setPbaFilenameLinux: this.setPbaFilenameLinux, selectedSection: this.state.selectedSection }) + formProperties['fields'] = {DescriptionField: HtmlFieldDescription}; formProperties['formData'] = this.state.currentFormData; formProperties['onChange'] = this.onChange; formProperties['customFormats'] = formValidationFormats;