Expand Minimize

SPC020614: Do not define 'EnvironmentPermission' with 'Unrestricted=true'

The CAS Policy for System.Security.Permissions.EnvironmentPermission with setting 'Unrestricted=true' is not allowed.

CheckId SPC020614
TypeName DoNotDefineUnrestrictedEnvironmentPermission
Severity Error
Type PermissionSet

Remove permission 'EnvironmentPermission' with setting 'Unrestricted=true'.
Bad Practice

<Solution xmlns="http://schemas.microsoft.com/sharepoint/">
  <CodeAccessSecurity>
    <PolicyItem>
      <PermissionSet class="NamedPermissionSet" version="1">
      ...
        <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="True" />
      ...
      </PermissionSet>
    <PolicyItem>
  <CodeAccessSecurity>
</Solution></code

Good Practice
<PermissionSet class="NamedPermissionSet" version="1">
...
  <IPermission class="EnvironmentPermission" version="1" Flags="TEMP; TMP;USERNAME;OS;COMPUTERNAME" />
...
</PermissionSet>

Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of RENCORE AB. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.