Maybe it's simple question but I would like to discuss it with other specialists.
The problem.
User submits some form (for example post new thread at forum). His browser send data to web application, web application purifies data from js code and saves it to DB. That's ok.
Another case - user submits data to web application but he makes some error in data and the web application returns its data (without saving it to DB), put them in form (in order user not to fulfill all again) and displayes message error.
The question.
I've read somewhere that the following attack can be done - user follow some link (foreign link) that redirects to our site and sends with it data with js. So the question - should we purify data in second case?