<p>I'm building a webapp that contains an IFrame in design mode so my user's can "tart" their content up and paste in content to be displayed on their page.  Like the WYSIWYG editor on most blog engines or forums.</p>

<p>I'm trying to think of all potential security holes I need to plug, one of which is a user pasting in Javascript:</p>

<pre><code>&lt;script type="text/javascript"&gt;

// Do some nasty stuff

&lt;/script&gt;
</code></pre>

<p>Now I know I can strip this out at the server end, before saving it and/or serving it back, but I'm worried about the possibility of someone being able to paste some script in and run it there and then, without even sending it back to the server for processing.</p>

<p>Am I worrying over nothing?</p>

<p>Any advice would be great, couldn't find much searching Google.</p>

<p>Anthony</p>

[{'answer_id': 50474, 'author': 'Ryan Lanciaux', 'author_id': 1385358, 'author_profile': 'https://Stackoverflow.com/users/1385358', 'pm_score': 2, 'selected': False, 'text': '<p>As Jason said, I would focus more on cleaning the data on the server side. You don\'t really have any real control on the client side unless you\'re using Silverlight / Flex and even then you\'d need to check the server.</p>\n\n<p>That said, Here are some tips from <em>"A List Apart"</em> you may find helpful regarding server side data cleaning.</p>\n\n<p><a href="http://www.alistapart.com/articles/secureyourcode" rel="nofollow noreferrer">http://www.alistapart.com/articles/secureyourcode</a></p>\n'}, {'answer_id': 50481, 'author': 'Jason Bunting', 'author_id': 1790, 'author_profile': 'https://Stackoverflow.com/users/1790', 'pm_score': 3, 'selected': True, 'text': "<blockquote>\n  <p>...I'm worried about the possibility of someone being able to paste some script in and run it there and then, without even sending it back to the server for processing.  </p>\n  \n  <p>Am I worrying over nothing?</p>\n</blockquote>\n\n<p>Firefox has a plug-in called Greasemonkey that allows users to arbitrarily run JavaScript against any page that loads into their browser, and there is nothing you can do about it. Firebug allows you to modify web pages as well as run arbitrary JavaScript.</p>\n\n<p>AFAIK, you really only need to worry once it gets to your server, and then potentially hits other users.</p>\n"}]
['https://Stackoverflow.com/questions/50470', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/366/']