This has serious XSS holes which need fixing! Here is a PR that should do the job (not tested): https://github.com/idoco/map-chat/pull/1
Show HN: MapChat – A simple location based chat in 300 lines of code
51–60 of 122 posts
Re: Show HN: MapChat – A simple location based chat in 300 lines of code
#52Re: Show HN: MapChat – A simple location based chat in 300 lines of code
#53very cool actually seeing all the other writers - a counter would actually be a great idea
Re: Show HN: MapChat – A simple location based chat in 300 lines of code
#54Ok I added a real XSS filter, lets hope that it holds :)
Re: Show HN: MapChat – A simple location based chat in 300 lines of code
#55Earlier quoted context omitted.
This is what I did for now msg.text = msg.text.replace('>','') .replace(' I will think of a more clever solution next week :)
Here is how mustache.js[0] does it: var entityMap = { "&": "&", " ": ">", '"': '"', "'": ''', "/": '/' }; function escapeHtml(string) { return String(string).replace(/[& "'\/]/g, function (s) { return entityMap[s]; }); } also document.createTextNode will tell the browser not to render the children as html, whereas appending a dom element and innerHTML will.[1] I'm just assuming that behavior is c…
Re: Show HN: MapChat – A simple location based chat in 300 lines of code
#56This has serious XSS holes which need fixing! Here is a PR that should do the job (not tested): https://github.com/idoco/map-chat/pull/1
Re: Show HN: MapChat – A simple location based chat in 300 lines of code
#57great concept, just needs some more polish
Re: Show HN: MapChat – A simple location based chat in 300 lines of code
#58This is super, will fork it into a private chat with bunch of my friends.
If you implement some new cool features, I'll be glad to merge them.