Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Cross-Site Scripting (XSS) Vulnerability #233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
sanitize html
gtsp233 committed Jan 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 09e63ee61f8319850982acc26411031e51d06fe5
4 changes: 3 additions & 1 deletion deprecated-components/richtext-renderer/package.json
Original file line number Diff line number Diff line change
@@ -30,7 +30,9 @@
"react": "^16.3.0",
"react-dom": "^16.3.0"
},
"dependencies": {},
"dependencies": {
"dompurify": "^3.0.8"
},
"devDependencies": {
"react": "^16.3.0",
"react-dom": "^16.3.0"
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import DOMPurify from "dompurify";

export default class RichtextRenderer extends Component {

@@ -9,7 +10,7 @@ export default class RichtextRenderer extends Component {
<div
{...others}
className={(className ? className + ' ' : '') + 'ice-richtext'}
dangerouslySetInnerHTML={{__html: html}}
dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(html) }}
/>
);
}