Skip to content

Commit eeec451

Browse files
authored
More CodeQL Suppressions (#2264)
1 parent bb36ed7 commit eeec451

File tree

4 files changed

+28
-7
lines changed

4 files changed

+28
-7
lines changed

src/TraceEvent/Symbols/NativeSymbolModule.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,17 @@ private void TryInitializeCppChecksum(IDiaSourceFile sourceFile)
664664
// 3 checksum generated with the SHA256 hashing algorithm.
665665
if (sourceFile.checksumType == 1)
666666
{
667-
_hashAlgorithm = System.Security.Cryptography.MD5.Create(); // lgtm [cs/weak-crypto] The PDB specifies the checksum algorithm. This is not controlled by TraceEvent.
667+
// CodeQL [SM02196] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
668+
// CodeQL [SM03938] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
669+
// CodeQL [SM03939] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
670+
_hashAlgorithm = System.Security.Cryptography.MD5.Create();
668671
}
669672
else if (sourceFile.checksumType == 2)
670673
{
671-
_hashAlgorithm = System.Security.Cryptography.SHA1.Create(); // lgtm [cs/weak-crypto] The PDB specifies the checksum algorithm. This is not controlled by TraceEvent.
674+
// CodeQL [SM02196] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
675+
// CodeQL [SM03938] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
676+
// CodeQL [SM03939] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
677+
_hashAlgorithm = System.Security.Cryptography.SHA1.Create();
672678
}
673679
else if (sourceFile.checksumType == 3)
674680
{
@@ -725,11 +731,17 @@ private void TryInitializeManagedChecksum(NativeSymbolModule module)
725731

726732
if (srcFormat.Header.algorithmId == guidMD5)
727733
{
728-
_hashAlgorithm = System.Security.Cryptography.MD5.Create(); // lgtm [cs/weak-crypto] The checksum algorithm is specified by the injected source. This is not controlled by TraceEvent.
734+
// CodeQL [SM02196] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
735+
// CodeQL [SM03938] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
736+
// CodeQL [SM03939] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
737+
_hashAlgorithm = System.Security.Cryptography.MD5.Create();
729738
}
730739
else if (srcFormat.Header.algorithmId == guidSHA1)
731740
{
732-
_hashAlgorithm = System.Security.Cryptography.SHA1.Create(); // lgtm [cs/weak-crypto] The checksum algorithm is specified by the injected source. This is not controlled by TraceEvent.
741+
// CodeQL [SM02196] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
742+
// CodeQL [SM03938] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
743+
// CodeQL [SM03939] The checksum algorithm is specified by the built artifact. This is not controlled by TraceEvent.
744+
_hashAlgorithm = System.Security.Cryptography.SHA1.Create();
733745
}
734746
else if (srcFormat.Header.algorithmId == guidSHA256)
735747
{

src/TraceEvent/Symbols/PortableSymbolModule.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ internal PortablePdbSourceFile(DocumentHandle documentHandle, PortableSymbolModu
119119
Guid hashAlgorithmGuid = metaData.GetGuid(sourceFileDocument.HashAlgorithm);
120120
if (hashAlgorithmGuid == HashAlgorithmSha1)
121121
{
122-
_hashAlgorithm = System.Security.Cryptography.SHA1.Create(); // lgtm [cs/weak-crypto] The PDB specifies the checksum algorithm. This is not controlled by TraceEvent.
122+
// CodeQL [SM02196] The PDB specifies the checksum algorithm. This is not controlled by TraceEvent.
123+
// CodeQL [SM03938] The PDB specifies the checksum algorithm. This is not controlled by TraceEvent.
124+
// CodeQL [SM03939] The PDB specifies the checksum algorithm. This is not controlled by TraceEvent.
125+
_hashAlgorithm = System.Security.Cryptography.SHA1.Create();
123126
}
124127
else if (hashAlgorithmGuid == HashAlgorithmSha256)
125128
{

src/TraceEvent/TraceEventSession.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3053,7 +3053,10 @@ public static Guid GetEventSourceGuidFromName(string name)
30533053
}
30543054

30553055
// Compute the Sha1 hash
3056-
var sha1 = System.Security.Cryptography.SHA1.Create(); // lgtm [cs/weak-crypto] The EventSource name to GUID protocol requires a SHA1 hash.
3056+
// CodeQL [SM02196] The EventSource name to GUID protocol requires a SHA1 hash.
3057+
// CodeQL [SM03938] The EventSource name to GUID protocol requires a SHA1 hash.
3058+
// CodeQL [SM03939] The EventSource name to GUID protocol requires a SHA1 hash.
3059+
var sha1 = System.Security.Cryptography.SHA1.Create();
30573060
byte[] hash = sha1.ComputeHash(bytes);
30583061

30593062
// Create a GUID out of the first 16 bytes of the hash (SHA-1 create a 20 byte hash)

src/TraceParserGen/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,10 @@ private static Guid GenerateGuidFromName(string name)
636636
}
637637

638638
// Compute the Sha1 hash
639-
var sha1 = System.Security.Cryptography.SHA1.Create(); // lgtm [cs/weak-crypto] The EventSource name to GUID protocol requires a SHA1 hash.
639+
// CodeQL [SM02196] The EventSource name to GUID protocol requires a SHA1 hash.
640+
// CodeQL [SM03938] The EventSource name to GUID protocol requires a SHA1 hash.
641+
// CodeQL [SM03939] The EventSource name to GUID protocol requires a SHA1 hash.
642+
var sha1 = System.Security.Cryptography.SHA1.Create();
640643
byte[] hash = sha1.ComputeHash(bytes);
641644

642645
// Create a GUID out of the first 16 bytes of the hash (SHA-1 create a 20 byte hash)

0 commit comments

Comments
 (0)