In our application, in landing page we show a scrolling message, which is entered in a admin screen and stored in DB and shown to other external users when they login (like "the site will be down for maintenance.. etc). The message is entered with html tags to change color and text size.
During security testing this process failed as a java script was introduced and it runs on landing page.
We are advised to use ESAPI libraries. Used many Encoder methods. All those are encoding all the tags. I want to allow few html tags and encode everything else.
In some other forums, it is mentioned to use HTML sanitizer. What is the right way to do please..