I have to render "User's" HTML as HTML.
"User" is an administrator, so it is kind of safe, but despite everything I'd want to prevent any xss-ish attack
I came with an idea like this:
while (html.Contains("script"))
{
html = html.Replace("script", "");
}
Why while
? because scripscriptt
+ replace script
to ""
would still leave script
So, what are other key-words that have to be deleted?
img
? due to loading data from other server
iframe
?
button
?
href
?
Over all I want to delete dangerous markup, but I do not want to delete safe things like table, <b>, <div>
and the rest of text formatting / page style markups