Don't let end users embed HTML markup that allows you to either use <script>, <style>, a style attribute, or any of them? event attribute ... and viewing the contents of the href and src attributes
eg. if you have a blog, don't just let them comment on any HTML code.
Why?
tag
1.) the script is obvious, they can do whatever they want
2.) the style and style attribute are not so obvious, but in IE they can use behavior or expression properties to invoke script content
3.) any onclick, onmouseover, etc. attribute can obviously contain script content, so avoid it.
4.) see the href and src attributes if they contain the javascript: protocol, you also show the script.
Update: throw in <iframe>, <object> and <embed> as dangerous tags too ...
source share