in my application i have some tinymce editors and the userinput is shown with
<h:outputText escape="false"/>
but how can i prevent malicious input, like javascript or iframes? Is there any lib which can filter the input strings?
UPDATE:
i found “htmlpurifier” but it is for php, is there anyting like this for java?
You’d need to use a HTML parser which supports cleaning/whitelisting tags/attributes. Among them there’s Jsoup, it has a
clean()method for exactly this purpose. Here’s an extract of relevance from its site.