Hi,
I'm developing a web app where users can response to blog entries. This is a security problem because they can send dangerous data that will be rendered to other users (and executed by javascript).
They can't format the text they send. No "bold", no colors, no nothing. Just simple text. I came up with this regex to solve my problem:
[^\\w\\s.?!()]
So anything that is not a word character (a-Z, A-Z, 0-9), not a whitespace, ".", "?", "!", "(" or ")" will be replaced with an empty string. Than every quatation mark will be replaced with: """.
I check the data on the front end and I check it on my server.
Is there any way somebody could bypass this "solution"?
I'm wondering how StackOverflow does this thing? There are a lot of formatting here so they must do a good work with it.