Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Strip out SecurityCritical attributes #14383

Merged
merged 1 commit into from
Dec 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ private SafeSharedX509NameStackHandle() :
}
}

[SecurityCritical]
internal sealed class SafeX509NameStackHandle : SafeHandle
{
private SafeX509NameStackHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ internal partial class Kernel32
/// "lpt1:", etc. Use this to avoid security problems, like allowing a web client asking a server
/// for "http://server/com1.aspx" and then causing a worker process to hang.
/// </summary>
[System.Security.SecurityCritical] // auto-generated
internal static SafeFileHandle SafeCreateFile(
String lpFileName,
int dwDesiredAccess,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ internal partial class Interop
{
internal partial class Kernel32
{
[System.Security.SecurityCritical] // auto-generated
internal static SafeFileHandle UnsafeCreateFile(
string lpFileName,
int dwDesiredAccess,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeAsn1ObjectHandle : SafeHandle
{
private SafeAsn1ObjectHandle() :
Expand All @@ -29,7 +28,6 @@ public override bool IsInvalid
}
}

[SecurityCritical]
internal sealed class SafeAsn1BitStringHandle : SafeHandle
{
private SafeAsn1BitStringHandle() :
Expand All @@ -50,7 +48,6 @@ public override bool IsInvalid
}
}

[SecurityCritical]
internal sealed class SafeAsn1OctetStringHandle : SafeHandle
{
private SafeAsn1OctetStringHandle() :
Expand All @@ -71,7 +68,6 @@ public override bool IsInvalid
}
}

[SecurityCritical]
internal sealed class SafeAsn1StringHandle : SafeHandle
{
private SafeAsn1StringHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeBignumHandle : SafeHandle
{
private SafeBignumHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeBioHandle : SafeHandle
{
private SafeHandle _parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace Microsoft.Win32.SafeHandles
/// if a Create* function is called, the caller must also CFRelease
/// on the same pointer in order to correctly free the memory.
/// </summary>
[System.Security.SecurityCritical]
internal sealed partial class SafeCreateHandle : SafeHandle
{
internal SafeCreateHandle() : base(IntPtr.Zero, true) { }
Expand All @@ -23,7 +22,6 @@ internal SafeCreateHandle(IntPtr ptr) : base(IntPtr.Zero, true)
this.SetHandle(ptr);
}

[System.Security.SecurityCritical]
protected override bool ReleaseHandle()
{
Interop.CoreFoundation.CFRelease(handle);
Expand All @@ -33,7 +31,6 @@ protected override bool ReleaseHandle()

public override bool IsInvalid
{
[System.Security.SecurityCritical]
get
{
return handle == IntPtr.Zero;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeDsaHandle : SafeHandle
{
private SafeDsaHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeEcKeyHandle : SafeHandle
{
private SafeEcKeyHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace Microsoft.Win32.SafeHandles
/// and CFRelease to free; however, FSEventStream has it's own release
/// function, so we need to extend the pattern to account for that.
/// </summary>
[System.Security.SecurityCritical]
internal sealed partial class SafeEventStreamHandle : SafeHandle
{
internal SafeEventStreamHandle() : base(IntPtr.Zero, true) { }
Expand All @@ -24,7 +23,6 @@ internal SafeEventStreamHandle(IntPtr ptr) : base(IntPtr.Zero, true)
this.SetHandle(ptr);
}

[System.Security.SecurityCritical]
protected override bool ReleaseHandle()
{
Interop.EventStream.FSEventStreamStop(handle);
Expand All @@ -36,7 +34,6 @@ protected override bool ReleaseHandle()

public override bool IsInvalid
{
[System.Security.SecurityCritical]
get
{
return handle == IntPtr.Zero;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeEvpCipherCtxHandle : SafeHandle
{
private SafeEvpCipherCtxHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}

[SecurityCritical]
protected override bool ReleaseHandle()
{
Interop.Crypto.EvpCipherDestroy(handle);
Expand All @@ -26,7 +24,6 @@ protected override bool ReleaseHandle()

public override bool IsInvalid
{
[SecurityCritical]
get { return handle == IntPtr.Zero; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeEvpMdCtxHandle : SafeHandle
{
private SafeEvpMdCtxHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}

[SecurityCritical]
protected override bool ReleaseHandle()
{
Interop.Crypto.EvpMdCtxDestroy(handle);
Expand All @@ -25,7 +23,6 @@ protected override bool ReleaseHandle()

public override bool IsInvalid
{
[SecurityCritical]
get { return handle == IntPtr.Zero; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Microsoft.Win32.SafeHandles
{
[System.Security.SecurityCritical]
sealed partial class SafeFileHandle : SafeHandle
{
/// <summary>A handle value of -1.</summary>
Expand Down Expand Up @@ -80,7 +79,6 @@ internal static SafeFileHandle Open(Func<SafeFileHandle> fdFunc)
return handle;
}

[System.Security.SecurityCritical]
protected override bool ReleaseHandle()
{
// When the SafeFileHandle was opened, we likely issued an flock on the created descriptor in order to add
Expand Down Expand Up @@ -108,7 +106,6 @@ protected override bool ReleaseHandle()

public override bool IsInvalid
{
[System.Security.SecurityCritical]
get
{
long h = (long)handle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeRsaHandle : SafeHandle
{
private SafeRsaHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeX509Handle : SafeHandle
{
internal static readonly SafeX509Handle InvalidHandle = new SafeX509Handle();
Expand All @@ -19,7 +18,6 @@ private SafeX509Handle() :
{
}

[SecurityCritical]
protected override bool ReleaseHandle()
{
Interop.Crypto.X509Destroy(handle);
Expand All @@ -29,7 +27,6 @@ protected override bool ReleaseHandle()

public override bool IsInvalid
{
[SecurityCritical]
get { return handle == IntPtr.Zero; }
}
}
Expand All @@ -54,7 +51,6 @@ public override bool IsInvalid
}
}

[SecurityCritical]
internal sealed class SafeX509StoreHandle : SafeHandle
{
private SafeX509StoreHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeX509NameHandle : SafeHandle
{
private SafeX509NameHandle() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Microsoft.Win32.SafeHandles
{
[SecurityCritical]
internal sealed class SafeX509ExtensionHandle : SafeHandle
{
private SafeX509ExtensionHandle() :
Expand All @@ -29,7 +28,6 @@ public override bool IsInvalid
}
}

[SecurityCritical]
internal sealed class SafeEkuExtensionHandle : SafeHandle
{
private SafeEkuExtensionHandle() :
Expand Down
2 changes: 0 additions & 2 deletions src/Common/src/System/Diagnostics/Debug.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ static partial class Debug

internal sealed class WindowsDebugLogger : IDebugLogger
{
[SecuritySafeCritical]
public void ShowAssertDialog(string stackTrace, string message, string detailMessage)
{
if (Debugger.IsAttached)
Expand Down Expand Up @@ -60,7 +59,6 @@ public void WriteCore(string message)
}
}

[System.Security.SecuritySafeCritical]
private static void WriteToDebugger(string message)
{
if (Debugger.IsLogging())
Expand Down
1 change: 0 additions & 1 deletion src/Common/src/System/Diagnostics/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public static void Assert(bool condition, string message)
}

[System.Diagnostics.Conditional("DEBUG")]
[System.Security.SecuritySafeCritical]
public static void Assert(bool condition, string message, string detailMessage)
{
if (!condition)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace System
{
static partial class StringNormalizationExtensions
{
[SecurityCritical]
public static bool IsNormalized(this string strInput, NormalizationForm normalizationForm)
{
if (strInput == null)
Expand Down Expand Up @@ -46,7 +45,6 @@ public static bool IsNormalized(this string strInput, NormalizationForm normaliz
return result;
}

[SecurityCritical]
public static string Normalize(this string strInput, NormalizationForm normalizationForm)
{
if (strInput == null)
Expand Down
3 changes: 0 additions & 3 deletions src/Microsoft.VisualBasic/ref/Microsoft.VisualBasic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,8 @@ public OptionTextAttribute() { }
public sealed partial class ProjectData
{
internal ProjectData() { }
[System.Security.SecuritySafeCriticalAttribute]
public static void ClearProjectError() { }
[System.Security.SecuritySafeCriticalAttribute]
public static void SetProjectError(System.Exception ex) { }
[System.Security.SecuritySafeCriticalAttribute]
public static void SetProjectError(System.Exception ex, int lErl) { }
}
[System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited = false, AllowMultiple = false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace Microsoft.Win32
{
[System.Security.SecurityCriticalAttribute]
public static partial class RegistryAclExtensions
{
public static System.Security.AccessControl.RegistrySecurity GetAccessControl(this Microsoft.Win32.RegistryKey key) { throw null; }
Expand All @@ -18,7 +17,6 @@ public static void SetAccessControl(this Microsoft.Win32.RegistryKey key, System
}
namespace System.Security.AccessControl
{
[System.Security.SecurityCriticalAttribute]
public sealed partial class RegistryAccessRule : System.Security.AccessControl.AccessRule
{
public RegistryAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.RegistryRights registryRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
Expand All @@ -27,14 +25,12 @@ public sealed partial class RegistryAccessRule : System.Security.AccessControl.A
public RegistryAccessRule(string identity, System.Security.AccessControl.RegistryRights registryRights, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
public System.Security.AccessControl.RegistryRights RegistryRights { get { throw null; } }
}
[System.Security.SecurityCriticalAttribute]
public sealed partial class RegistryAuditRule : System.Security.AccessControl.AuditRule
{
public RegistryAuditRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.RegistryRights registryRights, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AuditFlags)) { }
public RegistryAuditRule(string identity, System.Security.AccessControl.RegistryRights registryRights, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AuditFlags)) { }
public System.Security.AccessControl.RegistryRights RegistryRights { get { throw null; } }
}
[System.Security.SecurityCriticalAttribute]
public sealed partial class RegistrySecurity : System.Security.AccessControl.NativeObjectSecurity
{
public RegistrySecurity() : base(default(bool), default(System.Security.AccessControl.ResourceType)) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public static RegistrySecurity GetAccessControl(this RegistryKey key)
return GetAccessControl(key, AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
}

[SecuritySafeCritical]
public static RegistrySecurity GetAccessControl(this RegistryKey key, AccessControlSections includeSections)
{
if (key.Handle == null)
Expand All @@ -26,7 +25,6 @@ public static RegistrySecurity GetAccessControl(this RegistryKey key, AccessCont
return new RegistrySecurity(key.Handle, key.Name, includeSections);
}

[SecuritySafeCritical]
public static void SetAccessControl(this RegistryKey key, RegistrySecurity registrySecurity)
{
if (registrySecurity == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ public RegistrySecurity()
{
}

[SecurityCritical]
internal RegistrySecurity(SafeRegistryHandle hKey, string name, AccessControlSections includeSections)
: base(true, ResourceType.RegistryKey, hKey, includeSections, _HandleErrorCode, null)
{
}

[SecurityCritical]
private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
{
Exception exception = null;
Expand Down Expand Up @@ -159,7 +157,6 @@ internal AccessControlSections GetAccessControlSectionsFromChanges()
return persistRules;
}

[SecurityCritical]
internal void Persist(SafeRegistryHandle hKey, string keyName)
{
WriteLock();
Expand Down
Loading