diff --git a/public/components/report_definitions/report_settings/report_settings.tsx b/public/components/report_definitions/report_settings/report_settings.tsx index 9e185862..b4beedf0 100644 --- a/public/components/report_definitions/report_settings/report_settings.tsx +++ b/public/components/report_definitions/report_settings/report_settings.tsx @@ -3,6 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +import createDOMPurify from 'dompurify'; import React, { useEffect, useState } from 'react'; import { i18n } from '@osd/i18n'; import { @@ -340,6 +341,8 @@ export function ReportSettings(props: ReportSettingProps) { setCheckboxIdSelectHeaderFooter(newCheckboxIdToSelectedMap); }; + const DOMPurify = createDOMPurify(window); + const showFooter = checkboxIdSelectHeaderFooter.footer ? ( - Promise.resolve(converter.makeHtml(markdown)) + Promise.resolve(DOMPurify.sanitize(converter.makeHtml(markdown))) } /> @@ -380,7 +383,7 @@ export function ReportSettings(props: ReportSettingProps) { ['unordered-list', 'ordered-list', 'checked-list'], ]} generateMarkdownPreview={(markdown) => - Promise.resolve(converter.makeHtml(markdown)) + Promise.resolve(DOMPurify.sanitize(converter.makeHtml(markdown))) } />