This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
XSS Experimental Minimal Encoding Rules
From OWASP
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> |
|