Skip to content

Commit 64e797c

Browse files
authored
Merge pull request #9383 from NuGet/dev
[ReleasePrep][2023.02.08] RI of dev into main
2 parents 60fc5d5 + 4e5f90d commit 64e797c

File tree

22 files changed

+524
-69
lines changed

22 files changed

+524
-69
lines changed

src/AccountDeleter/EmptyFeatureFlagService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ public bool IsShowReportAbuseSafetyChangesEnabled()
276276
throw new NotImplementedException();
277277
}
278278

279+
public bool IsAllowAadContentSafetyReportsEnabled()
280+
{
281+
throw new NotImplementedException();
282+
}
283+
279284
public bool IsTyposquattingEnabled()
280285
{
281286
throw new NotImplementedException();

src/Bootstrap/dist/css/bootstrap-theme.css

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

src/Bootstrap/less/theme/page-list-packages.less

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,6 @@
1111
margin: 0 !important;
1212
}
1313

14-
.btn-filter {
15-
margin-top: 33px;
16-
margin-bottom: 33px;
17-
width: 90px;
18-
height: 45px;
19-
font-weight: 500;
20-
font-size: medium;
21-
background-color: transparent;
22-
border: none;
23-
}
24-
25-
.btn-filter:hover {
26-
background-color: #f4f4f4;
27-
}
28-
2914
@media (max-width: @screen-md) {
3015
.btn-filter {
3116
text-align: left;
@@ -118,6 +103,7 @@
118103
.collapsible {
119104
color: rgb(73, 73, 73);
120105
background-color: @alert-info-bg;
106+
position: relative;
121107
padding-top: 0px;
122108
padding-bottom: 0px;
123109
border: none;
@@ -131,6 +117,7 @@
131117

132118
.collapsible:focus {
133119
outline: solid;
120+
z-index: 1;
134121
}
135122

136123
.tfmTab {

src/GitHubVulnerabilities2Db/Fakes/FakeFeatureFlagService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ public bool IsShowReportAbuseSafetyChangesEnabled()
215215
throw new NotImplementedException();
216216
}
217217

218+
public bool IsAllowAadContentSafetyReportsEnabled()
219+
{
220+
throw new NotImplementedException();
221+
}
222+
218223
public bool IsPackageDependentsEnabled(User user)
219224
{
220225
throw new NotImplementedException();

src/NuGetGallery.Core/CredentialTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public static bool IsApiKey(string type)
104104
{
105105
return type?.StartsWith(ApiKey.Prefix, StringComparison.OrdinalIgnoreCase) ?? false;
106106
}
107+
107108
public static bool IsMicrosoftAccount(string type)
108109
{
109110
return type?.Equals(External.MicrosoftAccount, StringComparison.OrdinalIgnoreCase) ?? false;

src/NuGetGallery.Core/Frameworks/FrameworkCompatibilityService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ private static IReadOnlyDictionary<NuGetFramework, ISet<NuGetFramework>> GetComp
6161
}
6262
}
6363

64+
matrix.Add(SupportedFrameworks.Net60Windows7,
65+
new HashSet<NuGetFramework>() {
66+
SupportedFrameworks.Net60Windows, SupportedFrameworks.Net60Windows7,
67+
SupportedFrameworks.Net70Windows, SupportedFrameworks.Net70Windows7 });
68+
6469
return matrix;
6570
}
6671
}

src/NuGetGallery.Core/Frameworks/SupportedFrameworks.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public static class SupportedFrameworks
5050
public static readonly NuGetFramework XamarinMac = new NuGetFramework(FrameworkIdentifiers.XamarinMac, EmptyVersion);
5151
public static readonly NuGetFramework XamarinTvOs = new NuGetFramework(FrameworkIdentifiers.XamarinTVOS, EmptyVersion);
5252
public static readonly NuGetFramework XamarinWatchOs = new NuGetFramework(FrameworkIdentifiers.XamarinWatchOS, EmptyVersion);
53+
54+
public static readonly NuGetFramework Net60Windows7 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6, "windows", Version7);
55+
public static readonly NuGetFramework Net70Windows7 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7, "windows", Version7);
5356

5457
public static readonly IReadOnlyList<NuGetFramework> AllSupportedNuGetFrameworks;
5558

src/NuGetGallery.Services/Configuration/FeatureFlagService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class FeatureFlagService : IFeatureFlagService
5252
private const string ImageAllowlistFlightName = GalleryPrefix + "ImageAllowlist";
5353
private const string DisplayBannerFlightName = GalleryPrefix + "Banner";
5454
private const string ShowReportAbuseSafetyChanges = GalleryPrefix + "ShowReportAbuseSafetyChanges";
55+
private const string AllowAadContentSafetyReports = GalleryPrefix + "AllowAadContentSafetyReports";
5556
private const string DisplayTargetFrameworkFeatureName = GalleryPrefix + "DisplayTargetFramework";
5657
private const string ComputeTargetFrameworkFeatureName = GalleryPrefix + "ComputeTargetFramework";
5758
private const string RecentPackagesNoIndexFeatureName = GalleryPrefix + "RecentPackagesNoIndex";
@@ -333,6 +334,11 @@ public bool IsShowReportAbuseSafetyChangesEnabled()
333334
return _client.IsEnabled(ShowReportAbuseSafetyChanges, defaultValue: false);
334335
}
335336

337+
public bool IsAllowAadContentSafetyReportsEnabled()
338+
{
339+
return _client.IsEnabled(AllowAadContentSafetyReports, defaultValue: false);
340+
}
341+
336342
public bool IsMarkdigMdRenderingEnabled()
337343
{
338344
return _client.IsEnabled(MarkdigMdRenderingFlightName, defaultValue: false);

src/NuGetGallery.Services/Configuration/IFeatureFlagService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ public interface IFeatureFlagService
258258
/// </summary>
259259
bool IsShowReportAbuseSafetyChangesEnabled();
260260

261+
/// <summary>
262+
/// Whether online safety categories are available to content owned by at least one AAD-authenticated account
263+
/// </summary>
264+
bool IsAllowAadContentSafetyReportsEnabled();
265+
261266
/// <summary>
262267
/// Whether rendering Markdown content to HTML using Markdig is enabled
263268
/// </summary>

src/NuGetGallery/Controllers/PackagesController.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ public virtual ActionResult ReportAbuse(string id, string version)
13851385
var model = new ReportAbuseViewModel
13861386
{
13871387
ReasonChoices = _featureFlagService.IsShowReportAbuseSafetyChangesEnabled()
1388+
&& (_featureFlagService.IsAllowAadContentSafetyReportsEnabled() || PackageHasNoAadOwners(package))
13881389
? ReportAbuseWithSafetyReasons
13891390
: ReportAbuseReasons,
13901391
PackageId = id,
@@ -2857,6 +2858,38 @@ await _auditingService.SaveAuditRecordAsync(
28572858
}
28582859
}
28592860

2861+
private static bool PackageHasNoAadOwners(Package package)
2862+
{
2863+
var owners = package?.PackageRegistration?.Owners;
2864+
if (owners == null || !owners.Any()) {
2865+
return true;
2866+
}
2867+
2868+
// First check direct owner credentials
2869+
if (owners.Any(o => o.Credentials.GetAzureActiveDirectoryCredential() != null))
2870+
{
2871+
return false;
2872+
}
2873+
2874+
// Check all members of organization owners
2875+
var orgOwners = owners.Where(o => o is Organization).Select(o => o as Organization);
2876+
foreach (var orgOwner in orgOwners)
2877+
{
2878+
if (orgOwner.Members == null)
2879+
{
2880+
continue;
2881+
}
2882+
2883+
if (orgOwner.Members.Any(m => m.Member?.Credentials != null &&
2884+
m.Member.Credentials.GetAzureActiveDirectoryCredential() != null))
2885+
{
2886+
return false;
2887+
}
2888+
}
2889+
2890+
return true;
2891+
}
2892+
28602893
private async Task DeleteUploadedFileForUser(User currentUser, Stream uploadedFileStream)
28612894
{
28622895
try

0 commit comments

Comments
 (0)