Skip to content

Commit 821fac2

Browse files
authored
Merge pull request #10702 from NuGet/main
[ReleasePrep][2026.02.05]FI of main into dev
2 parents e9a6916 + 7f378e0 commit 821fac2

25 files changed

Lines changed: 382 additions & 76 deletions

RemovedPackages.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,16 @@ Scanning is not perfect. Community partnership is a very valuable part of the ov
9191
| Tracer.Fody.NLog | 12/17/2025 | Malware |
9292
| Gp4Framework 0.0.9 | 12/17/2025 | Potentially Malicious |
9393
| Gp4Framework 0.1.0 | 12/17/2025 | Potentially Malicious |
94+
| Allegory.Logo.Gateway.HttpApi.Host 0.1.17 | 12/17/2025 | Potentially Malicious |
95+
| Allegory.Logo.Gateway.HttpApi.Host 0.1.18 | 12/17/2025 | Potentially Malicious |
96+
| Allegory.Logo.Gateway.HttpApi.Host 0.1.19 | 12/17/2025 | Potentially Malicious |
97+
| Allegory.Logo.Gateway.HttpApi.Host 0.1.20 | 12/17/2025 | Potentially Malicious |
9498
| SystemDiagnosticsv324824726 1.0.0 | 01/09/2026 | Malware |
9599
| SystemDiagnosticsv324824726 1.2.0 | 01/09/2026 | Malware |
96100
| SystemDiagnosticsV2.5467 1.0.0 | 01/09/2026 | Malware |
101+
| SolnetWallet.Net.Core | 01/27/2026 | Potentially Malicious |
102+
| Z.Dp.All 1.0.1 | 01/27/2026 | Malware |
103+
| Z.Dp.All 1.0.2 | 01/27/2026 | Malware |
97104

98105

99106

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.303",
3+
"version": "8.0.318",
44
"rollForward": "latestFeature",
55
"allowPrerelease": false
66
}

src/AccountDeleter/Configuration/GalleryConfiguration.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;
@@ -118,5 +118,7 @@ public string SiteRoot
118118
public string AdminSenderUser { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
119119
public string SupportEmailSiteRoot { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
120120
public int MaxJsonLengthOverride { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
121+
public int MaxOwnerPerPackageRegistration { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
122+
public int MaxOwnerRequestsPerPackageRegistration { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
121123
}
122124
}

src/Bootstrap/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Catalog/Helpers/Utils.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public static class Utils
3636

3737
private static readonly char[] TagTrimChars = { ',', ' ', '\t', '|', ';' };
3838

39+
private static readonly char[] Slashes = { '/', '\\' };
40+
3941
public static string[] SplitTags(string original)
4042
{
4143
var fields = original
@@ -118,12 +120,13 @@ public static XDocument GetNuspec(ZipArchive package)
118120

119121
foreach (ZipArchiveEntry part in package.Entries)
120122
{
121-
if (part.FullName.EndsWith(".nuspec") && part.FullName.IndexOf('/') == -1)
123+
if (part.FullName.EndsWith(".nuspec") && part.FullName.IndexOfAny(Slashes) == -1)
122124
{
123125
XDocument nuspec = XDocument.Load(part.Open());
124126
return nuspec;
125127
}
126128
}
129+
127130
return null;
128131
}
129132

src/NuGetGallery.Services/Configuration/AppConfiguration.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,27 @@ public string ExternalBrandingMessage
417417

418418
[DefaultValue(null)]
419419
public int? MinWorkerThreads { get; set; }
420+
420421
[DefaultValue(null)]
421422
public int? MaxWorkerThreads { get; set; }
423+
422424
[DefaultValue(null)]
423425
public int? MinIoThreads { get; set; }
426+
424427
[DefaultValue(null)]
425428
public int? MaxIoThreads { get; set; }
429+
426430
public string InternalMicrosoftTenantKey { get; set; }
431+
427432
public string AdminSenderUser { get; set; }
433+
428434
[DefaultValue(16 * 1024 * 1024)]
429435
public int MaxJsonLengthOverride { get; set; }
436+
437+
[DefaultValue(15)]
438+
public int MaxOwnerPerPackageRegistration { get; set; }
439+
440+
[DefaultValue(3)]
441+
public int MaxOwnerRequestsPerPackageRegistration { get; set; }
430442
}
431-
}
443+
}

src/NuGetGallery.Services/Configuration/IAppConfiguration.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,5 +530,15 @@ public interface IAppConfiguration : IMessageServiceConfiguration
530530
/// select places where large JSON response bodies are possible.
531531
/// </summary>
532532
int MaxJsonLengthOverride { get; set; }
533+
534+
/// <summary>
535+
/// The maximum number of owners allowed per package registration. If this limit is reached, no more owners can be added and others must be removed first.
536+
/// </summary>
537+
int MaxOwnerPerPackageRegistration { get; set; }
538+
539+
/// <summary>
540+
/// The maximum number of owner requests allowed per package registration. If this limit is reached, no more requests can be made and other requests must be removed first.
541+
/// </summary>
542+
int MaxOwnerRequestsPerPackageRegistration { get; set; }
533543
}
534-
}
544+
}

src/NuGetGallery.Services/PackageManagement/PackageOwnerRequestService.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
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;
55
using System.Collections.Generic;
66
using System.Data.Entity;
7+
using System.Globalization;
78
using System.Linq;
89
using System.Threading.Tasks;
910
using NuGet.Services.Entities;
11+
using NuGetGallery.Configuration;
1012

1113
namespace NuGetGallery
1214
{
1315
public class PackageOwnerRequestService : IPackageOwnerRequestService
1416
{
1517
private readonly IEntityRepository<PackageOwnerRequest> _packageOwnerRequestRepository;
18+
private readonly IAppConfiguration _appConfiguration;
1619

17-
public PackageOwnerRequestService(IEntityRepository<PackageOwnerRequest> packageOwnerRequestRepository)
20+
public PackageOwnerRequestService(
21+
IEntityRepository<PackageOwnerRequest> packageOwnerRequestRepository,
22+
IAppConfiguration appConfiguration)
1823
{
1924
_packageOwnerRequestRepository = packageOwnerRequestRepository ?? throw new ArgumentNullException(nameof(packageOwnerRequestRepository));
25+
_appConfiguration = appConfiguration ?? throw new ArgumentNullException(nameof(appConfiguration));
2026
}
2127

2228
public PackageOwnerRequest GetPackageOwnershipRequest(PackageRegistration package, User newOwner, string token)
@@ -111,10 +117,19 @@ public async Task<PackageOwnerRequest> AddPackageOwnershipRequest(PackageRegistr
111117
throw new ArgumentNullException(nameof(newOwner));
112118
}
113119

114-
var existingRequest = GetPackageOwnershipRequests(package: package, newOwner: newOwner).FirstOrDefault();
115-
if (existingRequest != null)
120+
var existingRequests = GetPackageOwnershipRequests(package: package).ToList();
121+
var duplicate = existingRequests.FirstOrDefault(x => x.NewOwnerKey == newOwner.Key);
122+
if (duplicate is not null)
116123
{
117-
return existingRequest;
124+
return duplicate;
125+
}
126+
127+
if (existingRequests.Count >= Math.Max(1, _appConfiguration.MaxOwnerRequestsPerPackageRegistration))
128+
{
129+
throw new UserSafeException(string.Format(
130+
CultureInfo.CurrentCulture,
131+
ServicesStrings.MaximumPackageOwnerRequestsReached,
132+
_appConfiguration.MaxOwnerRequestsPerPackageRegistration));
118133
}
119134

120135
var newRequest = new PackageOwnerRequest
@@ -147,4 +162,4 @@ public async Task DeletePackageOwnershipRequest(PackageOwnerRequest request, boo
147162
}
148163
}
149164
}
150-
}
165+
}

src/NuGetGallery.Services/PackageManagement/PackageOwnershipManagementService.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
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;
55
using System.Collections.Generic;
6+
using System.Globalization;
67
using System.Linq;
78
using System.Threading.Tasks;
89
using System.Web;
@@ -47,6 +48,16 @@ public PackageOwnershipManagementService(
4748

4849
public async Task AddPackageOwnerWithMessagesAsync(PackageRegistration packageRegistration, User user)
4950
{
51+
if (packageRegistration == null)
52+
{
53+
throw new ArgumentNullException(nameof(packageRegistration));
54+
}
55+
56+
if (packageRegistration.Owners.Count >= Math.Max(_appConfiguration.MaxOwnerPerPackageRegistration, 1))
57+
{
58+
throw new UserSafeException(string.Format(CultureInfo.CurrentCulture, ServicesStrings.MaximumPackageOwnersReached, _appConfiguration.MaxOwnerPerPackageRegistration));
59+
}
60+
5061
await AddPackageOwnerAsync(packageRegistration, user, commitChanges: true);
5162

5263
var packageUrl = _urlHelper.Package(packageRegistration.Id, version: null, relativeUrl: false, supportEmail: true);
@@ -418,4 +429,4 @@ private static bool OwnerHasPermissionsToRemoveFromNamespace(User requestingOwne
418429
return true;
419430
}
420431
}
421-
}
432+
}

src/NuGetGallery.Services/PackageManagement/PackageService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Linq;
99
using System.Threading;
1010
using System.Threading.Tasks;
11-
using System.Web.Helpers;
1211
using Newtonsoft.Json;
1312
using Newtonsoft.Json.Linq;
1413
using NuGet.Frameworks;

0 commit comments

Comments
 (0)