Skip to content

Commit 8e05def

Browse files
authored
Suppress CodeQL false alarm (#4960)
* Supress CodeQL false alarm. * update. * Update suppress comment
1 parent 55e5bac commit 8e05def

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/System.ServiceModel.Primitives/src/System/IdentityModel/CryptoHelper.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ internal static KeyedHashAlgorithm CreateKeyedHashAlgorithm(byte[] key, string a
7676
{
7777
case SecurityAlgorithms.HmacSha1Signature:
7878
#pragma warning disable CA5350 // Do not use insecure cryptographic algorithm SHA1.
79-
return new HMACSHA1(key);
79+
return new HMACSHA1(key);// CodeQL [SM02200] Insecure cryptographic algorithm HMACSHA1 is needed here as a requirement of SOAP protocols
8080
#pragma warning restore CA5350 // Do not use insecure cryptographic algorithm SHA1.
8181
case SecurityAlgorithms.HmacSha256Signature:
8282
return new HMACSHA256(key);
@@ -196,7 +196,7 @@ internal static HashAlgorithm CreateHashAlgorithm(string algorithm)
196196
case SystemSecurityCryptographySha1String:
197197
case SecurityAlgorithms.Sha1Digest:
198198
#pragma warning disable CA5350 // Do not use insecure cryptographic algorithm SHA1.
199-
return SHA1.Create();
199+
return SHA1.Create();// CodeQL [SM02196] Insecure cryptographic algorithm SHA1 is needed here as a requirement of SOAP protocols
200200
#pragma warning restore CA5350 // Do not use insecure cryptographic algorithm SHA1.
201201
case SHA256String:
202202
case SecurityAlgorithms.Sha256Digest:
@@ -223,7 +223,7 @@ private static object GetDefaultAlgorithm(string algorithm)
223223
// will be inside the delegate dictionary.
224224
case SecurityAlgorithms.Sha1Digest:
225225
#pragma warning disable CA5350 // Do not use insecure cryptographic algorithm SHA1.
226-
return SHA1.Create();
226+
return SHA1.Create();// CodeQL [SM02196] Insecure cryptographic algorithm SHA1 is needed here as a requirement of SOAP protocols
227227
#pragma warning restore CA5350 // Do not use insecure cryptographic algorithm SHA1.
228228
case SecurityAlgorithms.ExclusiveC14n:
229229
throw ExceptionHelper.PlatformNotSupported();
@@ -242,11 +242,11 @@ private static object GetDefaultAlgorithm(string algorithm)
242242
case SecurityAlgorithms.TripleDesEncryption:
243243
case SecurityAlgorithms.TripleDesKeyWrap:
244244
#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
245-
return TripleDES.Create();
245+
return TripleDES.Create();// CodeQL [SM02192] Weak cryptographic algorithm TripleDES is needed here as a requirement of SOAP protocols
246246
#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
247247
case SecurityAlgorithms.HmacSha1Signature:
248248
#pragma warning disable CA5350 // Do not use insecure cryptographic algorithm SHA1.
249-
return new HMACSHA1();
249+
return new HMACSHA1();// CodeQL [SM02200] Insecure cryptographic algorithm HMACSHA1 is needed here as a requirement of SOAP protocols
250250
#pragma warning restore CA5350 // Do not use insecure cryptographic algorithm SHA1.
251251
case SecurityAlgorithms.HmacSha256Signature:
252252
return new HMACSHA256();
@@ -256,7 +256,7 @@ private static object GetDefaultAlgorithm(string algorithm)
256256
return null;
257257
case SecurityAlgorithms.DesEncryption:
258258
#pragma warning disable CA5351 // Do Not Use Broken Cryptographic Algorithms
259-
return DES.Create();
259+
return DES.Create();// CodeQL [SM02192] Broken cryptographic algorithm DES is needed here as a requirement of SOAP protocols
260260
#pragma warning restore CA5351 // Do Not Use Broken Cryptographic Algorithms
261261
default:
262262
return null;
@@ -340,11 +340,11 @@ internal static object GetAlgorithmFromConfig(string algorithm)
340340
return SHA256.Create();
341341
case SecurityAlgorithms.Sha1Digest:
342342
#pragma warning disable CA5350 // Do not use insecure cryptographic algorithm SHA1.
343-
return SHA1.Create();
343+
return SHA1.Create();// CodeQL [SM02196] Insecure cryptographic algorithm SHA1 is needed here as a requirement of SOAP protocols
344344
#pragma warning restore CA5350 // Do not use insecure cryptographic algorithm SHA1.
345345
case SecurityAlgorithms.HmacSha1Signature:
346346
#pragma warning disable CA5350 // Do not use insecure cryptographic algorithm SHA1.
347-
return new HMACSHA1();
347+
return new HMACSHA1();// CodeQL [SM02200] Insecure cryptographic algorithm HMACSHA1 is needed here as a requirement of SOAP protocols
348348
#pragma warning restore CA5350 // Do not use insecure cryptographic algorithm SHA1.
349349
default:
350350
break;

0 commit comments

Comments
 (0)