r/javascript • Front-End Engineer • Aug 09 '12

A JavaScript Security Flaw

http://blog.alexmaccaw.com/a-javascript-security-flaw
0 Upvotes

13 comments sorted by

View all comments

1

u/ctrldavid Aug 09 '12

Note: The "flaw" doesn't happen in an xml serialised page when the code is wrapped in a CDATA section.

2

u/ctrldavid Aug 09 '12

Otherwise you should be escaping your < and > characters:

var str = "&lt;/script&gt;&lt;script&gt;alert('Pwned');&lt;/script&gt;";

1

u/kenman Aug 10 '12

Wow, someone should write that down in a guide somewhere.