Skip to content
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

Remove [SecurityCritical] and [SecuritySafeCritical] attributes #18938

Closed
danmoseley opened this issue Oct 12, 2016 · 10 comments
Closed

Remove [SecurityCritical] and [SecuritySafeCritical] attributes #18938

danmoseley opened this issue Oct 12, 2016 · 10 comments
Labels
area-Meta enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors
Milestone

Comments

@danmoseley
Copy link
Member

Security transparency will not be implemented in CoreFX, and use of these attributes can be removed throughout.

@danmoseley
Copy link
Member Author

Same applies for eg [SecurityTransparent] but I don't really see use of that.

@danmoseley danmoseley changed the title Remove [System.Security.SecurityCritical] attributes Remove [SecurityCritical] and [SecuritySafeCritical] attributes Oct 12, 2016
@danmoseley
Copy link
Member Author

Also [ComVisible] can be removed

@morganbr
Copy link
Contributor

Any assemblies that can also be used on .NET Framework need to keep their attributes or they may break.

@hughbe
Copy link
Contributor

hughbe commented Oct 15, 2016

@morganbr how does one identify which assembly can be used on .NET fx?

@jkotas
Copy link
Member

jkotas commented Oct 15, 2016

  • In reference assemblies ie. ...\ref...*.cs, SecuritySafeCritical attributes can be always removed (they have no impact on the contract) and SecurityCritical attributes should always stay (I believe that some of the tooling looks at them in reference assemblies)
  • In implementation assemblies ie ...\src...*.cs, the SecuritySafeCritical/SecurityCritical annotations are only needed if:
    • The files are built as OOB for desktop (the .cs files are included in the build unconditionally or for net46x TargetGroup) AND
    • The assembly is opted into security transparency. It is done via assembly level attribute like [assembly: SecurityTransparentAttribute]

(Edit) The assemblies in this category are: System.Collections.Immutable, System.IO.Compression and System.Net.Http - so we need to be careful about cleaning it up from those. It should be fine to clean it up everywhere else.

@hughbe
Copy link
Contributor

hughbe commented Oct 15, 2016

@jkotas cheers, and what about ComVisible?

@jkotas
Copy link
Member

jkotas commented Oct 15, 2016

There are a few cases where ComVisible is needed for tests, or other corner cases; but it should be fine to remove otherwise. It was scrubbed once already (dotnet/corefx#782), so there are not that many files that have it.

@morganbr
Copy link
Contributor

The assembly is opted into security transparency

The assembly attributes for that are SecurityTransparent, SecurityCritical, and AllowPartiallyTrustedCallers.

@JeremyKuhne JeremyKuhne self-assigned this Dec 10, 2016
@karelz
Copy link
Member

karelz commented Jan 29, 2017

@JeremyKuhne are you still working on it? Or should we flip it back to "up for grabs"?

@danmoseley danmoseley assigned danmoseley and unassigned JeremyKuhne Feb 9, 2017
@danmoseley danmoseley removed their assignment Mar 4, 2017
@weshaggard
Copy link
Member

When we find cases where we need to keep the attributes for at least one build configuration can we please just keep it for all configurations instead of #ifdef'ing them like we are doing in dotnet/corefx#17262 (comment)

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.1.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Meta enhancement Product code improvement that does NOT require public API changes/additions help wanted [up-for-grabs] Good issue for external contributors
Projects
None yet
Development

No branches or pull requests

8 participants