From 38803e58e5fe8d55ddd744558fbe3ca77cda8e90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 20:25:54 +0000 Subject: [PATCH 1/2] Bump the dependencies group with 5 updates Bumps BenchmarkDotNet from 0.15.0 to 0.15.2 Bumps Meziantou.Analyzer from 2.0.201 to 2.0.203 Bumps Microsoft.Extensions.Logging.Abstractions from 9.0.5 to 9.0.6 Bumps Microsoft.Extensions.Logging.Console from 9.0.5 to 9.0.6 Bumps SonarAnalyzer.CSharp from 10.10.0.116381 to 10.12.0.118525 --- updated-dependencies: - dependency-name: BenchmarkDotNet dependency-version: 0.15.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: Meziantou.Analyzer dependency-version: 2.0.203 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: SonarAnalyzer.CSharp dependency-version: 10.12.0.118525 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a4d12ed86..7bdbdbf48 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,21 +4,21 @@ false - + - + - - + + - + From 7e6787568d484c952cd651e182207872e347346e Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Sat, 12 Jul 2025 14:48:56 +0200 Subject: [PATCH 2/2] seal types not publicly instantiable (ma0053) --- Directory.Packages.props | 16 +++++++--------- src/Renci.SshNet/Common/PortForwardEventArgs.cs | 2 +- src/Renci.SshNet/Session.cs | 4 ++-- src/Renci.SshNet/Sftp/SftpFileAttributes.cs | 2 +- src/Renci.SshNet/Sftp/SftpFileStream.cs | 4 ++-- .../Sftp/SftpFileSystemInformation.cs | 6 ++---- src/Renci.SshNet/Shell.cs | 4 ++-- src/Renci.SshNet/ShellStream.cs | 2 +- src/Renci.SshNet/SshCommand.cs | 4 ++-- 9 files changed, 20 insertions(+), 24 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 7bdbdbf48..169d98d16 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,20 +9,18 @@ - - + - - - + + + - + - - + - + \ No newline at end of file diff --git a/src/Renci.SshNet/Common/PortForwardEventArgs.cs b/src/Renci.SshNet/Common/PortForwardEventArgs.cs index 743cdce2c..89def98cf 100644 --- a/src/Renci.SshNet/Common/PortForwardEventArgs.cs +++ b/src/Renci.SshNet/Common/PortForwardEventArgs.cs @@ -6,7 +6,7 @@ namespace Renci.SshNet.Common /// /// Provides data for event. /// - public class PortForwardEventArgs : EventArgs + public sealed class PortForwardEventArgs : EventArgs { /// /// Initializes a new instance of the class. diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs index dc252c39c..1dfd18a10 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -30,7 +30,7 @@ namespace Renci.SshNet /// /// Provides functionality to connect and interact with SSH server. /// - public class Session : ISession + public sealed class Session : ISession { internal const byte CarriageReturn = 0x0d; internal const byte LineFeed = 0x0a; @@ -2185,7 +2185,7 @@ public void Dispose() /// Releases unmanaged and - optionally - managed resources. /// /// to release both managed and unmanaged resources; to release only unmanaged resources. - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (_disposed) { diff --git a/src/Renci.SshNet/Sftp/SftpFileAttributes.cs b/src/Renci.SshNet/Sftp/SftpFileAttributes.cs index 11d2fd8a8..503e14706 100644 --- a/src/Renci.SshNet/Sftp/SftpFileAttributes.cs +++ b/src/Renci.SshNet/Sftp/SftpFileAttributes.cs @@ -10,7 +10,7 @@ namespace Renci.SshNet.Sftp /// /// Contains SFTP file attributes. /// - public class SftpFileAttributes + public sealed class SftpFileAttributes { #pragma warning disable IDE1006 // Naming Styles #pragma warning disable SA1310 // Field names should not contain underscore diff --git a/src/Renci.SshNet/Sftp/SftpFileStream.cs b/src/Renci.SshNet/Sftp/SftpFileStream.cs index 2965f86e7..0b86595e2 100644 --- a/src/Renci.SshNet/Sftp/SftpFileStream.cs +++ b/src/Renci.SshNet/Sftp/SftpFileStream.cs @@ -16,7 +16,7 @@ namespace Renci.SshNet.Sftp #pragma warning disable IDE0079 // We intentionally want to suppress the below warning. [SuppressMessage("Performance", "CA1844: Provide memory-based overrides of async methods when subclassing 'Stream'", Justification = "TODO: This should be addressed in the future.")] #pragma warning restore IDE0079 - public class SftpFileStream : Stream + public sealed class SftpFileStream : Stream { private readonly Lock _lock = new Lock(); private readonly int _readBufferSize; @@ -162,7 +162,7 @@ public override long Position /// /// The operating system file handle for the file that the current encapsulates. /// - public virtual byte[] Handle + public byte[] Handle { get { diff --git a/src/Renci.SshNet/Sftp/SftpFileSystemInformation.cs b/src/Renci.SshNet/Sftp/SftpFileSystemInformation.cs index c9ae1abd4..a740ad3d8 100644 --- a/src/Renci.SshNet/Sftp/SftpFileSystemInformation.cs +++ b/src/Renci.SshNet/Sftp/SftpFileSystemInformation.cs @@ -3,11 +3,9 @@ namespace Renci.SshNet.Sftp { /// - /// Contains File system information exposed by statvfs@openssh.com request. + /// Contains file system information exposed by statvfs@openssh.com request. /// -#pragma warning disable SA1649 // File name should match first type name - public class SftpFileSystemInformation -#pragma warning restore SA1649 // File name should match first type name + public sealed class SftpFileSystemInformation { #pragma warning disable SA1310 // Field names should not contain underscore internal const ulong SSH_FXE_STATVFS_ST_RDONLY = 0x1; diff --git a/src/Renci.SshNet/Shell.cs b/src/Renci.SshNet/Shell.cs index 909d8f507..c2548e7f7 100644 --- a/src/Renci.SshNet/Shell.cs +++ b/src/Renci.SshNet/Shell.cs @@ -12,7 +12,7 @@ namespace Renci.SshNet /// /// Represents instance of the SSH shell object. /// - public class Shell : IDisposable + public sealed class Shell : IDisposable { private const int DefaultBufferSize = 1024; @@ -315,7 +315,7 @@ public void Dispose() /// Releases unmanaged and - optionally - managed resources. /// /// to release both managed and unmanaged resources; to release only unmanaged resources. - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (_disposed) { diff --git a/src/Renci.SshNet/ShellStream.cs b/src/Renci.SshNet/ShellStream.cs index f7dc862ac..e1571c671 100644 --- a/src/Renci.SshNet/ShellStream.cs +++ b/src/Renci.SshNet/ShellStream.cs @@ -17,7 +17,7 @@ namespace Renci.SshNet /// /// Contains operation for working with SSH Shell. /// - public class ShellStream : Stream + public sealed class ShellStream : Stream { private const int DefaultBufferSize = 1024; diff --git a/src/Renci.SshNet/SshCommand.cs b/src/Renci.SshNet/SshCommand.cs index 1a3c6945d..79c61dfd5 100644 --- a/src/Renci.SshNet/SshCommand.cs +++ b/src/Renci.SshNet/SshCommand.cs @@ -16,7 +16,7 @@ namespace Renci.SshNet /// /// Represents an SSH command that can be executed. /// - public class SshCommand : IDisposable + public sealed class SshCommand : IDisposable { private readonly ISession _session; private readonly Encoding _encoding; @@ -630,7 +630,7 @@ public void Dispose() /// Releases unmanaged and - optionally - managed resources. /// /// to release both managed and unmanaged resources; to release only unmanaged resources. - protected virtual void Dispose(bool disposing) + private void Dispose(bool disposing) { if (_isDisposed) {