From f5e6ce710c25749a6029bf5a06b81b4d562973fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 17:20:18 +0200 Subject: [PATCH] Bump the dependencies group with 11 updates (#1808) * Bump the dependencies group with 11 updates Bumps coverlet.collector from 6.0.4 to 10.0.1 Bumps coverlet.msbuild from 6.0.4 to 10.0.1 Bumps GitHubActionsTestLogger from 3.0.1 to 3.0.4 Bumps Meziantou.Analyzer from 3.0.18 to 3.0.114 Bumps Microsoft.Bcl.Cryptography from 10.0.3 to 10.0.9 Bumps Microsoft.Extensions.Logging.Console from 10.0.3 to 10.0.9 Bumps MSTest from 4.1.0 to 4.2.3 Bumps PolySharp from 1.15.0 to 1.16.0 Bumps SonarAnalyzer.CSharp from 10.20.0.135146 to 10.27.0.140913 Bumps System.Formats.Asn1 from 10.0.3 to 10.0.9 Bumps Testcontainers from 4.10.0 to 4.12.0 Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Robert Hague --- .editorconfig | 9 +++++++ Directory.Packages.props | 24 +++++++++---------- .../Abstractions/SocketAbstraction.cs | 2 ++ src/Renci.SshNet/Connection/HttpConnector.cs | 1 + .../Connection/ProtocolVersionExchange.cs | 1 + src/Renci.SshNet/ForwardedPortLocal.cs | 2 +- src/Renci.SshNet/IServiceFactory.cs | 2 +- src/Renci.SshNet/Netconf/NetConfSession.cs | 6 +++-- src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs | 2 +- src/Renci.SshNet/ScpClient.cs | 1 + src/Renci.SshNet/ServiceFactory.cs | 2 +- .../OldIntegrationTests/ScpClientTest.cs | 2 +- .../Classes/ForwardedPortLocalTest.cs | 2 +- .../Classes/ForwardedPortRemoteTest.cs | 2 +- ...oardInteractiveAuthenticationMethodTest.cs | 2 +- .../PasswordAuthenticationMethodTest.cs | 2 +- .../Classes/ScpClientTest.cs | 2 +- .../Security/CertificateHostAlgorithmTest.cs | 2 +- .../Renci.SshNet.Tests/Classes/SessionTest.cs | 2 +- .../Classes/SshCommandTest.cs | 2 +- ...SubsystemSession_Connect_NeverConnected.cs | 6 ----- .../SubsystemSession_SendData_Disconnected.cs | 6 ----- 22 files changed, 43 insertions(+), 39 deletions(-) delete mode 100644 test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_NeverConnected.cs delete mode 100644 test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disconnected.cs diff --git a/.editorconfig b/.editorconfig index 89939594..f92acc7d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -620,12 +620,21 @@ dotnet_diagnostic.MA0112.severity = warning # MA0165: Make interpolated string dotnet_diagnostic.MA0165.severity = none +# MA0173 - Use LazyInitializer.EnsureInitialize +dotnet_diagnostic.MA0173.severity = none + # MA0182: Avoid unused internal types dotnet_diagnostic.MA0182.severity = none # MA0184: Do not use interpolated string without parameters dotnet_diagnostic.MA0184.severity = none +# MA0190 - Use partial property instead of partial method for GeneratedRegex +dotnet_diagnostic.MA0190.severity = none + +# MA0192 - Use HasFlag instead of bitwise checks +dotnet_diagnostic.MA0192.severity = none + #### MSTest rules #### # MSTEST0015: Test method should not be ignored diff --git a/Directory.Packages.props b/Directory.Packages.props index 8991d83e..c03b54e0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,22 +6,22 @@ - - - - + + + + - + - - + + - - - + + + - - + + diff --git a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs index 63dc2bf5..1dc992da 100644 --- a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs @@ -8,6 +8,8 @@ using System.Threading.Tasks; using Renci.SshNet.Common; using Renci.SshNet.Messages.Transport; +#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets + namespace Renci.SshNet.Abstractions { internal static partial class SocketAbstraction diff --git a/src/Renci.SshNet/Connection/HttpConnector.cs b/src/Renci.SshNet/Connection/HttpConnector.cs index 063562f8..07e713dc 100644 --- a/src/Renci.SshNet/Connection/HttpConnector.cs +++ b/src/Renci.SshNet/Connection/HttpConnector.cs @@ -31,6 +31,7 @@ namespace Renci.SshNet.Connection /// /// /// +#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets internal sealed partial class HttpConnector : ProxyConnector { private const string HttpResponsePattern = @"HTTP/(?\d[.]\d) (?\d{3}) (?.+)$"; diff --git a/src/Renci.SshNet/Connection/ProtocolVersionExchange.cs b/src/Renci.SshNet/Connection/ProtocolVersionExchange.cs index a0c67a86..27ae098a 100644 --- a/src/Renci.SshNet/Connection/ProtocolVersionExchange.cs +++ b/src/Renci.SshNet/Connection/ProtocolVersionExchange.cs @@ -19,6 +19,7 @@ namespace Renci.SshNet.Connection /// /// https://tools.ietf.org/html/rfc4253#section-4.2. /// +#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets internal sealed partial class ProtocolVersionExchange : IProtocolVersionExchange { private const byte Null = 0x00; diff --git a/src/Renci.SshNet/ForwardedPortLocal.cs b/src/Renci.SshNet/ForwardedPortLocal.cs index b021ab73..9bf5c058 100644 --- a/src/Renci.SshNet/ForwardedPortLocal.cs +++ b/src/Renci.SshNet/ForwardedPortLocal.cs @@ -12,7 +12,7 @@ namespace Renci.SshNet /// /// Provides functionality for local port forwarding. /// - public partial class ForwardedPortLocal : ForwardedPort + public class ForwardedPortLocal : ForwardedPort { private ForwardedPortStatus _status; private bool _isDisposed; diff --git a/src/Renci.SshNet/IServiceFactory.cs b/src/Renci.SshNet/IServiceFactory.cs index 681d69da..48ca70c8 100644 --- a/src/Renci.SshNet/IServiceFactory.cs +++ b/src/Renci.SshNet/IServiceFactory.cs @@ -14,7 +14,7 @@ namespace Renci.SshNet /// /// Factory for creating new services. /// - internal partial interface IServiceFactory + internal interface IServiceFactory { /// /// Creates an . diff --git a/src/Renci.SshNet/Netconf/NetConfSession.cs b/src/Renci.SshNet/Netconf/NetConfSession.cs index 60edc2d8..941d4959 100644 --- a/src/Renci.SshNet/Netconf/NetConfSession.cs +++ b/src/Renci.SshNet/Netconf/NetConfSession.cs @@ -7,6 +7,8 @@ using System.Xml; using Renci.SshNet.Common; +#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets + namespace Renci.SshNet.NetConf { internal sealed partial class NetConfSession : SubsystemSession, INetConfSession @@ -129,7 +131,7 @@ namespace Renci.SshNet.NetConf { _ = _data.Append(chunk); - if (!chunk.Contains(Prompt)) + if (!chunk.Contains(Prompt, StringComparison.Ordinal)) { return; } @@ -194,7 +196,7 @@ namespace Renci.SshNet.NetConf { _ = _data.Append(chunk); - if (!chunk.Contains(Prompt)) + if (!chunk.Contains(Prompt, StringComparison.Ordinal)) { return; } diff --git a/src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs b/src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs index 5bae05f2..f63c4390 100644 --- a/src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs +++ b/src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs @@ -70,7 +70,7 @@ namespace Renci.SshNet throw new SshException("Invalid passphrase."); } - if (keyType.Contains("rsa")) + if (keyType.Contains("rsa", StringComparison.Ordinal)) { var exponent = ReadBigIntWithBits(keyReader); var d = ReadBigIntWithBits(keyReader); diff --git a/src/Renci.SshNet/ScpClient.cs b/src/Renci.SshNet/ScpClient.cs index 1a63f321..fffa9601 100644 --- a/src/Renci.SshNet/ScpClient.cs +++ b/src/Renci.SshNet/ScpClient.cs @@ -30,6 +30,7 @@ namespace Renci.SshNet /// /// /// +#pragma warning disable MA0204 // Remove unnecessary partial modifier; not true for all targets public partial class ScpClient : BaseClient { private const string FileInfoPattern = @"C(?\d{4}) (?\d+) (?.+)"; diff --git a/src/Renci.SshNet/ServiceFactory.cs b/src/Renci.SshNet/ServiceFactory.cs index f9dbdc42..937f4224 100644 --- a/src/Renci.SshNet/ServiceFactory.cs +++ b/src/Renci.SshNet/ServiceFactory.cs @@ -16,7 +16,7 @@ namespace Renci.SshNet /// /// Basic factory for creating new services. /// - internal sealed partial class ServiceFactory : IServiceFactory + internal sealed class ServiceFactory : IServiceFactory { /// /// Defines the number of times an authentication attempt with any given diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ScpClientTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ScpClientTest.cs index 20106a2c..839e4a03 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ScpClientTest.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ScpClientTest.cs @@ -8,7 +8,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests /// Provides SCP client functionality. /// [TestClass] - public partial class ScpClientTest : IntegrationTestBase + public class ScpClientTest : IntegrationTestBase { [TestMethod] [TestCategory("Scp")] diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest.cs index 766dd23a..b17cf0e0 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest.cs @@ -11,7 +11,7 @@ namespace Renci.SshNet.Tests.Classes /// Provides functionality for local port forwarding /// [TestClass] - public partial class ForwardedPortLocalTest : TestBase + public class ForwardedPortLocalTest : TestBase { [TestMethod] public void ConstructorShouldThrowArgumentNullExceptionWhenBoundHostIsNull() diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest.cs index b18e4ab5..e72aff2c 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest.cs @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes /// Provides functionality for remote port forwarding /// [TestClass] - public partial class ForwardedPortRemoteTest : TestBase + public class ForwardedPortRemoteTest : TestBase { [TestMethod] public void Start_NotAddedToClient() diff --git a/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs index 03f6e302..7004a940 100644 --- a/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs +++ b/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes /// Provides functionality to perform keyboard interactive authentication. /// [TestClass] - public partial class KeyboardInteractiveAuthenticationMethodTest : TestBase + public class KeyboardInteractiveAuthenticationMethodTest : TestBase { [TestMethod] public void Keyboard_Test_Pass_Null() diff --git a/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs index 820138f2..0e519ee2 100644 --- a/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes /// Provides functionality to perform password authentication. /// [TestClass] - public partial class PasswordAuthenticationMethodTest : TestBase + public class PasswordAuthenticationMethodTest : TestBase { [TestMethod] public void Password_Test_Pass_Null_Username() diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs index e85b0b53..35643adb 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs @@ -12,7 +12,7 @@ namespace Renci.SshNet.Tests.Classes /// Provides SCP client functionality. /// [TestClass] - public partial class ScpClientTest : TestBase + public class ScpClientTest : TestBase { private Random _random; diff --git a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs index a18a63b3..ec69a957 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs @@ -287,7 +287,7 @@ namespace Renci.SshNet.Tests.Classes.Security "PD7/nXcyxnY3zALlPQTxb19EVx5lz58BS96gg="; char[] chars = goodCertString.ToCharArray(); - chars[^10] = 'a'; + chars[chars.Length - 10] = 'a'; string badCertString = new string(chars); Assert.IsTrue(VerifySignature(goodCertString)); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest.cs b/test/Renci.SshNet.Tests/Classes/SessionTest.cs index 05c7f342..62cc837b 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest.cs @@ -14,7 +14,7 @@ namespace Renci.SshNet.Tests.Classes /// Provides functionality to connect and interact with SSH server. /// [TestClass] - public partial class SessionTest : TestBase + public class SessionTest : TestBase { private Mock _serviceFactoryMock; private Mock _socketFactoryMock; diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs index e677f496..46910baf 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs @@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes /// Represents SSH command that can be executed. /// [TestClass] - public partial class SshCommandTest : TestBase + public class SshCommandTest : TestBase { [TestMethod] public void Test_Execute_SingleCommand_Without_Connecting() diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_NeverConnected.cs deleted file mode 100644 index 23bd273e..00000000 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_NeverConnected.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Renci.SshNet.Tests.Classes -{ - class SubsystemSession_Connect_NeverConnected - { - } -} diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disconnected.cs deleted file mode 100644 index 92754621..00000000 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disconnected.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Renci.SshNet.Tests.Classes -{ - class SubsystemSession_SendData_Disconnected - { - } -}