<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx</link><description>With all the changes in the security system of .NET 4, the question frequently arises “so, is CAS dead now?”. One of the reasons that this question comes up so frequently, is that the term CAS in the .NET 1 security model was overloaded to refer to many</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx#10216570</link><pubDate>Mon, 26 Sep 2011 10:12:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10216570</guid><dc:creator>Sviver</dc:creator><description>&lt;p&gt;Hello Shawn,&lt;/p&gt;
&lt;p&gt;Though there has recently been no activity on the blog, I hope you are still getting a notification about my new post and will read it.&lt;/p&gt;
&lt;p&gt;I have read a lot about CAS now, your blog was one of the most understandable ones. However, there are a few things I still don&amp;#39;t get - or actually I fear I get it, and what I want to achieve is not possible...&lt;/p&gt;
&lt;p&gt;Currently we have a .NET 2.0 solution which looks like this:&lt;/p&gt;
&lt;p&gt;- A signed ActiveX component written in .NET which needs permission to access local files&lt;/p&gt;
&lt;p&gt;- ActiveX is embedded in intranet site&lt;/p&gt;
&lt;p&gt;- Assembly is not installed to the GAC but downloaded directly from the server so we can easily roll out updates&lt;/p&gt;
&lt;p&gt;- An MSI package setting .NET runtime security polcies so that the assembly has local file access permission based on the certificate it is signed with. This package only needs to be installed once of course.&lt;/p&gt;
&lt;p&gt;All is running fine.&lt;/p&gt;
&lt;p&gt;Now if I change to .NET 4.0, including the new security model, the permissions granted to the assembly are decided by the host, in this case Internet Explorer. Any policies defined with caspol.exe will not be taken into account. My ActiveX will be run in a sandbox without any file local access permission.&lt;/p&gt;
&lt;p&gt;I have not yet found any way to let Internet Explorer know, that my partical assembly shall be executed in a &amp;quot;privileged sandbox&amp;quot;.&lt;/p&gt;
&lt;p&gt;Is there any way to achieve this? Can SRP be parametrized in a way that it will not restrict software, but instead allow extra permissions? Does it work within Internet Explorer also?&lt;/p&gt;
&lt;p&gt;Or do I have to stay with the &amp;lt;NetFx40_LegacySecurityPolicy&amp;gt; forever? Will that be supported in future, or will it be obsolete and run out with time?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Oliver&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10216570" width="1" height="1"&gt;</description></item><item><title>re: Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx#10216569</link><pubDate>Mon, 26 Sep 2011 10:11:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10216569</guid><dc:creator>Sviver</dc:creator><description>&lt;p&gt;Hello Shawn,&lt;/p&gt;
&lt;p&gt;Though there has recently been no activity on the blog, I hope you are still getting a notification about my new post and will read it.&lt;/p&gt;
&lt;p&gt;I have read a lot about CAS now, your blog was one of the most understandable ones. However, there are a few things I still don&amp;#39;t get - or actually I fear I get it, and what I want to achieve is not possible...&lt;/p&gt;
&lt;p&gt;Currently we have a .NET 2.0 solution which looks like this:&lt;/p&gt;
&lt;p&gt;- A signed ActiveX component written in .NET which needs permission to access local files&lt;/p&gt;
&lt;p&gt;- ActiveX is embedded in intranet site&lt;/p&gt;
&lt;p&gt;- Assembly is not installed to the GAC but downloaded directly from the server so we can easily roll out updates&lt;/p&gt;
&lt;p&gt;- An MSI package setting .NET runtime security polcies so that the assembly has local file access permission based on the certificate it is signed with. This package only needs to be installed once of course.&lt;/p&gt;
&lt;p&gt;All is running fine.&lt;/p&gt;
&lt;p&gt;Now if I change to .NET 4.0, including the new security model, the permissions granted to the assembly are decided by the host, in this case Internet Explorer. Any policies defined with caspol.exe will not be taken into account. My ActiveX will be run in a sandbox without any file local access permission.&lt;/p&gt;
&lt;p&gt;I have not yet found any way to let Internet Explorer know, that my partical assembly shall be executed in a &amp;quot;privileged sandbox&amp;quot;.&lt;/p&gt;
&lt;p&gt;Is there any way to achieve this? Can SRP be parametrized in a way that it will not restrict software, but instead allow extra permissions? Does it work within Internet Explorer also?&lt;/p&gt;
&lt;p&gt;Or do I have to stay with the &amp;lt;NetFx40_LegacySecurityPolicy&amp;gt; forever? Will that be supported in future, or will it be obsolete and run out with time?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Oliver&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10216569" width="1" height="1"&gt;</description></item><item><title>re: Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx#9988979</link><pubDate>Thu, 01 Apr 2010 16:41:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9988979</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;Thanks Shawn, so it was OK pre-v4 because only the VS designer (full trust) would use our designer code.&lt;/p&gt;
&lt;p&gt;But now, even though asp.net doesn't use the designer code, that inheritance check is still performed.&lt;/p&gt;
&lt;p&gt;Sounds like will have to separate out the designer stuff into a different assembly.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Jim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9988979" width="1" height="1"&gt;</description></item><item><title>re: Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx#9988446</link><pubDate>Wed, 31 Mar 2010 22:58:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9988446</guid><dc:creator>shawnfa</dc:creator><description>&lt;p&gt;Hi Jim,&lt;/p&gt;
&lt;p&gt;If your control assembly is partially trusted (for instance, it loads into the partial trust web app but is not loaded from the GAC), then it can never contain security critical or safe critical code. &amp;nbsp;In fact, the CLR will ignore all transparency attributes it finds in the code itself and treat the assembly as if it were marked [assembly: SecurityTransparent]. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Therefore, if you mark your type wtih [SecurityCritical] it's really having no effect at all - although if you were a fully trusted APTCA library that would be exactly the correct solution.&lt;/p&gt;
&lt;p&gt;The reason that the legacy level 1 rule makes this error go away is that level 1 transparency did not enforce any sort of inheritance rules at all - since level 1 is ther to be compatible with the v2 transparency model, it also cannot enforce inheritance rules.&lt;/p&gt;
&lt;p&gt;-Shawn&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9988446" width="1" height="1"&gt;</description></item><item><title>re: Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx#9988285</link><pubDate>Wed, 31 Mar 2010 18:21:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9988285</guid><dc:creator>Jim</dc:creator><description>&lt;p&gt;Shawn, a question if you don't mind.&lt;/p&gt;
&lt;p&gt;Let's say you build an ASP.NET control library, for use in less than full trust level web apps.&lt;/p&gt;
&lt;p&gt;Your only exposure to SecurityCritical code is through your inheritance of the framework's ControlDesigner class.&lt;/p&gt;
&lt;p&gt;When running the app. you'll see the exception&lt;/p&gt;
&lt;p&gt;&amp;quot;Inheritance security rules violated by type: 'ABC'. Derived types must either match the security accessibility of the base type or be less accessible&amp;quot;&lt;/p&gt;
&lt;p&gt;This means you should add SecurityCritical to your type ABC - however it doesn't resolve the problem. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;If however you mark the assembly with &amp;quot;level 1&amp;quot; transparency, it will work (regardless of marking SecurityCritical on the type 'ABC'.&lt;/p&gt;
&lt;p&gt;APTCA is also set.&lt;/p&gt;
&lt;p&gt;If Level 1 is legacy, then what would be the correct way to do this for v4?&lt;/p&gt;
&lt;p&gt;Initially I thought that this situation was the same as bridging between transparent and securitycritical, using securitysafecritical, but making that doesn't seem to apply to subclasses.&lt;/p&gt;
&lt;p&gt;It seems like the runtime is saying &amp;quot;your subclass needs to be securitycritical&amp;quot;, but, when we set the assembly to level 2, that's when the check kicks in and it decides &amp;quot;if the app. is partially trusted, it cannot use this assembly&amp;quot;.&lt;/p&gt;
&lt;p&gt;Am I understanding it correctly?&lt;/p&gt;
&lt;p&gt;If I just leave the assembly as level 1, then it all seems to be OK - but what's the drawback? &amp;nbsp;Level 1 might be dropped in next ver?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Jim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9988285" width="1" height="1"&gt;</description></item><item><title>re: Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx#9969563</link><pubDate>Thu, 25 Feb 2010 22:05:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9969563</guid><dc:creator>shawnfa</dc:creator><description>&lt;p&gt;The security model is a pretty large topic ... I'd recommend this blog as a starting point, it's got a lot of information about how things used to be and I've been writing recently about what we're changing in v4. &amp;nbsp; You could also check out MSDN (for instnace &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/dd233103"&gt;http://msdn.microsoft.com/en-us/library/dd233103&lt;/a&gt;(VS.100).aspx) for some other details.&lt;/p&gt;
&lt;p&gt;-Shawn &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9969563" width="1" height="1"&gt;</description></item><item><title>re: Is CAS dead in .NET 4?</title><link>http://blogs.msdn.com/b/shawnfa/archive/2010/02/24/so-is-cas-dead-in-net-4-or-what.aspx#9968988</link><pubDate>Thu, 25 Feb 2010 01:16:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9968988</guid><dc:creator>Ben</dc:creator><description>&lt;p&gt;Reading this interesting blog post, I realized there is a lot of things I didn't know. Could you point me to some resources explaining how the security model in .NET 2.0 (and 3.5 I guess) works and how it works in .NET 4.0. I would greatly appreciate!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9968988" width="1" height="1"&gt;</description></item></channel></rss>