<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET MVC</title><link>http://forums.asp.net/1146.aspx</link><description>Discussions regarding Model-View-Controller (MVC) support in ASP.NET.  &lt;a href="http://forums.asp.net/1215.aspx"&gt;T4MVC subforum&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2076628.aspx</link><pubDate>Tue, 25 Dec 2007 19:00:46 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2076628</guid><dc:creator>FCsteve</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2076628.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2076628</wfw:commentRss><description>&lt;p&gt;I&amp;#39;d like it to be overloaded..&amp;nbsp; but by default I would prefer not to encode..&lt;/p&gt;
&lt;p&gt;I can kind of see the reason for the default to be encoded.. defaults targetting the most common scenario.. and I imagine you would love your &amp;#39;product&amp;#39; to do as much as possible for you by default.. but stay highly custimizable and configurable..&lt;/p&gt;
&lt;p&gt;Either way I wouldn&amp;#39;t be too bothered what the default is as there is some option.. as otherwise it would just add to the code in .NET that becomes useless outside of its default scenario.. (disclaimer: most of the code in .NET I think it done great)..&lt;/p&gt;
&lt;p&gt;My personal argument for the output encoding is that it should be handler by the output generators.. but it would be great if we had a simpler way to do primative output encoding (such as the &amp;lt;%!= idea).&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2076138.aspx</link><pubDate>Tue, 25 Dec 2007 06:23:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2076138</guid><dc:creator>robconery</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2076138.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2076138</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;damieng:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Encode on input is so very very wrong it&amp;#39;s hard to put it into words. You would be forcing developers to do the wrong thing on input, and the wrong thing on output (no encoding) which means they&amp;#39;ll be used to no encoding and when they pick up content that hasn&amp;#39;t processed through your input encoder is wide open for attack again.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;One thing I&amp;#39;d like to reiterate at this point in the thread is that I completely agree with no encoded data in the DB. My point (and others who like the idea of encoding on input) is that you protect one of the main vectors of XSS attack - regurgitation of input to the screen (search results being one of the main culprits).&lt;/p&gt;&lt;p&gt;So, to be clear: no one is suggesting you must input encoded text into your Db. Especially me. This discussion started with regards to a method that binds an object from Request.Form and the decision to encode/decode being your or ours.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2074151.aspx</link><pubDate>Sun, 23 Dec 2007 01:19:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2074151</guid><dc:creator>sergiopereira</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2074151.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2074151</wfw:commentRss><description>&lt;p&gt;Great thread. Nice to see how this discussion was brought back from a down spiral.&lt;/p&gt;&lt;p&gt;&amp;nbsp;I&amp;#39;d like to add that although &lt;b&gt;security&lt;/b&gt; is a cross-cutting concern, &lt;i&gt;it needs to be dealt in each component at the component&amp;#39;s context&lt;/i&gt;. By that I mean, if the UI needs to be secure (it does) then UI security measures need to be taken in the UI code (HtmlEncode in the outputs for example), never let UI concerns happen at the controller level (if you see any HtmlEncode calls in the controller code, think about it a little more.) And, please, no UI encoded stuff in my database, OK? :)&lt;/p&gt;&lt;p&gt;An example of security concern that could be dealt at the controller level would be to inspect the user input before assigning it to the models and later to the database. In practical terms a good example of that is making sure only the fields you expect to be in the Response.Form gets populated in the model, so be careful on how you use myModel.UpdateFrom(Request.Form) so that you don&amp;#39;t allow hand-crafted form posts to update sensitive properties.&lt;/p&gt;&lt;p&gt;All in all, I think we are all getting to the same page now.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;- sp&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2073946.aspx</link><pubDate>Sat, 22 Dec 2007 18:57:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2073946</guid><dc:creator>damieng</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2073946.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2073946</wfw:commentRss><description>&lt;p&gt;I presume you mean encode on output - I&amp;#39;d agree with the sentiments.&lt;/p&gt;&lt;p&gt;Encode on input is so very very wrong it&amp;#39;s hard to put it into words. You would be forcing developers to do the wrong thing on input, and the wrong thing on output (no encoding) which means they&amp;#39;ll be used to no encoding and when they pick up content that hasn&amp;#39;t processed through your input encoder is wide open for attack again.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;[)amien&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2073920.aspx</link><pubDate>Sat, 22 Dec 2007 18:36:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2073920</guid><dc:creator>tgmdbm</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2073920.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2073920</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m all in favour of trying to eliminate all those poorly developed sites. And if we can take a huge bite out of them by html encoding on input then it&amp;#39;s possibly not such a bad idea.&lt;/p&gt;&lt;p&gt;However, I&amp;#39;m developing a WinForms interface which accesses the same database so encoding on input is obviously not an option.&lt;/p&gt;&lt;p&gt;The question then is &amp;quot;which to do by default?&amp;quot;.&lt;/p&gt;&lt;p&gt;Well, if encode on input is OFF by default, will a novice turn it on? I&amp;#39;m not so sure that they would. If they are lazy enough not to bother about security they aren&amp;#39;t even going to care that such an option exists. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;If it&amp;#39;s ON by default, will we turn if off? Of course we will. We&amp;#39;ll check the comments of our web.config and turn it off. All we need is good documentation!&lt;br /&gt; &lt;/p&gt;&lt;p&gt;To be honest I&amp;#39;m not too concerned about which way they implement it as long as its extensible, overridable, configurable, and most of all it should be obvious what it&amp;#39;s doing.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071530.aspx</link><pubDate>Thu, 20 Dec 2007 23:32:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071530</guid><dc:creator>Jonathan Holland</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071530.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071530</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;damieng:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;/p&gt;&lt;p&gt;I think then you are missing the point of .NET with it&amp;#39;s sandboxed VM, code access security, type safety, bounds checking, pointerless operations, garbage collection, trust levels...&lt;/p&gt;&lt;p&gt;[)amien&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Your right, lets just add Html Encoding at the CLR level. Encode all strings!&lt;/p&gt;&lt;p&gt;Apples to Oranges.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071520.aspx</link><pubDate>Thu, 20 Dec 2007 23:25:47 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071520</guid><dc:creator>damieng</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071520.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071520</wfw:commentRss><description>&lt;p&gt;I think then you are missing the point of .NET with it&amp;#39;s sandboxed VM, code access security, type safety, bounds checking, pointerless operations, garbage collection, trust levels...&lt;/p&gt;&lt;p&gt;[)amien&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071490.aspx</link><pubDate>Thu, 20 Dec 2007 22:55:35 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071490</guid><dc:creator>Jonathan Holland</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071490.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071490</wfw:commentRss><description>&lt;p&gt;I believe that the only responsibility of Microsoft is to provide the means to encode and decode HTML. The responsibility to use it is placed at the feet of the developer.&lt;/p&gt;&lt;p&gt;Sure, ignorance leads to crappy, vulnerable sites....But that is not Microsoft&amp;#39;s fault, and that is not really their problem. As you can see from the PHP community, default features such as this only provide a false sense of security and enable the crappy developer to continue to develop crappy sites. It does not magically turn them into good developers. Would you tell the ADO.NET team to only allow parameterized queries? Every decent developer knows better than using string concatenation to build a query, but you will never be able to convince the ADO.NET team that removing the ability to do queries that way is a good idea.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I want a framework, not a set of training wheels without a bike.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071478.aspx</link><pubDate>Thu, 20 Dec 2007 22:48:16 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071478</guid><dc:creator>damieng</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071478.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071478</wfw:commentRss><description>&lt;p&gt;We can surely agree the root of the problem is ignorance?&lt;/p&gt;&lt;p&gt;In which case defaulting to off or alternate syntax achieves nothing.&lt;/p&gt;&lt;p&gt;They didn&amp;#39;t know HttpUtility.HtmlEncode and now they won&amp;#39;t know &amp;lt;page defaultOutput=&amp;quot;Encoded&amp;quot; /&amp;gt; either.&amp;nbsp;&lt;/p&gt;&lt;p&gt;[)amien&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071469.aspx</link><pubDate>Thu, 20 Dec 2007 22:44:08 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071469</guid><dc:creator>Jonathan Holland</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071469.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071469</wfw:commentRss><description>&lt;p&gt;So if you must have default encoding, what is so hard about default being off, and just having a config section in web.config for it?&lt;/p&gt;&lt;p&gt;It seems like the convention over configuration concept is being taken too far, configuration files are not all that bad :)&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071463.aspx</link><pubDate>Thu, 20 Dec 2007 22:40:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071463</guid><dc:creator>damieng</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071463.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071463</wfw:commentRss><description>&lt;p&gt;It is incredibly easy to miss or forget with alternate syntax, especially if you also maintain ASP.NET which won&amp;#39;t have the new syntax. If you could rely on everybody being professional you wouldn&amp;#39;t have this problem - the fact is you can&amp;#39;t rely on that.&lt;/p&gt;&lt;p&gt;As for hand-holding the fact is the majority of the time &amp;lt;%= %&amp;gt; is used to output simple text not HTML building.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;[)amien&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071429.aspx</link><pubDate>Thu, 20 Dec 2007 22:18:09 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071429</guid><dc:creator>Jonathan Holland</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071429.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071429</wfw:commentRss><description>&lt;p&gt;It absolutely baffles me to think that anyone would encourage default encoding. I know not everyone here has worked in PHP, but that language is a unorganized mess because of features such as &amp;quot;Magic_Escape_Strings&amp;quot; and &amp;quot;strip_Slashes&amp;quot; etc. The lesson learned? Leave the encoding to be done by the developer, not the framework implementation.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;We are all professionals here right? There is no need for hand holding.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2071207.aspx</link><pubDate>Thu, 20 Dec 2007 20:22:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2071207</guid><dc:creator>ghotiman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2071207.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2071207</wfw:commentRss><description>&lt;p&gt;SteveSanderson1, I don&amp;#39;t care to much what the syntax should be, just that it be different than the current &amp;lt;%= %&amp;gt;.&amp;nbsp; If they change the behavoir of &amp;lt;%= %&amp;gt; then most of the developers who need to be educated on this will never know anything about it.&amp;nbsp; Also, there will be the inconsistant behavior between forms and mvc, or old code will break.&amp;nbsp; If there is a new syntax, it can serve as the talking point for XSS.&amp;nbsp; The new syntax should be easy, I think everyone can agree on that.&amp;nbsp; I just think it should be different.&lt;/p&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2070973.aspx</link><pubDate>Thu, 20 Dec 2007 18:15:04 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2070973</guid><dc:creator>SteveSanderson1</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2070973.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2070973</wfw:commentRss><description>Ghotiman, I certainly agree that education is important. I&amp;#39;d be sad if we force people to type a big trainwreck of punctuation (&amp;lt;%% ... %%&amp;gt;) just to get the behaviour they should &amp;quot;always use&amp;quot;. If other developers are as lazy as me, they&amp;#39;re just going to press the fewest number of keys needed to say their project is finished, which means &amp;lt;%= ... %&amp;gt; (&amp;quot;seems to work fine&amp;quot;).&lt;br /&gt;</description></item><item><title>Re: UpdateFrom and Encoding</title><link>http://forums.asp.net/thread/2070944.aspx</link><pubDate>Thu, 20 Dec 2007 17:57:34 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2070944</guid><dc:creator>ghotiman</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2070944.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2070944</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m not too fond of encoding the input by default for all the reasons already mentioned.&amp;nbsp; I like the idea of adding to &amp;lt;%=%&amp;gt;, but not changing it.&amp;nbsp; As others have said, that would cause some confusion.&amp;nbsp; If something like &amp;lt;%% = %%&amp;gt; did HTML encoding by default it would not break the old model, and it would get used since it&amp;#39;s easy.&amp;nbsp; Also, it would be an opportunity to educate developers on XSS.&amp;nbsp; Every one would say to always use &amp;lt;%% = %%&amp;gt; and when devs asked why they could learn about XSS.&amp;nbsp; Education on the matter is probably more important than the framework handling everything.&lt;/p&gt;
&lt;p&gt;I also like the idea of having extension methods to handle the different encodings for HTML, XML, and JavaScript.&amp;nbsp; They are discoverable and easy to use.&lt;/p&gt;</description></item></channel></rss>