Remove deprecated attributes and move to standardized version

This commit is contained in:
Rob Mensching 2021-04-29 15:14:20 -07:00
Родитель ff8f134351
Коммит fcca002ecd
20 изменённых файлов: 1 добавлений и 158 удалений

Просмотреть файл

@ -2,22 +2,4 @@
using System.Diagnostics.CodeAnalysis;
#if NET20
using System.Security;
using System.Security.Permissions;
// SECURITY: The UnmanagedCode assertions in the cabinet classes are safe, because the
// assertions are not propagated through calls to the provided callbacks. So there
// is no way that a partially-trusted malicious client could trick a trusted cabinet
// class into executing its own unmanaged code.
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Assertion=true, UnmanagedCode=true)]
// SECURITY: Review carefully!
// This assembly is designed so that partially trusted callers should be able to
// do cabinet compression and extraction in a file path where they have limited
// file I/O permission. Or they can even do in-memory compression and extraction
// with absolutely no file I/O permission.
[assembly: AllowPartiallyTrustedCallers]
#endif
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "WixToolset.Dtf.Compression.Cab")]

Просмотреть файл

@ -6,7 +6,6 @@ namespace WixToolset.Dtf.Compression.Cab
using System.IO;
using System.Resources;
using System.Globalization;
using System.Security.Permissions;
using System.Runtime.Serialization;
/// <summary>
@ -114,7 +113,6 @@ namespace WixToolset.Dtf.Compression.Cab
/// </summary>
/// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixToolset.Dtf.Compression.Cab
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Security.Permissions;
/// <summary>
/// Object representing a compressed file within a cabinet package; provides operations for getting
@ -72,7 +71,6 @@ namespace WixToolset.Dtf.Compression.Cab
/// <param name="info">The SerializationInfo that holds the serialized object data.</param>
/// <param name="context">The StreamingContext that contains contextual information
/// about the source or destination.</param>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixToolset.Dtf.Compression.Cab
using System;
using System.IO;
using System.Text;
using System.Security.Permissions;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
@ -147,9 +146,6 @@ namespace WixToolset.Dtf.Compression.Cab
this.CheckError(false);
}
[SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")]
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Pack(
IPackStreamContext streamContext,
IEnumerable<string> files,

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixToolset.Dtf.Compression.Cab
using System;
using System.IO;
using System.Text;
using System.Security.Permissions;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
@ -33,9 +32,6 @@ namespace WixToolset.Dtf.Compression.Cab
private Predicate<string> filter;
[SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")]
[SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public CabUnpacker(CabEngine cabEngine)
: base(cabEngine)
{
@ -69,8 +65,6 @@ namespace WixToolset.Dtf.Compression.Cab
}
}
[SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public bool IsArchive(Stream stream)
{
if (stream == null)
@ -86,8 +80,6 @@ namespace WixToolset.Dtf.Compression.Cab
}
}
[SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public IList<ArchiveFileInfo> GetFileInfo(
IUnpackStreamContext streamContext,
Predicate<string> fileFilter)
@ -147,8 +139,6 @@ namespace WixToolset.Dtf.Compression.Cab
}
}
[SuppressMessage("Microsoft.Security", "CA2106:SecureAsserts")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Unpack(
IUnpackStreamContext streamContext,
Predicate<string> fileFilter)

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixToolset.Dtf.Compression.Cab
using System;
using System.Text;
using System.Security;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
@ -170,7 +169,6 @@ internal static class NativeMethods
/// Releases the handle by calling FDIDestroy().
/// </summary>
/// <returns>True if the release succeeded.</returns>
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
protected override bool ReleaseHandle()
{
return FCI.Destroy(this.handle);

Просмотреть файл

@ -2,20 +2,4 @@
using System.Diagnostics.CodeAnalysis;
#if NET20
using System.Security;
using System.Security.Permissions;
// SECURITY: The UnmanagedCode assertions in the zip classes are safe, because
// only some very limited date-time unmanaged APIs are called.
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Assertion = true, UnmanagedCode = true)]
// SECURITY: Review carefully!
// This assembly is designed so that partially trusted callers should be able to
// do zip compression and extraction in a file path where they have limited
// file I/O permission. Or they can even do in-memory compression and extraction
// with absolutely no file I/O permission.
[assembly: AllowPartiallyTrustedCallers]
#endif
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "WixToolset.Dtf.Compression.Zip")]

Просмотреть файл

@ -6,7 +6,6 @@ namespace WixToolset.Dtf.Compression.Zip
using System.IO;
using System.Resources;
using System.Globalization;
using System.Security.Permissions;
using System.Runtime.Serialization;
/// <summary>
@ -53,7 +52,6 @@ namespace WixToolset.Dtf.Compression.Zip
/// </summary>
/// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixToolset.Dtf.Compression.Zip
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Security.Permissions;
/// <summary>
/// Object representing a compressed file within a zip package; provides operations for getting
@ -96,7 +95,6 @@ namespace WixToolset.Dtf.Compression.Zip
/// <param name="info">The SerializationInfo that holds the serialized object data.</param>
/// <param name="context">The StreamingContext that contains contextual information
/// about the source or destination.</param>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);

Просмотреть файл

@ -4,7 +4,6 @@ namespace WixToolset.Dtf.Compression
{
using System;
using System.IO;
using System.Security.Permissions;
using System.Runtime.Serialization;
using System.Diagnostics.CodeAnalysis;
@ -281,7 +280,6 @@ namespace WixToolset.Dtf.Compression
/// object data.</param>
/// <param name="context">The StreamingContext that contains contextual
/// information about the source or destination.</param>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override void GetObjectData(
SerializationInfo info, StreamingContext context)
{

Просмотреть файл

@ -8,7 +8,6 @@ namespace WixToolset.Dtf.Compression
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using System.Security.Permissions;
using System.Runtime.Serialization;
using System.Diagnostics.CodeAnalysis;

Просмотреть файл

@ -1,15 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#if NET20
using System.Security;
using System.Security.Permissions;
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Unrestricted = true)]
// SECURITY: Review carefully!
// This assembly is designed so that partially trusted callers should be able to
// do compression and extraction in a file path where they have limited
// file I/O permission. Or they can even do in-memory compression and extraction
// with absolutely no file I/O permission.
[assembly: AllowPartiallyTrustedCallers]
#endif

Просмотреть файл

@ -2,20 +2,4 @@
using System.Diagnostics.CodeAnalysis;
#if NET20
using System.Security;
using System.Security.Permissions;
// SECURITY: The UnmanagedCode assertions in the resource classes are safe, because
// appropriate demands are made for file I/O permissions before reading/writing files.
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Assertion = true, UnmanagedCode = true)]
// SECURITY: Review carefully!
// This assembly is designed so that partially trusted callers should be able to
// read and write file version info in a path where they have limited
// file I/O permission.
[assembly: AllowPartiallyTrustedCallers]
#endif
[assembly: SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Scope = "member", Target = "WixToolset.Dtf.Resources.ResourceCollection.#System.Collections.Generic.ICollection`1<WixToolset.Dtf.Resources.Resource>.IsReadOnly")]

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixToolset.Dtf.Resources
using System;
using System.IO;
using System.Text;
using System.Security.Permissions;
using System.Reflection;
using System.Collections;
using System.Globalization;
@ -107,14 +106,8 @@ namespace WixToolset.Dtf.Resources
/// Loads the resource data from a file. The file is searched for a resource with matching type, name, and locale.
/// </summary>
/// <param name="file">Win32 PE file containing the resource</param>
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Load(string file)
{
#if NET20
new FileIOPermission(FileIOPermissionAccess.Read, file).Demand();
#endif
IntPtr module = NativeMethods.LoadLibraryEx(file, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_AS_DATAFILE);
try
{
@ -148,14 +141,8 @@ namespace WixToolset.Dtf.Resources
/// Saves the resource to a file. Any existing resource data with matching type, name, and locale is overwritten.
/// </summary>
/// <param name="file">Win32 PE file to contain the resource</param>
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Save(string file)
{
#if NET20
new FileIOPermission(FileIOPermissionAccess.AllAccess, file).Demand();
#endif
IntPtr updateHandle = IntPtr.Zero;
try
{

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixToolset.Dtf.Resources
using System;
using System.IO;
using System.Text;
using System.Security.Permissions;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
@ -45,14 +44,8 @@ namespace WixToolset.Dtf.Resources
/// </summary>
/// <param name="resFile">The file to be searched for resources.</param>
/// <exception cref="IOException">resources could not be read from the file</exception>
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Find(string resFile)
{
#if NET20
new FileIOPermission(FileIOPermissionAccess.Read, resFile).Demand();
#endif
this.Clear();
IntPtr module = NativeMethods.LoadLibraryEx(resFile, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_AS_DATAFILE);
@ -82,14 +75,8 @@ namespace WixToolset.Dtf.Resources
/// <param name="resFile">The file to be searched for resources.</param>
/// <param name="type">The type of resource to search for; may be one of the ResourceType constants or a user-defined type.</param>
/// <exception cref="IOException">resources could not be read from the file</exception>
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Find(string resFile, ResourceType type)
{
#if NET20
new FileIOPermission(FileIOPermissionAccess.Read, resFile).Demand();
#endif
this.Clear();
IntPtr module = NativeMethods.LoadLibraryEx(resFile, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_AS_DATAFILE);
@ -115,14 +102,8 @@ namespace WixToolset.Dtf.Resources
/// <param name="type">The type of resource to search for; may be one of the ResourceType constants or a user-defined type.</param>
/// <param name="name">The name of the resource to search for.</param>
/// <exception cref="IOException">resources could not be read from the file</exception>
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Find(string resFile, ResourceType type, string name)
{
#if NET20
new FileIOPermission(FileIOPermissionAccess.Read, resFile).Demand();
#endif
this.Clear();
IntPtr module = NativeMethods.LoadLibraryEx(resFile, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_AS_DATAFILE);
@ -196,14 +177,8 @@ namespace WixToolset.Dtf.Resources
/// For all resources in the collection, loads their data from a resource file.
/// </summary>
/// <param name="file">The file from which resources are loaded.</param>
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Load(string file)
{
#if NET20
new FileIOPermission(FileIOPermissionAccess.Read, file).Demand();
#endif
IntPtr module = NativeMethods.LoadLibraryEx(file, IntPtr.Zero, NativeMethods.LOAD_LIBRARY_AS_DATAFILE);
try
{
@ -222,14 +197,8 @@ namespace WixToolset.Dtf.Resources
/// For all resources in the collection, saves their data to a resource file.
/// </summary>
/// <param name="file">The file to which resources are saved.</param>
[SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")]
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
public void Save(string file)
{
#if NET20
new FileIOPermission(FileIOPermissionAccess.AllAccess, file).Demand();
#endif
IntPtr updateHandle = IntPtr.Zero;
try
{

Просмотреть файл

@ -1,8 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#if NET20
using System.Security;
using System.Security.Permissions;
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode=true)]
#endif

Просмотреть файл

@ -1,8 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#if NET20
using System.Security;
using System.Security.Permissions;
[assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode = true)]
#endif

Просмотреть файл

@ -7,7 +7,6 @@ namespace WixToolset.Dtf.WindowsInstaller
using System.Text;
using System.Collections.Generic;
using System.Globalization;
using System.Security.Permissions;
using System.Runtime.Serialization;
using System.Diagnostics.CodeAnalysis;
@ -114,7 +113,6 @@ namespace WixToolset.Dtf.WindowsInstaller
/// </summary>
/// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
@ -560,7 +558,6 @@ namespace WixToolset.Dtf.WindowsInstaller
/// </summary>
/// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter=true)]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)

Просмотреть файл

@ -4,7 +4,6 @@ namespace WixToolset.Dtf.WindowsInstaller
{
using System;
using System.Text;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Diagnostics.CodeAnalysis;
@ -301,7 +300,6 @@ internal static class NativeMethods
return msiHandle.handle;
}
[SecurityPermission(SecurityAction.Assert, UnmanagedCode = true)]
protected override bool ReleaseHandle()
{
return RemotableNativeMethods.MsiCloseHandle((int) this.handle) == 0;

Просмотреть файл

@ -1,5 +1,5 @@
{
"version": "4.0",
"version": "4.0.0-preview.0-build.{height}",
"publicReleaseRefSpec": [
"^refs/heads/master$"
],