<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How addons.mozilla.org defends against XSS attacks</title>
	<atom:link href="http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/</link>
	<description>because at 3am anything sounds good</description>
	<lastBuildDate>Thu, 13 May 2010 02:29:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ennuyer.net &#187; Blog Archive &#187; 2009-03-19- Today’s Ruby/Rails Reading</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-31598</link>
		<dc:creator>Ennuyer.net &#187; Blog Archive &#187; 2009-03-19- Today’s Ruby/Rails Reading</dc:creator>
		<pubDate>Sat, 21 Mar 2009 20:47:15 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-31598</guid>
		<description>[...]  All Night Diner : How addons.mozilla.org defends against XSS attacks  [...]</description>
		<content:encoded><![CDATA[<p>[...]  All Night Diner : How addons.mozilla.org defends against XSS attacks  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wait till I come! &#187; Blog Archive &#187; TTMMHTM: Guardian getting enabled by design,interview,open hack day,bash magic,and XSS filters</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-31390</link>
		<dc:creator>Wait till I come! &#187; Blog Archive &#187; TTMMHTM: Guardian getting enabled by design,interview,open hack day,bash magic,and XSS filters</dc:creator>
		<pubDate>Wed, 18 Mar 2009 20:41:44 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-31390</guid>
		<description>[...] If you ever wondered how addons.mozilla.org battles XSS attacks, here&#8217;s how [...]</description>
		<content:encoded><![CDATA[<p>[...] If you ever wondered how addons.mozilla.org battles XSS attacks, here&#8217;s how [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Migliorisi</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-31382</link>
		<dc:creator>Bryan Migliorisi</dc:creator>
		<pubDate>Wed, 18 Mar 2009 16:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-31382</guid>
		<description>Oops, I posted the link to HTML Purified, a Wordpress plugin for sanitizing comments.  

The HTML Purifier can be found @ http://htmlpurifier.org/</description>
		<content:encoded><![CDATA[<p>Oops, I posted the link to HTML Purified, a Wordpress plugin for sanitizing comments.  </p>
<p>The HTML Purifier can be found @ <a href="http://htmlpurifier.org/" rel="nofollow">http://htmlpurifier.org/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Migliorisi</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-31381</link>
		<dc:creator>Bryan Migliorisi</dc:creator>
		<pubDate>Wed, 18 Mar 2009 16:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-31381</guid>
		<description>Check out HTML purifier @ http://urbangiraffe.com/plugins/html-purified/

It is a php solution that uses whitelists, is recursive, and checks attributes as well as tags.  I have never used HTML purifier, but I recently wrote a Java class for doing this exact thing for our web application and it has passed every test I&#039;ve thrown at it thus far.  It seems to be a pretty good solution.</description>
		<content:encoded><![CDATA[<p>Check out HTML purifier @ <a href="http://urbangiraffe.com/plugins/html-purified/" rel="nofollow">http://urbangiraffe.com/plugins/html-purified/</a></p>
<p>It is a php solution that uses whitelists, is recursive, and checks attributes as well as tags.  I have never used HTML purifier, but I recently wrote a Java class for doing this exact thing for our web application and it has passed every test I&#8217;ve thrown at it thus far.  It seems to be a pretty good solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jones</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-31031</link>
		<dc:creator>Jones</dc:creator>
		<pubDate>Fri, 13 Mar 2009 11:10:32 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-31031</guid>
		<description>what about cookies and http headers and post? seems an architectural weekness to check this on other places in your app. the best thing would be to check ALL input channels in ONE file and with the same expressions, not clutter it over different files. Also tighten your app to only let ALL input channels through ONE special file, where no side-effects can occur. Also, of course, WHITELIST and not BLACKLIST. 
I checked cakephp and it seems one of the weeker frameworks considering security architecture - it leaves certain important steps to the user, that means the framework does NOT make things more secure for you but you have to think yourself - besides having a lot of development goodness from a security pov the question arises &quot;so wtf is the framework good for then?&quot;. Also the AUTH and especially the ACL system is not integrated into he backend but users have to configure and built it itself - it shows that most people do not understand how to do it and open new security holes. As we have seen in the recent past even mature cake devs are not able to implement secure auth themaselves - how could users, if documentation is extremely vague?
cake is a great tool for rapid dev - but it is contraproductive in security as it A) not gives you security for your apps out-of-the-box and B) complicates the way you might be used to secure your site because it injects another level of abstraction. A framework with these weeknesses in security can only be used by extremely experienced developers which are used to study forign code - you will have to study cake very deeply to make a secure site. Of course, if you are that experienced, you will already have your own framework that might be much more accurate and adopts common anti-xss measures to the max. 
I predict: many many middle- to low-skilled php developers, mostly typically &quot;designers with some web skillz&quot; will adopt cakephp as a  &quot;cool framework&quot; without even knowing anything about its inner workings - and they will produce the next big wave of insecure php applications. That is why a framework MUST be secure out-of-.the-box - every action that might endanger your site must be safe by default and an experienced developer *might* disable this behaviour if she knows what she is doing, not the other way around.</description>
		<content:encoded><![CDATA[<p>what about cookies and http headers and post? seems an architectural weekness to check this on other places in your app. the best thing would be to check ALL input channels in ONE file and with the same expressions, not clutter it over different files. Also tighten your app to only let ALL input channels through ONE special file, where no side-effects can occur. Also, of course, WHITELIST and not BLACKLIST.<br />
I checked cakephp and it seems one of the weeker frameworks considering security architecture &#8211; it leaves certain important steps to the user, that means the framework does NOT make things more secure for you but you have to think yourself &#8211; besides having a lot of development goodness from a security pov the question arises &#8220;so wtf is the framework good for then?&#8221;. Also the AUTH and especially the ACL system is not integrated into he backend but users have to configure and built it itself &#8211; it shows that most people do not understand how to do it and open new security holes. As we have seen in the recent past even mature cake devs are not able to implement secure auth themaselves &#8211; how could users, if documentation is extremely vague?<br />
cake is a great tool for rapid dev &#8211; but it is contraproductive in security as it A) not gives you security for your apps out-of-the-box and B) complicates the way you might be used to secure your site because it injects another level of abstraction. A framework with these weeknesses in security can only be used by extremely experienced developers which are used to study forign code &#8211; you will have to study cake very deeply to make a secure site. Of course, if you are that experienced, you will already have your own framework that might be much more accurate and adopts common anti-xss measures to the max.<br />
I predict: many many middle- to low-skilled php developers, mostly typically &#8220;designers with some web skillz&#8221; will adopt cakephp as a  &#8220;cool framework&#8221; without even knowing anything about its inner workings &#8211; and they will produce the next big wave of insecure php applications. That is why a framework MUST be secure out-of-.the-box &#8211; every action that might endanger your site must be safe by default and an experienced developer *might* disable this behaviour if she knows what she is doing, not the other way around.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AD7six</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-30988</link>
		<dc:creator>AD7six</dc:creator>
		<pubDate>Thu, 12 Mar 2009 08:54:29 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-30988</guid>
		<description>Hi Wil,

Interesting stuff.

Would it be easier/simpler/the same (or is there an additional advantage?) to drop the iconv call and add this to the preg_replace

&quot;/\x00-\x1f/&quot; =&gt; &#039;&#039;
( OR &quot;/\x{0000}-\x{002f}/&quot; =&gt; &#039;&#039; )

I ask primarily because this is what I do, and want to know if I&#039;m missing out/opening things up ( :) ).

Cheers,

Andy</description>
		<content:encoded><![CDATA[<p>Hi Wil,</p>
<p>Interesting stuff.</p>
<p>Would it be easier/simpler/the same (or is there an additional advantage?) to drop the iconv call and add this to the preg_replace</p>
<p>&#8220;/\x00-\x1f/&#8221; =&gt; &#8221;<br />
( OR &#8220;/\x{0000}-\x{002f}/&#8221; =&gt; &#8221; )</p>
<p>I ask primarily because this is what I do, and want to know if I&#8217;m missing out/opening things up ( <img src='http://micropipes.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).</p>
<p>Cheers,</p>
<p>Andy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Garibaldo Persisto</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-30914</link>
		<dc:creator>Garibaldo Persisto</dc:creator>
		<pubDate>Tue, 10 Mar 2009 14:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-30914</guid>
		<description>would you like to speak out a little bit about what you are expectin the combination of the first two regexes to do? and how did you test, if your expectations are met? Thanks!
Otherwise still very confusing, that a framework like cakephp does still not give you xss protection right out of tthe box.</description>
		<content:encoded><![CDATA[<p>would you like to speak out a little bit about what you are expectin the combination of the first two regexes to do? and how did you test, if your expectations are met? Thanks!<br />
Otherwise still very confusing, that a framework like cakephp does still not give you xss protection right out of tthe box.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CakePHP Digest #9 - The One Where I Steal Everyone&#8217;s Ideas &#124; PseudoCoder.com</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-30895</link>
		<dc:creator>CakePHP Digest #9 - The One Where I Steal Everyone&#8217;s Ideas &#124; PseudoCoder.com</dc:creator>
		<pubDate>Tue, 10 Mar 2009 04:00:57 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-30895</guid>
		<description>[...] You can&#8217;t get away from the XSS. @brian_dailey pointed out this article about how addons.mozilla.org combats XSS attacks. [...]</description>
		<content:encoded><![CDATA[<p>[...] You can&#8217;t get away from the XSS. @brian_dailey pointed out this article about how addons.mozilla.org combats XSS attacks. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fernando Hartmann</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-30556</link>
		<dc:creator>Fernando Hartmann</dc:creator>
		<pubDate>Tue, 03 Mar 2009 14:25:49 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-30556</guid>
		<description>Good post, I will suggest you, to transform this code in a separated library/project, so all of us can use your skills in our projects.</description>
		<content:encoded><![CDATA[<p>Good post, I will suggest you, to transform this code in a separated library/project, so all of us can use your skills in our projects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Thomas (thelem)</title>
		<link>http://micropipes.com/blog/2009/02/23/how-addonsmozillaorg-defends-against-xss-attacks/comment-page-1/#comment-29974</link>
		<dc:creator>Ian Thomas (thelem)</dc:creator>
		<pubDate>Tue, 24 Feb 2009 00:17:51 +0000</pubDate>
		<guid isPermaLink="false">http://micropipes.com/blog/?p=70#comment-29974</guid>
		<description>Good post. I generally just use htmlspecialchars at the moment, but will consider adding a similar function to our codebase. 

I think its worth pointing out more clearly exactly where the sanitise function is run. Lots of developers know that they need to run strings through functions like this to be safe, but they don&#039;t really understand what they are doing so just run the strings through these functions wherever they see the string and remember to do it. That leads to some strings being sanitised multiple times, and others not to be sanitised at all.

It can be tempting just to sanitise everything on it&#039;s way in - once it is in your system it is trusted data (think PHP&#039;s Magic Quotes). But how do you sanitise it? SQL escaping? HTML escaping?

I like to think of it as converting a string from it&#039;s original format, as supplied by the user, to a particular format for how I want to use it. If I want use the string in a PostgreSQL query, then I convert it to PostgreSQL by running it through pg_escape_string. If I want to use it on a web page, then I convert it to HTML by running it through htmlspecialchars (or Wil&#039;s sanitise function). In both cases the end user (querying the database or browsing the web) will see the string in its original format, but the intermediate language (PostgreSQL or HTML) will ignore any special characters.</description>
		<content:encoded><![CDATA[<p>Good post. I generally just use htmlspecialchars at the moment, but will consider adding a similar function to our codebase. </p>
<p>I think its worth pointing out more clearly exactly where the sanitise function is run. Lots of developers know that they need to run strings through functions like this to be safe, but they don&#8217;t really understand what they are doing so just run the strings through these functions wherever they see the string and remember to do it. That leads to some strings being sanitised multiple times, and others not to be sanitised at all.</p>
<p>It can be tempting just to sanitise everything on it&#8217;s way in &#8211; once it is in your system it is trusted data (think PHP&#8217;s Magic Quotes). But how do you sanitise it? SQL escaping? HTML escaping?</p>
<p>I like to think of it as converting a string from it&#8217;s original format, as supplied by the user, to a particular format for how I want to use it. If I want use the string in a PostgreSQL query, then I convert it to PostgreSQL by running it through pg_escape_string. If I want to use it on a web page, then I convert it to HTML by running it through htmlspecialchars (or Wil&#8217;s sanitise function). In both cases the end user (querying the database or browsing the web) will see the string in its original format, but the intermediate language (PostgreSQL or HTML) will ignore any special characters.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
