Skip to content

Commit b374399

Browse files
authored
CodeQL fixes. (#10353)
1 parent c700723 commit b374399

3 files changed

Lines changed: 5 additions & 12 deletions

File tree

src/NuGetGallery.Core/Certificates/CertificateFile.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -65,6 +65,7 @@ private static MemoryStream CopyAsReadOnly(Stream source)
6565
private static string GetSha1Thumbprint(MemoryStream stream)
6666
{
6767
#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
68+
// CodeQL [SM02196] Calculated for backwards compatibility, it is not used for anything
6869
using (var hashAlgorithm = SHA1.Create())
6970
#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms
7071
{
@@ -95,4 +96,4 @@ private static string GetHexString(byte[] bytes)
9596
return BitConverter.ToString(bytes).Replace("-", "").ToLowerInvariant();
9697
}
9798
}
98-
}
99+
}

src/NuGetGallery/Controllers/ApiController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ public virtual ActionResult SimulateError(SimulatedErrorType type = SimulatedErr
329329
[ApiAuthorize]
330330
[ApiScopeRequired(NuGetScopes.PackagePush, NuGetScopes.PackagePushVersion)]
331331
[ActionName("CreatePackageVerificationKey")]
332-
public virtual async Task<ActionResult> CreatePackageVerificationKeyAsync(string id, string version)
333332
// CodeQL [SM00433] This endpoint uses API Key authentication
333+
public virtual async Task<ActionResult> CreatePackageVerificationKeyAsync(string id, string version)
334334
{
335335
// For backwards compatibility, we must preserve existing behavior where the client always pushes
336336
// symbols and the VerifyPackageKey callback returns the appropriate response. For this reason, we

tests/NuGetGallery.Core.Facts/Services/CloudBlobCoreFileStorageServiceIntegrationTests.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -171,14 +171,6 @@ public async Task OpenWriteAsyncReturnsWritableStream()
171171
var fileName = _prefixA;
172172
var expectedContent = "Hello, world.";
173173
var bytes = Encoding.UTF8.GetBytes(expectedContent);
174-
string expectedContentMD5;
175-
#pragma warning disable CA5351
176-
using (var md5 = MD5.Create())
177-
{
178-
expectedContentMD5 = Convert.ToBase64String(md5.ComputeHash(bytes));
179-
}
180-
#pragma warning disable CA5351
181-
182174
var container = _clientA.GetContainerReference(folderName);
183175
var file = container.GetBlobReference(fileName);
184176

0 commit comments

Comments
 (0)