Browse Source

Fix | Suppress CodeQL warning for usage of deprecated Ssl2. (#2428)

pull/2440/head
Aris Rellegue 1 year ago
committed by GitHub
parent
commit
908f563699
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserHelperClasses.cs
  2. 5
      src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs

10
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserHelperClasses.cs

@ -764,13 +764,14 @@ namespace Microsoft.Data.SqlClient
{
name = "TLS 1.0";
}
#pragma warning disable CS0618 // Type or member is obsolete: SSL is depricated
// SSL 2.0 and 3.0 are only referenced to log a warning, not explicitly used for connections
#pragma warning disable CS0618, CA5397
else if ((protocol & SslProtocols.Ssl3) == SslProtocols.Ssl3)
{
name = "SSL 3.0";
}
else if ((protocol & SslProtocols.Ssl2) == SslProtocols.Ssl2)
#pragma warning restore CS0618 // Type or member is obsolete: SSL is depricated
#pragma warning restore CS0618, CA5397
{
name = "SSL 2.0";
}
@ -790,9 +791,10 @@ namespace Microsoft.Data.SqlClient
public static string GetProtocolWarning(this SslProtocols protocol)
{
string message = string.Empty;
#pragma warning disable CS0618 // Type or member is obsolete : SSL is depricated
// SSL 2.0 and 3.0 are only referenced to log a warning, not explicitly used for connections
#pragma warning disable CS0618, CA5397
if ((protocol & (SslProtocols.Ssl2 | SslProtocols.Ssl3 | SslProtocols.Tls | SslProtocols.Tls11)) != SslProtocols.None)
#pragma warning restore CS0618 // Type or member is obsolete : SSL is depricated
#pragma warning restore CS0618, CA5397
{
message = StringsHelper.Format(Strings.SEC_ProtocolWarning, protocol.ToFriendlyName());
}

5
src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectNative.cs

@ -427,13 +427,14 @@ namespace Microsoft.Data.SqlClient
}
else if (nativeProtocol.HasFlag(NativeProtocols.SP_PROT_SSL3_CLIENT) || nativeProtocol.HasFlag(NativeProtocols.SP_PROT_SSL3_SERVER))
{
#pragma warning disable CS0618 // Type or member is obsolete : SSL is depricated
// SSL 2.0 and 3.0 are only referenced to log a warning, not explicitly used for connections
#pragma warning disable CS0618, CA5397
protocolVersion = (int)SslProtocols.Ssl3;
}
else if (nativeProtocol.HasFlag(NativeProtocols.SP_PROT_SSL2_CLIENT) || nativeProtocol.HasFlag(NativeProtocols.SP_PROT_SSL2_SERVER))
{
protocolVersion = (int)SslProtocols.Ssl2;
#pragma warning restore CS0618 // Type or member is obsolete : SSL is depricated
#pragma warning restore CS0618, CA5397
}
else //if (nativeProtocol.HasFlag(NativeProtocols.SP_PROT_NONE))
{

Loading…
Cancel
Save