mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 23:52:42 +00:00
Add sanitization of Style content
This commit is contained in:
@@ -107,6 +107,12 @@ const BrewRenderer = createClass({
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
sanitizeScriptTags : function(content) {
|
||||||
|
return content
|
||||||
|
.replace(/<script/ig, '<script')
|
||||||
|
.replace(/<\/script>/ig, '</script>');
|
||||||
|
},
|
||||||
|
|
||||||
renderPageInfo : function(){
|
renderPageInfo : function(){
|
||||||
return <div className='pageInfo' ref='main'>
|
return <div className='pageInfo' ref='main'>
|
||||||
<div>
|
<div>
|
||||||
@@ -134,7 +140,7 @@ const BrewRenderer = createClass({
|
|||||||
|
|
||||||
renderStyle : function() {
|
renderStyle : function() {
|
||||||
if(!this.props.style) return;
|
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){
|
renderPage : function(pageText, index){
|
||||||
|
|||||||
Reference in New Issue
Block a user