PrincipalPermissionAttribute ctor should be obsolete as error #36972
Labels
api-approved
API was approved in API review, it can be implemented
area-System.Security
breaking-change
Issue or PR that represents a breaking API or functional change over a prerelease.
Milestone
We have a few work items to obsolete existing APIs that are legacy / unsupported / disrecommended. In most cases the behaviors of the APIs are either unchanged from their Full Framework implementations or throw
PNSE
when they're invoked.However, per #31279,
PrincipalPermissionAttribute
is a special-case. In Full Framework, this attribute is generally honored by the runtime (even in full trust environments!) and leverages the CAS infrastructure to turn a declarative authn / authz check into a runtime-enforced check. However, in Core, this and other CAS attributes are ignored by the runtime. This leads to a "fail open" scenario.I wanted to split this out from the other API proposals because I think the situation is bad enough where this merits obsoletion as error, and obsoleting an API as error is clearly a breaking change.
API proposal
Of note is that this proposal only contemplates obsoleting the constructor as error. The reason for this is that we want anybody who has slapped a
[PrincipalPermission]
declaration on an API to see the compile-time error. It is not sufficient simply to make the constructor throw PNSE, as the constructor isn't actually invoked at runtime.Marking only the constructor - not the entire type - with "as error" allows scenarios like the below to continue working.
Obsoleting the constructor as error does not prevent us from obsoleting other members (or the type itself) as warning. There is some discussion about doing this to the CAS types all-up. But that's a matter for a different issue. I wanted to focus discussion here on the constructor given the breaking change nature of obsoleting this member as error.
The text was updated successfully, but these errors were encountered: