Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
igHtmlEditor - need suggestions for displaying stored html content securely
posted

Hello,

This post is not a technical problem with igHtmlEditor but rather a request for best practice suggestions.

My MVC project uses igHtmlEditor to allow the user to enter content, which is then stored in a database.  Later, this content will be retrieved for further editing.

To protect against scripting attacks, I am using Microsoft AntiXss.  Currently I store the user content in the database as-entered and sanitize the content prior to sending it back to the browser.

Here is some html that was created in the igHtmlEditor and then saved to the database.  This is exactly as expected.

<span style="font-family: Arial; font-weight: bold;">This is some bold text using the arial font.</span><div><span style="font-family: 'Comic Sans MS';">This is regular text using Comic Sans.</span></div><div><span style="font-family: 'Comic Sans MS';"><br></span><div><br></div></div>

After retrieving the content and sanitizing it, here is the sanitized html:

<span>This is some bold text using the arial font.</span><span>This is regular text using Comic Sans.</span><span></span>

Obviously this is not what is needed.

So I am wondering if anyone has suggestions for how to successfully send html back to the igHtmlEditor while at the same time protecting against a scripting attack.

Thank You!

Randy

Parents Reply Children