I have JavaScript code in a string that I received dynamically according to certain conditions (the result of certain user actions).
Now I am wondering if I should just eval it (will work, checked) or should I embed <script> in the DOM with the string value inside it. Part of the risk of XSS is clear to me (the script absolutely does not use anything that the user enters). I would like to know the problems associated with the area (if any) that arise due to the insertion of the <script> .
source share