Skip to content

Commit aea1c1f

Browse files
authored
Ignore SHA1 codeQL warnings (#1143)
1 parent 32a5a10 commit aea1c1f

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Microsoft.Sbom.Contracts/Contracts/Enums/AlgorithmName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,5 @@ public static AlgorithmName FromString(string name)
114114
/// Gets equivalent to <see cref="HashAlgorithmName.MD5"/>.
115115
/// </summary>
116116
[SuppressMessage("Security", "CA5351:Do Not Use Broken Cryptographic Algorithms", Justification = "Used by conda package manager.")]
117-
public static AlgorithmName MD5 => new AlgorithmName(nameof(MD5), stream => System.Security.Cryptography.MD5.Create().ComputeHash(stream));
117+
public static AlgorithmName MD5 => new AlgorithmName(nameof(MD5), stream => System.Security.Cryptography.MD5.Create().ComputeHash(stream)); // CodeQL [SM02196] Used by conda package manager.
118118
}

src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Utils/SPDXExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static string AddSpdxId(this SPDXFile spdxFile, string fileName, IEnumera
9494

9595
if (checksums is null || !checksums.Any(c => c.Algorithm == AlgorithmName.SHA1))
9696
{
97-
throw new MissingHashValueException($"The file {fileName} is missing the {HashAlgorithmName.SHA1} hash value.");
97+
throw new MissingHashValueException($"The file {fileName} is missing the {HashAlgorithmName.SHA1} hash value."); // CodeQL [SM02196] Sha1 is required per the SPDX spec.
9898
}
9999

100100
// Get the SHA1 for this file.

src/Microsoft.Sbom.Parsers.Spdx30SbomParser/Utils/SPDXExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static string AddSpdxId(this File element, InternalSbomFileInfo fileInfo)
4242

4343
if (fileInfo.Checksum is null || !fileInfo.Checksum.Any(c => c.Algorithm == AlgorithmName.SHA1))
4444
{
45-
throw new MissingHashValueException($"The file {fileInfo.Path} is missing the {HashAlgorithmName.SHA1} hash value.");
45+
throw new MissingHashValueException($"The file {fileInfo.Path} is missing the {HashAlgorithmName.SHA1} hash value."); // CodeQL [SM02196] Sha1 is required per the SPDX spec.
4646
}
4747

4848
// Get the SHA1 for this file.

0 commit comments

Comments
 (0)