From bf88d056eef28e83a34c6cdcc1636695fc487435 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 11:14:24 +0000 Subject: [PATCH 1/4] 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.104 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 --- updated-dependencies: - dependency-name: coverlet.collector dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: dependencies - dependency-name: coverlet.msbuild dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: dependencies - dependency-name: GitHubActionsTestLogger dependency-version: 3.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: Meziantou.Analyzer dependency-version: 3.0.104 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: Microsoft.Bcl.Cryptography dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: MSTest dependency-version: 4.2.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: PolySharp dependency-version: 1.16.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: SonarAnalyzer.CSharp dependency-version: 10.27.0.140913 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: System.Formats.Asn1 dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: Testcontainers dependency-version: 4.12.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8991d83e0..27cbb3806 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,22 +6,22 @@ - - - - + + + + - + - - + + - - + + - - + + From 91bba91fc4bfb9b730c0f3d95c634fa88b02033f Mon Sep 17 00:00:00 2001 From: Robert Hague Date: Fri, 26 Jun 2026 13:26:21 +0200 Subject: [PATCH 2/4] fixes --- .editorconfig | 9 +++++++++ src/Renci.SshNet/Netconf/NetConfSession.cs | 4 ++-- src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs | 2 +- .../Classes/Security/CertificateHostAlgorithmTest.cs | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 899395944..f92acc7da 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/src/Renci.SshNet/Netconf/NetConfSession.cs b/src/Renci.SshNet/Netconf/NetConfSession.cs index 60edc2d81..0d4fe3873 100644 --- a/src/Renci.SshNet/Netconf/NetConfSession.cs +++ b/src/Renci.SshNet/Netconf/NetConfSession.cs @@ -129,7 +129,7 @@ protected override void OnDataReceived(ArraySegment data) { _ = _data.Append(chunk); - if (!chunk.Contains(Prompt)) + if (!chunk.Contains(Prompt, StringComparison.Ordinal)) { return; } @@ -194,7 +194,7 @@ protected override void OnDataReceived(ArraySegment data) { _ = _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 5bae05f20..f63c4390e 100644 --- a/src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs +++ b/src/Renci.SshNet/PrivateKeyFile.SSHCOM.cs @@ -70,7 +70,7 @@ public Key Parse() 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/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs index a18a63b3f..728988ec8 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs @@ -287,7 +287,7 @@ public void CertificateBadCASignature_VerifySignatureReturnsFalse() "PD7/nXcyxnY3zALlPQTxb19EVx5lz58BS96gg="; char[] chars = goodCertString.ToCharArray(); - chars[^10] = 'a'; + chars[chars.Length - 1] = 'a'; string badCertString = new string(chars); Assert.IsTrue(VerifySignature(goodCertString)); From 177a291201ebe8c20e89a0b952e581c72306d773 Mon Sep 17 00:00:00 2001 From: Robert Hague Date: Fri, 26 Jun 2026 14:13:09 +0200 Subject: [PATCH 3/4] fix --- .../Classes/Security/CertificateHostAlgorithmTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs index 728988ec8..ec69a9572 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs @@ -287,7 +287,7 @@ public void CertificateBadCASignature_VerifySignatureReturnsFalse() "PD7/nXcyxnY3zALlPQTxb19EVx5lz58BS96gg="; char[] chars = goodCertString.ToCharArray(); - chars[chars.Length - 1] = 'a'; + chars[chars.Length - 10] = 'a'; string badCertString = new string(chars); Assert.IsTrue(VerifySignature(goodCertString)); From 87425dbb80514cfec95c751b04147dfedaf89dab Mon Sep 17 00:00:00 2001 From: Robert Hague Date: Fri, 26 Jun 2026 14:27:23 +0200 Subject: [PATCH 4/4] more --- Directory.Packages.props | 4 ++-- src/Renci.SshNet/Abstractions/SocketAbstraction.cs | 2 ++ src/Renci.SshNet/Connection/HttpConnector.cs | 1 + src/Renci.SshNet/Connection/ProtocolVersionExchange.cs | 1 + src/Renci.SshNet/ForwardedPortLocal.cs | 2 +- src/Renci.SshNet/IServiceFactory.cs | 2 +- src/Renci.SshNet/Netconf/NetConfSession.cs | 2 ++ src/Renci.SshNet/ScpClient.cs | 1 + src/Renci.SshNet/ServiceFactory.cs | 2 +- .../OldIntegrationTests/ScpClientTest.cs | 2 +- test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest.cs | 2 +- test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest.cs | 2 +- .../Classes/KeyboardInteractiveAuthenticationMethodTest.cs | 2 +- .../Classes/PasswordAuthenticationMethodTest.cs | 2 +- test/Renci.SshNet.Tests/Classes/ScpClientTest.cs | 2 +- test/Renci.SshNet.Tests/Classes/SessionTest.cs | 2 +- test/Renci.SshNet.Tests/Classes/SshCommandTest.cs | 2 +- .../Classes/SubsystemSession_Connect_NeverConnected.cs | 6 ------ .../Classes/SubsystemSession_SendData_Disconnected.cs | 6 ------ 19 files changed, 20 insertions(+), 25 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/Directory.Packages.props b/Directory.Packages.props index 27cbb3806..c03b54e08 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,14 +9,14 @@ - + - + diff --git a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs index 63dc2bf54..1dc992da5 100644 --- a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs @@ -8,6 +8,8 @@ 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 063562f8a..07e713dcf 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 a0c67a865..27ae098af 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 b021ab736..9bf5c0583 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 681d69da9..48ca70c87 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 0d4fe3873..941d4959c 100644 --- a/src/Renci.SshNet/Netconf/NetConfSession.cs +++ b/src/Renci.SshNet/Netconf/NetConfSession.cs @@ -7,6 +7,8 @@ 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 diff --git a/src/Renci.SshNet/ScpClient.cs b/src/Renci.SshNet/ScpClient.cs index 1a63f3210..fffa96011 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 f9dbdc42b..937f4224d 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 20106a2c5..839e4a03e 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 766dd23a6..b17cf0e0d 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 b18e4ab57..e72aff2c6 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 03f6e3025..7004a9408 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 820138f26..0e519ee2d 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 e85b0b536..35643adb0 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/SessionTest.cs b/test/Renci.SshNet.Tests/Classes/SessionTest.cs index 05c7f3428..62cc837bf 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 e677f4961..46910bafb 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 23bd273ed..000000000 --- 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 92754621d..000000000 --- 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 - { - } -}