-
Notifications
You must be signed in to change notification settings - Fork 1.6k
.NET Core samples should not include CAS elements #837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks @danmosemsft. I've added this issue to our security review project. We're hoping to get started on this soon. |
Here's another example, which reminded me.
A bit confusing if you heard that CAS is dead. |
This issue has languished, @danmosemsft, but I'll start addressing it in the next sprint. |
Thanks, @rpetrusha |
@danmosemsft How can I get a list of the CAS types and Security Transparency types? |
https://github.com/dotnet/runtime/blob/master/src/libraries/System.Security.Permissions/ref/System.Security.Permissions.cs seems like a pretty good list @GrabYourPitchforks does that map pretty well to what should not be in samples anymore? |
That list, plus pretty much everything else in the System.Security.Permissions namespace, regardless of which reference assembly defines it. Conveniently, Dan just provided a nice list of every API I want to slap |
The only instances I've found where the CAS types are used for Core snippets are in API ref. There, the same snippet is shown regardless of whether Core or Framework is selected. To remove CAS from the snippet removes it from the Framework 4.x version too. Some options that come to mind:
Given that > 1,000 snippet files are affected, all of these options will involve a significant time investment, # 3 seems least problematic, and # 1 seems questionable whether the benefit would outweigh the cost. |
We haven't supported CAS in .NET Framework for years either. So I think generally (2) would make most sense. I see the size of the task. If I search samples\snippets for The good news is that it doesn't have to be perfect or complete. My suggestion is to look for something like the regex above (possbily improved to straddle lines) and just search and replace it away. Then do the same (using angle brackets) for VB. Then bulk revert anything the seems inappropriate. Then compile and either fix or just revert anything that breaks. I'd imagine you could spend a few hours and make a major dent, if you reverted anything that broke. It does seem like a bunch of work, but after all these years, we should not be encouraging people to continue using these broken things. Thoughts? |
That sounds like a good plan to me, I'll get started on it next week. |
Discussed this issue offline with @GrabYourPitchforks and @danmosemsft. Levi will identify specific categories of changes required, and for each category I'll make a PR that addresses all affected snippets. |
In .NET Core, CAS types (like
FileIOPermission
, etc) and Security Transparency types are stubbed only. CAS is not supported. Therefore the samples in .NET Core topics should not include use of them.For example, in the AppDomain.UnhandledException topic for .NET Core 2.1 it has this sample:
Here
[SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlAppDomain)]
should be removed as it does nothing and implies that CAS is relevant.Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: