You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.
Secondly, in browsers where that works you are vulnerable to JS injection:
ns.unescapeHTML('&lt;script&gt;alert("yo")&lt;/script&gt;');// will produce// <script>alert("yo")</script>// instead of expected// <script>alert("yo")</script>
The only way to escape/unescape a generic string is to grab all things that need to be escaped at once.
This is a little utility you can use in order to achieve the same in a secure way.
varhtml=(function(){// Andrea Giammarchi - WTFPLvarreEscape=/[&<>'"]/g,// all at oncereUnescape=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g,oEscape={'&': '&','<': '<','>': '>',"'": ''','"': '"'},oUnescape={'&': '&','&': '&','<': '<','<': '<','>': '>','>': '>',''': "'",''': "'",'"': '"','"': '"'},fnEscape=function(m){returnoEscape[m];},fnUnescape=function(m){returnoUnescape[m];},replace=String.prototype.replace;return(Object.freeze||Object)({escape: functionescape(s){returnreplace.call(s,reEscape,fnEscape);},unescape: functionunescape(s){returnreplace.call(s,reUnescape,fnUnescape);}});}());
Somebody mentioned this library and I've noticed you folks are XSS prone.
This is a very bad approach to html escape/unescape, explained here why that is deadly wrong: https://gist.github.com/WebReflection/df05641bd04954f6d366
Thanks for any update and Best Regards
The text was updated successfully, but these errors were encountered: