From 259e59e4a73b7e9ff3ca257faea7612447ac84c0 Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 11:06:39 +0200 Subject: [PATCH 01/10] Remove redundant security transparency level 2 attrs Reasons for removal have been stated in the following GitHub issue: https://github.com/castleproject/Core/issues/477 --- README.md | 2 +- buildscripts/CommonAssemblyInfo.cs | 5 --- .../Core/Internal/PermissionUtil.cs | 3 -- .../Core/Logging/LevelFilteredLogger.cs | 6 ---- src/Castle.Core/Core/Logging/TraceLogger.cs | 21 ----------- .../Core/Logging/TraceLoggerFactory.cs | 16 --------- .../Core/Smtp/DefaultSmtpSender.cs | 19 ---------- .../Generators/Emitters/StrongNameUtil.cs | 3 -- .../DynamicProxy/ProxyGenerationOptions.cs | 6 ---- .../DynamicProxy/ProxyGenerator.cs | 4 --- .../Serialization/ProxyObjectReference.cs | 36 ------------------- 11 files changed, 1 insertion(+), 120 deletions(-) diff --git a/README.md b/README.md index a1707b0797..32a9b7facc 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Symbol | .NET 4.5 | .NET Standard 2.x * `FEATURE_ASSEMBLYBUILDER_SAVE` - enabled support for saving the dynamically generated proxy assembly. * `FEATURE_EVENTLOG` - provides a diagnostics logger using the Windows Event Log. * `FEATURE_REMOTING` - supports remoting on various types including inheriting from MarshalByRefObject. -* `FEATURE_SECURITY_PERMISSIONS` - enables the use of CAS and Security[Critical|SafeCritical|Transparent]. +* `FEATURE_SECURITY_PERMISSIONS` - enables the use of CAS. * `FEATURE_SERIALIZATION` - enables support for serialization of dynamic proxies and other types. * `FEATURE_SYSTEM_CONFIGURATION` - enables features that use System.Configuration and the ConfigurationManager. * `FEATURE_TEST_COM` - enables COM Interop tests. diff --git a/buildscripts/CommonAssemblyInfo.cs b/buildscripts/CommonAssemblyInfo.cs index 8b636ea468..5b390f7a2d 100644 --- a/buildscripts/CommonAssemblyInfo.cs +++ b/buildscripts/CommonAssemblyInfo.cs @@ -14,11 +14,6 @@ using System; using System.Runtime.InteropServices; -using System.Security; [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] - -#if FEATURE_SECURITY_PERMISSIONS -[assembly: SecurityRules(SecurityRuleSet.Level2)] -#endif diff --git a/src/Castle.Core/Core/Internal/PermissionUtil.cs b/src/Castle.Core/Core/Internal/PermissionUtil.cs index 0f303f14a3..b02747f7f9 100644 --- a/src/Castle.Core/Core/Internal/PermissionUtil.cs +++ b/src/Castle.Core/Core/Internal/PermissionUtil.cs @@ -22,9 +22,6 @@ namespace Castle.Core.Internal public static class PermissionUtil { -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public static bool IsGranted(this IPermission permission) { var permissionSet = new PermissionSet(PermissionState.None); diff --git a/src/Castle.Core/Core/Logging/LevelFilteredLogger.cs b/src/Castle.Core/Core/Logging/LevelFilteredLogger.cs index a49f91831e..47f0a13d8a 100644 --- a/src/Castle.Core/Core/Logging/LevelFilteredLogger.cs +++ b/src/Castle.Core/Core/Logging/LevelFilteredLogger.cs @@ -16,9 +16,6 @@ namespace Castle.Core.Logging { using System; using System.Globalization; -#if FEATURE_SECURITY_PERMISSIONS - using System.Security; -#endif /// /// The Level Filtered Logger class. This is a base class which @@ -63,9 +60,6 @@ protected LevelFilteredLogger(String loggerName, LoggerLevel loggerLevel) : this /// /// Keep the instance alive in a remoting scenario /// -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif public override object InitializeLifetimeService() { return null; diff --git a/src/Castle.Core/Core/Logging/TraceLogger.cs b/src/Castle.Core/Core/Logging/TraceLogger.cs index 767946fac4..6c39c80b19 100644 --- a/src/Castle.Core/Core/Logging/TraceLogger.cs +++ b/src/Castle.Core/Core/Logging/TraceLogger.cs @@ -17,9 +17,6 @@ namespace Castle.Core.Logging using System; using System.Diagnostics; using System.Collections.Generic; -#if FEATURE_SECURITY_PERMISSIONS - using System.Security; -#endif /// /// The TraceLogger sends all logging to the System.Diagnostics.TraceSource @@ -47,9 +44,6 @@ public class TraceLogger : LevelFilteredLogger /// Build a new trace logger based on the named TraceSource /// /// The name used to locate the best TraceSource. In most cases comes from the using type's fullname. -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public TraceLogger(string name) : base(name) { @@ -63,9 +57,6 @@ public TraceLogger(string name) /// The name used to locate the best TraceSource. In most cases comes from the using type's fullname. /// The default logging level at which this source should write messages. In almost all cases this /// default value will be overridden in the config file. -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public TraceLogger(string name, LoggerLevel level) : base(name, level) { @@ -79,17 +70,11 @@ public TraceLogger(string name, LoggerLevel level) /// /// The Subname of this logger. /// The New ILogger instance. -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public override ILogger CreateChildLogger(string loggerName) { return InternalCreateChildLogger(loggerName); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private ILogger InternalCreateChildLogger(string loggerName) { return new TraceLogger(string.Concat(Name, ".", loggerName), Level); @@ -107,9 +92,6 @@ protected override void Log(LoggerLevel loggerLevel, string loggerName, string m } } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private void Initialize() { lock (cache) @@ -172,9 +154,6 @@ private static string ShortenName(string name) return null; } -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif private static bool IsSourceConfigured(TraceSource source) { if (source.Listeners.Count == 1 && diff --git a/src/Castle.Core/Core/Logging/TraceLoggerFactory.cs b/src/Castle.Core/Core/Logging/TraceLoggerFactory.cs index 9bf05a164d..0604d62fb6 100644 --- a/src/Castle.Core/Core/Logging/TraceLoggerFactory.cs +++ b/src/Castle.Core/Core/Logging/TraceLoggerFactory.cs @@ -14,10 +14,6 @@ namespace Castle.Core.Logging { -#if FEATURE_SECURITY_PERMISSIONS - using System.Security; -#endif - /// /// Used to create the TraceLogger implementation of ILogger interface. See . /// @@ -34,9 +30,6 @@ public TraceLoggerFactory(LoggerLevel level) this.level = level; } -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public override ILogger Create(string name) { if (level.HasValue) @@ -46,25 +39,16 @@ public override ILogger Create(string name) return InternalCreate(name); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private ILogger InternalCreate(string name) { return new TraceLogger(name); } -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public override ILogger Create(string name, LoggerLevel level) { return InternalCreate(name, level); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private ILogger InternalCreate(string name, LoggerLevel level) { return new TraceLogger(name, level); diff --git a/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs b/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs index 276ae26ee9..e11ca30ac7 100644 --- a/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs +++ b/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs @@ -22,7 +22,6 @@ namespace Castle.Core.Smtp using System.Net; using System.Net.Mail; #if FEATURE_SECURITY_PERMISSIONS - using System.Security; using System.Security.Permissions; #endif using Castle.Core.Internal; @@ -115,9 +114,6 @@ public bool UseSsl /// To field /// e-mail's subject /// message's body -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public void Send(String from, String to, String subject, String messageText) { if (from == null) throw new ArgumentNullException("from"); @@ -133,17 +129,11 @@ public void Send(String from, String to, String subject, String messageText) /// /// If the message is null /// Message instance -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public void Send(MailMessage message) { InternalSend(message); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private void InternalSend(MailMessage message) { if (message == null) throw new ArgumentNullException("message"); @@ -180,9 +170,6 @@ private void InternalSend(MailMessage message) } } -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public void Send(IEnumerable messages) { foreach (MailMessage message in messages) @@ -227,9 +214,6 @@ public String Password /// informed /// /// Message instance -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif protected virtual void Configure(SmtpClient smtpClient) { smtpClient.Credentials = null; @@ -261,9 +245,6 @@ private bool HasCredentials get { return !string.IsNullOrEmpty(credentials.UserName); } } -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif private SmtpClient CreateSmtpClient() { if (string.IsNullOrEmpty(hostname)) diff --git a/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs b/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs index 5e13662834..f6a6356e26 100644 --- a/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs +++ b/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs @@ -28,9 +28,6 @@ public static class StrongNameUtil private static readonly IDictionary signedAssemblyCache = new Dictionary(); private static readonly object lockObject = new object(); -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif static StrongNameUtil() { #if FEATURE_SECURITY_PERMISSIONS diff --git a/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs b/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs index 6ad6b4dea4..1e06d3720d 100644 --- a/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs +++ b/src/Castle.Core/DynamicProxy/ProxyGenerationOptions.cs @@ -21,9 +21,6 @@ namespace Castle.DynamicProxy #if FEATURE_SERIALIZATION using System.Runtime.Serialization; #endif -#if FEATURE_SECURITY_PERMISSIONS - using System.Security; -#endif using Castle.Core.Internal; using Castle.DynamicProxy.Internal; @@ -102,9 +99,6 @@ public void Initialize() } #if FEATURE_SERIALIZATION -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("hook", Hook); diff --git a/src/Castle.Core/DynamicProxy/ProxyGenerator.cs b/src/Castle.Core/DynamicProxy/ProxyGenerator.cs index 9a5728481b..94c4df83c8 100644 --- a/src/Castle.Core/DynamicProxy/ProxyGenerator.cs +++ b/src/Castle.Core/DynamicProxy/ProxyGenerator.cs @@ -23,7 +23,6 @@ namespace Castle.DynamicProxy using System.Runtime.Remoting; #endif #if FEATURE_SECURITY_PERMISSIONS - using System.Security; using System.Security.Permissions; #endif using System.Text; @@ -550,9 +549,6 @@ public object CreateInterfaceProxyWithTargetInterface(Type interfaceToProxy, obj /// This method uses implementation to generate a proxy type. /// As such caller should expect any type of exception that given implementation may throw. /// -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public virtual object CreateInterfaceProxyWithTargetInterface(Type interfaceToProxy, Type[] additionalInterfacesToProxy, object target, ProxyGenerationOptions options, diff --git a/src/Castle.Core/DynamicProxy/Serialization/ProxyObjectReference.cs b/src/Castle.Core/DynamicProxy/Serialization/ProxyObjectReference.cs index b3d3429d79..c36f97eff4 100644 --- a/src/Castle.Core/DynamicProxy/Serialization/ProxyObjectReference.cs +++ b/src/Castle.Core/DynamicProxy/Serialization/ProxyObjectReference.cs @@ -21,9 +21,6 @@ namespace Castle.DynamicProxy.Serialization using System.Diagnostics; using System.Reflection; using System.Runtime.Serialization; -#if FEATURE_SECURITY_PERMISSIONS - using System.Security; -#endif using Castle.DynamicProxy.Generators; using Castle.DynamicProxy.Internal; @@ -86,9 +83,6 @@ public static ModuleScope ModuleScope get { return scope; } } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif protected ProxyObjectReference(SerializationInfo info, StreamingContext context) { this.info = info; @@ -118,9 +112,6 @@ private Type DeserializeTypeFromString(string key) return Type.GetType(info.GetString(key), true, false); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif protected virtual object RecreateProxy() { var generatorType = GetValue("__proxyTypeId"); @@ -138,9 +129,6 @@ protected virtual object RecreateProxy() return RecreateInterfaceProxy(generatorType); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private object RecreateClassProxyWithTarget() { var generator = new ClassProxyWithTargetGenerator(scope, baseType, interfaces, proxyGenerationOptions); @@ -148,9 +136,6 @@ private object RecreateClassProxyWithTarget() return InstantiateClassProxy(proxyType); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif public object RecreateInterfaceProxy(string generatorType) { var @interface = DeserializeTypeFromString("__theInterface"); @@ -181,9 +166,6 @@ public object RecreateInterfaceProxy(string generatorType) return FormatterServices.GetSafeUninitializedObject(proxyType); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif public object RecreateClassProxy() { var generator = new ClassProxyGenerator(scope, baseType); @@ -191,9 +173,6 @@ public object RecreateClassProxy() return InstantiateClassProxy(proxyType); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private object InstantiateClassProxy(Type proxy_type) { delegateToBase = GetValue("__delegateToBase"); @@ -215,26 +194,17 @@ protected void InvokeCallback(object target) } } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif public object GetRealObject(StreamingContext context) { return proxy; } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif public void GetObjectData(SerializationInfo info, StreamingContext context) { // There is no need to implement this method as // this class would never be serialized. } -#if FEATURE_SECURITY_PERMISSIONS - [SecuritySafeCritical] -#endif public void OnDeserialization(object sender) { var interceptors = GetValue("__interceptors"); @@ -247,9 +217,6 @@ public void OnDeserialization(object sender) InvokeCallback(proxy); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private void DeserializeProxyMembers() { var proxyType = proxy.GetType(); @@ -274,9 +241,6 @@ private void DeserializeProxyMembers() FormatterServices.PopulateObjectMembers(proxy, deserializedMembers.ToArray(), deserializedValues.ToArray()); } -#if FEATURE_SECURITY_PERMISSIONS - [SecurityCritical] -#endif private void DeserializeProxyState() { if (isInterfaceProxy) From ff4efb341450a92739115ab55c00478206cbd279 Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 11:14:09 +0200 Subject: [PATCH 02/10] Initialize logger regardless of security permissions --- src/Castle.Core/DynamicProxy/ProxyGenerator.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/Castle.Core/DynamicProxy/ProxyGenerator.cs b/src/Castle.Core/DynamicProxy/ProxyGenerator.cs index 94c4df83c8..27464377ea 100644 --- a/src/Castle.Core/DynamicProxy/ProxyGenerator.cs +++ b/src/Castle.Core/DynamicProxy/ProxyGenerator.cs @@ -21,9 +21,6 @@ namespace Castle.DynamicProxy using System.Runtime.InteropServices; #if FEATURE_REMOTING using System.Runtime.Remoting; -#endif -#if FEATURE_SECURITY_PERMISSIONS - using System.Security.Permissions; #endif using System.Text; @@ -48,21 +45,8 @@ public ProxyGenerator(IProxyBuilder builder) { proxyBuilder = builder; -#if FEATURE_SECURITY_PERMISSIONS - if (HasSecurityPermission()) -#endif - { - Logger = new TraceLogger("Castle.DynamicProxy", LoggerLevel.Warn); - } - } - -#if FEATURE_SECURITY_PERMISSIONS - private bool HasSecurityPermission() - { - const SecurityPermissionFlag flag = SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy; - return new SecurityPermission(flag).IsGranted(); + Logger = new TraceLogger("Castle.DynamicProxy", LoggerLevel.Warn); } -#endif /// /// Initializes a new instance of the class. From fd56e780c1dc930527a19572bfc8afbfbc1da666 Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 11:35:32 +0200 Subject: [PATCH 03/10] Remove security permissions in `DefaultSmtpSender` The use of security permissions' and `.IsGranted()` here appears to have had the purpose of allowing this class to work correctly when no credentials are set and executing code would have no permission to read `NetworkCredentials`. We can get rid of security permissions by refactoring code such that the `NetworkCredential` gets created only on demand. The only observ- able difference should be that in the absence of certain granted perm- issions, querying or setting `UserName`, `Password`, or `Domain` will no longer throw immediately. Failure is deferred until the moment when the SMTP client is built. --- .../Core/Smtp/DefaultSmtpSender.cs | 37 ++++--------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs b/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs index e11ca30ac7..da2998edee 100644 --- a/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs +++ b/src/Castle.Core/Core/Smtp/DefaultSmtpSender.cs @@ -21,9 +21,7 @@ namespace Castle.Core.Smtp using System.ComponentModel; using System.Net; using System.Net.Mail; -#if FEATURE_SECURITY_PERMISSIONS - using System.Security.Permissions; -#endif + using Castle.Core.Internal; /// @@ -36,7 +34,6 @@ public class DefaultSmtpSender : IEmailSender private int port = 25; private int? timeout; private bool useSsl; - private readonly NetworkCredential credentials = new NetworkCredential(); /// /// Initializes a new instance of the class based on the configuration provided in the application configuration file. @@ -182,31 +179,19 @@ public void Send(IEnumerable messages) /// Gets or sets the domain. /// /// The domain. - public String Domain - { - get { return credentials.Domain; } - set { credentials.Domain = value; } - } + public string Domain { get; set; } /// /// Gets or sets the name of the user. /// /// The name of the user. - public String UserName - { - get { return credentials.UserName; } - set { credentials.UserName = value; } - } + public string UserName { get; set; } /// /// Gets or sets the password. /// /// The password. - public String Password - { - get { return credentials.Password; } - set { credentials.Password = value; } - } + public string Password { get; set; } /// /// Configures the sender @@ -218,8 +203,9 @@ protected virtual void Configure(SmtpClient smtpClient) { smtpClient.Credentials = null; - if (CanAccessCredentials() && HasCredentials) + if (HasCredentials) { + var credentials = new NetworkCredential(UserName, Password, Domain); smtpClient.Credentials = credentials; } @@ -242,7 +228,7 @@ protected virtual void Configure(SmtpClient smtpClient) /// private bool HasCredentials { - get { return !string.IsNullOrEmpty(credentials.UserName); } + get { return !string.IsNullOrEmpty(UserName); } } private SmtpClient CreateSmtpClient() @@ -258,15 +244,6 @@ private SmtpClient CreateSmtpClient() Configure(smtpClient); return smtpClient; } - - private static bool CanAccessCredentials() - { -#if FEATURE_SECURITY_PERMISSIONS - return new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).IsGranted(); -#else - return false; -#endif - } } } From d6196de54fc34747ee3008698e084bad49a4cb1e Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 11:49:52 +0200 Subject: [PATCH 04/10] Remove `PermissionUtil.IsGranted` --- .../Internal/PermissionUtilTestCase.cs | 37 ------------------- .../Core/Internal/PermissionUtil.cs | 35 ------------------ 2 files changed, 72 deletions(-) delete mode 100644 src/Castle.Core.Tests/Core.Tests/Internal/PermissionUtilTestCase.cs delete mode 100644 src/Castle.Core/Core/Internal/PermissionUtil.cs diff --git a/src/Castle.Core.Tests/Core.Tests/Internal/PermissionUtilTestCase.cs b/src/Castle.Core.Tests/Core.Tests/Internal/PermissionUtilTestCase.cs deleted file mode 100644 index 5121789d12..0000000000 --- a/src/Castle.Core.Tests/Core.Tests/Internal/PermissionUtilTestCase.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2004-2010 Castle Project - http://www.castleproject.org/ -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#if FEATURE_SECURITY_PERMISSIONS - -namespace Castle.Core.Internal.Tests -{ - using System.Security.Permissions; - - using NUnit.Framework; - - [TestFixture] - public class PermissionUtilTestCase - { - [Test] - public void Correctly_determines_permissions() - { - // Execution has to be always granted. Otherwise this code wouldn't run in the first place. - var securityPermission = new SecurityPermission(SecurityPermissionFlag.Execution); - - Assert.IsTrue(securityPermission.IsGranted()); - } - } -} - -#endif \ No newline at end of file diff --git a/src/Castle.Core/Core/Internal/PermissionUtil.cs b/src/Castle.Core/Core/Internal/PermissionUtil.cs deleted file mode 100644 index b02747f7f9..0000000000 --- a/src/Castle.Core/Core/Internal/PermissionUtil.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2004-2009 Castle Project - http://www.castleproject.org/ -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#if FEATURE_SECURITY_PERMISSIONS - -namespace Castle.Core.Internal -{ - using System; - using System.Security; - using System.Security.Permissions; - - public static class PermissionUtil - { - public static bool IsGranted(this IPermission permission) - { - var permissionSet = new PermissionSet(PermissionState.None); - permissionSet.AddPermission(permission); - - return permissionSet.IsSubsetOf(AppDomain.CurrentDomain.PermissionSet); - } - } -} - -#endif \ No newline at end of file From bf2ebd34990f1e7085dfd7d8ac29b64bb99025f7 Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 12:26:29 +0200 Subject: [PATCH 05/10] .NET Standard defines `[Security]`, no need to guard it --- src/Castle.Core.Tests/Castle.Core.Tests.csproj | 3 +++ .../AttributesToAvoidReplicatingTestCase.cs | 7 +------ .../Generators/AttributesToAvoidReplicating.cs | 2 -- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Castle.Core.Tests/Castle.Core.Tests.csproj b/src/Castle.Core.Tests/Castle.Core.Tests.csproj index 0b7b6868e8..3e4987bfd7 100644 --- a/src/Castle.Core.Tests/Castle.Core.Tests.csproj +++ b/src/Castle.Core.Tests/Castle.Core.Tests.csproj @@ -47,6 +47,9 @@ + + + diff --git a/src/Castle.Core.Tests/DynamicProxy.Tests/AttributesToAvoidReplicatingTestCase.cs b/src/Castle.Core.Tests/DynamicProxy.Tests/AttributesToAvoidReplicatingTestCase.cs index f82ef974c4..221746bf18 100644 --- a/src/Castle.Core.Tests/DynamicProxy.Tests/AttributesToAvoidReplicatingTestCase.cs +++ b/src/Castle.Core.Tests/DynamicProxy.Tests/AttributesToAvoidReplicatingTestCase.cs @@ -17,12 +17,9 @@ namespace Castle.DynamicProxy.Tests using System; using System.Linq; using System.Reflection; - - using Castle.DynamicProxy.Generators; -#if FEATURE_SECURITY_PERMISSIONS using System.Security.Permissions; -#endif + using Castle.DynamicProxy.Generators; using Castle.DynamicProxy.Tests.Classes; using NUnit.Framework; @@ -70,7 +67,6 @@ public class AttributedClass_Inheritable { } -#if FEATURE_SECURITY_PERMISSIONS [Test] public void SecurityPermissionAttribute_should_not_be_replicated_as_it_is_part_of_cas() { @@ -94,7 +90,6 @@ public void ReflectionPermissionAttribute_should_not_be_replicated_as_it_is_part public class AttributedClass_ReflectionPermission { } -#endif private int AttributeCount(object proxy) where TAttribute : Attribute diff --git a/src/Castle.Core/DynamicProxy/Generators/AttributesToAvoidReplicating.cs b/src/Castle.Core/DynamicProxy/Generators/AttributesToAvoidReplicating.cs index e177d06571..c262b7b0ec 100644 --- a/src/Castle.Core/DynamicProxy/Generators/AttributesToAvoidReplicating.cs +++ b/src/Castle.Core/DynamicProxy/Generators/AttributesToAvoidReplicating.cs @@ -32,9 +32,7 @@ static AttributesToAvoidReplicating() typeof(System.Runtime.InteropServices.ComImportAttribute), typeof(System.Runtime.InteropServices.MarshalAsAttribute), typeof(System.Runtime.InteropServices.TypeIdentifierAttribute), -#if FEATURE_SECURITY_PERMISSIONS typeof(System.Security.Permissions.SecurityAttribute), -#endif }; } From 9e11388d853fcb183c39e9f61d1bbe7567a84d7e Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 12:33:15 +0200 Subject: [PATCH 06/10] `FEATURE_SECURITY_PERMISSIONS` unrelated to Winforms --- README.md | 2 ++ buildscripts/common.props | 2 +- src/Castle.Core.Tests/DynamicProxy.Tests/WinFormsTestCase.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 32a9b7facc..531acafcf2 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ Symbol | .NET 4.5 | .NET Standard 2.x `FEATURE_SYSTEM_CONFIGURATION` | :white_check_mark: | :no_entry_sign: `FEATURE_TEST_COM` | :white_check_mark: | :no_entry_sign: `FEATURE_TEST_PEVERIFY` | :white_check_mark: | :no_entry_sign: +`FEATURE_TEST_WINFORMS` | :white_check_mark: | :no_entry_sign: --- | | `DOTNET45` | :white_check_mark: | :no_entry_sign: @@ -83,3 +84,4 @@ Symbol | .NET 4.5 | .NET Standard 2.x * `FEATURE_SYSTEM_CONFIGURATION` - enables features that use System.Configuration and the ConfigurationManager. * `FEATURE_TEST_COM` - enables COM Interop tests. * `FEATURE_TEST_PEVERIFY` - enables verification of dynamic assemblies using PEVerify during tests. (Only defined on Windows builds since Windows is currently the only platform where PEVerify is available.) +* `FEATURE_TEST_WINFORMS` - enables Windows Forms tests. diff --git a/buildscripts/common.props b/buildscripts/common.props index 31e795b4db..a54545cac2 100644 --- a/buildscripts/common.props +++ b/buildscripts/common.props @@ -45,7 +45,7 @@ DEBUG TRACE TRACE - TRACE;FEATURE_APPDOMAIN;FEATURE_ASSEMBLYBUILDER_SAVE;FEATURE_EVENTLOG;FEATURE_REMOTING;FEATURE_SECURITY_PERMISSIONS;FEATURE_SERIALIZATION;FEATURE_SYSTEM_CONFIGURATION;FEATURE_TEST_COM + TRACE;FEATURE_APPDOMAIN;FEATURE_ASSEMBLYBUILDER_SAVE;FEATURE_EVENTLOG;FEATURE_REMOTING;FEATURE_SECURITY_PERMISSIONS;FEATURE_SERIALIZATION;FEATURE_SYSTEM_CONFIGURATION;FEATURE_TEST_COM;FEATURE_TEST_WINFORMS $(CommonDesktopClrConstants) $(CommonDesktopClrConstants);FEATURE_TEST_PEVERIFY diff --git a/src/Castle.Core.Tests/DynamicProxy.Tests/WinFormsTestCase.cs b/src/Castle.Core.Tests/DynamicProxy.Tests/WinFormsTestCase.cs index 0481f25d27..06e91f1ac3 100644 --- a/src/Castle.Core.Tests/DynamicProxy.Tests/WinFormsTestCase.cs +++ b/src/Castle.Core.Tests/DynamicProxy.Tests/WinFormsTestCase.cs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#if FEATURE_SECURITY_PERMISSIONS +#if FEATURE_TEST_WINFORMS namespace Castle.DynamicProxy.Tests { From cb88f50aae000390470877134d7b54f539ea7f93 Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 12:43:05 +0200 Subject: [PATCH 07/10] Stop checking ASP.NET trust level --- .../Generators/Emitters/ClassEmitter.cs | 9 ++------- .../Generators/Emitters/StrongNameUtil.cs | 20 ------------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/Castle.Core/DynamicProxy/Generators/Emitters/ClassEmitter.cs b/src/Castle.Core/DynamicProxy/Generators/Emitters/ClassEmitter.cs index 49a25ed4ba..94fee41b1f 100644 --- a/src/Castle.Core/DynamicProxy/Generators/Emitters/ClassEmitter.cs +++ b/src/Castle.Core/DynamicProxy/Generators/Emitters/ClassEmitter.cs @@ -30,13 +30,13 @@ public class ClassEmitter : AbstractTypeEmitter private readonly ModuleScope moduleScope; public ClassEmitter(ModuleScope modulescope, String name, Type baseType, IEnumerable interfaces) - : this(modulescope, name, baseType, interfaces, DefaultAttributes, ShouldForceUnsigned()) + : this(modulescope, name, baseType, interfaces, DefaultAttributes, forceUnsigned: false) { } public ClassEmitter(ModuleScope modulescope, String name, Type baseType, IEnumerable interfaces, TypeAttributes flags) - : this(modulescope, name, baseType, interfaces, flags, ShouldForceUnsigned()) + : this(modulescope, name, baseType, interfaces, flags, forceUnsigned: false) { } @@ -111,10 +111,5 @@ private static TypeBuilder CreateTypeBuilder(ModuleScope modulescope, string nam var isAssemblySigned = !forceUnsigned && !StrongNameUtil.IsAnyTypeFromUnsignedAssembly(baseType, interfaces); return modulescope.DefineType(isAssemblySigned, name, flags); } - - private static bool ShouldForceUnsigned() - { - return StrongNameUtil.CanStrongNameAssembly == false; - } } } \ No newline at end of file diff --git a/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs b/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs index f6a6356e26..2c05a71364 100644 --- a/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs +++ b/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs @@ -28,24 +28,6 @@ public static class StrongNameUtil private static readonly IDictionary signedAssemblyCache = new Dictionary(); private static readonly object lockObject = new object(); - static StrongNameUtil() - { -#if FEATURE_SECURITY_PERMISSIONS - //idea after http://blogs.msdn.com/dmitryr/archive/2007/01/23/finding-out-the-current-trust-level-in-asp-net.aspx - try - { - new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); - CanStrongNameAssembly = true; - } - catch (SecurityException) - { - CanStrongNameAssembly = false; - } -#else - CanStrongNameAssembly = true; -#endif - } - public static bool IsAssemblySigned(this Assembly assembly) { lock (lockObject) @@ -79,7 +61,5 @@ public static bool IsAnyTypeFromUnsignedAssembly(Type baseType, IEnumerable Date: Sat, 16 May 2020 12:45:13 +0200 Subject: [PATCH 08/10] Remove `FEATURE_SECURITY_PERMISSIONS` --- README.md | 2 -- buildscripts/common.props | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 531acafcf2..767eb07f26 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,6 @@ Symbol | .NET 4.5 | .NET Standard 2.x `FEATURE_ASSEMBLYBUILDER_SAVE` | :white_check_mark: | :no_entry_sign: `FEATURE_EVENTLOG` | :white_check_mark: | :no_entry_sign: `FEATURE_REMOTING` | :white_check_mark: | :no_entry_sign: -`FEATURE_SECURITY_PERMISSIONS` | :white_check_mark: | :no_entry_sign: `FEATURE_SERIALIZATION` | :white_check_mark: | :no_entry_sign: `FEATURE_SYSTEM_CONFIGURATION` | :white_check_mark: | :no_entry_sign: `FEATURE_TEST_COM` | :white_check_mark: | :no_entry_sign: @@ -79,7 +78,6 @@ Symbol | .NET 4.5 | .NET Standard 2.x * `FEATURE_ASSEMBLYBUILDER_SAVE` - enabled support for saving the dynamically generated proxy assembly. * `FEATURE_EVENTLOG` - provides a diagnostics logger using the Windows Event Log. * `FEATURE_REMOTING` - supports remoting on various types including inheriting from MarshalByRefObject. -* `FEATURE_SECURITY_PERMISSIONS` - enables the use of CAS. * `FEATURE_SERIALIZATION` - enables support for serialization of dynamic proxies and other types. * `FEATURE_SYSTEM_CONFIGURATION` - enables features that use System.Configuration and the ConfigurationManager. * `FEATURE_TEST_COM` - enables COM Interop tests. diff --git a/buildscripts/common.props b/buildscripts/common.props index a54545cac2..1fb3e174bb 100644 --- a/buildscripts/common.props +++ b/buildscripts/common.props @@ -45,7 +45,7 @@ DEBUG TRACE TRACE - TRACE;FEATURE_APPDOMAIN;FEATURE_ASSEMBLYBUILDER_SAVE;FEATURE_EVENTLOG;FEATURE_REMOTING;FEATURE_SECURITY_PERMISSIONS;FEATURE_SERIALIZATION;FEATURE_SYSTEM_CONFIGURATION;FEATURE_TEST_COM;FEATURE_TEST_WINFORMS + TRACE;FEATURE_APPDOMAIN;FEATURE_ASSEMBLYBUILDER_SAVE;FEATURE_EVENTLOG;FEATURE_REMOTING;FEATURE_SERIALIZATION;FEATURE_SYSTEM_CONFIGURATION;FEATURE_TEST_COM;FEATURE_TEST_WINFORMS $(CommonDesktopClrConstants) $(CommonDesktopClrConstants);FEATURE_TEST_PEVERIFY From d499f1775f34719db1d680af0de89ac2552856b8 Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 11:50:01 +0200 Subject: [PATCH 09/10] Update the changelog --- CHANGELOG.md | 4 ++++ .../DynamicProxy/Generators/Emitters/StrongNameUtil.cs | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7777a52b2..f5a5e20bb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ Enhancements: Deprecations: - Removed support for the .NET Framework < 4.5 and .NET Standard 1.x. (@stakx, #495, #496) + - Removed support for Code Access Security (CAS). (@stakx, #502) + - The following public members have been removed: + - `Castle.Core.Internal.PermissionUtil.IsGranted` (method) + - `Castle.DynamicProxy.Generators.Emitters.StrongNameUtil.CanStrongNameAssembly` (property) ## 4.4.1 (2020-05-06) diff --git a/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs b/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs index 2c05a71364..4763716fe4 100644 --- a/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs +++ b/src/Castle.Core/DynamicProxy/Generators/Emitters/StrongNameUtil.cs @@ -18,10 +18,6 @@ namespace Castle.DynamicProxy.Generators.Emitters using System.Collections.Generic; using System.Linq; using System.Reflection; -#if FEATURE_SECURITY_PERMISSIONS - using System.Security; - using System.Security.Permissions; -#endif public static class StrongNameUtil { From ff4b103905bba4aa5bb3f6f06086a0fc32737a46 Mon Sep 17 00:00:00 2001 From: stakx Date: Sat, 16 May 2020 12:52:29 +0200 Subject: [PATCH 10/10] Update `ref/` contracts --- ref/Castle.Core-net45.cs | 26 ------------------- ref/Castle.Core-netstandard2.0.cs | 1 - ref/Castle.Core-netstandard2.1.cs | 1 - ....Services.Logging.NLogIntegration-net45.cs | 1 - ...rvices.Logging.log4netIntegration-net45.cs | 1 - 5 files changed, 30 deletions(-) diff --git a/ref/Castle.Core-net45.cs b/ref/Castle.Core-net45.cs index dc73da89d4..9f2d06c435 100644 --- a/ref/Castle.Core-net45.cs +++ b/ref/Castle.Core-net45.cs @@ -2,7 +2,6 @@ [assembly: System.Runtime.CompilerServices.InternalsVisibleToAttribute(@"Castle.Core.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010077f5e87030dadccce6902c6adab7a987bd69cb5819991531f560785eacfc89b6fcddf6bb2a00743a7194e454c0273447fc6eec36474ba8e5a3823147d214298e4f9a631b1afee1a51ffeae4672d498f14b000e3d321453cdd8ac064de7e1cf4d222b7e81f54d4fd46725370d702a05b48738cc29d09228f1aa722ae1a9ca02fb")] [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName=".NET Framework 4.5")] -[assembly: System.Security.SecurityRulesAttribute(System.Security.SecurityRuleSet.Level2)] namespace Castle.Components.DictionaryAdapter { public abstract class AbstractDictionaryAdapter : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable @@ -1990,11 +1989,6 @@ public static Castle.Core.Internal.Lock Create() { } public abstract Castle.Core.Internal.ILockHolder ForWriting(); public abstract Castle.Core.Internal.ILockHolder ForWriting(bool waitForLock); } - public class static PermissionUtil - { - [System.Security.SecuritySafeCriticalAttribute()] - public static bool IsGranted(this System.Security.IPermission permission) { } - } } namespace Castle.Core.Logging { @@ -2182,7 +2176,6 @@ public void InfoFormat(string format, params object[] args) { } public void InfoFormat(System.Exception exception, string format, params object[] args) { } public void InfoFormat(System.IFormatProvider formatProvider, string format, params object[] args) { } public void InfoFormat(System.Exception exception, System.IFormatProvider formatProvider, string format, params object[] args) { } - [System.Security.SecurityCriticalAttribute()] public override object InitializeLifetimeService() { } protected abstract void Log(Castle.Core.Logging.LoggerLevel loggerLevel, string loggerName, string message, System.Exception exception); public void Trace(string message) { } @@ -2300,11 +2293,8 @@ public override Castle.Core.Logging.ILogger Create(string name, Castle.Core.Logg } public class TraceLogger : Castle.Core.Logging.LevelFilteredLogger { - [System.Security.SecuritySafeCriticalAttribute()] public TraceLogger(string name) { } - [System.Security.SecuritySafeCriticalAttribute()] public TraceLogger(string name, Castle.Core.Logging.LoggerLevel level) { } - [System.Security.SecuritySafeCriticalAttribute()] public override Castle.Core.Logging.ILogger CreateChildLogger(string loggerName) { } protected override void Log(Castle.Core.Logging.LoggerLevel loggerLevel, string loggerName, string message, System.Exception exception) { } } @@ -2312,9 +2302,7 @@ public class TraceLoggerFactory : Castle.Core.Logging.AbstractLoggerFactory { public TraceLoggerFactory() { } public TraceLoggerFactory(Castle.Core.Logging.LoggerLevel level) { } - [System.Security.SecuritySafeCriticalAttribute()] public override Castle.Core.Logging.ILogger Create(string name) { } - [System.Security.SecuritySafeCriticalAttribute()] public override Castle.Core.Logging.ILogger Create(string name, Castle.Core.Logging.LoggerLevel level) { } } } @@ -2468,13 +2456,9 @@ public DefaultSmtpSender(string hostname) { } public int Timeout { get; set; } public bool UseSsl { get; set; } public string UserName { get; set; } - [System.Security.SecurityCriticalAttribute()] protected virtual void Configure(System.Net.Mail.SmtpClient smtpClient) { } - [System.Security.SecuritySafeCriticalAttribute()] public void Send(string from, string to, string subject, string messageText) { } - [System.Security.SecuritySafeCriticalAttribute()] public void Send(System.Net.Mail.MailMessage message) { } - [System.Security.SecuritySafeCriticalAttribute()] public void Send(System.Collections.Generic.IEnumerable messages) { } } public interface IEmailSender @@ -2734,7 +2718,6 @@ public void AddDelegateTypeMixin(System.Type delegateType) { } public void AddMixinInstance(object instance) { } public override bool Equals(object obj) { } public override int GetHashCode() { } - [System.Security.SecurityCriticalAttribute()] public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public void Initialize() { } public object[] MixinsAsArray() { } @@ -2794,7 +2777,6 @@ public TInterface CreateInterfaceProxyWithTargetInterface(TInterface where TInterface : class { } public object CreateInterfaceProxyWithTargetInterface(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, object target, params Castle.DynamicProxy.IInterceptor[] interceptors) { } public object CreateInterfaceProxyWithTargetInterface(System.Type interfaceToProxy, object target, Castle.DynamicProxy.ProxyGenerationOptions options, params Castle.DynamicProxy.IInterceptor[] interceptors) { } - [System.Security.SecuritySafeCriticalAttribute()] public virtual object CreateInterfaceProxyWithTargetInterface(System.Type interfaceToProxy, System.Type[] additionalInterfacesToProxy, object target, Castle.DynamicProxy.ProxyGenerationOptions options, params Castle.DynamicProxy.IInterceptor[] interceptors) { } public TInterface CreateInterfaceProxyWithoutTarget(Castle.DynamicProxy.IInterceptor interceptor) where TInterface : class { } @@ -3444,7 +3426,6 @@ public sealed class StindOpCodesDictionary : System.Collections.Generic.Dictiona } public class static StrongNameUtil { - public static bool CanStrongNameAssembly { get; set; } public static bool IsAnyTypeFromUnsignedAssembly(System.Collections.Generic.IEnumerable types) { } public static bool IsAnyTypeFromUnsignedAssembly(System.Type baseType, System.Collections.Generic.IEnumerable interfaces) { } public static bool IsAssemblySigned(this System.Reflection.Assembly assembly) { } @@ -3823,21 +3804,14 @@ public static void ApplyTo(System.Reflection.Emit.AssemblyBuilder assemblyBuilde } public class ProxyObjectReference : System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.IObjectReference, System.Runtime.Serialization.ISerializable { - [System.Security.SecurityCriticalAttribute()] protected ProxyObjectReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public static Castle.DynamicProxy.ModuleScope ModuleScope { get; } - [System.Security.SecurityCriticalAttribute()] public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - [System.Security.SecurityCriticalAttribute()] public object GetRealObject(System.Runtime.Serialization.StreamingContext context) { } protected void InvokeCallback(object target) { } - [System.Security.SecuritySafeCriticalAttribute()] public void OnDeserialization(object sender) { } - [System.Security.SecurityCriticalAttribute()] public object RecreateClassProxy() { } - [System.Security.SecurityCriticalAttribute()] public object RecreateInterfaceProxy(string generatorType) { } - [System.Security.SecurityCriticalAttribute()] protected virtual object RecreateProxy() { } public static void ResetScope() { } public static void SetScope(Castle.DynamicProxy.ModuleScope scope) { } diff --git a/ref/Castle.Core-netstandard2.0.cs b/ref/Castle.Core-netstandard2.0.cs index b2b1ec6f5b..b2e69e9014 100644 --- a/ref/Castle.Core-netstandard2.0.cs +++ b/ref/Castle.Core-netstandard2.0.cs @@ -3367,7 +3367,6 @@ public sealed class StindOpCodesDictionary : System.Collections.Generic.Dictiona } public class static StrongNameUtil { - public static bool CanStrongNameAssembly { get; set; } public static bool IsAnyTypeFromUnsignedAssembly(System.Collections.Generic.IEnumerable types) { } public static bool IsAnyTypeFromUnsignedAssembly(System.Type baseType, System.Collections.Generic.IEnumerable interfaces) { } public static bool IsAssemblySigned(this System.Reflection.Assembly assembly) { } diff --git a/ref/Castle.Core-netstandard2.1.cs b/ref/Castle.Core-netstandard2.1.cs index 74efe690f4..89cfd91086 100644 --- a/ref/Castle.Core-netstandard2.1.cs +++ b/ref/Castle.Core-netstandard2.1.cs @@ -3367,7 +3367,6 @@ public sealed class StindOpCodesDictionary : System.Collections.Generic.Dictiona } public class static StrongNameUtil { - public static bool CanStrongNameAssembly { get; set; } public static bool IsAnyTypeFromUnsignedAssembly(System.Collections.Generic.IEnumerable types) { } public static bool IsAnyTypeFromUnsignedAssembly(System.Type baseType, System.Collections.Generic.IEnumerable interfaces) { } public static bool IsAssemblySigned(this System.Reflection.Assembly assembly) { } diff --git a/ref/Castle.Services.Logging.NLogIntegration-net45.cs b/ref/Castle.Services.Logging.NLogIntegration-net45.cs index f939e56637..e2b2e1c0ba 100644 --- a/ref/Castle.Services.Logging.NLogIntegration-net45.cs +++ b/ref/Castle.Services.Logging.NLogIntegration-net45.cs @@ -1,7 +1,6 @@ [assembly: System.CLSCompliantAttribute(true)] [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName=".NET Framework 4.5")] -[assembly: System.Security.SecurityRulesAttribute(System.Security.SecurityRuleSet.Level2)] namespace Castle.Services.Logging.NLogIntegration { public class ExtendedNLogFactory : Castle.Core.Logging.AbstractExtendedLoggerFactory diff --git a/ref/Castle.Services.Logging.log4netIntegration-net45.cs b/ref/Castle.Services.Logging.log4netIntegration-net45.cs index 16e0c54d64..e33f4b4468 100644 --- a/ref/Castle.Services.Logging.log4netIntegration-net45.cs +++ b/ref/Castle.Services.Logging.log4netIntegration-net45.cs @@ -1,7 +1,6 @@ [assembly: System.CLSCompliantAttribute(true)] [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] [assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName=".NET Framework 4.5")] -[assembly: System.Security.SecurityRulesAttribute(System.Security.SecurityRuleSet.Level2)] namespace Castle.Services.Logging.Log4netIntegration { public class ExtendedLog4netFactory : Castle.Core.Logging.AbstractExtendedLoggerFactory