I'm using TinyMCE on a textarea, which is submitted serverside and stored in the database. An example of what I have in the database could be:
<p><script>console.log("mce");</script></p>
So, the javascript is already escaped. My issue is, what if a malicious user bypasses TinyMCE and just submits raw data in textarea with unescaped javascript.
When another user needs to display this, how can I safely output it? I can't use htmlspecialchars as I would like the html content itself. I could manually check serverside (Laravel) for any <script></script
tags and rewrite these, but then what about inline javascript?