XSS Experimental Minimal Encoding Rules
From OWASP
Revision as of 17:46, 16 September 2012 by Jmanico (talk | contribs) (Created page with "The following examples demonstrate experimental minimal encoding rules for XSS prevention. {| class="wikitable nowraplinks" |- ! Context ! Code Sample ! Rules |- | JavaScrip...")
The following examples demonstrate experimental minimal encoding rules for XSS prevention.
| Context | Code Sample | Rules |
|---|---|---|
| JavaScript, quoted string in a script block | <script>alert("Hello "+"<%= UNTRUSTED DATA %>");</script> |
|
| JavaScript, quoted string in an event handler attribute | onclick="alert('<%= UNTRUSTED DATA %>')"; |
|
| HTML Body (up to HTML 4.01): | <div><%= UNTRUSTED DATA %></div> |
|
| XHTML Body: | <div><%= UNTRUSTED DATA %></div> |
|