Skip to content

Commit 0d1b015

Browse files
authored
[CodeQL] Suppress CSRF token validation warnings (#9278)
* Added CSRF token checks to address CodeQL bugs * Added CodeQL suppressions
1 parent 48dde8e commit 0d1b015

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/NuGetGallery/Controllers/ApiController.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ public virtual ActionResult SimulateError(SimulatedErrorType type = SimulatedErr
331331
[ApiScopeRequired(NuGetScopes.PackagePush, NuGetScopes.PackagePushVersion)]
332332
[ActionName("CreatePackageVerificationKey")]
333333
public virtual async Task<ActionResult> CreatePackageVerificationKeyAsync(string id, string version)
334+
// CodeQL [SM00433] This endpoint uses API Key authentication
334335
{
335336
// For backwards compatibility, we must preserve existing behavior where the client always pushes
336337
// symbols and the VerifyPackageKey callback returns the appropriate response. For this reason, we
@@ -427,6 +428,7 @@ public virtual Task<ActionResult> CreatePackagePut()
427428
[ApiScopeRequired(NuGetScopes.PackagePush, NuGetScopes.PackagePushVersion)]
428429
[ActionName("PushPackageApi")]
429430
public virtual Task<ActionResult> CreatePackagePost()
431+
// CodeQL [SM00433] This endpoint uses API Key authentication
430432
{
431433
return CreatePackageInternal();
432434
}
@@ -948,6 +950,7 @@ await PackageDeleteService.SoftDeletePackagesAsync(
948950
[ApiScopeRequired(NuGetScopes.PackageUnlist)]
949951
[ActionName("PublishPackageApi")]
950952
public virtual async Task<ActionResult> PublishPackage(string id, string version)
953+
// CodeQL [SM00433] This endpoint uses API Key authentication
951954
{
952955
var package = PackageService.FindPackageByIdAndVersionStrict(id, version);
953956
if (package == null)

0 commit comments

Comments
 (0)