I notice that I can return an iframe from a helper and it will run the iframe’s src script, but it seems that when I return a script from a helper, the whole script gets stripped out.
If it were possible, I could then generate javascript code dynamically and include the resulting script in my pages. Javascript writing javascript!
By understanding what could possibly go wrong (Murphy’s Law is strong when it comes to XSS…) you may rethink your approach of allowing dynamic inserts of script and js code.
Of course XSS Is only an issue when the included scripts are written by an outsider. The goal in my case is to pull in and execute dynamic scripts written by the development team and stored in the DB, not the source code.
thanks for your feedback. I’d like to upload new scripts that could be used without rebuilding the site. Simplified, pages would have their own script they pull from the db. and you could replace the scripts on the fly by editing the db record through the u/i.