Skip to content

Commit 6bc7ba3

Browse files
authored
CodeQL suppressions + suppression fixes (#10201)
1 parent e841950 commit 6bc7ba3

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/NuGetGallery/Controllers/ApiController.cs

Lines changed: 3 additions & 3 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
#pragma warning disable CA3147 // No need to validate Antiforgery Token with API request
@@ -426,8 +426,8 @@ public virtual Task<ActionResult> CreatePackagePut()
426426
[ApiAuthorize]
427427
[ApiScopeRequired(NuGetScopes.PackagePush, NuGetScopes.PackagePushVersion)]
428428
[ActionName("PushPackageApi")]
429-
public virtual Task<ActionResult> CreatePackagePost()
430429
// CodeQL [SM00433] This endpoint uses API Key authentication
430+
public virtual Task<ActionResult> CreatePackagePost()
431431
{
432432
return CreatePackageInternal();
433433
}
@@ -969,8 +969,8 @@ await PackageDeleteService.SoftDeletePackagesAsync(
969969
[ApiAuthorize]
970970
[ApiScopeRequired(NuGetScopes.PackageUnlist)]
971971
[ActionName("PublishPackageApi")]
972-
public virtual async Task<ActionResult> PublishPackage(string id, string version)
973972
// CodeQL [SM00433] This endpoint uses API Key authentication
973+
public virtual async Task<ActionResult> PublishPackage(string id, string version)
974974
{
975975
var package = PackageService.FindPackageByIdAndVersionStrict(id, version);
976976
if (package == null)

src/NuGetGallery/Controllers/AuthenticationController.cs

Lines changed: 3 additions & 1 deletion
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;
@@ -479,6 +479,7 @@ public virtual ActionResult AuthenticateExternal(string returnUrl)
479479
userOrganizationsWithTenantPolicy.Select(member => member.Organization.Username));
480480

481481
TempData["WarningMessage"] = string.Format(Strings.ChangeCredential_NotAllowed, orgList);
482+
// CodeQL [SM00405] the return URL is validated to be a relative URL before redirecting using Url.IsLocalUrl.
482483
return Redirect(returnUrl);
483484
}
484485
}
@@ -487,6 +488,7 @@ public virtual ActionResult AuthenticateExternal(string returnUrl)
487488
if (externalAuthProvider == null)
488489
{
489490
TempData["Message"] = Strings.ChangeCredential_ProviderNotFound;
491+
// CodeQL [SM00405] the return URL is validated to be a relative URL before redirecting using Url.IsLocalUrl.
490492
return Redirect(returnUrl);
491493
}
492494

0 commit comments

Comments
 (0)