diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx
index ed64c363b..c8deee8c9 100644
--- a/client/homebrew/brewRenderer/brewRenderer.jsx
+++ b/client/homebrew/brewRenderer/brewRenderer.jsx
@@ -14,6 +14,8 @@ const NotificationPopup = require('./notificationPopup/notificationPopup.jsx');
const Frame = require('react-frame-component').default;
const dedent = require('dedent-tabs').default;
+const DOMPurify = require('dompurify');
+
const Themes = require('themes/themes.json');
const PAGE_HEIGHT = 1056;
@@ -33,8 +35,10 @@ const BrewPage = (props)=>{
index : 0,
...props
};
+ const cleanText = DOMPurify.sanitize(props.contents);
+ // console.log(DOMPurify.removed);
return
;
};
@@ -128,19 +132,19 @@ const BrewRenderer = (props)=>{
const renderStyle = ()=>{
if(!props.style) return;
- const cleanStyle = sanitizeScriptTags(props.style);
+ const cleanStyle = DOMPurify.sanitize(props.style);
+ // console.log(DOMPurify.removed);
//return @layer styleTab {\n${sanitizeScriptTags(props.style)}\n} ` }} />;
return
${cleanStyle} ` }} />;
};
const renderPage = (pageText, index)=>{
- let cleanPageText = sanitizeScriptTags(pageText);
if(props.renderer == 'legacy') {
- const html = MarkdownLegacy.render(cleanPageText);
+ const html = MarkdownLegacy.render(pageText);
return ;
} else {
- cleanPageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
- const html = Markdown.render(cleanPageText, index);
+ pageText += `\n\n \n\\column\n `; //Artificial column break at page end to emulate column-fill:auto (until `wide` is used, when column-fill:balance will reappear)
+ const html = Markdown.render(pageText, index);
return ;
}
};
@@ -211,11 +215,11 @@ const BrewRenderer = (props)=>{
-
+
{baseThemePath &&
-
+
}
-
+
{/* Apply CSS from Style tab and render pages from Markdown tab */}
{state.isMounted