Skip to content

Commit

Permalink
Avoid S.S.Permissions dependency in S.S.Crypto.Xml (#58731)
Browse files Browse the repository at this point in the history
Avoid the S.S.Permissions dependency by referencing the
latest available System.Security.AccessControl package
which contans the Evidence types in all tfms in the
System.Security.Cryptography.Xml project.

Add suppression file for Permissions
  • Loading branch information
ViktorHofer authored Sep 7, 2021
1 parent 06b9703 commit d801ae2
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 59 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<SystemRuntimeInteropServicesVersion>4.3.0</SystemRuntimeInteropServicesVersion>
<SystemRuntimeInteropServicesRuntimeInformationVersion>4.3.0</SystemRuntimeInteropServicesRuntimeInformationVersion>
<SystemRuntimeSerializationPrimitivesVersion>4.3.0</SystemRuntimeSerializationPrimitivesVersion>
<SystemSecurityAccessControlVersion>5.0.0</SystemSecurityAccessControlVersion>
<SystemSecurityAccessControlVersion>6.0.0-rc.2.21454.1</SystemSecurityAccessControlVersion>
<SystemSecurityCryptographyAlgorithmsVersion>4.3.1</SystemSecurityCryptographyAlgorithmsVersion>
<SystemSecurityCryptographyCngVersion>5.0.0</SystemSecurityCryptographyCngVersion>
<SystemSecurityCryptographyOpenSslVersion>5.0.0</SystemSecurityCryptographyOpenSslVersion>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -530,3 +530,44 @@ public void SetAudit(System.Security.AccessControl.AuditFlags auditFlags, System
public void SetAudit(System.Security.Principal.SecurityIdentifier sid, System.Security.AccessControl.ObjectAuditRule rule) { }
}
}

namespace System.Security.Policy
{
public sealed partial class Evidence : System.Collections.ICollection, System.Collections.IEnumerable
{
public Evidence() { }
[System.ObsoleteAttribute("This constructor is obsolete. Use the constructor which accepts arrays of EvidenceBase instead.")]
public Evidence(object[] hostEvidence, object[] assemblyEvidence) { }
public Evidence(System.Security.Policy.Evidence evidence) { }
public Evidence(System.Security.Policy.EvidenceBase[] hostEvidence, System.Security.Policy.EvidenceBase[] assemblyEvidence) { }
[System.ObsoleteAttribute("Evidence should not be treated as an ICollection. Use GetHostEnumerator and GetAssemblyEnumerator to iterate over the evidence to collect a count.")]
public int Count { get { throw null; } }
public bool IsReadOnly { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public bool Locked { get { throw null; } set { } }
public object SyncRoot { get { throw null; } }
[System.ObsoleteAttribute("Evidence.AddAssembly has been deprecated. Use AddAssemblyEvidence instead.")]
public void AddAssembly(object id) { }
public void AddAssemblyEvidence<T>(T evidence) where T : System.Security.Policy.EvidenceBase { }
[System.ObsoleteAttribute("Evidence.AddHost has been deprecated. Use AddHostEvidence instead.")]
public void AddHost(object id) { }
public void AddHostEvidence<T>(T evidence) where T : System.Security.Policy.EvidenceBase { }
public void Clear() { }
public System.Security.Policy.Evidence? Clone() { throw null; }
[System.ObsoleteAttribute("Evidence should not be treated as an ICollection. Use the GetHostEnumerator and GetAssemblyEnumerator methods rather than using CopyTo.")]
public void CopyTo(System.Array array, int index) { }
public System.Collections.IEnumerator GetAssemblyEnumerator() { throw null; }
public T? GetAssemblyEvidence<T>() where T : System.Security.Policy.EvidenceBase { throw null; }
[System.ObsoleteAttribute("GetEnumerator is obsolete. Use GetAssemblyEnumerator and GetHostEnumerator instead.")]
public System.Collections.IEnumerator GetEnumerator() { throw null; }
public System.Collections.IEnumerator GetHostEnumerator() { throw null; }
public T? GetHostEvidence<T>() where T : System.Security.Policy.EvidenceBase { throw null; }
public void Merge(System.Security.Policy.Evidence evidence) { }
public void RemoveType(System.Type t) { }
}
public abstract partial class EvidenceBase
{
protected EvidenceBase() { }
public virtual System.Security.Policy.EvidenceBase? Clone() { throw null; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Security.AccessControl.cs" />
<Compile Include="System.Security.AccessControl.Evidence.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<ProjectReference Include="$(LibrariesProjectRoot)System.Xml.ReaderWriter\ref\System.Xml.ReaderWriter.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\ref\System.Security.Permissions.csproj" />
<PackageReference Include="System.Security.AccessControl" Version="$(SystemSecurityAccessControlVersion)" />
<!-- Manually reference the transitive dependency to make NuGet pick the package over the transitive project: https://github.com/NuGet/Home/issues/10368 -->
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<Reference Include="System.Security" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ System.Security.Cryptography.Xml.XmlLicenseTransform</PackageDescription>
<Compile Include="$(CommonPath)System\HexConverter.cs"
Link="Common\System\HexConverter.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Permissions\src\System.Security.Permissions.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Security.Cryptography.Pkcs\src\System.Security.Cryptography.Pkcs.csproj" />
</ItemGroup>
Expand All @@ -154,6 +151,7 @@ System.Security.Cryptography.Xml.XmlLicenseTransform</PackageDescription>
<Reference Include="System.Xml.XPath" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Security.AccessControl" Version="$(SystemSecurityAccessControlVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
<!-- Manually reference the transitive dependency to make NuGet pick the package over the transitive project: https://github.com/NuGet/Home/issues/10368 -->
<PackageReference Include="System.Numerics.Vectors" Version="$(SystemNumericsVectorsVersion)" PrivateAssets="all" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityPermissionAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Permissions.SecurityPermissionFlag))]
#if NET6_0_OR_GREATER
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Policy.Evidence))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.Policy.EvidenceBase))]
#endif
#if NETCOREAPP
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.IStackWalk))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Security.PermissionSet))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<Compile Include="System.Security.Permissions.cs" Condition="'$(TargetFramework)' != 'net461'" />
<Compile Include="System.Security.Permissions.Forwards.cs" Condition="'$(TargetFramework)' != 'net461'" />
<Compile Include="System.Security.Permissions.netcoreapp.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
<Compile Include="$(LibrariesProjectRoot)System.Security.AccessControl\ref\System.Security.AccessControl.Evidence.cs" Condition="'$(TargetFramework)' != 'net461' and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))" />
<Compile Include="System.Security.Permissions.net461.cs" Condition="'$(TargetFramework)' == 'net461'" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,88 @@
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.Evidence</Target>
<Left>ref/net5.0/System.Security.Permissions.dll</Left>
<Right>lib/net5.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.EvidenceBase</Target>
<Left>ref/net5.0/System.Security.Permissions.dll</Left>
<Right>lib/net5.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.Evidence</Target>
<Left>ref/netcoreapp3.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.EvidenceBase</Target>
<Left>ref/netcoreapp3.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.Evidence</Target>
<Left>ref/netstandard2.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.EvidenceBase</Target>
<Left>ref/netstandard2.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.Evidence</Target>
<Left>lib/net5.0/System.Security.Permissions.dll</Left>
<Right>lib/net5.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.EvidenceBase</Target>
<Left>lib/net5.0/System.Security.Permissions.dll</Left>
<Right>lib/net5.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.Evidence</Target>
<Left>lib/netcoreapp3.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.EvidenceBase</Target>
<Left>lib/netcoreapp3.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.Evidence</Target>
<Left>lib/netstandard2.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:System.Security.Policy.EvidenceBase</Target>
<Left>lib/netstandard2.0/System.Security.Permissions.dll</Left>
<Right>lib/netstandard2.0/System.Security.Permissions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@
<Compile Include="System\Security\Policy\ApplicationVersionMatch.cs" />
<Compile Include="System\Security\Policy\CodeConnectAccess.cs" />
<Compile Include="System\Security\Policy\CodeGroup.cs" />
<Compile Include="$(LibrariesProjectRoot)System.Security.AccessControl\src\System\Security\Policy\Evidence.cs" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))" />
<Compile Include="$(LibrariesProjectRoot)System.Security.AccessControl\src\System\Security\Policy\EvidenceBase.cs" Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))" />
<Compile Include="System\Security\Policy\FileCodeGroup.cs" />
<Compile Include="System\Security\Policy\FirstMatchCodeGroup.cs" />
<Compile Include="System\Security\Policy\GacInstalled.cs" />
Expand Down

0 comments on commit d801ae2

Please sign in to comment.