Skip to content

Conversation

@jaredpar
Copy link
Member

@jaredpar jaredpar commented Aug 6, 2024

This takes care of a number of CodeQL violations in our code base. Virtually all of these were about uses of MD5 or SHA-1 that we have to support due to the file formats we produce and consume. As such I added suppressions for those cases. There was one real case that could be migrated that I took care of.

@jaredpar jaredpar requested review from a team as code owners August 6, 2024 14:01
@ghost ghost added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 6, 2024
@jaredpar
Copy link
Member Author

jaredpar commented Aug 6, 2024

@dotnet/roslyn-compiler PTAL

Comment on lines +33 to +40
static byte[] calculateSha1(IEnumerable<Blob> content)
{
hash.AppendData(content);
return hash.GetHashAndReset();
// CodeQL [SM02196] ECMA-335 requires us to use SHA-1 and there is no alternative.
using (var hash = IncrementalHash.CreateHash(HashAlgorithmName.SHA1))
{
hash.AppendData(content);
return hash.GetHashAndReset();
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to a local function to make it clear that the scope of the SHA1 usage was this function.

This takes care of a number of CodeQL violations in our code base.
Virtually all of these were about uses of MD5 or SHA-1 that we have to
support due to the file formats we produce and consume. As such I added
suppressions for those cases. There was one real case that could be
migrated that I took care of.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants