0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-29 09:02:37 +00:00

Add sanitization of Style content

This commit is contained in:
G.Ambatte
2022-09-28 17:27:11 +13:00
parent a3c7e2f807
commit 8e26161244

View File

@@ -107,6 +107,12 @@ const BrewRenderer = createClass({
return false;
},
sanitizeScriptTags : function(content) {
return content
.replace(/<script/ig, '&lt;script')
.replace(/<\/script>/ig, '&lt;/script&gt;');
},
renderPageInfo : function(){
return <div className='pageInfo' ref='main'>
<div>
@@ -134,7 +140,7 @@ const BrewRenderer = createClass({
renderStyle : function() {
if(!this.props.style) return;
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.props.style} </style>` }} />;
return <div style={{ display: 'none' }} dangerouslySetInnerHTML={{ __html: `<style> ${this.sanitizeScriptTags(this.props.style)} </style>` }} />;
},
renderPage : function(pageText, index){