author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
455,742 | 13.07.2021 04:41:22 | -10,800 | 7557469186f07c1a15fff57e5efd3816e622a776 | Strip html comments from markdown | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Services/MarkdownService.cs",
"new_path": "src/NuGetGallery/Services/MarkdownService.cs",
"diff": "@@ -23,6 +23,7 @@ public class MarkdownService : IMarkdownService\nprivate static readonly TimeSpan RegexTimeout = TimeSpan.FromMinutes(1);\nprivate static readonly Regex EncodedBlockQuotePattern = new Regex(\"^ {0,3}>\", RegexOptions.Multiline, RegexTimeout);\nprivate static readonly Regex LinkPattern = new Regex(\"<a href=([\\\"\\']).*?\\\\1\", RegexOptions.None, RegexTimeout);\n+ private static readonly Regex HtmlCommentPattern = new Regex(\"<!--.*?-->\", RegexOptions.Singleline, RegexTimeout);\nprivate readonly IFeatureFlagService _features;\nprivate readonly IImageDomainValidator _imageDomainValidator;\n@@ -82,10 +83,12 @@ private RenderedMarkdownResult GetHtmlFromMarkdownCommonMark(string markdownStri\nImageSourceDisallowed = false\n};\n- var readmeWithoutBom = markdownString.StartsWith(\"\\ufeff\") ? markdownString.Replace(\"\\ufeff\", \"\") : markdownString;\n+ var markdownWithoutComments = HtmlCommentPattern.Replace(markdownString, \"\");\n+\n+ var markdownWithoutBom = markdownWithoutComments.StartsWith(\"\\ufeff\") ? markdownWithoutComments.Replace(\"\\ufeff\", \"\") : markdownWithoutComments;\n// HTML encode markdown, except for block quotes, to block inline html.\n- var encodedMarkdown = EncodedBlockQuotePattern.Replace(HttpUtility.HtmlEncode(readmeWithoutBom), \"> \");\n+ var encodedMarkdown = EncodedBlockQuotePattern.Replace(HttpUtility.HtmlEncode(markdownWithoutBom), \"> \");\nvar settings = CommonMarkSettings.Default.Clone();\nsettings.RenderSoftLineBreaksAsLineBreaks = true;\n@@ -189,7 +192,9 @@ private RenderedMarkdownResult GetHtmlFromMarkdownMarkdig(string markdownString,\nImageSourceDisallowed = false\n};\n- var readmeWithoutBom = markdownString.TrimStart('\\ufeff');\n+ var markdownWithoutComments = HtmlCommentPattern.Replace(markdownString, \"\");\n+\n+ var markdownWithoutBom = markdownWithoutComments.TrimStart('\\ufeff');\nvar pipeline = new MarkdownPipelineBuilder()\n.UseGridTables()\n@@ -208,7 +213,7 @@ private RenderedMarkdownResult GetHtmlFromMarkdownMarkdig(string markdownString,\nvar renderer = new HtmlRenderer(htmlWriter);\npipeline.Setup(renderer);\n- var document = Markdown.Parse(readmeWithoutBom, pipeline);\n+ var document = Markdown.Parse(markdownWithoutBom, pipeline);\nforeach (var node in document.Descendants())\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Services/MarkdownServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Services/MarkdownServiceFacts.cs",
"diff": "@@ -73,6 +73,8 @@ public void EncodesHtmlInMarkdownWithAdaptiveHeader(string originalMd, string ex\n[Theory]\n[InlineData(\"# Heading\", \"<h2>Heading</h2>\", false, true)]\n[InlineData(\"# Heading\", \"<h2>Heading</h2>\", false, false)]\n+ [InlineData(\"<!-- foo --> <!-- foo \\n bar --> baz\", \"<p>baz</p>\", false, true)]\n+ [InlineData(\"<!-- foo --> <!-- foo \\n bar --> baz\", \"<p>baz</p>\", false, false)]\n[InlineData(\"\\ufeff# Heading with BOM\", \"<h2>Heading with BOM</h2>\", false, true)]\n[InlineData(\"\\ufeff# Heading with BOM\", \"<h2>Heading with BOM</h2>\", false, false)]\n[InlineData(\"- List\", \"<ul>\\n<li>List</li>\\n</ul>\", false, true)]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Strip html comments from markdown (#8667) |
455,741 | 13.07.2021 15:22:37 | 25,200 | 84984d93c2b125a30ef3ff5177e7ad4b104c4406 | modify pettry link | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Helpers/HtmlExtensions.cs",
"new_path": "src/NuGetGallery/Helpers/HtmlExtensions.cs",
"diff": "@@ -103,7 +103,7 @@ void appendUrl(StringBuilder builder, string inputText)\n// Format links to NuGet packages\nMatch packageMatch = RegexEx.MatchWithTimeoutOrNull(\nformattedUri,\n- $@\"({Regex.Escape(siteRoot)}\\/packages\\/(?<name>\\w+([_.-]\\w+)*(\\/[0-9a-zA-Z-.]+)?)\\/?$)\",\n+ $@\"(^{Regex.Escape(siteRoot)}\\/packages\\/(?<name>\\w+([_.-]\\w+)*(\\/[0-9a-zA-Z-.]+)?)\\/?$)\",\nRegexOptions.IgnoreCase);\nif (packageMatch != null && packageMatch.Groups[\"name\"].Success)\n{\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | modify pettry link (#8658) |
455,744 | 16.07.2021 15:52:02 | 25,200 | 81d402ea89a4e8d49aa5061513d15561c2e78276 | First round of implementation. | [
{
"change_type": "MODIFY",
"old_path": "src/AccountDeleter/Configuration/GalleryConfiguration.cs",
"new_path": "src/AccountDeleter/Configuration/GalleryConfiguration.cs",
"diff": "@@ -37,6 +37,7 @@ public string SiteRoot\npublic string AzureStorage_Revalidation_ConnectionString { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }\npublic bool AzureStorageReadAccessGeoRedundant { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }\npublic TimeSpan FeatureFlagsRefreshInterval { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }\n+ public bool AdminPanelEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }\npublic bool AdminPanelDatabaseAccessEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }\npublic bool AsynchronousPackageValidationEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }\npublic bool BlockingAsynchronousPackageValidationEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/AppConfiguration.cs",
"new_path": "src/NuGetGallery.Services/Configuration/AppConfiguration.cs",
"diff": "@@ -76,6 +76,9 @@ public class AppConfiguration : IAppConfiguration\npublic TimeSpan FeatureFlagsRefreshInterval { get; set; }\n+ [DefaultValue(true)]\n+ public bool AdminPanelEnabled { get; set; }\n+\npublic bool AdminPanelDatabaseAccessEnabled { get; set; }\npublic bool AsynchronousPackageValidationEnabled { get; set; }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/IAppConfiguration.cs",
"new_path": "src/NuGetGallery.Services/Configuration/IAppConfiguration.cs",
"diff": "@@ -100,6 +100,11 @@ public interface IAppConfiguration : IMessageServiceConfiguration\n/// </summary>\nTimeSpan FeatureFlagsRefreshInterval { get; set; }\n+ /// <summary>\n+ /// Indicates whether Admin panel pages exist on this instance.\n+ /// </summary>\n+ bool AdminPanelEnabled { get; set; }\n+\n/// <summary>\n/// Gets a boolean indicating whether DB admin through web UI should be accesible.\n/// </summary>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/Routes.cs",
"new_path": "src/NuGetGallery/App_Start/Routes.cs",
"diff": "@@ -10,11 +10,11 @@ namespace NuGetGallery\n{\npublic static class Routes\n{\n- public static void RegisterRoutes(RouteCollection routes, bool feedOnlyMode = false)\n+ public static void RegisterRoutes(RouteCollection routes, bool feedOnlyMode = false, bool adminPanelEnabled = false)\n{\nif (!feedOnlyMode)\n{\n- RegisterUIRoutes(routes);\n+ RegisterUIRoutes(routes, adminPanelEnabled);\n}\nelse\n{\n@@ -29,7 +29,7 @@ public static void RegisterRoutes(RouteCollection routes, bool feedOnlyMode = fa\nRegisterApiV2Routes(routes);\n}\n- public static void RegisterUIRoutes(RouteCollection routes)\n+ public static void RegisterUIRoutes(RouteCollection routes, bool adminPanelEnabled)\n{\nroutes.MapRoute(\nRouteName.Home,\n@@ -449,11 +449,14 @@ public static void RegisterUIRoutes(RouteCollection routes)\n\"account/changeMultiFactorAuthentication\",\nnew { controller = \"Users\", action = \"ChangeMultiFactorAuthentication\" });\n+ if (adminPanelEnabled)\n+ {\nroutes.MapRoute(\nRouteName.AdminDeleteAccount,\n\"account/delete/{accountName}\",\nnew { controller = \"Users\", action = \"Delete\" },\nnew RouteExtensions.ObfuscatedPathMetadata(2, Obfuscator.DefaultTelemetryUserName));\n+ }\nroutes.MapRoute(\nRouteName.UserDeleteAccount,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/AdminAreaRegistration.cs",
"new_path": "src/NuGetGallery/Areas/Admin/AdminAreaRegistration.cs",
"diff": "@@ -18,6 +18,11 @@ public override void RegisterArea(AreaRegistrationContext context)\n{\nvar galleryConfigurationService = DependencyResolver.Current.GetService<IGalleryConfigurationService>();\n+ if (!galleryConfigurationService.Current.AdminPanelEnabled)\n+ {\n+ return;\n+ }\n+\nif (galleryConfigurationService.Current.AdminPanelDatabaseAccessEnabled)\n{\nvar galleryDbConnectionFactory = DependencyResolver.Current.GetService<ISqlConnectionFactory>();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Helpers/ObfuscationHelperFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Helpers/ObfuscationHelperFacts.cs",
"diff": "@@ -22,7 +22,7 @@ public TheObfuscateCurrentRequestUrlFacts()\n{\n_currentRoutes = new RouteCollection();\nRoutes.RegisterApiV2Routes(_currentRoutes);\n- Routes.RegisterUIRoutes(_currentRoutes);\n+ Routes.RegisterUIRoutes(_currentRoutes, false);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Telemetry/ClientTelemetryPIIProcessorTests.cs",
"new_path": "tests/NuGetGallery.Facts/Telemetry/ClientTelemetryPIIProcessorTests.cs",
"diff": "@@ -24,7 +24,7 @@ public ClientTelemetryPIIProcessorTests()\n{\n_currentRoutes = new RouteCollection();\nRoutes.RegisterApiV2Routes(_currentRoutes);\n- Routes.RegisterUIRoutes(_currentRoutes);\n+ Routes.RegisterUIRoutes(_currentRoutes, false);\n}\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | First round of implementation. |
455,744 | 16.07.2021 17:41:13 | 25,200 | bf65d6a73e692eaf0a41dd3d1aab162fb8563f66 | Does not immediately crash. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Compile Include=\"ExtensionMethods.cs\" />\n<Compile Include=\"Extensions\\CakeBuildManagerExtensions.cs\" />\n<Compile Include=\"Extensions\\ImageExtensions.cs\" />\n+ <Compile Include=\"Helpers\\AdminHelper.cs\" />\n<Compile Include=\"Helpers\\ValidationHelper.cs\" />\n<Compile Include=\"Helpers\\ViewModelExtensions\\DeleteAccountListPackageItemViewModelFactory.cs\" />\n<Compile Include=\"Helpers\\ViewModelExtensions\\DeletePackageViewModelFactory.cs\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/UrlHelperExtensions.cs",
"new_path": "src/NuGetGallery/UrlHelperExtensions.cs",
"diff": "@@ -1387,6 +1387,7 @@ public static string About(this UrlHelper url, bool relativeUrl = true)\npublic static string Admin(this UrlHelper url, bool relativeUrl = true)\n{\n+ // TODO: change to something when admin panel is disabled?\nreturn GetActionLink(\nurl,\n\"Index\",\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Shared/Gallery/Header.cshtml",
"new_path": "src/NuGetGallery/Views/Shared/Gallery/Header.cshtml",
"diff": "{\n@DisplayNavigationItem(\"Statistics\", Url.Statistics())\n}\n- @if (Request.IsAuthenticated && User.IsInRole(CoreConstants.AdminRoleName))\n+ @if (Request.IsAuthenticated && AdminHelper.IsAdminPanelEnabled && User.IsInRole(CoreConstants.AdminRoleName))\n{\n@DisplayNavigationItem(\"Admin\", Url.Admin())\n}\n<span class=\"dropdown-email\">@CurrentUser.EmailAddress.Abbreviate(25)</span>\n</div>\n</li>\n- @if (Request.IsAuthenticated && User.IsInRole(CoreConstants.AdminRoleName))\n+ @if (Request.IsAuthenticated && AdminHelper.IsAdminPanelEnabled && User.IsInRole(CoreConstants.AdminRoleName))\n{\n<li class=\"divider\"></li>\n<li role=\"presentation\"><a href=\"@Url.Admin()\" role=\"menuitem\">Admin</a></li>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Shared/SiteMenu.cshtml",
"new_path": "src/NuGetGallery/Views/Shared/SiteMenu.cshtml",
"diff": "{\n<li class=\"@classes[\"Statistics\"]\"><a href=\"@Url.Statistics()\">Statistics</a></li>\n}\n- @if (Request.IsAuthenticated && User.IsInRole(CoreConstants.AdminRoleName))\n+ @if (Request.IsAuthenticated && AdminHelper.IsAdminPanelEnabled && User.IsInRole(CoreConstants.AdminRoleName))\n{\n<li class=\"@classes[\"Admin\"]\"><a href=\"@Url.Admin()\">Admin</a></li>\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Does not immediately crash. |
455,737 | 22.07.2021 22:38:40 | 0 | 7e887121c941ad5042bce952fbcb8d206c519818 | Adding stubbed definition for missing DI objects For AccountDeleter. | [
{
"change_type": "MODIFY",
"old_path": "src/AccountDeleter/AccountDeleter.csproj",
"new_path": "src/AccountDeleter/AccountDeleter.csproj",
"diff": "<Compile Include=\"Configuration\\GalleryConfiguration.cs\" />\n<Compile Include=\"Configuration\\MailTemplateConfiguration.cs\" />\n<Compile Include=\"Configuration\\SourceConfiguration.cs\" />\n+ <Compile Include=\"EmptyFeatureFlagService.cs\" />\n<Compile Include=\"EmptyIndexingService.cs\" />\n<Compile Include=\"Evaluators\\AccountConfirmedEvaluator.cs\" />\n<Compile Include=\"Evaluators\\AggregateEvaluator.cs\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/AccountDeleter/Job.cs",
"new_path": "src/AccountDeleter/Job.cs",
"diff": "@@ -135,6 +135,7 @@ protected void ConfigureGalleryServices(IServiceCollection services)\nservices.AddScoped<IAuthenticationService, AuthenticationService>();\nservices.AddScoped<ISupportRequestService, ISupportRequestService>();\n+ services.AddScoped<IFeatureFlagService, EmptyFeatureFlagService>();\nservices.AddScoped<IEditableFeatureFlagStorageService, EditableFeatureFlagFileStorageService>();\nservices.AddScoped<ICoreFileStorageService, CloudBlobFileStorageService>();\nservices.AddScoped<ICloudBlobContainerInformationProvider, GalleryCloudBlobContainerInformationProvider>();\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Adding stubbed definition for missing DI objects For AccountDeleter. (#8677) |
455,744 | 26.07.2021 23:05:05 | 25,200 | fd56b01de7293e3ab145a7fce2494cf8f0f8754e | Config option for admin panel. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Web.config",
"new_path": "src/NuGetGallery/Web.config",
"diff": "<add key=\"Gallery.AzureStorageReadAccessGeoRedundant\" value=\"false\"/>\n<!-- If the storage account has to fall-back to a secondary (when Read Access Geo Redundant is enabled in Azure storage), change Gallery.AzureStorageReadAccessGeoRedundant to true -->\n<add key=\"Gallery.FeatureFlagsRefreshInterval\" value=\"00:01:00\"/>\n+ <add key=\"Gallery.AdminPanelEnabled\" value=\"true\"/>\n<add key=\"Gallery.AdminPanelDatabaseAccessEnabled\" value=\"false\"/>\n<add key=\"Gallery.AsynchronousPackageValidationEnabled\" value=\"false\"/>\n<add key=\"Gallery.BlockingAsynchronousPackageValidationEnabled\" value=\"false\"/>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Config option for admin panel. |
455,744 | 27.07.2021 13:17:45 | 25,200 | 6e28f2456486a2ef041e801d2008f98fb29fd02d | Running tests with admin enabled. | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Helpers/ObfuscationHelperFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Helpers/ObfuscationHelperFacts.cs",
"diff": "@@ -22,7 +22,7 @@ public TheObfuscateCurrentRequestUrlFacts()\n{\n_currentRoutes = new RouteCollection();\nRoutes.RegisterApiV2Routes(_currentRoutes);\n- Routes.RegisterUIRoutes(_currentRoutes, false);\n+ Routes.RegisterUIRoutes(_currentRoutes, true);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Telemetry/ClientTelemetryPIIProcessorTests.cs",
"new_path": "tests/NuGetGallery.Facts/Telemetry/ClientTelemetryPIIProcessorTests.cs",
"diff": "@@ -24,7 +24,7 @@ public ClientTelemetryPIIProcessorTests()\n{\n_currentRoutes = new RouteCollection();\nRoutes.RegisterApiV2Routes(_currentRoutes);\n- Routes.RegisterUIRoutes(_currentRoutes, false);\n+ Routes.RegisterUIRoutes(_currentRoutes, true);\n}\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Running tests with admin enabled. |
455,744 | 27.07.2021 17:40:22 | 25,200 | 57680b888240fb27e6267fa1971a0c02f6c667f8 | Admin panel enabled checks for package details page admin actions.
Admin panel enabled check in Site.master.cs in admin area. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/Routes.cs",
"new_path": "src/NuGetGallery/App_Start/Routes.cs",
"diff": "@@ -271,6 +271,8 @@ public static void RegisterUIRoutes(RouteCollection routes, bool adminPanelEnabl\nnew { controller = \"Packages\", action = \"SetLicenseReportVisibility\", visible = false },\nnew { version = new VersionRouteConstraint() });\n+ if (adminPanelEnabled)\n+ {\nroutes.MapRoute(\nRouteName.PackageReflowAction,\n\"packages/manage/reflow\",\n@@ -286,6 +288,12 @@ public static void RegisterUIRoutes(RouteCollection routes, bool adminPanelEnabl\n\"packages/manage/revalidate-symbols\",\nnew { controller = \"Packages\", action = nameof(PackagesController.RevalidateSymbols) });\n+ routes.MapRoute(\n+ RouteName.PackageDeleteAction,\n+ \"packages/manage/delete\",\n+ new { controller = \"Packages\", action = \"Delete\" });\n+ }\n+\nvar packageVersionActionRoute = routes.MapRoute(\nRouteName.PackageVersionAction,\n\"packages/{id}/{version}/{action}\",\n@@ -297,11 +305,6 @@ public static void RegisterUIRoutes(RouteCollection routes, bool adminPanelEnabl\n\"packages/{id}/{action}\",\nnew { controller = \"Packages\" });\n- var packageDeleteRoute = routes.MapRoute(\n- RouteName.PackageDeleteAction,\n- \"packages/manage/delete\",\n- new { controller = \"Packages\", action = \"Delete\" });\n-\nvar confirmationRequiredRoute = routes.MapRoute(\n\"ConfirmationRequired\",\n\"account/ConfirmationRequired\",\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/DynamicData/Site.master.cs",
"new_path": "src/NuGetGallery/Areas/Admin/DynamicData/Site.master.cs",
"diff": "@@ -17,7 +17,7 @@ protected override void OnInit(EventArgs e)\nResponse.End();\n}\n- if (!Request.IsLocal && !Page.User.IsAdministrator())\n+ if ((!Request.IsLocal && !Page.User.IsAdministrator()) || !AdminHelper.IsAdminPanelEnabled)\n{\nResponse.StatusCode = (int)HttpStatusCode.Forbidden;\nResponse.End();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "</li>\n}\n- @if (Model.Available && User.IsAdministrator())\n+ @if (AdminHelper.IsAdminPanelEnabled && Model.Available && User.IsAdministrator())\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n</li>\n}\n- @if (!Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && !Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n}\n}\n- @if (User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Health\" aria-hidden=\"true\"></i>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Admin panel enabled checks for package details page admin actions.
Admin panel enabled check in Site.master.cs in admin area. |
455,744 | 27.07.2021 18:43:11 | 25,200 | ddc6b73282c72ccd9c4a137bc7d338f03d69236a | Not showing admin links on package details page v2 as well. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackageV2.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackageV2.cshtml",
"diff": "</li>\n}\n- @if (Model.Available && User.IsAdministrator())\n+ @if (AdminHelper.IsAdminPanelEnabled && Model.Available && User.IsAdministrator())\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n</li>\n}\n- @if (!Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && !Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n}\n}\n- @if (User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Health\" aria-hidden=\"true\"></i>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Not showing admin links on package details page v2 as well. |
455,744 | 27.07.2021 19:58:20 | 25,200 | 2514f96f44ca719b96d1b39615f7edb4a4c296f8 | Added AdminAction attribute that additionally checks for admin panel enabled state.
Profile page adjustments for disabled admin panel. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/AccountsController.cs",
"new_path": "src/NuGetGallery/Controllers/AccountsController.cs",
"diff": "@@ -338,7 +338,7 @@ public virtual ActionResult DeleteRequest(string accountName = null)\n}\n[HttpGet]\n- [UIAuthorize(Roles = \"Admins\")]\n+ [AdminAction()]\npublic virtual ActionResult Delete(string accountName)\n{\nvar accountToDelete = UserService.FindByUsername(accountName) as TUser;\n@@ -351,7 +351,7 @@ public virtual ActionResult Delete(string accountName)\n}\n[HttpDelete]\n- [UIAuthorize(Roles = \"Admins\")]\n+ [AdminAction()]\n[RequiresAccountConfirmation(\"Delete account\")]\n[ValidateAntiForgeryToken]\npublic virtual async Task<ActionResult> Delete(DeleteAccountAsAdminViewModel model)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"new_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"diff": "@@ -1850,7 +1850,7 @@ public virtual ActionResult DeleteSymbols(string id, string version)\n[HttpPost]\n[ValidateAntiForgeryToken]\n- [UIAuthorize(Roles = \"Admins\")]\n+ [AdminAction()]\n[RequiresAccountConfirmation(\"reflow a package\")]\npublic virtual async Task<ActionResult> Reflow(string id, string version)\n{\n@@ -1887,7 +1887,7 @@ public virtual async Task<ActionResult> Reflow(string id, string version)\n[HttpPost]\n[ValidateAntiForgeryToken]\n- [UIAuthorize(Roles = \"Admins\")]\n+ [AdminAction()]\n[RequiresAccountConfirmation(\"revalidate a package\")]\npublic virtual async Task<ActionResult> Revalidate(string id, string version)\n{\n@@ -1916,7 +1916,7 @@ public virtual async Task<ActionResult> Revalidate(string id, string version)\n[HttpPost]\n[ValidateAntiForgeryToken]\n- [UIAuthorize(Roles = \"Admins\")]\n+ [AdminAction()]\n[RequiresAccountConfirmation(\"revalidate a symbols package\")]\npublic virtual async Task<ActionResult> RevalidateSymbols(string id, string version)\n{\n@@ -1981,7 +1981,7 @@ public virtual ActionResult Delete(string id, string version)\nreturn RedirectToActionPermanent(nameof(Manage));\n}\n- [UIAuthorize(Roles = \"Admins\")]\n+ [AdminAction()]\n[HttpPost]\n[RequiresAccountConfirmation(\"delete a package\")]\n[ValidateAntiForgeryToken]\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Filters/UiAuthorizeAttribute.cs",
"new_path": "src/NuGetGallery/Filters/UiAuthorizeAttribute.cs",
"diff": "namespace NuGetGallery.Filters\n{\n- public sealed class UIAuthorizeAttribute : AuthorizeAttribute\n+ public class UIAuthorizeAttribute : AuthorizeAttribute\n{\npublic bool AllowDiscontinuedLogins { get; }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Compile Include=\"ExtensionMethods.cs\" />\n<Compile Include=\"Extensions\\CakeBuildManagerExtensions.cs\" />\n<Compile Include=\"Extensions\\ImageExtensions.cs\" />\n+ <Compile Include=\"Filters\\AdminActionAttribute.cs\" />\n<Compile Include=\"Helpers\\AdminHelper.cs\" />\n<Compile Include=\"Helpers\\ValidationHelper.cs\" />\n<Compile Include=\"Helpers\\ViewModelExtensions\\DeleteAccountListPackageItemViewModelFactory.cs\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Users/Profiles.cshtml",
"new_path": "src/NuGetGallery/Views/Users/Profiles.cshtml",
"diff": "<div class=\"description\">Total @(Model.TotalPackageDownloadCount == 1 ? \"download\" : \"downloads\") of packages</div>\n</div>\n</div>\n- @if (User.IsAdministrator())\n+ @if (AdminHelper.IsAdminPanelEnabled && User.IsAdministrator())\n{\n<div class=\"additional-info\">\n<dl>\n{\n<a href=\"@(Model.UserIsOrganization ? Url.ManageMyOrganization(Model.Username) : Url.AccountSettings())\" aria-label=\"Manage this account\"><i class=\"ms-Icon ms-Icon--Edit ms-font-xl\"></i></a>\n}\n- @if (User.IsAdministrator())\n+ @if (AdminHelper.IsAdminPanelEnabled && User.IsAdministrator())\n{\nvar deleteUrl = Model.UserIsOrganization ? Url.AdminDeleteOrganization(Model.Username) : Url.AdminDeleteAccount(Model.Username);\n<a href=\"@deleteUrl\" aria-label=\"Delete this account\"><i class=\"ms-Icon ms-Icon--Delete ms-font-xl\" aria-hidden=\"true\"></i></a>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Added AdminAction attribute that additionally checks for admin panel enabled state.
Profile page adjustments for disabled admin panel. |
455,744 | 28.07.2021 18:07:10 | 25,200 | 0ab8f9035aa4e66840f7c96a3da81b72e1393f66 | .Admin helper will throw if admin panel is disabled. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/UrlHelperExtensions.cs",
"new_path": "src/NuGetGallery/UrlHelperExtensions.cs",
"diff": "@@ -1387,7 +1387,11 @@ public static string About(this UrlHelper url, bool relativeUrl = true)\npublic static string Admin(this UrlHelper url, bool relativeUrl = true)\n{\n- // TODO: change to something when admin panel is disabled?\n+ if (!AdminHelper.IsAdminPanelEnabled)\n+ {\n+ throw new InvalidOperationException(\"Admin panel is disabled, can't produce a link to it\");\n+ }\n+\nreturn GetActionLink(\nurl,\n\"Index\",\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | .Admin helper will throw if admin panel is disabled. |
455,745 | 05.08.2021 00:56:39 | -3,600 | 50cb0e2426a19e21d37935b06178c7c6e990e35e | Render a canonical tag on each page
Fixes | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/UrlHelperExtensions.cs",
"new_path": "src/NuGetGallery/UrlHelperExtensions.cs",
"diff": "@@ -68,6 +68,18 @@ internal static string GetSiteRoot(bool useHttps)\nreturn _configuration.GetSiteRoot(useHttps);\n}\n+ public static string GetCanonicalLinkUrl(this UrlHelper url)\n+ {\n+ var current = url.RequestContext.HttpContext.Request.Url;\n+ var siteRoot = new Uri(_configuration.Current.SiteRoot);\n+\n+ var builder = new UriBuilder(current);\n+ builder.Scheme = siteRoot.Scheme;\n+ builder.Host = siteRoot.Host;\n+ builder.Port = siteRoot.Port;\n+ return builder.Uri.AbsoluteUri;\n+ }\n+\nprivate static string GetConfiguredSiteHostName()\n{\n// It doesn't matter which value we pass on here for the useHttps parameter.\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Shared/Gallery/Layout.cshtml",
"new_path": "src/NuGetGallery/Views/Shared/Gallery/Layout.cshtml",
"diff": "{\n<meta name=\"robots\" content=\"noindex\">\n}\n+\n+ @if (!string.IsNullOrEmpty(Config.Current.SiteRoot))\n+ {\n+ <link rel=\"canonical\" href=\"@Url.GetCanonicalLinkUrl()\">\n+ }\n+\n@RenderSection(\"SocialMeta\", required: false)\n@RenderSection(\"Meta\", required: false)\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Render a canonical tag on each page (#8584)
Fixes #8559 |
455,747 | 06.08.2021 10:54:06 | 25,200 | 8a49379a76e707666eb0d52f5d620936acee8cc1 | Update server common libraries to use managed identities with service bus | [
{
"change_type": "MODIFY",
"old_path": "src/DatabaseMigrationTools/DatabaseMigrationTools.csproj",
"new_path": "src/DatabaseMigrationTools/DatabaseMigrationTools.csproj",
"diff": "<PrivateAssets>all</PrivateAssets>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"new_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"diff": "<Version>5.9.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.FeatureFlags\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"WindowsAzure.Storage\">\n<Version>9.3.3</Version>\n<ItemGroup Condition=\"'$(TargetFramework)' == 'net472'\">\n<PackageReference Include=\"NuGet.Services.Messaging.Email\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation.Issues\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.StrongName.elmah.corelibrary\">\n<Version>1.2.2</Version>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"new_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"diff": "<Version>5.9.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Configuration\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Logging\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.StrongName.WebBackgrounder\">\n<Version>0.2.0</Version>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Version>5.9.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Licenses\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Owin\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Sql\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n<PackageReference Include=\"Owin\">\n<Version>1.0.0</Version>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update server common libraries to use managed identities with service bus (#8739) |
455,747 | 06.08.2021 15:21:02 | 25,200 | 1039cd81ae954e3093b8cb7ff584c1cfb66563d6 | Update the NuGet jobs common libraries for gallery jobs | [
{
"change_type": "MODIFY",
"old_path": "src/AccountDeleter/AccountDeleter.csproj",
"new_path": "src/AccountDeleter/AccountDeleter.csproj",
"diff": "<PrivateAssets>all</PrivateAssets>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation.Common.Job\">\n- <Version>4.3.0-dev-3612825</Version>\n+ <Version>4.3.0-dev-5066115</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/AccountDeleter/Job.cs",
"new_path": "src/AccountDeleter/Job.cs",
"diff": "@@ -178,7 +178,7 @@ protected void ConfigureGalleryServices(IServiceCollection services)\n}\n}\n- protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder)\n+ protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder, IConfigurationRoot configurationRoot)\n{\nConfigureDefaultSubscriptionProcessor(containerBuilder);\ncontainerBuilder.RegisterType<EntityRepository<User>>()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/GitHubVulnerabilities2Db.csproj",
"new_path": "src/GitHubVulnerabilities2Db/GitHubVulnerabilities2Db.csproj",
"diff": "<PrivateAssets>all</PrivateAssets>\n</PackageReference>\n<PackageReference Include=\"NuGet.Jobs.Common\">\n- <Version>4.3.0-dev-3612825</Version>\n+ <Version>4.3.0-dev-5066115</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Cursor\">\n- <Version>2.86.0</Version>\n+ <Version>2.90.0</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/Job.cs",
"new_path": "src/GitHubVulnerabilities2Db/Job.cs",
"diff": "@@ -47,7 +47,7 @@ public void Dispose()\n_client.Dispose();\n}\n- protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder)\n+ protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder, IConfigurationRoot configurationRoot)\n{\ncontainerBuilder\n.RegisterAdapter<IOptionsSnapshot<GitHubVulnerabilities2DbConfiguration>, GitHubVulnerabilities2DbConfiguration>(c => c.Value);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGet.Services.DatabaseMigration/Job.cs",
"new_path": "src/NuGet.Services.DatabaseMigration/Job.cs",
"diff": "@@ -149,7 +149,7 @@ private void ExecuteDatabaseMigration(Func<DbMigrator> getMigrator, SqlConnectio\n}\n}\n- protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder)\n+ protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder, IConfigurationRoot configurationRoot)\n{\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj",
"new_path": "src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj",
"diff": "<Version>4.8.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Jobs.Common\">\n- <Version>4.3.0-dev-3612825</Version>\n+ <Version>4.3.0-dev-5066115</Version>\n</PackageReference>\n</ItemGroup>\n<Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/VerifyGitHubVulnerabilities/Job.cs",
"new_path": "src/VerifyGitHubVulnerabilities/Job.cs",
"diff": "@@ -48,7 +48,7 @@ protected override void ConfigureJobServices(IServiceCollection services, IConfi\nConfigureInitializationSection<VerifyGitHubVulnerabilitiesConfiguration>(services, configurationRoot);\n}\n- protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder)\n+ protected override void ConfigureAutofacServices(ContainerBuilder containerBuilder, IConfigurationRoot configurationRoot)\n{\ncontainerBuilder\n.RegisterAdapter<IOptionsSnapshot<VerifyGitHubVulnerabilitiesConfiguration>, VerifyGitHubVulnerabilitiesConfiguration>(c => c.Value);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/VerifyGitHubVulnerabilities/VerifyGitHubVulnerabilities.csproj",
"new_path": "src/VerifyGitHubVulnerabilities/VerifyGitHubVulnerabilities.csproj",
"diff": "</ItemGroup>\n<ItemGroup>\n<PackageReference Include=\"NuGet.Jobs.Common\">\n- <Version>4.3.0-dev-3612825</Version>\n+ <Version>4.3.0-dev-5066115</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update the NuGet jobs common libraries for gallery jobs (#8740) |
455,736 | 11.08.2021 10:38:15 | 25,200 | 3759c27dd8ed605c76be4534ef84997822e96cea | Add bulk revalidate buttons to Validation admin panel
* Fix bug causing only first package to revalidate to work
* Redirect back to admin panel when revalidating there
* Add revalidate pending packages and symbols to admin panel
* Add unit tests for new service method
Fix | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -45,6 +45,9 @@ body h3 {\ntext-overflow: ellipsis;\nwhite-space: nowrap;\n}\n+.form-inline-empty {\n+ display: inline-block;\n+}\n.footer {\nbackground-color: #002440;\ncolor: #e3ebf1;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/base.less",
"new_path": "src/Bootstrap/less/theme/base.less",
"diff": "@@ -55,6 +55,10 @@ body {\n}\n}\n+.form-inline-empty {\n+ display: inline-block;\n+}\n+\n.footer {\nbackground-color: @panel-footer-bg;\ncolor: @panel-footer-color;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Code/ViewHelpers.cshtml",
"new_path": "src/NuGetGallery/App_Code/ViewHelpers.cshtml",
"diff": "@@ -653,6 +653,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);\nstring controllerName,\nstring role,\nstring area = \"\",\n+ string classes = null,\nDictionary<string, string> formValues = null)\n{\nusing (page.Html.BeginForm(\n@@ -660,7 +661,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);\ncontrollerName,\nnew { area = area },\nFormMethod.Post,\n- new { id = formId }))\n+ new { id = formId, @class = classes }))\n{\[email protected]();\nif (formValues != null)\n@@ -682,6 +683,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);\nstring controllerName,\nstring role,\nstring area = \"\",\n+ string classes = null,\nDictionary<string, string> formValues = null)\n{\n@PostLink(\n@@ -692,6 +694,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);\ncontrollerName,\nrole,\narea,\n+ classes,\nformValues);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/Controllers/ValidationController.cs",
"new_path": "src/NuGetGallery/Areas/Admin/Controllers/ValidationController.cs",
"diff": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n+using System.Threading.Tasks;\nusing System.Web.Mvc;\n+using NuGet.Services.Entities;\nusing NuGet.Services.Validation;\nusing NuGet.Versioning;\nusing NuGetGallery.Areas.Admin.Services;\n@@ -40,6 +42,25 @@ public virtual ActionResult Pending()\nreturn View(nameof(Index), new ValidationPageViewModel(query, packageValidations));\n}\n+ [HttpPost]\n+ [ValidateAntiForgeryToken]\n+ public virtual async Task<RedirectToRouteResult> RevalidatePending(ValidatingType validatingType)\n+ {\n+ var revalidatedCount = await _validationAdminService.RevalidatePendingAsync(validatingType);\n+\n+ if (revalidatedCount == 0)\n+ {\n+ TempData[\"Message\"] = $\"There are no {validatingType} instances that are in the {PackageStatus.Validating} state so no validations were enqueued.\";\n+ }\n+ else\n+ {\n+ TempData[\"Message\"] = $\"{revalidatedCount} validations were enqueued for {validatingType} instances that are in the {PackageStatus.Validating} state. \" +\n+ $\"It may take some time for the new validations to appear as the validation subsystem reacts to the enqueued messages.\";\n+ }\n+\n+ return RedirectToAction(nameof(Pending));\n+ }\n+\n[HttpGet]\npublic virtual ActionResult Search(string q)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/Services/ValidationAdminService.cs",
"new_path": "src/NuGetGallery/Areas/Admin/Services/ValidationAdminService.cs",
"diff": "using System.Collections.Generic;\nusing System.Data.Entity;\nusing System.Linq;\n+using System.Threading.Tasks;\nusing NuGet.Services.Entities;\nusing NuGet.Services.Validation;\nusing NuGet.Versioning;\n@@ -20,17 +21,20 @@ public class ValidationAdminService\nprivate readonly IEntityRepository<PackageValidation> _validations;\nprivate readonly IEntityRepository<Package> _packages;\nprivate readonly IEntityRepository<SymbolPackage> _symbolPackages;\n+ private readonly IValidationService _validationService;\npublic ValidationAdminService(\nIEntityRepository<PackageValidationSet> validationSets,\nIEntityRepository<PackageValidation> validations,\nIEntityRepository<Package> packages,\n- IEntityRepository<SymbolPackage> symbolPackages)\n+ IEntityRepository<SymbolPackage> symbolPackages,\n+ IValidationService validationService)\n{\n_validationSets = validationSets ?? throw new ArgumentNullException(nameof(validationSets));\n_validations = validations ?? throw new ArgumentNullException(nameof(validations));\n_packages = packages ?? throw new ArgumentNullException(nameof(packages));\n_symbolPackages = symbolPackages ?? throw new ArgumentNullException(nameof(symbolPackages));\n+ _validationService = validationService ?? throw new ArgumentNullException(nameof(validationService));\n}\n/// <summary>\n@@ -83,6 +87,45 @@ public IReadOnlyList<PackageValidationSet> GetPending()\nreturn pendingValidations;\n}\n+ public async Task<int> RevalidatePendingAsync(ValidatingType validatingType)\n+ {\n+ if (validatingType == ValidatingType.Package)\n+ {\n+ var pendingPackages = _packages\n+ .GetAll()\n+ .Include(p => p.PackageRegistration)\n+ .Where(p => p.PackageStatusKey == PackageStatus.Validating)\n+ .ToList();\n+\n+ foreach (var package in pendingPackages)\n+ {\n+ await _validationService.RevalidateAsync(package);\n+ }\n+\n+ return pendingPackages.Count;\n+ }\n+ else if (validatingType == ValidatingType.SymbolPackage)\n+ {\n+ var pendingSymbolPackages = _symbolPackages\n+ .GetAll()\n+ .Include(p => p.Package)\n+ .Include(p => p.Package.PackageRegistration)\n+ .Where(s => s.StatusKey == PackageStatus.Validating)\n+ .ToList();\n+\n+ foreach (var symbolPackage in pendingSymbolPackages)\n+ {\n+ await _validationService.RevalidateAsync(symbolPackage);\n+ }\n+\n+ return pendingSymbolPackages.Count;\n+ }\n+ else\n+ {\n+ throw new NotSupportedException(\"The validating type \" + validatingType + \" is not supported.\");\n+ }\n+ }\n+\npublic PackageDeletedStatus GetDeletedStatus(int key, ValidatingType validatingType)\n{\nswitch (validatingType)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/Views/Validation/Index.cshtml",
"new_path": "src/NuGetGallery/Areas/Admin/Views/Validation/Index.cshtml",
"diff": "<section role=\"main\" class=\"container main-container\">\n<h2>Package Validations</h2>\n- <p>Get <a href=\"@Url.Action(actionName:\"Pending\")\">pending validations</a>.</p>\n+ <div>\n+ <a href=\"@Url.Action(actionName:\"Pending\")\">Get pending validations</a>\n+ |\n+ @ViewHelpers.PostLink(\n+ this,\n+ formId: \"revalidate-pending-packages\",\n+ linkText: \"Revalidate pending packages\",\n+ actionName: \"RevalidatePending\",\n+ controllerName: \"Validation\",\n+ role: string.Empty,\n+ area: \"Admin\",\n+ classes: \"form-inline-empty\",\n+ formValues: new Dictionary<string, string>\n+ {\n+ { \"validatingType\", ValidatingType.Package.ToString() },\n+ })\n+ |\n+ @ViewHelpers.PostLink(\n+ this,\n+ formId: \"revalidate-pending-symbol-packages\",\n+ linkText: \"Revalidate pending symbol packages\",\n+ actionName: \"RevalidatePending\",\n+ controllerName: \"Validation\",\n+ role: string.Empty,\n+ area: \"Admin\",\n+ classes: \"form-inline-empty\",\n+ formValues: new Dictionary<string, string>\n+ {\n+ { \"validatingType\", ValidatingType.SymbolPackage.ToString() },\n+ })\n+ </div>\n<form method=\"get\" action=\"@Url.Action(actionName: \"Search\")\">\n<p>\n{\[email protected](\nthis,\n- formId: \"revalidate-package-form\",\n+ formId: \"revalidate-package-form-\" + package.PackageKey,\nlinkText: \"Revalidate package\",\nactionName: \"Revalidate\",\ncontrollerName: \"Packages\",\n{\n{ \"id\", package.Id },\n{ \"version\", package.NormalizedVersion },\n+ { \"returnUrl\", Url.Current() },\n})\n<br />\n}\n{\[email protected](\nthis,\n- formId: \"revalidate-symbols-form\",\n+ formId: \"revalidate-symbols-form-\" + package.PackageKey,\nlinkText: \"Revalidate symbols\",\nactionName: \"RevalidateSymbols\",\ncontrollerName: \"Packages\",\n{\n{ \"id\", package.Id },\n{ \"version\", package.NormalizedVersion },\n+ { \"returnUrl\", Url.Current() },\n})\n<br />\n}\n</div>\n}\n</section>\n+\n+@section BottomScripts {\n+ <script>\n+ $(document).ready(function () {\n+ $('#revalidate-pending-packages, #revalidate-pending-symbol-packages').submit(function (e) {\n+ var operation = $(\".post-link[data-form-id='\" + e.target.id + \"']\").text().toLowerCase();\n+ if (!operation || !confirm('Are you sure you want to ' + operation + '?')) {\n+ e.preventDefault();\n+ }\n+ });\n+ });\n+ </script>\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"new_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"diff": "@@ -1911,7 +1911,7 @@ public virtual async Task<ActionResult> Reflow(string id, string version)\n[ValidateAntiForgeryToken]\n[UIAuthorize(Roles = \"Admins\")]\n[RequiresAccountConfirmation(\"revalidate a package\")]\n- public virtual async Task<ActionResult> Revalidate(string id, string version)\n+ public virtual async Task<ActionResult> Revalidate(string id, string version, string returnUrl = null)\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n@@ -1933,14 +1933,21 @@ public virtual async Task<ActionResult> Revalidate(string id, string version)\nTempData[\"Message\"] = $\"An error occurred while revalidating the package. {ex.Message}\";\n}\n+ if (string.IsNullOrEmpty(returnUrl))\n+ {\nreturn SafeRedirect(Url.Package(id, version));\n}\n+ else\n+ {\n+ return SafeRedirect(returnUrl);\n+ }\n+ }\n[HttpPost]\n[ValidateAntiForgeryToken]\n[UIAuthorize(Roles = \"Admins\")]\n[RequiresAccountConfirmation(\"revalidate a symbols package\")]\n- public virtual async Task<ActionResult> RevalidateSymbols(string id, string version)\n+ public virtual async Task<ActionResult> RevalidateSymbols(string id, string version, string returnUrl = null)\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n@@ -1988,8 +1995,15 @@ public virtual async Task<ActionResult> RevalidateSymbols(string id, string vers\nTempData[\"Message\"] = $\"An error occurred while revalidating the symbols package. {ex.Message}\";\n}\n+ if (string.IsNullOrEmpty(returnUrl))\n+ {\nreturn SafeRedirect(Url.Package(id, version));\n}\n+ else\n+ {\n+ return SafeRedirect(returnUrl);\n+ }\n+ }\n/// <summary>\n/// This is a redirect for a legacy route.\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Areas/Admin/Services/ValidationAdminServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Areas/Admin/Services/ValidationAdminServiceFacts.cs",
"diff": "using System;\nusing System.Linq;\n+using System.Threading.Tasks;\nusing Moq;\nusing NuGet.Services.Entities;\nusing NuGet.Services.Validation;\n@@ -30,6 +31,59 @@ public void DoesNotReturnDuplicatePackageValidationSets()\n}\n}\n+ public class TheRevalidatePendingMethod : FactsBase\n+ {\n+ [Fact]\n+ public async Task RevalidatesValidatingPackagesAsync()\n+ {\n+ _packages\n+ .Setup(x => x.GetAll())\n+ .Returns(() => new[]\n+ {\n+ new Package { Key = 1, PackageStatusKey = PackageStatus.Available },\n+ new Package { Key = 2, PackageStatusKey = PackageStatus.Validating },\n+ new Package { Key = 3, PackageStatusKey = PackageStatus.Validating },\n+ new Package { Key = 4, PackageStatusKey = PackageStatus.Deleted },\n+ new Package { Key = 5, PackageStatusKey = PackageStatus.FailedValidation },\n+ }.AsQueryable());\n+\n+ var revalidatedCount = await _target.RevalidatePendingAsync(ValidatingType.Package);\n+\n+ Assert.Equal(2, revalidatedCount);\n+ _validationService.Verify(x => x.RevalidateAsync(It.IsAny<Package>()), Times.Exactly(2));\n+ _validationService.Verify(x => x.RevalidateAsync(It.Is<Package>(p => p.Key == 2)), Times.Once);\n+ _validationService.Verify(x => x.RevalidateAsync(It.Is<Package>(p => p.Key == 3)), Times.Once);\n+ }\n+\n+ [Fact]\n+ public async Task RevalidatesValidatingSymbolsPackagesAsync()\n+ {\n+ _symbolPackages\n+ .Setup(x => x.GetAll())\n+ .Returns(() => new[]\n+ {\n+ new SymbolPackage { Key = 1, StatusKey = PackageStatus.Available },\n+ new SymbolPackage { Key = 2, StatusKey = PackageStatus.Validating },\n+ new SymbolPackage { Key = 3, StatusKey = PackageStatus.Validating },\n+ new SymbolPackage { Key = 4, StatusKey = PackageStatus.Deleted },\n+ new SymbolPackage { Key = 5, StatusKey = PackageStatus.FailedValidation },\n+ }.AsQueryable());\n+\n+ var revalidatedCount = await _target.RevalidatePendingAsync(ValidatingType.SymbolPackage);\n+\n+ Assert.Equal(2, revalidatedCount);\n+ _validationService.Verify(x => x.RevalidateAsync(It.IsAny<SymbolPackage>()), Times.Exactly(2));\n+ _validationService.Verify(x => x.RevalidateAsync(It.Is<SymbolPackage>(p => p.Key == 2)), Times.Once);\n+ _validationService.Verify(x => x.RevalidateAsync(It.Is<SymbolPackage>(p => p.Key == 3)), Times.Once);\n+ }\n+\n+ [Fact]\n+ public async Task RejectsUnknownPackageStatusKey()\n+ {\n+ await Assert.ThrowsAsync<NotSupportedException>(() => _target.RevalidatePendingAsync(ValidatingType.Generic));\n+ }\n+ }\n+\npublic class TheGetPackageDeletedStatusMethod : FactsBase\n{\n[Fact]\n@@ -133,6 +187,7 @@ public abstract class FactsBase\nprotected readonly Mock<IEntityRepository<PackageValidation>> _validations;\nprotected readonly Mock<IEntityRepository<Package>> _packages;\nprotected readonly Mock<IEntityRepository<SymbolPackage>> _symbolPackages;\n+ protected readonly Mock<IValidationService> _validationService;\nprotected readonly ValidationAdminService _target;\npublic FactsBase()\n@@ -160,6 +215,7 @@ public FactsBase()\n_validations = new Mock<IEntityRepository<PackageValidation>>();\n_packages = new Mock<IEntityRepository<Package>>();\n_symbolPackages = new Mock<IEntityRepository<SymbolPackage>>();\n+ _validationService = new Mock<IValidationService>();\n_packages\n.Setup(x => x.GetAll())\n@@ -178,7 +234,8 @@ public FactsBase()\n_validationSets.Object,\n_validations.Object,\n_packages.Object,\n- _symbolPackages.Object);\n+ _symbolPackages.Object,\n+ _validationService.Object);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Controllers/PackagesControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Controllers/PackagesControllerFacts.cs",
"diff": "@@ -9173,6 +9173,21 @@ public async Task RevalidateIsCalledWithTheExistingPackage()\nTimes.Once);\n}\n+ [Fact]\n+ public async Task RedirectsToCustomReturnUrl()\n+ {\n+ // Arrange & Act\n+ var result = await _target.Revalidate(\n+ _package.PackageRegistration.Id,\n+ _package.Version,\n+ \"/Admin\");\n+\n+ // Assert\n+ var redirect = Assert.IsType<SafeRedirectResult>(result);\n+ Assert.Equal(\"/Admin\", redirect.Url);\n+ Assert.Equal(\"/\", redirect.SafeUrl);\n+ }\n+\n[Fact]\npublic async Task RedirectsAfterRevalidatingPackage()\n{\n@@ -9261,6 +9276,21 @@ public async Task RevalidateIsCalledWithTheExistingSymbolsPackage()\nTimes.Once);\n}\n+ [Fact]\n+ public async Task RedirectsToCustomReturnUrl()\n+ {\n+ // Arrange & Act\n+ var result = await _target.RevalidateSymbols(\n+ _package.PackageRegistration.Id,\n+ _package.Version,\n+ \"/Admin\");\n+\n+ // Assert\n+ var redirect = Assert.IsType<SafeRedirectResult>(result);\n+ Assert.Equal(\"/Admin\", redirect.Url);\n+ Assert.Equal(\"/\", redirect.SafeUrl);\n+ }\n+\n[Theory]\n[InlineData(PackageStatus.Available)]\n[InlineData(PackageStatus.FailedValidation)]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add bulk revalidate buttons to Validation admin panel (#8738)
* Fix bug causing only first package to revalidate to work
* Redirect back to admin panel when revalidating there
* Add revalidate pending packages and symbols to admin panel
* Add unit tests for new service method
Fix https://github.com/NuGet/NuGetGallery/issues/8702 |
455,754 | 17.08.2021 21:02:38 | -36,000 | f260900017d9cfca5b0ff6df15b351a0501a59d2 | Add role="presentation" attribute to reserved checkmarks to satisfy a11y compliance | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "<img class=\"reserved-indicator\"\nsrc=\"~/Content/gallery/img/reserved-indicator.svg\"\[email protected](Url.Absolute(\"~/Content/gallery/img/reserved-indicator-25x25.png\"))\n- data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\"/>\n+ data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\" role=\"presentation\"/>\n}\n</h1>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Shared/_ListPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Shared/_ListPackage.cshtml",
"diff": "<img class=\"reserved-indicator\"\nsrc=\"~/Content/gallery/img/reserved-indicator.svg\"\[email protected](Url.Absolute(\"~/Content/gallery/img/reserved-indicator-20x20.png\"))\n- data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\" />\n+ data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\" role=\"presentation\"/>\n}\n@if (showEditButton && (Model.CanEdit || Model.CanManageOwners || Model.CanUnlistOrRelist))\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add role="presentation" attribute to reserved checkmarks to satisfy a11y compliance (#8746) |
455,754 | 27.08.2021 14:01:35 | -36,000 | b99a267481e6889e50a95a9b47d4074300e2cbf5 | convert role attributes to alt attributes for reserved checkmarks | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "<img class=\"reserved-indicator\"\nsrc=\"~/Content/gallery/img/reserved-indicator.svg\"\[email protected](Url.Absolute(\"~/Content/gallery/img/reserved-indicator-25x25.png\"))\n- data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\" role=\"presentation\"/>\n+ data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\" alt=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\"/>\n}\n</h1>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Shared/_ListPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Shared/_ListPackage.cshtml",
"diff": "<img class=\"reserved-indicator\"\nsrc=\"~/Content/gallery/img/reserved-indicator.svg\"\[email protected](Url.Absolute(\"~/Content/gallery/img/reserved-indicator-20x20.png\"))\n- data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\" role=\"presentation\"/>\n+ data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\" alt=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\"/>\n}\n@if (showEditButton && (Model.CanEdit || Model.CanManageOwners || Model.CanUnlistOrRelist))\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | convert role attributes to alt attributes for reserved checkmarks (#8759) |
455,736 | 27.08.2021 11:02:07 | 25,200 | c98395ffeebee7c9ef94bbdaf917d54ed1cbb59c | Audit add and remove ownership request action
Progress on | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/Auditing/AuditedPackageRegistrationAction.cs",
"new_path": "src/NuGetGallery.Core/Auditing/AuditedPackageRegistrationAction.cs",
"diff": "@@ -9,6 +9,8 @@ public enum AuditedPackageRegistrationAction\nRemoveOwner,\nMarkVerified,\nMarkUnverified,\n- SetRequiredSigner\n+ SetRequiredSigner,\n+ AddOwnershipRequest,\n+ DeleteOwnershipRequest,\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/Auditing/PackageRegistrationAuditRecord.cs",
"new_path": "src/NuGetGallery.Core/Auditing/PackageRegistrationAuditRecord.cs",
"diff": "@@ -14,6 +14,8 @@ public class PackageRegistrationAuditRecord : AuditRecord<AuditedPackageRegistra\npublic string Owner { get; }\npublic string PreviousRequiredSigner { get; private set; }\npublic string NewRequiredSigner { get; private set; }\n+ public string RequestingOwner { get; private set; }\n+ public string NewOwner { get; private set; }\npublic PackageRegistrationAuditRecord(\nstring id, AuditedPackageRegistration registrationRecord, AuditedPackageRegistrationAction action, string owner)\n@@ -55,5 +57,58 @@ public override string GetPath()\nreturn record;\n}\n+\n+ private static PackageRegistrationAuditRecord CreateForOwnerRequest(\n+ PackageRegistration registration,\n+ string requestingOwner,\n+ string newOwner,\n+ AuditedPackageRegistrationAction action)\n+ {\n+ if (registration == null)\n+ {\n+ throw new ArgumentNullException(nameof(registration));\n+ }\n+\n+ if (requestingOwner == null)\n+ {\n+ throw new ArgumentNullException(nameof(requestingOwner));\n+ }\n+\n+ if (newOwner == null)\n+ {\n+ throw new ArgumentNullException(nameof(newOwner));\n+ }\n+\n+ var record = new PackageRegistrationAuditRecord(registration, action, owner: null);\n+\n+ record.RequestingOwner = requestingOwner;\n+ record.NewOwner = newOwner;\n+\n+ return record;\n+ }\n+\n+ public static PackageRegistrationAuditRecord CreateForAddOwnershipRequest(\n+ PackageRegistration registration,\n+ string requestingOwner,\n+ string newOwner)\n+ {\n+ return CreateForOwnerRequest(\n+ registration,\n+ requestingOwner,\n+ newOwner,\n+ AuditedPackageRegistrationAction.AddOwnershipRequest);\n+ }\n+\n+ public static PackageRegistrationAuditRecord CreateForDeleteOwnershipRequest(\n+ PackageRegistration registration,\n+ string requestingOwner,\n+ string newOwner)\n+ {\n+ return CreateForOwnerRequest(\n+ registration,\n+ requestingOwner,\n+ newOwner,\n+ AuditedPackageRegistrationAction.DeleteOwnershipRequest);\n+ }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"new_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"diff": "</ItemGroup>\n<ItemGroup>\n+ <PackageReference Include=\"Microsoft.IdentityModel.Clients.ActiveDirectory\">\n+ <Version>5.2.6</Version>\n+ </PackageReference>\n<PackageReference Include=\"NuGet.Packaging\">\n<Version>5.9.0</Version>\n</PackageReference>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/PackageManagement/IPackageOwnerRequestService.cs",
"new_path": "src/NuGetGallery.Services/PackageManagement/IPackageOwnerRequestService.cs",
"diff": "@@ -10,7 +10,7 @@ namespace NuGetGallery\npublic interface IPackageOwnerRequestService\n{\n/// <summary>\n- /// Gets <see cref=\"PackageOwnerRequest\"/>s that match the provided conditions.\n+ /// Gets <see cref=\"PackageOwnerRequest\"/>s that match the provided conditions. User entities on the returned requests are not populated.\n/// </summary>\n/// <param name=\"package\">If nonnull, only returns <see cref=\"PackageOwnerRequest\"/>s that are for this package.</param>\n/// <param name=\"requestingOwner\">If nonnull, only returns <see cref=\"PackageOwnerRequest\"/>s that were requested by this owner.</param>\n@@ -18,6 +18,15 @@ public interface IPackageOwnerRequestService\n/// <returns>An <see cref=\"IEnumerable{PackageOwnerRequest}\"/> containing all objects that matched the conditions.</returns>\nIEnumerable<PackageOwnerRequest> GetPackageOwnershipRequests(PackageRegistration package = null, User requestingOwner = null, User newOwner = null);\n+ /// <summary>\n+ /// Gets <see cref=\"PackageOwnerRequest\"/>s that match the provided conditions. User entities on the returned requests are populated.\n+ /// </summary>\n+ /// <param name=\"package\">If nonnull, only returns <see cref=\"PackageOwnerRequest\"/>s that are for this package.</param>\n+ /// <param name=\"requestingOwner\">If nonnull, only returns <see cref=\"PackageOwnerRequest\"/>s that were requested by this owner.</param>\n+ /// <param name=\"newOwner\">If nonnull, only returns <see cref=\"PackageOwnerRequest\"/>s that are for this user to become an owner.</param>\n+ /// <returns>An <see cref=\"IEnumerable{PackageOwnerRequest}\"/> containing all objects that matched the conditions.</returns>\n+ IEnumerable<PackageOwnerRequest> GetPackageOwnershipRequestsWithUsers(PackageRegistration package = null, User requestingOwner = null, User newOwner = null);\n+\n/// <summary>\n/// Checks if the pending owner has a request for this package which matches the specified token.\n/// </summary>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/PackageManagement/PackageOwnerRequestService.cs",
"new_path": "src/NuGetGallery.Services/PackageManagement/PackageOwnerRequestService.cs",
"diff": "@@ -45,10 +45,37 @@ public PackageOwnerRequest GetPackageOwnershipRequest(PackageRegistration packag\nreturn request.ConfirmationCode == token ? request : null;\n}\n- public IEnumerable<PackageOwnerRequest> GetPackageOwnershipRequests(PackageRegistration package = null, User requestingOwner = null, User newOwner = null)\n+ public IEnumerable<PackageOwnerRequest> GetPackageOwnershipRequests(\n+ PackageRegistration package = null,\n+ User requestingOwner = null,\n+ User newOwner = null)\n+ {\n+ return GetPackageOwnershipRequests(includeUsers: false, package, requestingOwner, newOwner);\n+ }\n+\n+ public IEnumerable<PackageOwnerRequest> GetPackageOwnershipRequestsWithUsers(\n+ PackageRegistration package = null,\n+ User requestingOwner = null,\n+ User newOwner = null)\n+ {\n+ return GetPackageOwnershipRequests(includeUsers: true, package, requestingOwner, newOwner);\n+ }\n+\n+ private IEnumerable<PackageOwnerRequest> GetPackageOwnershipRequests(\n+ bool includeUsers,\n+ PackageRegistration package,\n+ User requestingOwner,\n+ User newOwner)\n{\nvar query = _packageOwnerRequestRepository.GetAll().Include(e => e.PackageRegistration);\n+ if (includeUsers)\n+ {\n+ query = query\n+ .Include(x => x.RequestingOwner)\n+ .Include(x => x.NewOwner);\n+ }\n+\nif (package != null)\n{\nquery = query.Where(r => r.PackageRegistrationKey == package.Key);\n@@ -101,11 +128,17 @@ public async Task<PackageOwnerRequest> AddPackageOwnershipRequest(PackageRegistr\n_packageOwnerRequestRepository.InsertOnCommit(newRequest);\nawait _packageOwnerRequestRepository.CommitChangesAsync();\n+\nreturn newRequest;\n}\npublic async Task DeletePackageOwnershipRequest(PackageOwnerRequest request, bool commitChanges = true)\n{\n+ if (request == null)\n+ {\n+ throw new ArgumentNullException(nameof(request));\n+ }\n+\n_packageOwnerRequestRepository.DeleteOnCommit(request);\nif (commitChanges)\n@@ -113,6 +146,5 @@ public async Task DeletePackageOwnershipRequest(PackageOwnerRequest request, boo\nawait _packageOwnerRequestRepository.CommitChangesAsync();\n}\n}\n-\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/PackageManagement/PackageOwnershipManagementService.cs",
"new_path": "src/NuGetGallery.Services/PackageManagement/PackageOwnershipManagementService.cs",
"diff": "@@ -95,12 +95,22 @@ private async Task AddPackageOwnerTask(PackageRegistration packageRegistration,\nawait _packageService.AddPackageOwnerAsync(packageRegistration, user, commitChanges);\n- await DeletePackageOwnershipRequestAsync(packageRegistration, user, commitChanges);\n+ // Delete any ownership request related to this new owner, since the work is done. Don't audit since the\n+ // \"add owner\" operation is audited itself. Having a \"delete package ownership\" audit here would be confusing\n+ // because the intended user action was to add an owner, not to reject (delete) an ownership request.\n+ await DeletePackageOwnershipRequestAsync(packageRegistration, user, commitChanges, saveAudit: false);\n}\npublic async Task<PackageOwnerRequest> AddPackageOwnershipRequestAsync(PackageRegistration packageRegistration, User requestingOwner, User newOwner)\n{\n- return await _packageOwnerRequestService.AddPackageOwnershipRequest(packageRegistration, requestingOwner, newOwner);\n+ var request = await _packageOwnerRequestService.AddPackageOwnershipRequest(packageRegistration, requestingOwner, newOwner);\n+\n+ await _auditingService.SaveAuditRecordAsync(PackageRegistrationAuditRecord.CreateForAddOwnershipRequest(\n+ packageRegistration,\n+ requestingOwner.Username,\n+ newOwner.Username));\n+\n+ return request;\n}\npublic PackageOwnerRequest GetPackageOwnershipRequest(PackageRegistration package, User pendingOwner, string token)\n@@ -184,6 +194,11 @@ private async Task RemovePackageOwnerImplAsync(PackageRegistration packageRegist\n}\npublic async Task DeletePackageOwnershipRequestAsync(PackageRegistration packageRegistration, User newOwner, bool commitChanges = true)\n+ {\n+ await DeletePackageOwnershipRequestAsync(packageRegistration, newOwner, commitChanges, saveAudit: true);\n+ }\n+\n+ private async Task DeletePackageOwnershipRequestAsync(PackageRegistration packageRegistration, User newOwner, bool commitChanges, bool saveAudit)\n{\nif (packageRegistration == null)\n{\n@@ -195,10 +210,25 @@ public async Task DeletePackageOwnershipRequestAsync(PackageRegistration package\nthrow new ArgumentNullException(nameof(newOwner));\n}\n- var request = _packageOwnerRequestService.GetPackageOwnershipRequests(package: packageRegistration, newOwner: newOwner).FirstOrDefault();\n+ var request = _packageOwnerRequestService\n+ .GetPackageOwnershipRequestsWithUsers(package: packageRegistration, newOwner: newOwner)\n+ .FirstOrDefault();\nif (request != null)\n{\n+ // We must capture this audit record prior to the actual deletion operation. Deletion of an entity in\n+ // Entity Framework clears the relationship properties cause us to lose the information needed to create\n+ // the audit record. The package ID and usernames become unavailable.\n+ var auditRecord = PackageRegistrationAuditRecord.CreateForDeleteOwnershipRequest(\n+ request.PackageRegistration,\n+ request.RequestingOwner.Username,\n+ request.NewOwner.Username);\n+\nawait _packageOwnerRequestService.DeletePackageOwnershipRequest(request, commitChanges);\n+\n+ if (saveAudit)\n+ {\n+ await _auditingService.SaveAuditRecordAsync(auditRecord);\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<PackageReference Include=\"Microsoft.Extensions.Logging.Abstractions\">\n<Version>2.2.0</Version>\n</PackageReference>\n- <PackageReference Include=\"Microsoft.IdentityModel.Clients.ActiveDirectory\">\n- <Version>5.2.6</Version>\n- </PackageReference>\n<PackageReference Include=\"Microsoft.Net.Http\">\n<Version>2.2.29</Version>\n</PackageReference>\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Core.Facts/Auditing/AuditedPackageRegistrationActionTests.cs",
"new_path": "tests/NuGetGallery.Core.Facts/Auditing/AuditedPackageRegistrationActionTests.cs",
"diff": "@@ -16,7 +16,9 @@ public void Definition_HasNotChanged()\n\"RemoveOwner\",\n\"MarkVerified\",\n\"MarkUnverified\",\n- \"SetRequiredSigner\"\n+ \"SetRequiredSigner\",\n+ \"AddOwnershipRequest\",\n+ \"DeleteOwnershipRequest\",\n};\nVerify(typeof(AuditedPackageRegistrationAction), expectedNames);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Core.Facts/Auditing/PackageRegistrationAuditRecordTests.cs",
"new_path": "tests/NuGetGallery.Core.Facts/Auditing/PackageRegistrationAuditRecordTests.cs",
"diff": "@@ -38,6 +38,34 @@ public void GetPath_ReturnsLowerCasedId()\nAssert.Equal(\"a\", actualPath);\n}\n+ [Fact]\n+ public void CreateForAddOwnershipRequest_InitializesProperties()\n+ {\n+ var record = PackageRegistrationAuditRecord.CreateForAddOwnershipRequest(\n+ new PackageRegistration { Id = \"NuGet.Versioning\" },\n+ requestingOwner: \"NuGet\",\n+ newOwner: \"Microsoft\");\n+\n+ Assert.Equal(\"NuGet.Versioning\", record.Id);\n+ Assert.Equal(\"NuGet\", record.RequestingOwner);\n+ Assert.Equal(\"Microsoft\", record.NewOwner);\n+ Assert.Equal(AuditedPackageRegistrationAction.AddOwnershipRequest, record.Action);\n+ }\n+\n+ [Fact]\n+ public void CreateForDeleteOwnershipRequest_InitializesProperties()\n+ {\n+ var record = PackageRegistrationAuditRecord.CreateForDeleteOwnershipRequest(\n+ new PackageRegistration { Id = \"NuGet.Versioning\" },\n+ requestingOwner: \"NuGet\",\n+ newOwner: \"Microsoft\");\n+\n+ Assert.Equal(\"NuGet.Versioning\", record.Id);\n+ Assert.Equal(\"NuGet\", record.RequestingOwner);\n+ Assert.Equal(\"Microsoft\", record.NewOwner);\n+ Assert.Equal(AuditedPackageRegistrationAction.DeleteOwnershipRequest, record.Action);\n+ }\n+\n[Fact]\npublic void CreateForSetRequiredSigner_WhenRegistrationIsNull_Throws()\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Controllers/ApiControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Controllers/ApiControllerFacts.cs",
"diff": "@@ -2659,10 +2659,10 @@ public async Task ReturnsForbiddenIfFeatureFlagDisabled()\npublic class PackageVerificationKeyContainer : TestContainer\n{\n- public static int UserKey = 1234;\n- public static string Username = \"testuser\";\n- public static string PackageId = \"foo\";\n- public static string PackageVersion = \"1.0.0\";\n+ public const int UserKey = 1234;\n+ public const string Username = \"testuser\";\n+ public const string PackageId = \"foo\";\n+ public string PackageVersion = \"1.0.0\";\ninternal TestableApiController SetupController(string keyType, Scope scope, Package package, bool isOwner = true)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Extensions/RouteExtensionsFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Extensions/RouteExtensionsFacts.cs",
"diff": "@@ -10,10 +10,10 @@ namespace NuGetGallery.Extensions\n{\npublic class RouteExtensionsFacts\n{\n- private static string _routeUrl = \"test/{user}\";\n- private static string _url = \"test/user1\";\n- private static int _segment = 1;\n- private static string _obfuscatedValue = \"obfuscatedData\";\n+ private const string _routeUrl = \"test/{user}\";\n+ private const string _url = \"test/user1\";\n+ private const int _segment = 1;\n+ private const string _obfuscatedValue = \"obfuscatedData\";\n[Fact]\npublic void MapRoute_WithoutConstraints_AddsObfuscation()\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Services/DeleteAccountServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Services/DeleteAccountServiceFacts.cs",
"diff": "@@ -21,7 +21,7 @@ public class DeleteAccountServiceFacts\n{\npublic class TheDeleteGalleryUserAccountAsyncMethod\n{\n- private static int Key = -1;\n+ private int Key = -1;\n[Theory]\n[InlineData(false)]\n@@ -429,7 +429,7 @@ public async Task DeleteUserThatOwnsOrphanRegistrationWillCleanTheRegistration(b\n}\n- private static User CreateTestUserWithRegistration(ref PackageRegistration registration)\n+ private User CreateTestUserWithRegistration(ref PackageRegistration registration)\n{\nvar testUser = new User(\"TestUser\") { Key = Key++ };\ntestUser.EmailAddress = \"[email protected]\";\n@@ -439,7 +439,7 @@ private static User CreateTestUserWithRegistration(ref PackageRegistration regis\nreturn testUser;\n}\n- private static User CreateTestUser(ref PackageRegistration registration)\n+ private User CreateTestUser(ref PackageRegistration registration)\n{\nvar testUser = new User(\"TestUser\") { Key = Key++ };\ntestUser.EmailAddress = \"[email protected]\";\n@@ -473,7 +473,7 @@ private static User CreateTestUser(ref PackageRegistration registration)\nreturn testUser;\n}\n- private static void AddOrganizationMigrationRequest(User testUser)\n+ private void AddOrganizationMigrationRequest(User testUser)\n{\nvar testOrganizationAdmin = new User(\"TestOrganizationAdmin\") { Key = Key++ };\n@@ -482,7 +482,7 @@ private static void AddOrganizationMigrationRequest(User testUser)\ntestOrganizationAdmin.OrganizationMigrationRequests.Add(request);\n}\n- private static void AddOrganizationMigrationRequests(User testUser)\n+ private void AddOrganizationMigrationRequests(User testUser)\n{\nvar testOrganization = new Organization(\"testOrganization\") { Key = Key++ };\n@@ -491,7 +491,7 @@ private static void AddOrganizationMigrationRequests(User testUser)\ntestUser.OrganizationMigrationRequests.Add(request);\n}\n- private static void AddOrganizationRequests(User testUser, bool isAdmin)\n+ private void AddOrganizationRequests(User testUser, bool isAdmin)\n{\nvar testOrganization = new Organization(\"testOrganization\") { Key = Key++ };\n@@ -500,7 +500,7 @@ private static void AddOrganizationRequests(User testUser, bool isAdmin)\ntestUser.OrganizationRequests.Add(request);\n}\n- private static void AddOrganization(User testUser, bool isAdmin, bool hasAdminMember, bool hasCollaboratorMember)\n+ private void AddOrganization(User testUser, bool isAdmin, bool hasAdminMember, bool hasCollaboratorMember)\n{\nvar testOrganization = new Organization(\"testOrganization\") { Key = Key++ };\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Services/PackageOwnerRequestServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Services/PackageOwnerRequestServiceFacts.cs",
"diff": "// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\nusing System;\n+using System.Collections.Generic;\n+using System.Data.Entity;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Moq;\n@@ -39,7 +41,7 @@ public void ThrowsArgumentNullIfTokenIsNullOrEmpty(string token)\n[InlineData(2, 2, \"token\", false)]\n[InlineData(1, 1, \"token\", false)]\n[InlineData(1, 2, \"token2\", false)]\n- private void ReturnsSuccessIfPackageOwnerRequestMatches(int packageId, int userId, string token, bool success)\n+ public void ReturnsSuccessIfPackageOwnerRequestMatches(int packageId, int userId, string token, bool success)\n{\n// Arrange\nconst int actualKey = 1;\n@@ -115,10 +117,10 @@ public async Task NullNewOwnerThrowsException()\npublic async Task CreatesPackageOwnerRequest()\n{\nvar packageOwnerRequestRepository = new Mock<IEntityRepository<PackageOwnerRequest>>();\n- var service = CreateService(packageOwnerRequestRepo: packageOwnerRequestRepository);\n- var package = new PackageRegistration { Key = 1 };\n- var owner = new User { Key = 100 };\n- var newOwner = new User { Key = 200 };\n+ var service = CreateService(packageOwnerRequestRepository);\n+ var package = new PackageRegistration { Id = \"NuGet.Versioning\", Key = 1 };\n+ var owner = new User { Username = \"NuGet\", Key = 100 };\n+ var newOwner = new User { Username = \"Microsoft\", Key = 200 };\nawait service.AddPackageOwnershipRequest(package, owner, newOwner);\n@@ -153,7 +155,7 @@ public async Task ReturnsExistingMatchingPackageOwnerRequest()\nNewOwnerKey = newOwner.Key\n}\n}.AsQueryable());\n- var service = CreateService(packageOwnerRequestRepo: packageOwnerRequestRepository);\n+ var service = CreateService(packageOwnerRequestRepository);\n// Act\nvar request = await service.AddPackageOwnershipRequest(package, newRequestingOwner, newOwner);\n@@ -163,7 +165,210 @@ public async Task ReturnsExistingMatchingPackageOwnerRequest()\n}\n}\n- private static IPackageOwnerRequestService CreateService(Mock<IEntityRepository<PackageOwnerRequest>> packageOwnerRequestRepo = null)\n+ public class TheDeletePackageOwnershipRequestMethod\n+ {\n+ [Fact]\n+ public async Task NullRequestThrowsException()\n+ {\n+ var service = CreateService();\n+ await Assert.ThrowsAsync<ArgumentNullException>(async () => await service.DeletePackageOwnershipRequest(request: null));\n+ }\n+\n+ [Theory]\n+ [InlineData(false)]\n+ [InlineData(true)]\n+ public async Task DeletesPackageOwnerRequest(bool commitChanges)\n+ {\n+ var packageOwnerRequestRepository = new Mock<IEntityRepository<PackageOwnerRequest>>();\n+ var service = CreateService(packageOwnerRequestRepository);\n+ var request = new PackageOwnerRequest\n+ {\n+ PackageRegistration = new PackageRegistration { Id = \"NuGet.Versioning\" },\n+ RequestingOwner = new User { Username = \"NuGet\" },\n+ NewOwner = new User { Username = \"Microsoft\" },\n+ };\n+\n+ await service.DeletePackageOwnershipRequest(request, commitChanges);\n+\n+ packageOwnerRequestRepository.Verify(r => r.DeleteOnCommit(request), Times.Once);\n+ packageOwnerRequestRepository.Verify(r => r.CommitChangesAsync(), commitChanges ? Times.Once() : Times.Never());\n+ }\n+ }\n+\n+ public class TheGetPackageOwnershipRequestsMethod : Facts\n+ {\n+ [Fact]\n+ public void IncludesThePackageRegistrationRelationship()\n+ {\n+ Target.GetPackageOwnershipRequests(package: PackageRegistration);\n+\n+ DbSet.Verify(x => x.Include(It.IsAny<string>()), Times.Once);\n+ DbSet.Verify(x => x.Include(nameof(PackageOwnerRequest.PackageRegistration)), Times.Once);\n+ }\n+\n+ [Fact]\n+ public void ReturnsRequestsFilteredByPackageRegistration()\n+ {\n+ var requests = Target.GetPackageOwnershipRequests(package: PackageRegistration);\n+\n+ Assert.Same(Entities[0], Assert.Single(requests));\n+ }\n+\n+ [Fact]\n+ public void UsesPackageRegistrationKeyForFiltering()\n+ {\n+ PackageRegistration.Key++;\n+\n+ var requests = Target.GetPackageOwnershipRequests(package: PackageRegistration);\n+\n+ Assert.Empty(requests);\n+ }\n+\n+ [Fact]\n+ public void ReturnsRequestsFilteredByRequestingOwner()\n+ {\n+ var requests = Target.GetPackageOwnershipRequests(requestingOwner: RequestingOwner);\n+\n+ Assert.Same(Entities[0], Assert.Single(requests));\n+ }\n+\n+ [Fact]\n+ public void UsesRequestOwnerKeyForFiltering()\n+ {\n+ RequestingOwner.Key++;\n+\n+ var requests = Target.GetPackageOwnershipRequests(requestingOwner: RequestingOwner);\n+\n+ Assert.Empty(requests);\n+ }\n+\n+ [Fact]\n+ public void ReturnsRequestsFilteredByNewOwner()\n+ {\n+ var requests = Target.GetPackageOwnershipRequests(newOwner: NewOwner);\n+\n+ Assert.Same(Entities[0], Assert.Single(requests));\n+ }\n+\n+ [Fact]\n+ public void UsesNewOwnerKeyForFiltering()\n+ {\n+ NewOwner.Key++;\n+\n+ var requests = Target.GetPackageOwnershipRequests(newOwner: NewOwner);\n+\n+ Assert.Empty(requests);\n+ }\n+ }\n+\n+ public class TheGetPackageOwnershipRequestsWithUsersMethod : Facts\n+ {\n+ [Fact]\n+ public void IncludesThePackageRegistrationRelationship()\n+ {\n+ Target.GetPackageOwnershipRequestsWithUsers(package: PackageRegistration);\n+\n+ DbSet.Verify(x => x.Include(It.IsAny<string>()), Times.Exactly(3));\n+ DbSet.Verify(x => x.Include(nameof(PackageOwnerRequest.PackageRegistration)), Times.Once);\n+ DbSet.Verify(x => x.Include(nameof(PackageOwnerRequest.RequestingOwner)), Times.Once);\n+ DbSet.Verify(x => x.Include(nameof(PackageOwnerRequest.NewOwner)), Times.Once);\n+ }\n+\n+ [Fact]\n+ public void ReturnsRequestsFilteredByPackageRegistration()\n+ {\n+ var requests = Target.GetPackageOwnershipRequestsWithUsers(package: PackageRegistration);\n+\n+ Assert.Same(Entities[0], Assert.Single(requests));\n+ }\n+\n+ [Fact]\n+ public void UsesPackageRegistrationKeyForFiltering()\n+ {\n+ PackageRegistration.Key++;\n+\n+ var requests = Target.GetPackageOwnershipRequestsWithUsers(package: PackageRegistration);\n+\n+ Assert.Empty(requests);\n+ }\n+\n+ [Fact]\n+ public void ReturnsRequestsFilteredByRequestingOwner()\n+ {\n+ var requests = Target.GetPackageOwnershipRequestsWithUsers(requestingOwner: RequestingOwner);\n+\n+ Assert.Same(Entities[0], Assert.Single(requests));\n+ }\n+\n+ [Fact]\n+ public void UsesRequestOwnerKeyForFiltering()\n+ {\n+ RequestingOwner.Key++;\n+\n+ var requests = Target.GetPackageOwnershipRequestsWithUsers(requestingOwner: RequestingOwner);\n+\n+ Assert.Empty(requests);\n+ }\n+\n+ [Fact]\n+ public void ReturnsRequestsFilteredByNewOwner()\n+ {\n+ var requests = Target.GetPackageOwnershipRequestsWithUsers(newOwner: NewOwner);\n+\n+ Assert.Same(Entities[0], Assert.Single(requests));\n+ }\n+\n+ [Fact]\n+ public void UsesNewOwnerKeyForFiltering()\n+ {\n+ NewOwner.Key++;\n+\n+ var requests = Target.GetPackageOwnershipRequestsWithUsers(newOwner: NewOwner);\n+\n+ Assert.Empty(requests);\n+ }\n+ }\n+\n+ public abstract class Facts\n+ {\n+ public Facts()\n+ {\n+ PackageOwnerRequestRepository = new Mock<IEntityRepository<PackageOwnerRequest>>();\n+\n+ PackageRegistration = new PackageRegistration { Key = 1, Id = \"NuGet.Versioning\" };\n+ RequestingOwner = new User { Key = 2, Username = \"NuGet\" };\n+ NewOwner = new User { Key = 3, Username = \"Microsoft\" };\n+ Entities = new List<PackageOwnerRequest>\n+ {\n+ new PackageOwnerRequest\n+ {\n+ PackageRegistration = PackageRegistration,\n+ PackageRegistrationKey = PackageRegistration.Key,\n+ RequestingOwner = RequestingOwner,\n+ RequestingOwnerKey = RequestingOwner.Key,\n+ NewOwner = NewOwner,\n+ NewOwnerKey = NewOwner.Key,\n+ },\n+ };\n+ DbSet = Entities.MockDbSet();\n+\n+ PackageOwnerRequestRepository.Setup(x => x.GetAll()).Returns(() => DbSet.Object);\n+ DbSet.Setup(x => x.Include(It.IsAny<string>())).Returns(() => DbSet.Object);\n+\n+ Target = new PackageOwnerRequestService(PackageOwnerRequestRepository.Object);\n+ }\n+\n+ public Mock<IEntityRepository<PackageOwnerRequest>> PackageOwnerRequestRepository { get; }\n+ public PackageRegistration PackageRegistration { get; }\n+ public User RequestingOwner { get; }\n+ public User NewOwner { get; }\n+ public List<PackageOwnerRequest> Entities { get; }\n+ public Mock<DbSet<PackageOwnerRequest>> DbSet { get; }\n+ public PackageOwnerRequestService Target { get; }\n+ }\n+\n+ private static IPackageOwnerRequestService CreateService(\n+ Mock<IEntityRepository<PackageOwnerRequest>> packageOwnerRequestRepo = null)\n{\npackageOwnerRequestRepo = packageOwnerRequestRepo ?? new Mock<IEntityRepository<PackageOwnerRequest>>();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Services/PackageOwnershipManagementServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Services/PackageOwnershipManagementServiceFacts.cs",
"diff": "@@ -64,7 +64,17 @@ public class PackageOwnershipManagementServiceFacts\n})\n.Verifiable();\n- packageOwnerRequestService.Setup(x => x.GetPackageOwnershipRequests(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>())).Returns(new[] { new PackageOwnerRequest() }).Verifiable();\n+ packageOwnerRequestService\n+ .Setup(x => x.GetPackageOwnershipRequestsWithUsers(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>()))\n+ .Returns<PackageRegistration, User, User>((pr, ro, no) => new[]\n+ {\n+ new PackageOwnerRequest\n+ {\n+ PackageRegistration = pr ?? new PackageRegistration { Id = \"NuGet.Versioning\" },\n+ RequestingOwner = ro ?? new User { Username = \"NuGet\" },\n+ NewOwner = no ?? new User { Username = \"Microsoft\" },\n+ },\n+ }).Verifiable();\npackageOwnerRequestService.Setup(x => x.DeletePackageOwnershipRequest(It.IsAny<PackageOwnerRequest>(), true)).Returns(Task.CompletedTask).Verifiable();\npackageOwnerRequestService.Setup(x => x.AddPackageOwnershipRequest(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>())).Returns(Task.FromResult(new PackageOwnerRequest())).Verifiable();\n}\n@@ -109,7 +119,7 @@ public async Task NewOwnerIsAddedSuccessfullyToTheRegistration()\nawait service.AddPackageOwnerAsync(package, pendingOwner);\npackageService.Verify(x => x.AddPackageOwnerAsync(package, pendingOwner, true));\n- packageOwnerRequestService.Verify(x => x.GetPackageOwnershipRequests(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>()));\n+ packageOwnerRequestService.Verify(x => x.GetPackageOwnershipRequestsWithUsers(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>()));\npackageOwnerRequestService.Verify(x => x.DeletePackageOwnershipRequest(It.IsAny<PackageOwnerRequest>(), true));\n}\n@@ -127,7 +137,7 @@ public async Task NewOwnerIsAddedSuccessfullyWithoutPendingRequest()\nawait service.AddPackageOwnerAsync(package, pendingOwner);\npackageService.Verify(x => x.AddPackageOwnerAsync(package, pendingOwner, true));\n- packageOwnerRequestService.Verify(x => x.GetPackageOwnershipRequests(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>()));\n+ packageOwnerRequestService.Verify(x => x.GetPackageOwnershipRequestsWithUsers(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>()));\npackageOwnerRequestService.Verify(x => x.DeletePackageOwnershipRequest(It.IsAny<PackageOwnerRequest>(), true), Times.Never);\n}\n@@ -147,7 +157,7 @@ public async Task AddingOwnerMarksPackageVerifiedForMatchingNamespace()\nawait service.AddPackageOwnerAsync(package, pendingOwner);\npackageService.Verify(x => x.UpdatePackageVerifiedStatusAsync(It.Is<IReadOnlyCollection<PackageRegistration>>(pr => pr.First() == package), true, true));\n- packageOwnerRequestService.Verify(x => x.GetPackageOwnershipRequests(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>()));\n+ packageOwnerRequestService.Verify(x => x.GetPackageOwnershipRequestsWithUsers(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>()));\npackageOwnerRequestService.Verify(x => x.DeletePackageOwnershipRequest(It.IsAny<PackageOwnerRequest>(), true));\nreservedNamespaceService.Verify(x => x.AddPackageRegistrationToNamespace(It.IsAny<string>(), It.IsAny<PackageRegistration>()), Times.Once);\nAssert.True(package.IsVerified);\n@@ -205,6 +215,7 @@ public async Task WritesAnAuditRecord()\nAssert.True(auditingService.WroteRecord<PackageRegistrationAuditRecord>(ar =>\nar.Action == AuditedPackageRegistrationAction.AddOwner\n&& ar.Id == package.Id));\n+ Assert.Single(auditingService.Records);\n}\n}\n@@ -217,9 +228,16 @@ public async Task RequestIsAddedSuccessfully()\nvar user1 = new User { Key = 101, Username = \"user1\" };\nvar user2 = new User { Key = 101, Username = \"user2\" };\nvar packageOwnerRequestService = new Mock<IPackageOwnerRequestService>();\n- var service = CreateService(packageOwnerRequestService: packageOwnerRequestService);\n+ var auditingService = new Mock<IAuditingService>();\n+ var service = CreateService(packageOwnerRequestService: packageOwnerRequestService, auditingService: auditingService.Object);\nawait service.AddPackageOwnershipRequestAsync(packageRegistration: package, requestingOwner: user1, newOwner: user2);\npackageOwnerRequestService.Verify(x => x.AddPackageOwnershipRequest(package, user1,user2));\n+ auditingService.Verify(x => x.SaveAuditRecordAsync(It.IsAny<PackageRegistrationAuditRecord>()), Times.Once);\n+ auditingService.Verify(x => x.SaveAuditRecordAsync(It.Is<PackageRegistrationAuditRecord>(r =>\n+ r.Id == \"pkg42\"\n+ && r.RequestingOwner == \"user1\"\n+ && r.NewOwner == \"user2\"\n+ && r.Action == AuditedPackageRegistrationAction.AddOwnershipRequest)), Times.Once);\n}\n}\n@@ -508,18 +526,42 @@ public async Task RequestIsDeletedSuccessfully()\n{\nvar package = new PackageRegistration { Key = 2, Id = \"pkg42\" };\nvar user1 = new User { Key = 101, Username = \"user1\" };\n+ var user2 = new User { Key = 101, Username = \"user2\" };\nvar packageOwnerRequestService = new Mock<IPackageOwnerRequestService>();\n+ var auditingService = new Mock<IAuditingService>();\nvar pendingRequest = new PackageOwnerRequest\n{\nPackageRegistration = package,\n- NewOwner = user1,\n+ RequestingOwner = user1,\n+ NewOwner = user2,\nConfirmationCode = \"token\"\n};\n- packageOwnerRequestService.Setup(x => x.GetPackageOwnershipRequests(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>())).Returns(new[] { pendingRequest }).Verifiable();\n+ packageOwnerRequestService.Setup(x => x.GetPackageOwnershipRequestsWithUsers(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>())).Returns(new[] { pendingRequest }).Verifiable();\npackageOwnerRequestService.Setup(x => x.DeletePackageOwnershipRequest(It.IsAny<PackageOwnerRequest>(), true)).Returns(Task.CompletedTask).Verifiable();\n- var service = CreateService(packageOwnerRequestService: packageOwnerRequestService, useDefaultSetup: false);\n- await service.DeletePackageOwnershipRequestAsync(packageRegistration: package, newOwner: user1);\n+ var service = CreateService(packageOwnerRequestService: packageOwnerRequestService, auditingService: auditingService.Object, useDefaultSetup: false);\n+ await service.DeletePackageOwnershipRequestAsync(packageRegistration: package, newOwner: user2);\npackageOwnerRequestService.Verify(x => x.DeletePackageOwnershipRequest(pendingRequest, true));\n+ auditingService.Verify(x => x.SaveAuditRecordAsync(It.IsAny<PackageRegistrationAuditRecord>()), Times.Once);\n+ auditingService.Verify(x => x.SaveAuditRecordAsync(It.Is<PackageRegistrationAuditRecord>(r =>\n+ r.Id == \"pkg42\"\n+ && r.RequestingOwner == \"user1\"\n+ && r.NewOwner == \"user2\"\n+ && r.Action == AuditedPackageRegistrationAction.DeleteOwnershipRequest)), Times.Once);\n+ }\n+\n+ [Fact]\n+ public async Task DoesNotDeleteOrAuditIfRecordDoesNotExist()\n+ {\n+ var package = new PackageRegistration { Key = 2, Id = \"pkg42\" };\n+ var user1 = new User { Key = 101, Username = \"user1\" };\n+ var user2 = new User { Key = 101, Username = \"user2\" };\n+ var packageOwnerRequestService = new Mock<IPackageOwnerRequestService>();\n+ var auditingService = new Mock<IAuditingService>();\n+ packageOwnerRequestService.Setup(x => x.GetPackageOwnershipRequestsWithUsers(It.IsAny<PackageRegistration>(), It.IsAny<User>(), It.IsAny<User>())).Returns(new PackageOwnerRequest[0]).Verifiable();\n+ var service = CreateService(packageOwnerRequestService: packageOwnerRequestService, auditingService: auditingService.Object, useDefaultSetup: false);\n+ await service.DeletePackageOwnershipRequestAsync(packageRegistration: package, newOwner: user2);\n+ packageOwnerRequestService.Verify(x => x.DeletePackageOwnershipRequest(It.IsAny<PackageOwnerRequest>(), It.IsAny<bool>()), Times.Never);\n+ auditingService.Verify(x => x.SaveAuditRecordAsync(It.IsAny<PackageRegistrationAuditRecord>()), Times.Never);\n}\n}\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Audit add and remove ownership request action (#8764)
Progress on https://github.com/NuGet/Engineering/issues/3994 |
455,781 | 03.09.2021 15:34:26 | 25,200 | a2c88e3b2b4af827ceb9b401a87a9b4107b4dd1a | [HotFix] Update test to use Newtonsoft.Json instead of jQuery. | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.FunctionalTests/ODataFeeds/V2FeedTests.cs",
"new_path": "tests/NuGetGallery.FunctionalTests/ODataFeeds/V2FeedTests.cs",
"diff": "@@ -52,13 +52,13 @@ public async Task ApiV2MetadataTest()\n}\n[Fact]\n- [Description(\"Verify the webresponse from top30 packages feed contains jQuery\")]\n+ [Description(\"Verify the webresponse from top30 packages feed contains Newtonsoft.Json\")]\n[Priority(0)]\n[Category(\"P0Tests\")]\npublic async Task Top30PackagesFeedTest()\n{\nstring url = UrlHelper.V2FeedRootUrl + @\"/Search()?$filter=IsAbsoluteLatestVersion&$orderby=DownloadCount%20desc,Id&$skip=0&$top=30&searchTerm=''&targetFramework='net45'&includePrerelease=true\";\n- bool containsResponseText = await _odataHelper.ContainsResponseText(url, \"jQuery\");\n+ bool containsResponseText = await _odataHelper.ContainsResponseText(url, \"Newtonsoft.Json\");\nAssert.True(containsResponseText);\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [HotFix] Update test to use Newtonsoft.Json instead of jQuery. (#8785) |
455,781 | 03.09.2021 16:43:08 | 25,200 | f08f9af86f14034516aa78ab25ca990b9cc23629 | [Hotfix] Update test to be Newtonsoft.Json instead of jQuery on loadtest. | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.LoadTests/LoadTests.cs",
"new_path": "tests/NuGetGallery.LoadTests/LoadTests.cs",
"diff": "@@ -128,13 +128,13 @@ public async Task HitSearchEndPointDirectly()\n}\n[TestMethod]\n- [Description(\"Verify the webresponse from top30 packages feed contains jQuery\")]\n+ [Description(\"Verify the webresponse from top30 packages feed contains Newtonsoft.Json\")]\n[TestCategory(\"P0Tests\")]\npublic async Task Top30PackagesFeedTest()\n{\nstring url = UrlHelper.V2FeedRootUrl + @\"/Search()?$filter=IsAbsoluteLatestVersion&$orderby=DownloadCount%20desc,Id&$skip=0&$top=30&searchTerm=''&targetFramework='net45'&includePrerelease=true\";\nvar odataHelper = new ODataHelper();\n- bool containsResponseText = await odataHelper.ContainsResponseText(url, \"jQuery\");\n+ bool containsResponseText = await odataHelper.ContainsResponseText(url, \"Newtonsoft.Json\");\nAssert.IsTrue(containsResponseText);\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [Hotfix] Update test to be Newtonsoft.Json instead of jQuery on loadtest. (#8787) |
455,736 | 03.09.2021 16:45:38 | 25,200 | 32a9cbf9c5df7ea3c9db9981939769bb6e103b6d | Check for deleted packages on several read and write operations
Fix | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/Services/ICorePackageService.cs",
"new_path": "src/NuGetGallery.Core/Services/ICorePackageService.cs",
"diff": "@@ -29,7 +29,11 @@ public interface ICorePackageService\nTask UpdatePackageStatusAsync(Package package, PackageStatus newPackageStatus, bool commitChanges = true);\n/// <summary>\n- /// Gets the package with the given ID and version when exists; otherwise <c>null</c>.\n+ /// Gets the package with the given ID and version when exists; otherwise <c>null</c>. Note that this method\n+ /// can return a soft deleted package. This will be indicated by <see cref=\"PackageStatus.Deleted\"/> on the\n+ /// <see cref=\"Package.PackageStatusKey\"/> property. Hard deleted packages will be returned as null because no\n+ /// record of the package exists. Consider checking for a null package and a soft deleted depending on your\n+ /// desired behavior for non-existent and deleted packages.\n/// </summary>\n/// <param name=\"id\">The package ID.</param>\n/// <param name=\"version\">The package version.</param>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"new_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"diff": "@@ -1182,7 +1182,7 @@ public virtual ActionResult AtomFeed(string id, bool prerel = true)\npublic virtual async Task<ActionResult> License(string id, string version)\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n- if (package == null)\n+ if (package == null || package.PackageStatusKey == PackageStatus.Deleted)\n{\nreturn HttpNotFound();\n}\n@@ -1878,7 +1878,7 @@ public virtual async Task<ActionResult> Reflow(string id, string version)\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n- if (package == null)\n+ if (package == null || package.PackageStatusKey == PackageStatus.Deleted)\n{\nreturn HttpNotFound();\n}\n@@ -1915,7 +1915,7 @@ public virtual async Task<ActionResult> Revalidate(string id, string version, st\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n- if (package == null)\n+ if (package == null || package.PackageStatusKey == PackageStatus.Deleted)\n{\nreturn HttpNotFound();\n}\n@@ -1951,7 +1951,7 @@ public virtual async Task<ActionResult> RevalidateSymbols(string id, string vers\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n- if (package == null)\n+ if (package == null || package.PackageStatusKey == PackageStatus.Deleted)\n{\nreturn new HttpStatusCodeResult(HttpStatusCode.NotFound,\nstring.Format(Strings.PackageWithIdAndVersionNotFound, id, version));\n@@ -2152,7 +2152,7 @@ public virtual ActionResult Edit(string id, string version)\npublic virtual async Task<ActionResult> UpdateListed(string id, string version, bool? listed)\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n- if (package == null)\n+ if (package == null || package.PackageStatusKey == PackageStatus.Deleted)\n{\nreturn HttpNotFound();\n}\n@@ -2195,7 +2195,7 @@ public virtual async Task<ActionResult> UpdateListed(string id, string version,\npublic virtual async Task<JsonResult> Edit(string id, string version, VerifyPackageRequest formData, string returnUrl)\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n- if (package == null)\n+ if (package == null || package.PackageStatusKey == PackageStatus.Deleted)\n{\nreturn Json(HttpStatusCode.NotFound, new[] { new JsonValidationMessage(string.Format(Strings.PackageWithIdAndVersionNotFound, id, version)) });\n}\n@@ -2992,7 +2992,7 @@ public virtual async Task<JsonResult> PreviewReadMe(ReadMeRequest formData)\npublic virtual async Task<JsonResult> GetReadMeMd(string id, string version)\n{\nvar package = _packageService.FindPackageByIdAndVersionStrict(id, version);\n- if (package == null)\n+ if (package == null || package.PackageStatusKey == PackageStatus.Deleted)\n{\nreturn Json(HttpStatusCode.NotFound, null, JsonRequestBehavior.AllowGet);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Controllers/PackagesControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Controllers/PackagesControllerFacts.cs",
"diff": "@@ -4450,6 +4450,29 @@ public async Task Returns404IfNotFound(bool listed)\nAssert.IsType<HttpNotFoundResult>(result);\n}\n+ [Theory]\n+ [InlineData(false)]\n+ [InlineData(true)]\n+ public async Task Returns404IfDeleted(bool listed)\n+ {\n+ // Arrange\n+ var packageService = new Mock<IPackageService>(MockBehavior.Strict);\n+ packageService.Setup(svc => svc.FindPackageByIdAndVersionStrict(\"Foo\", \"1.0\"))\n+ .Returns(new Package { PackageStatusKey = PackageStatus.Deleted });\n+ // Note: this Mock must be strict because it guarantees that MarkPackageListedAsync is not called!\n+\n+ var controller = CreateController(\n+ GetConfigurationService(),\n+ packageService: packageService);\n+ controller.Url = new UrlHelper(new RequestContext(), new RouteCollection());\n+\n+ // Act\n+ var result = await controller.UpdateListed(\"Foo\", \"1.0\", listed);\n+\n+ // Assert\n+ Assert.IsType<HttpNotFoundResult>(result);\n+ }\n+\npublic static IEnumerable<object[]> NotOwner_Data\n{\nget\n@@ -4700,7 +4723,8 @@ public static IEnumerable<object[]> NotOwner_Data\nbool hasReadMe = false,\nbool isPackageLocked = false,\nMock<IPackageFileService> packageFileService = null,\n- IReadMeService readMeService = null)\n+ IReadMeService readMeService = null,\n+ PackageStatus packageStatus = PackageStatus.Available)\n{\nvar package = new Package\n{\n@@ -4708,6 +4732,7 @@ public static IEnumerable<object[]> NotOwner_Data\nVersion = \"1.0\",\nListed = true,\nHasReadMe = hasReadMe,\n+ PackageStatusKey = packageStatus,\n};\npackage.PackageRegistration.Owners.Add(owner);\n@@ -4912,6 +4937,21 @@ public async Task WhenPackageRegistrationIsLockedReturns403(User currentUser, Us\nAssert.IsType<JsonResult>(result);\nAssert.Equal(403, controller.Response.StatusCode);\n}\n+\n+ [Theory]\n+ [MemberData(nameof(Owner_Data))]\n+ public async Task WhenPackageIsDeletedReturns404(User currentUser, User owner)\n+ {\n+ // Arrange\n+ var controller = SetupController(currentUser, owner, packageStatus: PackageStatus.Deleted);\n+\n+ // Act\n+ var result = await controller.Edit(\"packageId\", \"1.0.0\", new VerifyPackageRequest(), string.Empty);\n+\n+ // Assert\n+ Assert.IsType<JsonResult>(result);\n+ Assert.Equal(404, controller.Response.StatusCode);\n+ }\n}\npublic class TheListPackagesMethod\n@@ -9220,12 +9260,31 @@ public async Task ReturnsNotFoundForUnknownPackage()\n// Assert\nAssert.IsType<HttpNotFoundResult>(result);\n}\n+\n+ [Fact]\n+ public async Task ReturnsNotFoundForDeletedPackage()\n+ {\n+ // Arrange\n+ _packageService\n+ .Setup(svc => svc.FindPackageByIdAndVersionStrict(\n+ It.IsAny<string>(),\n+ It.IsAny<string>()))\n+ .Returns(new Package { PackageStatusKey = PackageStatus.Deleted });\n+\n+ // Act\n+ var result = await _target.Revalidate(\n+ _package.PackageRegistration.Id,\n+ _package.Version);\n+\n+ // Assert\n+ Assert.IsType<HttpNotFoundResult>(result);\n+ }\n}\npublic class TheRevalidateSymbolsMethod : TestContainer\n{\nprivate Package _package;\n- private SymbolPackage _symbolPacakge;\n+ private SymbolPackage _symbolPackage;\nprivate readonly Mock<IPackageService> _packageService;\nprivate readonly Mock<IValidationService> _validationService;\nprivate readonly TestGalleryConfigurationService _configurationService;\n@@ -9238,12 +9297,12 @@ public TheRevalidateSymbolsMethod()\nPackageRegistration = new PackageRegistration { Id = \"NuGet.Versioning\" },\nVersion = \"3.4.0\",\n};\n- _symbolPacakge = new SymbolPackage\n+ _symbolPackage = new SymbolPackage\n{\nPackage = _package,\nStatusKey = PackageStatus.Available\n};\n- _package.SymbolPackages.Add(_symbolPacakge);\n+ _package.SymbolPackages.Add(_symbolPackage);\n_packageService = new Mock<IPackageService>();\n_packageService\n@@ -9272,7 +9331,7 @@ public async Task RevalidateIsCalledWithTheExistingSymbolsPackage()\n// Assert\n_validationService.Verify(\n- x => x.RevalidateAsync(_symbolPacakge),\n+ x => x.RevalidateAsync(_symbolPackage),\nTimes.Once);\n}\n@@ -9298,7 +9357,7 @@ public async Task RedirectsToCustomReturnUrl()\npublic async Task RedirectsAfterRevalidatingSymbolsPackageForAllValidStatus(PackageStatus status)\n{\n// Arrange & Act\n- _symbolPacakge.StatusKey = status;\n+ _symbolPackage.StatusKey = status;\nvar result = await _target.RevalidateSymbols(\n_package.PackageRegistration.Id,\n_package.Version);\n@@ -9329,13 +9388,33 @@ public async Task ReturnsNotFoundForUnknownPackage()\nResultAssert.IsStatusCode(result, HttpStatusCode.NotFound);\n}\n+ [Fact]\n+ public async Task ReturnsNotFoundForDeletedPackage()\n+ {\n+ // Arrange\n+ _packageService\n+ .Setup(svc => svc.FindPackageByIdAndVersionStrict(\n+ It.IsAny<string>(),\n+ It.IsAny<string>()))\n+ .Returns(new Package { PackageStatusKey = PackageStatus.Deleted });\n+\n+ // Act\n+ var result = await _target.RevalidateSymbols(\n+ _package.PackageRegistration.Id,\n+ _package.Version);\n+\n+ // Assert\n+ Assert.IsType<HttpStatusCodeResult>(result);\n+ ResultAssert.IsStatusCode(result, HttpStatusCode.NotFound);\n+ }\n+\n[Theory]\n[InlineData(PackageStatus.Deleted)]\n[InlineData(921)]\npublic async Task ReturnsBadRequestForInvalidSymbolPackageStatus(PackageStatus status)\n{\n// Arrange and Act\n- _symbolPacakge.StatusKey = status;\n+ _symbolPackage.StatusKey = status;\nvar result = await _target.RevalidateSymbols(\n_package.PackageRegistration.Id,\n_package.Version);\n@@ -9597,7 +9676,7 @@ public async Task ReturnsProperResponseModelWhenConversionFails()\npublic class TheGetReadMeMethod : TestContainer\n{\n[Fact]\n- public async Task ReturnsNotFoundIfPackageMissing()\n+ public async Task ReturnsNotFoundIfPackageIsMissing()\n{\n// Arrange\nvar packageService = new Mock<IPackageService>();\n@@ -9616,6 +9695,26 @@ public async Task ReturnsNotFoundIfPackageMissing()\nAssert.Equal((int)HttpStatusCode.NotFound, controller.Response.StatusCode);\n}\n+ [Fact]\n+ public async Task ReturnsNotFoundIfPackageIsDeleted()\n+ {\n+ // Arrange\n+ var packageService = new Mock<IPackageService>();\n+ packageService\n+ .Setup(x => x.FindPackageByIdAndVersionStrict(It.IsAny<string>(), It.IsAny<string>()))\n+ .Returns(new Package { PackageStatusKey = PackageStatus.Deleted });\n+\n+ var controller = CreateController(\n+ GetConfigurationService(),\n+ packageService: packageService);\n+\n+ // Act\n+ var result = await controller.GetReadMeMd(\"a\", \"1.9.2019\");\n+\n+ // Assert\n+ Assert.Equal((int)HttpStatusCode.NotFound, controller.Response.StatusCode);\n+ }\n+\npublic static IEnumerable<object[]> NotOwner_Data\n{\nget\n@@ -9784,7 +9883,37 @@ public async Task ReturnsForPackageWithReadMe(User currentUser, User owner)\n}\n}\n- public class LicenseMethod : TestContainer\n+ public class TheReflowMethod : TestContainer\n+ {\n+ private readonly Mock<IPackageService> _packageService;\n+ private string _packageId = \"packageId\";\n+ private string _packageVersion = \"1.0.0\";\n+\n+ public TheReflowMethod()\n+ {\n+ _packageService = new Mock<IPackageService>();\n+ }\n+\n+ [Fact]\n+ public async Task GivenDeletedPackageReturns404()\n+ {\n+ // arrange\n+ _packageService\n+ .Setup(p => p.FindPackageByIdAndVersionStrict(_packageId, _packageVersion))\n+ .Returns(new Package { PackageStatusKey = PackageStatus.Deleted });\n+ var controller = CreateController(\n+ GetConfigurationService(),\n+ packageService: _packageService);\n+\n+ // act\n+ var result = await controller.Reflow(_packageId, _packageVersion);\n+\n+ // assert\n+ Assert.IsType<HttpNotFoundResult>(result);\n+ }\n+ }\n+\n+ public class TheLicenseMethod : TestContainer\n{\nprivate readonly Mock<IPackageService> _packageService;\nprivate readonly Mock<IPackageFileService> _packageFileService;\n@@ -9792,7 +9921,7 @@ public class LicenseMethod : TestContainer\nprivate string _packageId = \"packageId\";\nprivate string _packageVersion = \"1.0.0\";\n- public LicenseMethod()\n+ public TheLicenseMethod()\n{\n_packageService = new Mock<IPackageService>();\n_packageFileService = new Mock<IPackageFileService>();\n@@ -9815,6 +9944,24 @@ public async Task GivenInvalidPackageReturns404()\nAssert.IsType<HttpNotFoundResult>(result);\n}\n+ [Fact]\n+ public async Task GivenDeletedPackageReturns404()\n+ {\n+ // arrange\n+ _packageService\n+ .Setup(p => p.FindPackageByIdAndVersionStrict(_packageId, _packageVersion))\n+ .Returns(new Package { PackageStatusKey = PackageStatus.Deleted });\n+ var controller = CreateController(\n+ GetConfigurationService(),\n+ packageService: _packageService);\n+\n+ // act\n+ var result = await controller.License(_packageId, _packageVersion);\n+\n+ // assert\n+ Assert.IsType<HttpNotFoundResult>(result);\n+ }\n+\n[Theory]\n[InlineData(\"MIT\")]\n[InlineData(\"some expression\")]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Check for deleted packages on several read and write operations (#8779)
Fix https://github.com/NuGet/NuGetGallery/issues/8778 |
455,766 | 08.09.2021 16:37:16 | 10,800 | 70410644e3c591c69d6c455f88d2534483f89ccb | Order vulnerabilities by severity
Addresses | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Helpers/ViewModelExtensions/DisplayPackageViewModelFactory.cs",
"new_path": "src/NuGetGallery/Helpers/ViewModelExtensions/DisplayPackageViewModelFactory.cs",
"diff": "@@ -206,7 +206,7 @@ public DisplayPackageViewModelFactory(IIconUrlProvider iconUrlProvider)\n&& packageKeyToVulnerabilities.TryGetValue(package.Key, out var vulnerabilities)\n&& vulnerabilities != null && vulnerabilities.Any())\n{\n- viewModel.Vulnerabilities = vulnerabilities;\n+ viewModel.Vulnerabilities = vulnerabilities.OrderByDescending(vul => vul.Severity).ToList().AsReadOnly();\nmaxVulnerabilitySeverity = viewModel.Vulnerabilities.Max(v => v.Severity); // cache for messaging\nviewModel.MaxVulnerabilitySeverity = maxVulnerabilitySeverity.Value;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"new_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"diff": "@@ -924,6 +924,38 @@ public void ReturnsExpectedUser(Package package, User currentUser, string expect\nAssert.Null(versionModel.CustomMessage);\n}\n+ [Fact]\n+ public void VulnerabilitiesDisplayedInOrder()\n+ {\n+ var package = CreateTestPackage(\"1.0.0\");\n+\n+ var packageKeyToVulnerabilities = new Dictionary<int, IReadOnlyList<PackageVulnerability>>\n+ {\n+ { package.Key, new List<PackageVulnerability>\n+ {\n+ new PackageVulnerability { Key = 1, Severity = PackageVulnerabilitySeverity.High },\n+ new PackageVulnerability { Key = 2, Severity = PackageVulnerabilitySeverity.Low },\n+ new PackageVulnerability { Key = 3, Severity = PackageVulnerabilitySeverity.Critical },\n+ }\n+ }\n+ };\n+\n+ // Act\n+ var model = CreateDisplayPackageViewModel(\n+ package,\n+ currentUser: null,\n+ packageKeyToVulnerabilities: packageKeyToVulnerabilities,\n+ readmeHtml: null);\n+\n+ // Assert\n+ var versionModel = model.PackageVersions.Single();\n+ Assert.Null(versionModel.CustomMessage);\n+ Assert.NotNull(model.Vulnerabilities);\n+ Assert.Equal(PackageVulnerabilitySeverity.Critical, model.Vulnerabilities.ElementAt(0).Severity);\n+ Assert.Equal(PackageVulnerabilitySeverity.High, model.Vulnerabilities.ElementAt(1).Severity);\n+ Assert.Equal(PackageVulnerabilitySeverity.Low, model.Vulnerabilities.ElementAt(2).Severity);\n+ }\n+\n[Theory]\n[InlineData(true)]\n[InlineData(false)]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Order vulnerabilities by severity (#8780)
Addresses #8703 |
455,744 | 14.09.2021 14:20:08 | 25,200 | bfad23470599cac87928e0e653a62dc3ef5c02e7 | Added admin enabled checks that were lost during merge back | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "</li>\n}\n- @if (Model.Available && User.IsAdministrator())\n+ @if (AdminHelper.IsAdminPanelEnabled && Model.Available && User.IsAdministrator())\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n</li>\n}\n- @if (!Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && !Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n}\n}\n- @if (User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Health\" aria-hidden=\"true\"></i>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackageV2.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackageV2.cshtml",
"diff": "</li>\n}\n- @if (Model.Available && User.IsAdministrator())\n+ @if (AdminHelper.IsAdminPanelEnabled && Model.Available && User.IsAdministrator())\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n</li>\n}\n- @if (!Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && !Model.Deleted && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Refresh\" aria-hidden=\"true\"></i>\n}\n}\n- @if (User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n+ @if (AdminHelper.IsAdminPanelEnabled && User.IsAdministrator() && Config.Current.AsynchronousPackageValidationEnabled)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Health\" aria-hidden=\"true\"></i>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Shared/Gallery/Header.cshtml",
"new_path": "src/NuGetGallery/Views/Shared/Gallery/Header.cshtml",
"diff": "{\n@DisplayNavigationItem(\"Statistics\", Url.Statistics())\n}\n- @if (Request.IsAuthenticated && User.IsInRole(CoreConstants.AdminRoleName))\n+ @if (Request.IsAuthenticated && AdminHelper.IsAdminPanelEnabled && User.IsInRole(CoreConstants.AdminRoleName))\n{\n@DisplayNavigationItem(\"Admin\", Url.Admin())\n}\n<span class=\"dropdown-email\">@CurrentUser.EmailAddress.Abbreviate(25)</span>\n</div>\n</li>\n- @if (Request.IsAuthenticated && User.IsInRole(CoreConstants.AdminRoleName))\n+ @if (Request.IsAuthenticated && AdminHelper.IsAdminPanelEnabled && User.IsInRole(CoreConstants.AdminRoleName))\n{\n<li class=\"divider\"></li>\n<li role=\"presentation\"><a href=\"@Url.Admin()\" role=\"menuitem\">Admin</a></li>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Added admin enabled checks that were lost during merge back |
455,744 | 14.09.2021 14:52:34 | 25,200 | 116db709a158a0982357582a36281863458336d1 | Immediately returning from AdminActionAttribute.OnAuthorization upon determining result. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Filters/AdminActionAttribute.cs",
"new_path": "src/NuGetGallery/Filters/AdminActionAttribute.cs",
"diff": "@@ -17,6 +17,7 @@ public override void OnAuthorization(AuthorizationContext filterContext)\nif (!AdminHelper.IsAdminPanelEnabled)\n{\nfilterContext.Result = new HttpStatusCodeResult(HttpStatusCode.Forbidden);\n+ return;\n}\nRoles = \"Admins\";\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Immediately returning from AdminActionAttribute.OnAuthorization upon determining result. |
455,744 | 14.09.2021 14:57:49 | 25,200 | 5c16da97bd01f5d9404fa75294b22d3b569947e6 | AdminAction attribute without parens. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/AccountsController.cs",
"new_path": "src/NuGetGallery/Controllers/AccountsController.cs",
"diff": "@@ -338,7 +338,7 @@ public virtual ActionResult DeleteRequest(string accountName = null)\n}\n[HttpGet]\n- [AdminAction()]\n+ [AdminAction]\npublic virtual ActionResult Delete(string accountName)\n{\nvar accountToDelete = UserService.FindByUsername(accountName) as TUser;\n@@ -351,7 +351,7 @@ public virtual ActionResult Delete(string accountName)\n}\n[HttpDelete]\n- [AdminAction()]\n+ [AdminAction]\n[RequiresAccountConfirmation(\"Delete account\")]\n[ValidateAntiForgeryToken]\npublic virtual async Task<ActionResult> Delete(DeleteAccountAsAdminViewModel model)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"new_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"diff": "@@ -1872,7 +1872,7 @@ public virtual ActionResult DeleteSymbols(string id, string version)\n[HttpPost]\n[ValidateAntiForgeryToken]\n- [AdminAction()]\n+ [AdminAction]\n[RequiresAccountConfirmation(\"reflow a package\")]\npublic virtual async Task<ActionResult> Reflow(string id, string version)\n{\n@@ -1909,7 +1909,7 @@ public virtual async Task<ActionResult> Reflow(string id, string version)\n[HttpPost]\n[ValidateAntiForgeryToken]\n- [AdminAction()]\n+ [AdminAction]\n[RequiresAccountConfirmation(\"revalidate a package\")]\npublic virtual async Task<ActionResult> Revalidate(string id, string version, string returnUrl = null)\n{\n@@ -1945,7 +1945,7 @@ public virtual async Task<ActionResult> Revalidate(string id, string version, st\n[HttpPost]\n[ValidateAntiForgeryToken]\n- [AdminAction()]\n+ [AdminAction]\n[RequiresAccountConfirmation(\"revalidate a symbols package\")]\npublic virtual async Task<ActionResult> RevalidateSymbols(string id, string version, string returnUrl = null)\n{\n@@ -2017,7 +2017,7 @@ public virtual ActionResult Delete(string id, string version)\nreturn RedirectToActionPermanent(nameof(Manage));\n}\n- [AdminAction()]\n+ [AdminAction]\n[HttpPost]\n[RequiresAccountConfirmation(\"delete a package\")]\n[ValidateAntiForgeryToken]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | AdminAction attribute without parens. |
455,744 | 14.09.2021 15:10:27 | 25,200 | d00117ebb27dd94f7448ef63869626df0e95b9cc | Clarified RegisterUIRoutes calls | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Helpers/ObfuscationHelperFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Helpers/ObfuscationHelperFacts.cs",
"diff": "@@ -22,7 +22,7 @@ public TheObfuscateCurrentRequestUrlFacts()\n{\n_currentRoutes = new RouteCollection();\nRoutes.RegisterApiV2Routes(_currentRoutes);\n- Routes.RegisterUIRoutes(_currentRoutes, true);\n+ Routes.RegisterUIRoutes(_currentRoutes, adminPanelEnabled: true);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Telemetry/ClientTelemetryPIIProcessorTests.cs",
"new_path": "tests/NuGetGallery.Facts/Telemetry/ClientTelemetryPIIProcessorTests.cs",
"diff": "@@ -24,7 +24,7 @@ public ClientTelemetryPIIProcessorTests()\n{\n_currentRoutes = new RouteCollection();\nRoutes.RegisterApiV2Routes(_currentRoutes);\n- Routes.RegisterUIRoutes(_currentRoutes, true);\n+ Routes.RegisterUIRoutes(_currentRoutes, adminPanelEnabled: true);\n}\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Clarified RegisterUIRoutes calls |
455,744 | 14.09.2021 16:42:59 | 25,200 | 77229744d9ee356cfce0f6e71aade3909f8d12b8 | Putting back admin read-only features. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Users/Profiles.cshtml",
"new_path": "src/NuGetGallery/Views/Users/Profiles.cshtml",
"diff": "<div class=\"description\">Total @(Model.TotalPackageDownloadCount == 1 ? \"download\" : \"downloads\") of packages</div>\n</div>\n</div>\n- @if (AdminHelper.IsAdminPanelEnabled && User.IsAdministrator())\n+ @if (User.IsAdministrator())\n{\n<div class=\"additional-info\">\n<dl>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Putting back admin read-only features. |
455,754 | 17.09.2021 07:21:00 | -36,000 | 03ea2cc05f38860097e95f8e9a20f7b37fd5cdee | Make pva cache case insensitive to support all package details urls | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Services/PackageVulnerabilitiesCacheService.cs",
"new_path": "src/NuGetGallery/Services/PackageVulnerabilitiesCacheService.cs",
"diff": "@@ -86,7 +86,9 @@ public void RefreshCache(IServiceScopeFactory serviceScopeFactory)\nikv.GroupBy(kv => kv.PackageKey, kv => kv.Vulnerability)\n// - build the inner dictionaries, all under the same <id>, each keyed by <package key>\n.ToDictionary(kv => kv.Key,\n- kv => kv.ToList().AsReadOnly() as IReadOnlyList<PackageVulnerability>));\n+ kv => kv.ToList().AsReadOnly() as IReadOnlyList<PackageVulnerability>),\n+ // we need this lookup to be case insensitive for package details page load URLs to work regardless of case\n+ StringComparer.InvariantCultureIgnoreCase);\n}\nstopwatch.Stop();\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Make pva cache case insensitive to support all package details urls (#8793) |
455,741 | 17.09.2021 14:43:35 | 25,200 | ce803dc957171e39dc03d377a13e8f69b34c99fd | add domain app.fossa.com & cdn.syncfusion.com | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Data/Files/Content/Trusted-Image-Domains.json",
"new_path": "src/NuGetGallery/App_Data/Files/Content/Trusted-Image-Domains.json",
"diff": "\"api.travis-ci.com\",\n\"api.travis-ci.org\",\n\"app.fossa.io\",\n+ \"app.fossa.com\",\n\"badge.fury.io\",\n\"badgen.net\",\n\"badges.gitter.im\",\n\"bettercodehub.com\",\n\"buildstats.info\",\n\"cdn.jsdelivr.net\",\n+ \"cdn.syncfusion.com\",\n\"ci.appveyor.com\",\n\"circleci.com\",\n\"codecov.io\",\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | add domain app.fossa.com & cdn.syncfusion.com (#8805) |
455,744 | 17.09.2021 19:38:07 | 25,200 | 4e62f823b65ed27cda3645b19b60c51367f80101 | Configurable admin actions. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Permissions/ActionsRequiringPermissions.cs",
"new_path": "src/NuGetGallery.Services/Permissions/ActionsRequiringPermissions.cs",
"diff": "@@ -8,22 +8,27 @@ namespace NuGetGallery\n/// </summary>\npublic static class ActionsRequiringPermissions\n{\n- private const PermissionsRequirement RequireOwnerOrSiteAdmin =\n- PermissionsRequirement.Owner | PermissionsRequirement.SiteAdmin;\n- private const PermissionsRequirement RequireOwnerOrSiteAdminOrOrganizationAdmin =\n- PermissionsRequirement.Owner | PermissionsRequirement.SiteAdmin | PermissionsRequirement.OrganizationAdmin;\n- private const PermissionsRequirement RequireOwnerOrOrganizationAdmin =\n+ public static bool AdminAccessEnabled { get; set; } = true;\n+\n+ private static PermissionsRequirement AdminRequirement =>\n+ AdminAccessEnabled ? PermissionsRequirement.SiteAdmin : PermissionsRequirement.Unsatisfiable;\n+\n+ private static PermissionsRequirement RequireOwnerOrSiteAdmin =>\n+ PermissionsRequirement.Owner | AdminRequirement;\n+ private static PermissionsRequirement RequireOwnerOrSiteAdminOrOrganizationAdmin =>\n+ PermissionsRequirement.Owner | AdminRequirement | PermissionsRequirement.OrganizationAdmin;\n+ private static PermissionsRequirement RequireOwnerOrOrganizationAdmin =>\nPermissionsRequirement.Owner | PermissionsRequirement.OrganizationAdmin;\n- private const PermissionsRequirement RequireOwnerOrOrganizationMember =\n+ private static PermissionsRequirement RequireOwnerOrOrganizationMember =>\nPermissionsRequirement.Owner | PermissionsRequirement.OrganizationAdmin | PermissionsRequirement.OrganizationCollaborator;\n- private const PermissionsRequirement RequireOwnerOrSiteAdminOrOrganizationMember =\n- PermissionsRequirement.Owner | PermissionsRequirement.SiteAdmin | PermissionsRequirement.OrganizationAdmin | PermissionsRequirement.OrganizationCollaborator;\n+ private static PermissionsRequirement RequireOwnerOrSiteAdminOrOrganizationMember =>\n+ PermissionsRequirement.Owner | AdminRequirement | PermissionsRequirement.OrganizationAdmin | PermissionsRequirement.OrganizationCollaborator;\n/// <summary>\n/// The action of seeing private metadata about a package.\n/// For example, if a package is validating, only users who can perform this action can see the metadata of the package.\n/// </summary>\n- public static ActionRequiringPackagePermissions DisplayPrivatePackageMetadata =\n+ public static ActionRequiringPackagePermissions DisplayPrivatePackageMetadata =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: RequireOwnerOrSiteAdmin);\n@@ -31,7 +36,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of uploading a new package ID.\n/// </summary>\n- public static ActionRequiringReservedNamespacePermissions UploadNewPackageId =\n+ public static ActionRequiringReservedNamespacePermissions UploadNewPackageId =>\nnew ActionRequiringReservedNamespacePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\nreservedNamespacePermissionsRequirement: PermissionsRequirement.Owner);\n@@ -39,7 +44,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of uploading a new version of an existing package ID.\n/// </summary>\n- public static ActionRequiringPackagePermissions UploadNewPackageVersion =\n+ public static ActionRequiringPackagePermissions UploadNewPackageVersion =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: PermissionsRequirement.Owner);\n@@ -47,7 +52,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of uploading a symbols package for an existing package.\n/// </summary>\n- public static ActionRequiringPackagePermissions UploadSymbolPackage =\n+ public static ActionRequiringPackagePermissions UploadSymbolPackage =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: PermissionsRequirement.Owner);\n@@ -55,7 +60,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of deleting a symbols package for an existing package.\n/// </summary>\n- public static ActionRequiringPackagePermissions DeleteSymbolPackage =\n+ public static ActionRequiringPackagePermissions DeleteSymbolPackage =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: RequireOwnerOrSiteAdmin);\n@@ -63,7 +68,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of verify a package verification key.\n/// </summary>\n- public static ActionRequiringPackagePermissions VerifyPackage =\n+ public static ActionRequiringPackagePermissions VerifyPackage =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: PermissionsRequirement.Owner);\n@@ -71,7 +76,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of editing an existing version of an existing package ID.\n/// </summary>\n- public static ActionRequiringPackagePermissions EditPackage =\n+ public static ActionRequiringPackagePermissions EditPackage =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: RequireOwnerOrSiteAdmin);\n@@ -79,7 +84,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of unlisting or relisting an existing version of an existing package ID.\n/// </summary>\n- public static ActionRequiringPackagePermissions UnlistOrRelistPackage =\n+ public static ActionRequiringPackagePermissions UnlistOrRelistPackage =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: RequireOwnerOrSiteAdmin);\n@@ -87,7 +92,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of deprecating an existing version of an existing package ID.\n/// </summary>\n- public static ActionRequiringPackagePermissions DeprecatePackage =\n+ public static ActionRequiringPackagePermissions DeprecatePackage =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: RequireOwnerOrSiteAdmin);\n@@ -95,7 +100,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of managing the ownership of an existing package ID.\n/// </summary>\n- public static ActionRequiringPackagePermissions ManagePackageOwnership =\n+ public static ActionRequiringPackagePermissions ManagePackageOwnership =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationAdmin,\npackageRegistrationPermissionsRequirement: RequireOwnerOrSiteAdmin);\n@@ -103,7 +108,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of reporting an existing package ID as the owner of the package.\n/// </summary>\n- public static ActionRequiringPackagePermissions ReportPackageAsOwner =\n+ public static ActionRequiringPackagePermissions ReportPackageAsOwner =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: PermissionsRequirement.Owner);\n@@ -111,7 +116,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of seeing a breadcrumb linking the user back to their profile when performing actions on a package.\n/// </summary>\n- public static ActionRequiringPackagePermissions ShowProfileBreadcrumb =\n+ public static ActionRequiringPackagePermissions ShowProfileBreadcrumb =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationMember,\npackageRegistrationPermissionsRequirement: PermissionsRequirement.Owner);\n@@ -119,14 +124,14 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of handling package ownership requests for a user to become an owner of a package.\n/// </summary>\n- public static ActionRequiringAccountPermissions HandlePackageOwnershipRequest =\n+ public static ActionRequiringAccountPermissions HandlePackageOwnershipRequest =>\nnew ActionRequiringAccountPermissions(\naccountPermissionsRequirement: RequireOwnerOrOrganizationAdmin);\n/// <summary>\n/// The action of viewing (read-only) a user or organization account.\n/// </summary>\n- public static ActionRequiringAccountPermissions ViewAccount =\n+ public static ActionRequiringAccountPermissions ViewAccount =>\nnew ActionRequiringAccountPermissions(\naccountPermissionsRequirement: RequireOwnerOrSiteAdminOrOrganizationMember);\n@@ -134,21 +139,21 @@ public static class ActionsRequiringPermissions\n/// The action of managing a user or organization account. This includes confirming an account,\n/// changing the email address, changing email subscriptions, modifying sign-in credentials, etc.\n/// </summary>\n- public static ActionRequiringAccountPermissions ManageAccount =\n+ public static ActionRequiringAccountPermissions ManageAccount =>\nnew ActionRequiringAccountPermissions(\naccountPermissionsRequirement: RequireOwnerOrOrganizationAdmin);\n/// <summary>\n/// The action of managing an organization's memberships.\n/// </summary>\n- public static ActionRequiringAccountPermissions ManageMembership =\n+ public static ActionRequiringAccountPermissions ManageMembership =>\nnew ActionRequiringAccountPermissions(\naccountPermissionsRequirement: RequireOwnerOrSiteAdminOrOrganizationAdmin);\n/// <summary>\n/// The action of changing a package's required signer.\n/// </summary>\n- public static ActionRequiringPackagePermissions ManagePackageRequiredSigner =\n+ public static ActionRequiringPackagePermissions ManagePackageRequiredSigner =>\nnew ActionRequiringPackagePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrOrganizationAdmin,\npackageRegistrationPermissionsRequirement: RequireOwnerOrOrganizationAdmin);\n@@ -156,7 +161,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of adding a package to a reserved namespace that the package is in.\n/// </summary>\n- public static ActionRequiringReservedNamespacePermissions AddPackageToReservedNamespace =\n+ public static ActionRequiringReservedNamespacePermissions AddPackageToReservedNamespace =>\nnew ActionRequiringReservedNamespacePermissions(\naccountOnBehalfOfPermissionsRequirement: PermissionsRequirement.Owner,\nreservedNamespacePermissionsRequirement: PermissionsRequirement.Owner);\n@@ -164,7 +169,7 @@ public static class ActionsRequiringPermissions\n/// <summary>\n/// The action of removing a package from a reserved namespace that the package is in.\n/// </summary>\n- public static ActionRequiringReservedNamespacePermissions RemovePackageFromReservedNamespace =\n+ public static ActionRequiringReservedNamespacePermissions RemovePackageFromReservedNamespace =>\nnew ActionRequiringReservedNamespacePermissions(\naccountOnBehalfOfPermissionsRequirement: RequireOwnerOrSiteAdminOrOrganizationAdmin,\nreservedNamespacePermissionsRequirement: RequireOwnerOrOrganizationAdmin);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/DefaultDependenciesModule.cs",
"new_path": "src/NuGetGallery/App_Start/DefaultDependenciesModule.cs",
"diff": "@@ -110,6 +110,8 @@ protected override void Load(ContainerBuilder builder)\nloggerConfiguration,\ntelemetryConfiguration: applicationInsightsConfiguration.TelemetryConfiguration);\n+ ActionsRequiringPermissions.AdminAccessEnabled = configuration.Current.AdminPanelEnabled;\n+\nbuilder.RegisterInstance(applicationInsightsConfiguration.TelemetryConfiguration)\n.AsSelf()\n.SingleInstance();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj",
"new_path": "tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj",
"diff": "<Compile Include=\"Helpers\\StreamHelperFacts.cs\" />\n<Compile Include=\"Infrastructure\\Mail\\Messages\\SearchSideBySideMessageFacts.cs\" />\n<Compile Include=\"Infrastructure\\SearchServiceFactoryFacts.cs\" />\n+ <Compile Include=\"Services\\ActionsRequiringPermissionsAdminFacts.cs\" />\n<Compile Include=\"Services\\ImageDomainValidatorFacts.cs\" />\n<Compile Include=\"Services\\MarkdownServiceFacts.cs\" />\n<Compile Include=\"Services\\PackageVulnerabilitiesCacheServiceFacts.cs\" />\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Configurable admin actions. |
455,744 | 21.09.2021 18:46:40 | 25,200 | 89fc141e9e763fb346ea95798946880a87bad41b | Switching httpRuntime to 4.7.2 | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Web.config",
"new_path": "src/NuGetGallery/Web.config",
"diff": "<add tagPrefix=\"ef\" assembly=\"Microsoft.AspNet.EntityDataSource\" namespace=\"Microsoft.AspNet.EntityDataSource\"/>\n</controls>\n</pages>\n- <httpRuntime targetFramework=\"4.5\" maxQueryStringLength=\"12000\" maxRequestLength=\"256000\" requestPathInvalidCharacters=\"<,>,*,%,:,\\,?\" relaxedUrlToFileSystemMapping=\"true\" enableVersionHeader=\"false\"/>\n+ <httpRuntime targetFramework=\"4.7.2\" maxQueryStringLength=\"12000\" maxRequestLength=\"256000\" requestPathInvalidCharacters=\"<,>,*,%,:,\\,?\" relaxedUrlToFileSystemMapping=\"true\" enableVersionHeader=\"false\"/>\n<httpModules>\n<add name=\"ErrorFilter\" type=\"Elmah.ErrorFilterModule, Elmah, Version=1.2.14706.0, Culture=neutral, PublicKeyToken=57eac04b2e0f138e, processorArchitecture=MSIL\"/>\n<add name=\"ErrorLog\" type=\"Elmah.ErrorLogModule, Elmah, Version=1.2.14706.0, Culture=neutral, PublicKeyToken=57eac04b2e0f138e, processorArchitecture=MSIL\"/>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Switching httpRuntime to 4.7.2 (#8810) |
455,756 | 27.09.2021 10:37:14 | 25,200 | 7045ad65133a2c8999df53d0f80f2675069208f6 | Update HSTS header | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Web.config",
"new_path": "src/NuGetGallery/Web.config",
"diff": "<add name=\"X-Frame-Options\" value=\"deny\"/>\n<add name=\"X-XSS-Protection\" value=\"1; mode=block\"/>\n<add name=\"X-Content-Type-Options\" value=\"nosniff\"/>\n- <add name=\"Strict-Transport-Security\" value=\"max-age=31536000\"/>\n+ <add name=\"Strict-Transport-Security\" value=\"max-age=31536000; includeSubDomains\"/>\n</customHeaders>\n</httpProtocol>\n<handlers>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update HSTS header (#8824) |
455,754 | 30.09.2021 12:29:10 | -36,000 | c63bb491d60af4760cc97404d2c1324e91b46eb3 | Streamline report package page and add vulnerability text | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Models/ReportPackageReason.cs",
"new_path": "src/NuGetGallery.Services/Models/ReportPackageReason.cs",
"diff": "@@ -10,19 +10,22 @@ public enum ReportPackageReason\n[Description(\"Other\")]\nOther,\n- [Description(\"The package has a bug/failed to install\")]\n+ [Description(\"A bug/failed to install\")]\nHasABugOrFailedToInstall,\n- [Description(\"The package contains malicious code\")]\n+ [Description(\"Malicious code\")]\nContainsMaliciousCode,\n- [Description(\"The package is infringing my copyright or trademark\")]\n+ [Description(\"A security vulnerability\")]\n+ ContainsSecurityVulnerability,\n+\n+ [Description(\"Content infringing my copyright or trademark\")]\nViolatesALicenseIOwn,\n- [Description(\"The package contains private/confidential data\")]\n+ [Description(\"Private/confidential data\")]\nContainsPrivateAndConfidentialData,\n- [Description(\"The package was not intended to be published publicly on nuget.org\")]\n+ [Description(\"Content not intended to be published publicly on nuget.org\")]\nReleasedInPublicByAccident,\n[Description(\"Child sexual exploitation or abuse\")]\n@@ -31,13 +34,13 @@ public enum ReportPackageReason\n[Description(\"Terrorism or violent extremism\")]\nTerrorismOrViolentExtremism,\n- [Description(\"The package contains hate speech\")]\n+ [Description(\"Hate speech\")]\nHateSpeech,\n- [Description(\"The package contains content related to imminent harm\")]\n+ [Description(\"Content related to imminent harm\")]\nImminentHarm,\n- [Description(\"The package contains non-consensual intimate imagery (i.e. \\\"revenge porn\\\")\")]\n+ [Description(\"Non-consensual intimate imagery (i.e. \\\"revenge porn\\\")\")]\nRevengePorn,\n[Description(\"Other nudity or pornography (not \\\"revenge porn\\\")\")]\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"new_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"diff": "@@ -63,6 +63,7 @@ public partial class PackagesController\n{\nReportPackageReason.ViolatesALicenseIOwn,\nReportPackageReason.ContainsMaliciousCode,\n+ ReportPackageReason.ContainsSecurityVulnerability,\nReportPackageReason.HasABugOrFailedToInstall,\nReportPackageReason.Other\n};\n@@ -71,6 +72,7 @@ public partial class PackagesController\n{\nReportPackageReason.ViolatesALicenseIOwn,\nReportPackageReason.ContainsMaliciousCode,\n+ ReportPackageReason.ContainsSecurityVulnerability,\nReportPackageReason.HasABugOrFailedToInstall,\nReportPackageReason.ChildSexualExploitationOrAbuse,\nReportPackageReason.TerrorismOrViolentExtremism,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/ReportViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/ReportViewModel.cs",
"diff": "@@ -13,9 +13,8 @@ public abstract class ReportViewModel : IPackageVersionModel\npublic string PackageVersion { get; set; }\n- [NotEqual(ReportPackageReason.HasABugOrFailedToInstall, ErrorMessage = \"Unfortunately we cannot provide support for bugs in NuGet Packages. Please contact owner(s) for assistance.\")]\n- [Required(ErrorMessage = \"You must select a reason for reporting the package.\")]\n[Display(Name = \"Reason\")]\n+ [Required(ErrorMessage = \"You must select a reason for reporting the package.\")]\npublic ReportPackageReason? Reason { get; set; }\n[Display(Name = \"Send me a copy\")]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Streamline report package page and add vulnerability text (#8831) |
455,754 | 15.10.2021 14:47:31 | -36,000 | 78357e135a1acaa92ce456caef86ed12b3dd5f53 | Add recaptcha to the forgot password page | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/UsersController.cs",
"new_path": "src/NuGetGallery/Controllers/UsersController.cs",
"diff": "@@ -624,6 +624,7 @@ public virtual ActionResult ForgotPassword()\n[HttpPost]\n[ValidateAntiForgeryToken]\n+ [ValidateRecaptchaResponse]\npublic virtual async Task<ActionResult> ForgotPassword(ForgotPasswordViewModel model)\n{\n// We don't want Login to have us as a return URL\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Users/ForgotPassword.cshtml",
"new_path": "src/NuGetGallery/Views/Users/ForgotPassword.cshtml",
"diff": "@Html.ShowValidationMessagesForEmpty()\n</div>\n<div class=\"form-group\">\n- <input type=\"submit\" class=\"btn btn-primary form-control\" value=\"Send\" />\n+ <input id=\"Submit\" type=\"submit\" class=\"btn btn-primary form-control\" value=\"Send\" />\n</div>\n}\n</div>\n</div>\n</div>\n</section>\n+\n+@section BottomScripts {\n+ @ViewHelpers.RecaptchaScripts(Config.Current.ReCaptchaPublicKey, \"Submit\")\n+}\n\\ No newline at end of file\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add recaptcha to the forgot password page (#8849) |
455,744 | 26.10.2021 19:00:29 | 25,200 | c63f62cb9fb2c83e5e2143518cab522084c63d8b | More readable test data | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Services/ActionsRequiringPermissionsAdminFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Services/ActionsRequiringPermissionsAdminFacts.cs",
"diff": "@@ -15,20 +15,20 @@ public class ActionsRequiringPermissionsAdminFacts\n{\nprivate int _key = 0;\n- public static IEnumerable<object[]> PackageActions = new object[][]\n+ public static IEnumerable<Func<ActionRequiringPackagePermissions>> PackageActions = new Func<ActionRequiringPackagePermissions>[]\n{\n- new object[] { (Func<ActionRequiringPackagePermissions>)(() => ActionsRequiringPermissions.DisplayPrivatePackageMetadata) },\n- new object[] { (Func<ActionRequiringPackagePermissions>)(() => ActionsRequiringPermissions.DeleteSymbolPackage) },\n- new object[] { (Func<ActionRequiringPackagePermissions>)(() => ActionsRequiringPermissions.EditPackage) },\n- new object[] { (Func<ActionRequiringPackagePermissions>)(() => ActionsRequiringPermissions.UnlistOrRelistPackage) },\n- new object[] { (Func<ActionRequiringPackagePermissions>)(() => ActionsRequiringPermissions.DeprecatePackage) },\n- new object[] { (Func<ActionRequiringPackagePermissions>)(() => ActionsRequiringPermissions.ManagePackageOwnership) },\n+ () => ActionsRequiringPermissions.DisplayPrivatePackageMetadata,\n+ () => ActionsRequiringPermissions.DeleteSymbolPackage,\n+ () => ActionsRequiringPermissions.EditPackage,\n+ () => ActionsRequiringPermissions.UnlistOrRelistPackage,\n+ () => ActionsRequiringPermissions.DeprecatePackage,\n+ () => ActionsRequiringPermissions.ManagePackageOwnership,\n};\npublic static IEnumerable<object[]> PackageActionsWithAdmin =>\nfrom actionProvider in PackageActions\nfrom isAdmin in new[] { false, true }\n- select new object[] { actionProvider[0], isAdmin };\n+ select new object[] { actionProvider, isAdmin };\n[Theory]\n[MemberData(nameof(PackageActionsWithAdmin))]\n@@ -52,16 +52,16 @@ public class ActionsRequiringPermissionsAdminFacts\nAssert.Equal(isAdmin, PermissionsCheckResult.Allowed == result);\n}\n- public static IEnumerable<object[]> AccountActions = new object[][]\n+ public static IEnumerable<Func<ActionRequiringAccountPermissions>> AccountActions = new Func<ActionRequiringAccountPermissions>[]\n{\n- new object[]{ (Func<ActionRequiringAccountPermissions>)(() => ActionsRequiringPermissions.ViewAccount) },\n- new object[]{ (Func<ActionRequiringAccountPermissions>)(() => ActionsRequiringPermissions.ManageMembership) },\n+ () => ActionsRequiringPermissions.ViewAccount,\n+ () => ActionsRequiringPermissions.ManageMembership,\n};\npublic static IEnumerable<object[]> AccountActionsWithAdmin =>\nfrom actionProvider in AccountActions\nfrom isAdmin in new[] { false, true }\n- select new object[] { actionProvider[0], isAdmin };\n+ select new object[] { actionProvider, isAdmin };\n[Theory]\n[MemberData(nameof(AccountActionsWithAdmin))]\n@@ -81,15 +81,15 @@ public class ActionsRequiringPermissionsAdminFacts\nAssert.Equal(isAdmin, PermissionsCheckResult.Allowed == result);\n}\n- public static IEnumerable<object[]> ReservedNamespaceAction = new object[][]\n+ public static IEnumerable<Func<ActionRequiringReservedNamespacePermissions>> ReservedNamespaceAction = new Func<ActionRequiringReservedNamespacePermissions>[]\n{\n- new object[]{ (Func<ActionRequiringReservedNamespacePermissions>)(() => ActionsRequiringPermissions.RemovePackageFromReservedNamespace) },\n+ () => ActionsRequiringPermissions.RemovePackageFromReservedNamespace,\n};\npublic static IEnumerable<object[]> ReservedNamespaceActionWithAdmin =>\nfrom actionProvider in ReservedNamespaceAction\nfrom isAdmin in new[] { false, true }\n- select new object[] { actionProvider[0], isAdmin };\n+ select new object[] { actionProvider, isAdmin };\n[Theory]\n[MemberData(nameof(ReservedNamespaceActionWithAdmin))]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | More readable test data |
455,754 | 27.10.2021 12:01:56 | -36,000 | 26f9d1bd800829ada58551dca6debcf686f27fa8 | Add link to form for revenge porn reporting, remove fields | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Data/Files/Content/flags.json",
"new_path": "src/NuGetGallery/App_Data/Files/Content/flags.json",
"diff": "\"NuGetGallery.PatternSetTfmHeuristics\": \"Enabled\",\n\"NuGetGallery.EmbeddedIcons\": \"Enabled\",\n\"NuGetGallery.MarkdigMdRendering\": \"Enabled\",\n- \"NuGetGallery.ImageAllowlist\": \"Enabled\"\n+ \"NuGetGallery.ImageAllowlist\": \"Enabled\",\n+ \"NuGetGallery.ShowReportAbuseSafetyChanges\": \"Enabled\"\n},\n\"Flights\": {\n\"NuGetGallery.TyposquattingFlight\": {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"diff": "If this is not a Microsoft - owned package, consider also <a href=\"@Url.ContactOwners(Model)\" title=\"contact the owners\">contacting the owners</a>.\n</p>\n</div>\n+ <div class=\"reason-error-revenge-porn\" tabindex=\"0\">\n+ <p>\n+ Please report this safety violation through the <a href=\"https://www.microsoft.com/en-us/concern/revengeporn\" title=\"revenge porn portal\">official portal</a>.\n+ </p>\n+ </div>\n<div id=\"report-abuse-form\">\n<div class=\"form-group @Html.HasErrorFor(m => m.Email)\">\[email protected](m => m.Email)\n// For error conditions, hide the other form fields and show error messages\nif (val === 'HasABugOrFailedToInstall'\n- || val === 'ContainsSecurityVulnerability') {\n+ || val === 'ContainsSecurityVulnerability'\n+ || val === 'RevengePorn') {\n$('#report-abuse-form').hide();\n} else {\n$('#report-abuse-form').show();\n$form.find('.reason-error-security-vulnerability').hide();\n}\n+ if (val === 'RevengePorn') {\n+ $form.find('.reason-error-revenge-porn').show();\n+ } else {\n+ $form.find('.reason-error-revenge-porn').hide();\n+ }\n+\n// We don't suggest the customer contact the owner in the case of safety violations\nif (val === 'ChildSexualExploitationOrAbuse'\n|| val === 'TerrorismOrViolentExtremism'\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add link to form for revenge porn reporting, remove fields (#8857) |
455,744 | 15.11.2021 14:32:52 | 28,800 | 0be284ebfaa8fc4f7d01b02fcf65b3f3361718da | Registering admin panel routes when admin panel is not disabled. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/AppActivator.cs",
"new_path": "src/NuGetGallery/App_Start/AppActivator.cs",
"diff": "@@ -248,7 +248,7 @@ private static void AppPostStart(IAppConfiguration configuration)\n// Log unhandled exceptions\nGlobalConfiguration.Configuration.Services.Add(typeof(IExceptionLogger), new QuietExceptionLogger());\n- Routes.RegisterRoutes(RouteTable.Routes, configuration.FeedOnlyMode);\n+ Routes.RegisterRoutes(RouteTable.Routes, configuration.FeedOnlyMode, configuration.AdminPanelEnabled);\nAreaRegistration.RegisterAllAreas();\nGlobalFilters.Filters.Add(new SendErrorsToTelemetryAttribute { View = \"~/Views/Errors/InternalError.cshtml\" });\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Registering admin panel routes when admin panel is not disabled. (#8880) |
455,754 | 06.12.2021 15:04:32 | -36,000 | fbdd379552b7112854e4d3a7d99795a6a1937606 | Additional online safety instructions | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"diff": "<p tabindex=\"0\">\nPlease provide a detailed description of the problem.\n<p>\n+ <div class=\"online-safety-extras\" tabindex=\"0\">\n+ <p>\n+ Please also describe where in the package the problem was found. Be sure to include:\n+ <ul>\n+ <li>Whether the problem is in graphics, video, readme, scripts, libraries, nuspec, other metadata, other file(s)</li>\n+ <li>The exact names of the offending file(s)</li>\n+ </ul>\n+ </p>\n+ </div>\n<div class=\"infringement-claim-requirements\" tabindex=\"0\">\n<p>\nIf you are reporting copyright infringement, please describe the copyrighted material with particularity and provide us with information about your copyright (i.e. title of copyrighted work, URL where to view your copyrighted work, description of your copyrighted work, and any copyright registrations you may have, etc.). For trademark infringement, include the name of your trademark, registration number, and country where registered.\n|| val === 'RevengePorn'\n|| val === 'OtherNudityOrPornography') {\n$form.find('.already-contacted-owner').hide();\n+ $form.find('.online-safety-extras').show();\n} else {\n$form.find('.already-contacted-owner').show();\n+ $form.find('.online-safety-extras').hide();\n}\nif (val === 'ChildSexualExploitationOrAbuse') {\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Additional online safety instructions (#8902) |
455,754 | 07.12.2021 14:57:58 | -36,000 | af38edce56418a2e3995066d788a472c8c041ef3 | Make checkmarks and bangs accessible in package details page | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Scripts/gallery/page-display-package-v2.js",
"new_path": "src/NuGetGallery/Scripts/gallery/page-display-package-v2.js",
"diff": "}\n});\n}\n+\n+ $(\".reserved-indicator\").each(window.nuget.setPopovers);\n+ $(\".package-warning-icon\").each(window.nuget.setPopovers);\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackageV2.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackageV2.cshtml",
"diff": "src=\"@(PackageHelper.ShouldRenderUrl(Model.IconUrl) ? Model.IconUrl : Url.Absolute(\"~/Content/gallery/img/default-package-icon.svg\"))\"\[email protected](Url.Absolute(\"~/Content/gallery/img/default-package-icon-256x256.png\")) />\n</span>\n- <span class=\"title\">\n+ <span class=\"title\" tabindex=\"0\">\[email protected](Model.Id)\n</span>\n- <span class=\"version-title\">\n+ <span class=\"version-title\" tabindex=\"0\">\[email protected]\n</span>\n@if (Model.IsVerified.HasValue && Model.IsVerified.Value)\n<img class=\"reserved-indicator\"\nsrc=\"~/Content/gallery/img/reserved-indicator.svg\"\[email protected](Url.Absolute(\"~/Content/gallery/img/reserved-indicator-25x25.png\"))\n- title=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" />\n+ data-content=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" tabindex=\"0\"\n+ alt=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\"/>\n<a href=\"https://docs.microsoft.com/en-us/nuget/nuget-org/id-prefix-reservation\" class=\"prefix-reserve-label\">\nPrefix Reserved\n</a>\n|| (!packageVersion.Deleted && Model.CanDisplayPrivateMetadata))\n{\n<tr class=\"@(packageVersion.IsCurrent(Model) ? \"bg-info\" : null)\">\n- <td tabindex=\"0\">\n+ <td>\n<a href=\"@Url.Package(packageVersion)\" title=\"@packageVersion.Version\">\[email protected](30)\n</a>\n}\nelse\n{\n- <td tabindex=\"0\" class=\"package-icon-cell\">\n- <i class=\"ms-Icon ms-Icon--Warning package-icon\" title=\"@packageVersion.PackageWarningIconTitle\"></i>\n+ <td class=\"package-icon-cell\">\n+ <span class=\"package-warning-icon\" aria-label=\"@packageVersion.PackageWarningIconTitle\"\n+ data-content=\"@packageVersion.PackageWarningIconTitle\" tabindex=\"0\">\n+ <i class=\"ms-Icon ms-Icon--Warning package-icon\"></i>\n+ </span>\n</td>\n}\n</tr>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Make checkmarks and bangs accessible in package details page (#8901) |
455,754 | 04.01.2022 15:23:02 | -36,000 | d12c199b7067700d917086894ae3b2981de08398 | Remove cybertip link from report package page | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"diff": "If you are reporting copyright infringement, please describe the copyrighted material with particularity and provide us with information about your copyright (i.e. title of copyrighted work, URL where to view your copyrighted work, description of your copyrighted work, and any copyright registrations you may have, etc.). For trademark infringement, include the name of your trademark, registration number, and country where registered.\n</p>\n</div>\n- <div class=\"child-sexual-exploitation\" tabindex=\"0\">\n- <p>\n- Note: Please complete this form and submit it so we can proceed with an appropriate response regarding the NuGet package (e.g. removing it). In addition, please proceed to <a href=\"https://report.cybertip.org\">https://report.cybertip.org</a> to report the matter in more detail.\n- </p>\n- </div>\n<div class=\"imminent-harm\" tabindex=\"0\">\n<p>\nNote: please ensure when reporting this type of abuse that you've considered whether the following are present:\n$form.find('.online-safety-extras').hide();\n}\n- if (val === 'ChildSexualExploitationOrAbuse') {\n- $form.find('.child-sexual-exploitation').show();\n- } else {\n- $form.find('.child-sexual-exploitation').hide();\n- }\n-\nif (val === 'ImminentHarm') {\n$form.find('.imminent-harm').show();\n} else {\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Remove cybertip link from report package page (#8917) |
455,747 | 04.01.2022 15:22:04 | 28,800 | d01ec315d51ef07d0c1d2c408b296f04a73e5615 | Fix assembly warnings | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"new_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"diff": "<Version>6.0.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.FeatureFlags\">\n- <Version>2.96.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"WindowsAzure.Storage\">\n<Version>9.3.3</Version>\n<ItemGroup Condition=\"'$(TargetFramework)' == 'net472'\">\n<PackageReference Include=\"NuGet.Services.Messaging.Email\">\n- <Version>2.96.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation\">\n- <Version>2.96.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation.Issues\">\n- <Version>2.96.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.StrongName.elmah.corelibrary\">\n<Version>1.2.2</Version>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Version>6.0.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Licenses\">\n- <Version>2.96.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Owin\">\n- <Version>2.96.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Sql\">\n- <Version>2.96.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"Owin\">\n<Version>1.0.0</Version>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Web.config",
"new_path": "src/NuGetGallery/Web.config",
"diff": "</dependentAssembly>\n<dependentAssembly>\n<assemblyIdentity name=\"Microsoft.Azure.Services.AppAuthentication\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-1.3.1.0\" newVersion=\"1.3.1.0\"/>\n+ <bindingRedirect oldVersion=\"0.0.0.0-1.4.0.0\" newVersion=\"1.4.0.0\"/>\n</dependentAssembly>\n<dependentAssembly>\n<assemblyIdentity name=\"System.Web.Http\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Fix assembly warnings (#8928) |
455,781 | 05.01.2022 13:22:27 | 25,200 | 7d4c4353985e39eb540814ff58260bc61c32a43d | Add feature flags for TFM. | [
{
"change_type": "MODIFY",
"old_path": "src/AccountDeleter/EmptyFeatureFlagService.cs",
"new_path": "src/AccountDeleter/EmptyFeatureFlagService.cs",
"diff": "@@ -51,6 +51,11 @@ public bool IsAsyncAccountDeleteEnabled()\nthrow new NotImplementedException();\n}\n+ public bool IsComputeTargetFrameworkEnabled()\n+ {\n+ throw new NotImplementedException();\n+ }\n+\npublic bool IsDeletePackageApiEnabled(User user)\n{\nthrow new NotImplementedException();\n@@ -81,7 +86,7 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)\nthrow new NotImplementedException();\n}\n- public bool IsDisplayTargetFrameworkEnabled()\n+ public bool IsDisplayTargetFrameworkEnabled(User user)\n{\nthrow new NotImplementedException();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/Fakes/FakeFeatureFlagService.cs",
"new_path": "src/GitHubVulnerabilities2Db/Fakes/FakeFeatureFlagService.cs",
"diff": "@@ -270,7 +270,12 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)\nthrow new NotImplementedException();\n}\n- public bool IsDisplayTargetFrameworkEnabled()\n+ public bool IsDisplayTargetFrameworkEnabled(User user)\n+ {\n+ throw new NotImplementedException();\n+ }\n+\n+ public bool IsComputeTargetFrameworkEnabled()\n{\nthrow new NotImplementedException();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/FeatureFlagService.cs",
"new_path": "src/NuGetGallery.Services/Configuration/FeatureFlagService.cs",
"diff": "@@ -53,6 +53,7 @@ public class FeatureFlagService : IFeatureFlagService\nprivate const string DisplayPackagePageV2FeatureName = GalleryPrefix + \"DisplayPackagePageV2\";\nprivate const string ShowReportAbuseSafetyChanges = GalleryPrefix + \"ShowReportAbuseSafetyChanges\";\nprivate const string DisplayTargetFrameworkFeatureName = GalleryPrefix + \"DisplayTargetFramework\";\n+ private const string ComputeTargetFrameworkFeatureName = GalleryPrefix + \"ComputeTargetFramework\";\nprivate const string ODataV1GetAllNonHijackedFeatureName = GalleryPrefix + \"ODataV1GetAllNonHijacked\";\nprivate const string ODataV1GetAllCountNonHijackedFeatureName = GalleryPrefix + \"ODataV1GetAllCountNonHijacked\";\n@@ -358,9 +359,14 @@ public bool IsDisplayBannerEnabled()\nreturn _client.IsEnabled(DisplayBannerFlightName, defaultValue: false);\n}\n- public bool IsDisplayTargetFrameworkEnabled()\n+ public bool IsDisplayTargetFrameworkEnabled(User user)\n{\n- return _client.IsEnabled(DisplayTargetFrameworkFeatureName, defaultValue: false);\n+ return _client.IsEnabled(DisplayTargetFrameworkFeatureName, user, defaultValue: false);\n+ }\n+\n+ public bool IsComputeTargetFrameworkEnabled()\n+ {\n+ return _client.IsEnabled(ComputeTargetFrameworkFeatureName, defaultValue: false);\n}\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/IFeatureFlagService.cs",
"new_path": "src/NuGetGallery.Services/Configuration/IFeatureFlagService.cs",
"diff": "@@ -290,6 +290,11 @@ public interface IFeatureFlagService\n/// <summary>\n/// Whether or not display target framework badges and table on nuget.org\n/// </summary>\n- bool IsDisplayTargetFrameworkEnabled();\n+ bool IsDisplayTargetFrameworkEnabled(User user);\n+\n+ /// <summary>\n+ /// Whether or not to compute backend operations for target framework. This flag is overridden by <see cref=\"IsDisplayTargetFrameworkEnabled\"/> if that flag is true.\n+ /// </summary>\n+ bool IsComputeTargetFrameworkEnabled();\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Data/Files/Content/flags.json",
"new_path": "src/NuGetGallery/App_Data/Files/Content/flags.json",
"diff": "\"NuGetGallery.MarkdigMdRendering\": \"Enabled\",\n\"NuGetGallery.ImageAllowlist\": \"Enabled\",\n\"NuGetGallery.ShowReportAbuseSafetyChanges\": \"Enabled\",\n- \"NuGetGallery.DisplayTFM\": \"Enabled\"\n+ \"NuGetGallery.ComputeTargetFramework\": \"Enabled\"\n},\n\"Flights\": {\n\"NuGetGallery.TyposquattingFlight\": {\n\"SiteAdmins\": false,\n\"Accounts\": [],\n\"Domains\": []\n+ },\n+ \"NuGetGallery.DisplayTargetFramework\": {\n+ \"All\": true,\n+ \"SiteAdmins\": false,\n+ \"Accounts\": [],\n+ \"Domains\": []\n}\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/VerifyMicrosoftPackage/Fakes/FakeFeatureFlagService.cs",
"new_path": "src/VerifyMicrosoftPackage/Fakes/FakeFeatureFlagService.cs",
"diff": "@@ -120,6 +120,8 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)\nthrow new NotImplementedException();\n}\n- public bool IsDisplayTargetFrameworkEnabled() => throw new NotImplementedException();\n+ public bool IsDisplayTargetFrameworkEnabled(User user) => throw new NotImplementedException();\n+\n+ public bool IsComputeTargetFrameworkEnabled() => throw new NotImplementedException();\n}\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add feature flags for TFM. (#8929) |
455,747 | 07.01.2022 18:03:21 | 28,800 | c81a82a238cd16dd9ee485de01bea3981d6429d0 | Update gallery jobs to use new service bus MSI | [
{
"change_type": "MODIFY",
"old_path": "NuGet.config",
"new_path": "NuGet.config",
"diff": "<package pattern=\"NuGet.Jobs.*\" />\n<package pattern=\"NuGet.Services.*\" />\n<package pattern=\"NuGet.StrongName.*\" />\n+ <package pattern=\"NuGetGallery.Core\" />\n<package pattern=\"Strathweb.CacheOutput.WebApi2.StrongName\" />\n</packageSource>\n<packageSource key=\"nuget-server-upstreams\">\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/GitHubVulnerabilities2Db.csproj",
"new_path": "src/GitHubVulnerabilities2Db/GitHubVulnerabilities2Db.csproj",
"diff": "<PrivateAssets>all</PrivateAssets>\n</PackageReference>\n<PackageReference Include=\"NuGet.Jobs.Common\">\n- <Version>4.3.0-dev-5066115</Version>\n+ <Version>4.3.0-dev-5590084</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Cursor\">\n- <Version>2.94.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj",
"new_path": "src/NuGet.Services.DatabaseMigration/NuGet.Services.DatabaseMigration.csproj",
"diff": "<PrivateAssets>all</PrivateAssets>\n</PackageReference>\n<PackageReference Include=\"NuGet.Jobs.Common\">\n- <Version>4.3.0-dev-5066115</Version>\n+ <Version>4.3.0-dev-5590084</Version>\n</PackageReference>\n</ItemGroup>\n<Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"new_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"diff": "<Version>6.0.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Configuration\">\n- <Version>2.94.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Logging\">\n- <Version>2.94.0</Version>\n+ <Version>2.97.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.StrongName.WebBackgrounder\">\n<Version>0.2.0</Version>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/VerifyGitHubVulnerabilities/VerifyGitHubVulnerabilities.csproj",
"new_path": "src/VerifyGitHubVulnerabilities/VerifyGitHubVulnerabilities.csproj",
"diff": "</ItemGroup>\n<ItemGroup>\n<PackageReference Include=\"NuGet.Jobs.Common\">\n- <Version>4.3.0-dev-5066115</Version>\n+ <Version>4.3.0-dev-5590084</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGet.Services.DatabaseMigration.Facts/NuGet.Services.DatabaseMigration.Facts.csproj",
"new_path": "tests/NuGet.Services.DatabaseMigration.Facts/NuGet.Services.DatabaseMigration.Facts.csproj",
"diff": "<Project>{f4c8c34f-72a9-4773-a315-8fa3f2d5ce4e}</Project>\n<Name>NuGet.Services.DatabaseMigration</Name>\n</ProjectReference>\n+ <ProjectReference Include=\"..\\..\\src\\NuGet.Services.Entities\\NuGet.Services.Entities.csproj\">\n+ <Project>{6262f4fc-29be-4226-b676-db391c89d396}</Project>\n+ <Name>NuGet.Services.Entities</Name>\n+ </ProjectReference>\n+ <ProjectReference Include=\"..\\..\\src\\NuGetGallery.Core\\NuGetGallery.Core.csproj\">\n+ <Project>{097b2cdd-9623-4c34-93c2-d373d51f5b4e}</Project>\n+ <Name>NuGetGallery.Core</Name>\n+ </ProjectReference>\n</ItemGroup>\n<Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n</Project>\n\\ No newline at end of file\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update gallery jobs to use new service bus MSI (#8930) |
455,736 | 19.01.2022 12:40:02 | 28,800 | 4aec7e0833ede13a4ed598badc1b5162df9a1a2d | Fix issue template links
Fix | [
{
"change_type": "MODIFY",
"old_path": ".github/ISSUE_TEMPLATE/NUGETORG_ISSUE.yml",
"new_path": ".github/ISSUE_TEMPLATE/NUGETORG_ISSUE.yml",
"diff": "@@ -10,9 +10,9 @@ body:\nThe more detail you provide, the more likely it will be for us to be able to identify what is going on and how to solve it!\n- ### For issues connecting to NuGet.org, please refer to [this guide](https://docs.microsoft.com/en-us/nuget/faqs/nuget-faq#nugetorg-not-accessible).\n+ ### For issues connecting to NuGet.org, please refer to [this guide](https://docs.microsoft.com/en-us/nuget/nuget-org/nuget-org-faq#nuget.org-not-accessible).\n- ### For issues regarding your NuGet.org account, please refer to [this guide](https://docs.microsoft.com/en-us/nuget/faqs/nuget-faq#nugetorg-account-management).\n+ ### For issues regarding your NuGet.org account, please refer to [this guide](https://docs.microsoft.com/en-us/nuget/nuget-org/nuget-org-faq#nuget.org-account-management).\n- type: dropdown\nid: impact\nattributes:\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Fix issue template links (#8946)
Fix https://github.com/NuGet/NuGetGallery/issues/8944 |
455,754 | 25.01.2022 15:10:02 | -36,000 | afb9219b5c3d42388972146a95a98617c8ba4f00 | Add reCAPTCHA to package uploads | [
{
"change_type": "MODIFY",
"old_path": "src/AccountDeleter/EmptyFeatureFlagService.cs",
"new_path": "src/AccountDeleter/EmptyFeatureFlagService.cs",
"diff": "@@ -285,5 +285,10 @@ public bool ProxyGravatarEnSubdomain()\n{\nthrow new NotImplementedException();\n}\n+\n+ public bool IsRecaptchaEnabledForUploads()\n+ {\n+ throw new NotImplementedException();\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/Fakes/FakeFeatureFlagService.cs",
"new_path": "src/GitHubVulnerabilities2Db/Fakes/FakeFeatureFlagService.cs",
"diff": "@@ -284,5 +284,10 @@ public bool IsRecentPackagesNoIndexEnabled()\n{\nthrow new NotImplementedException();\n}\n+\n+ public bool IsRecaptchaEnabledForUploads()\n+ {\n+ throw new NotImplementedException();\n+ }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/FeatureFlagService.cs",
"new_path": "src/NuGetGallery.Services/Configuration/FeatureFlagService.cs",
"diff": "@@ -55,6 +55,7 @@ public class FeatureFlagService : IFeatureFlagService\nprivate const string DisplayTargetFrameworkFeatureName = GalleryPrefix + \"DisplayTargetFramework\";\nprivate const string ComputeTargetFrameworkFeatureName = GalleryPrefix + \"ComputeTargetFramework\";\nprivate const string RecentPackagesNoIndexFeatureName = GalleryPrefix + \"RecentPackagesNoIndex\";\n+ private const string RecaptchaEnabledForUploadsName = GalleryPrefix + \"RecaptchaForUploads\";\nprivate const string ODataV1GetAllNonHijackedFeatureName = GalleryPrefix + \"ODataV1GetAllNonHijacked\";\nprivate const string ODataV1GetAllCountNonHijackedFeatureName = GalleryPrefix + \"ODataV1GetAllCountNonHijacked\";\n@@ -374,5 +375,10 @@ public bool IsRecentPackagesNoIndexEnabled()\n{\nreturn _client.IsEnabled(RecentPackagesNoIndexFeatureName, defaultValue: false);\n}\n+\n+ public bool IsRecaptchaEnabledForUploads()\n+ {\n+ return _client.IsEnabled(RecaptchaEnabledForUploadsName, defaultValue: false);\n+ }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/IFeatureFlagService.cs",
"new_path": "src/NuGetGallery.Services/Configuration/IFeatureFlagService.cs",
"diff": "@@ -301,5 +301,10 @@ public interface IFeatureFlagService\n/// Whether or not recent packages has no index applied to block search engine indexing.\n/// </summary>\nbool IsRecentPackagesNoIndexEnabled();\n+\n+ /// <summary>\n+ /// Whether or not we have reCAPTCHA enabled for package uploads\n+ /// </summary>\n+ bool IsRecaptchaEnabledForUploads();\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Data/Files/Content/flags.json",
"new_path": "src/NuGetGallery/App_Data/Files/Content/flags.json",
"diff": "\"NuGetGallery.MarkdigMdRendering\": \"Enabled\",\n\"NuGetGallery.ImageAllowlist\": \"Enabled\",\n\"NuGetGallery.ShowReportAbuseSafetyChanges\": \"Enabled\",\n- \"NuGetGallery.ComputeTargetFramework\": \"Enabled\"\n+ \"NuGetGallery.ComputeTargetFramework\": \"Enabled\",\n+ \"NuGetGallery.RecaptchaForUploads\": \"Disabled\"\n},\n\"Flights\": {\n\"NuGetGallery.TyposquattingFlight\": {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/DefaultDependenciesModule.cs",
"new_path": "src/NuGetGallery/App_Start/DefaultDependenciesModule.cs",
"diff": "using Autofac;\nusing Autofac.Core;\nusing Autofac.Extensions.DependencyInjection;\n+using Autofac.Integration.Mvc;\nusing Elmah;\nusing Microsoft.ApplicationInsights.Extensibility;\nusing Microsoft.ApplicationInsights.Extensibility.Implementation;\nusing NuGetGallery.Cookies;\nusing NuGetGallery.Diagnostics;\nusing NuGetGallery.Features;\n+using NuGetGallery.Filters;\nusing NuGetGallery.Frameworks;\n-using NuGetGallery.Helpers;\nusing NuGetGallery.Infrastructure;\nusing NuGetGallery.Infrastructure.Authentication;\nusing NuGetGallery.Infrastructure.Lucene;\n@@ -509,6 +510,8 @@ protected override void Load(ContainerBuilder builder)\nRegisterCookieComplianceService(configuration, loggerFactory);\n+ RegisterCustomMvcFilters(builder, configuration);\n+\nbuilder.RegisterType<CookieExpirationService>()\n.As<ICookieExpirationService>()\n.SingleInstance();\n@@ -860,6 +863,17 @@ private static void RegisterFeatureFlagsService(ContainerBuilder builder, Config\n.SingleInstance();\n}\n+ private static void RegisterCustomMvcFilters(ContainerBuilder builder, ConfigurationService configuration)\n+ {\n+#pragma warning disable CS4014 // VerifyPackage is not awaited because this is attachment, not execution\n+ builder\n+ .Register(context => new ValidateRecaptchaResponseForUploadsAttribute(context.Resolve<IFeatureFlagService>()))\n+ .AsActionFilterFor<PackagesController>(controller => controller.VerifyPackage(default(VerifyPackageRequest)));\n+#pragma warning restore CS4014 // VerifyPackage is not awaited because this is attachment, not execution\n+\n+ builder.RegisterFilterProvider();\n+ }\n+\nprivate static void RegisterMessagingService(ContainerBuilder builder, ConfigurationService configuration)\n{\nif (configuration.Current.AsynchronousEmailServiceEnabled)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"new_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"diff": "@@ -326,6 +326,7 @@ public virtual async Task<ActionResult> UploadPackage()\nvar verifyRequest = new VerifyPackageRequest(packageMetadata, accountsAllowedOnBehalfOf, existingPackageRegistration);\nverifyRequest.IsSymbolsPackage = true;\nverifyRequest.HasExistingAvailableSymbols = packageForUploadingSymbols.IsLatestSymbolPackageAvailable();\n+ verifyRequest.RecaptchaEnabled = false; // No need for recaptcha for symbols packages\nmodel.InProgressUpload = verifyRequest;\n@@ -373,6 +374,7 @@ public virtual async Task<ActionResult> UploadPackage()\nverifyRequest.LicenseFileContents = await GetLicenseFileContentsOrNullAsync(packageMetadata, packageArchiveReader);\nverifyRequest.LicenseExpressionSegments = GetLicenseExpressionSegmentsOrNull(packageMetadata.LicenseMetadata);\nverifyRequest.ReadmeFileContents = await GetReadmeFileContentsOrNullAsync(packageMetadata, packageArchiveReader);\n+ verifyRequest.RecaptchaEnabled = _featureFlagService.IsRecaptchaEnabledForUploads();\nmodel.InProgressUpload = verifyRequest;\nreturn View(model);\n@@ -2405,6 +2407,7 @@ public virtual ActionResult CancelPendingOwnershipRequest(string id, string requ\nreturn Redirect(Url.ManagePackageOwnership(id));\n}\n+ /// Note that for Recaptcha filtering we attach ValidateRecaptchaResponseForUploadsAttribute directly here: <see cref=\"DefaultDependenciesModule.RegisterCustomMvcFilters\" />.\n[UIAuthorize]\n[HttpPost]\n[RequiresAccountConfirmation(\"upload a package\")]\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Filters/ValidateRecaptchaResponseAttribute.cs",
"new_path": "src/NuGetGallery/Filters/ValidateRecaptchaResponseAttribute.cs",
"diff": "namespace NuGetGallery.Filters\n{\n[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)]\n- public sealed class ValidateRecaptchaResponseAttribute : ActionFilterAttribute\n+ public class ValidateRecaptchaResponseAttribute : ActionFilterAttribute\n{\nprivate const string RecaptchaResponseId = \"g-recaptcha-response\";\nprivate const string RecaptchaValidationUrl = \"https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}\";\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Compile Include=\"Extensions\\CakeBuildManagerExtensions.cs\" />\n<Compile Include=\"Extensions\\ImageExtensions.cs\" />\n<Compile Include=\"Filters\\AdminActionAttribute.cs\" />\n+ <Compile Include=\"Filters\\ValidateRecaptchaResponseForUploadsAttribute.cs\" />\n<Compile Include=\"Helpers\\AdminHelper.cs\" />\n<Compile Include=\"Helpers\\ValidationHelper.cs\" />\n<Compile Include=\"Helpers\\ViewModelExtensions\\DeleteAccountListPackageItemViewModelFactory.cs\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/RequestModels/VerifyPackageRequest.cs",
"new_path": "src/NuGetGallery/RequestModels/VerifyPackageRequest.cs",
"diff": "@@ -118,6 +118,7 @@ public VerifyPackageRequest(PackageMetadata packageMetadata, IEnumerable<User> p\npublic string Title { get; set; }\npublic bool IsSymbolsPackage { get; set; }\npublic bool HasExistingAvailableSymbols { get; set; }\n+ public bool RecaptchaEnabled { get; set; }\npublic List<JsonValidationMessage> Warnings { get; set; } = new List<JsonValidationMessage>();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/UploadPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/UploadPackage.cshtml",
"diff": "Submitting this request will replace the previously uploaded symbols package as well as the corresponding symbol files from the symbol server.</text>)\n</div>\n- @Html.Partial(\"_VerifyForm\")\n+ @Html.Partial(\"_VerifyForm\", Model)\n}\n</div>\n</div>\n'@Url.PreviewReadMe()');\n});\n</script>\n+ <script src='https://www.google.com/recaptcha/api.js' async defer></script>\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/_VerifyForm.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/_VerifyForm.cshtml",
"diff": "<div id=\"submit-package-container\">\n</div>\n+ @if(Model != null && Model.InProgressUpload != null && Model.InProgressUpload.RecaptchaEnabled)\n+ {\n+ <script type=\"text/javascript\">RecaptchaEnabled = true;</script>\n<script type=\"text/html\" id=\"submit-package-template\">\n<div class=\"form-group btn-toolbar row\" id=\"submit-package-form\">\n<div class=\"col-xs-6\">\n+ <div id=\"recaptcha\" class=\"g-recaptcha\" data-sitekey=\"@Config.Current.ReCaptchaPublicKey\" data-size=\"invisible\"\n+ data-callback=\"OnVerifySubmit\" data-tabindex=\"-1\"></div>\n<input type=\"button\" class=\"btn btn-primary btn-block\" value=\"Submit\" id=\"verify-submit-button\" />\n</div>\n<div class=\"col-xs-6\">\n</div>\n</div>\n</script>\n+ }\n+ else\n+ {\n+ <script type=\"text/javascript\">RecaptchaEnabled = false;</script>\n+ <script type=\"text/html\" id=\"submit-package-template\">\n+ <div class=\"form-group btn-toolbar row\" id=\"submit-package-form\">\n+ <div class=\"col-xs-6\">\n+ <input type=\"button\" class=\"btn btn-primary btn-block\" value=\"Submit\" id=\"verify-submit-button\" />\n+ </div>\n+ <div class=\"col-xs-6\">\n+ <input type=\"button\" class=\"btn btn-default btn-block\" value=\"Cancel\" id=\"verify-cancel-button\" />\n+ </div>\n+ </div>\n+ </script>\n+ }\n</form>\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/VerifyMicrosoftPackage/Fakes/FakeFeatureFlagService.cs",
"new_path": "src/VerifyMicrosoftPackage/Fakes/FakeFeatureFlagService.cs",
"diff": "@@ -125,5 +125,6 @@ public bool IsDisplayPackagePageV2PreviewEnabled(User user)\npublic bool IsComputeTargetFrameworkEnabled() => throw new NotImplementedException();\npublic bool IsRecentPackagesNoIndexEnabled() => throw new NotImplementedException();\n+ public bool IsRecaptchaEnabledForUploads() => throw new NotImplementedException();\n}\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add reCAPTCHA to package uploads (#8948) |
455,781 | 25.01.2022 12:55:09 | 25,200 | 9611fdb911a394daf3d4c8ea6245ac586c57e4e9 | Added error message to aria-label attribute. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Scripts/gallery/page-edit-readme.js",
"new_path": "src/NuGetGallery/Scripts/gallery/page-edit-readme.js",
"diff": "@@ -369,6 +369,9 @@ var BindReadMeDataManager = (function () {\n}\nfunction displayReadMeError(errorMsg) {\n+ // In order for Narrator to read the alert, this should be on an aria-label attribute.\n+ $(\"#readme-error-content\").attr(\"aria-label\", errorMsg);\n+\n$(\"#readme-errors\").removeClass(\"hidden\");\n$(\"#preview-readme-button\").attr(\"disabled\", \"disabled\");\n@@ -388,6 +391,7 @@ var BindReadMeDataManager = (function () {\nif (!$(\"#readme-errors\").hasClass(\"hidden\")) {\n$(\"#readme-errors\").addClass(\"hidden\");\n$(\"#readme-error-content\").text(\"\");\n+ $(\"#readme-error-content\").removeAttr(\"aria-label\");\n}\n$(\"#preview-readme-button\").prop(\"disabled\", false);\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Added error message to aria-label attribute. (#8954) |
455,737 | 26.01.2022 19:51:11 | 28,800 | d926c9a9fa155ca6deaf83144c8e0f9480592249 | Use table-responsive for sample glob descriptions. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Users/ApiKeys.cshtml",
"new_path": "src/NuGetGallery/Views/Users/ApiKeys.cshtml",
"diff": "<div class=\"panel-body\">\n<p>A glob pattern allows you to replace any sequence of characters with '*'.</p>\n<p>Example glob patterns:</p>\n- <table class=\"table table-condensed borderless\">\n+ <table class=\"table-responsive table-condensed borderless\">\n<thead>\n<tr>\n<th>Pattern</th>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Use table-responsive for sample glob descriptions. |
455,754 | 27.01.2022 15:47:56 | -36,000 | a49635c4d547452481cf60b72db54b1094dda34d | create nupkg and snupkg for sharing NuGetGallery.Services | [
{
"change_type": "MODIFY",
"old_path": "build.ps1",
"new_path": "build.ps1",
"diff": "@@ -116,6 +116,7 @@ Invoke-BuildStep 'Creating artifacts' { `\nNew-ProjectPackage (Join-Path $PSScriptRoot \"src\\NuGetGallery.Core\\NuGetGallery.Core.csproj\") -Configuration $Configuration -Symbols -BuildNumber $BuildNumber -Version $SemanticVersion -PackageId \"NuGetGallery.Core$PackageSuffix\"\nNew-ProjectPackage (Join-Path $PSScriptRoot \"src\\NuGet.Services.Entities\\NuGet.Services.Entities.csproj\") -Configuration $Configuration -Symbols -BuildNumber $BuildNumber -Version $SemanticVersion\nNew-ProjectPackage (Join-Path $PSScriptRoot \"src\\NuGet.Services.DatabaseMigration\\NuGet.Services.DatabaseMigration.csproj\") -Configuration $Configuration -Symbols -BuildNumber $BuildNumber -Version $SemanticVersion\n+ New-Package (Join-Path $PSScriptRoot \"src\\NuGetGallery.Services\\NuGetGallery.Services.nuspec\") -Configuration $Configuration -Symbols -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch\nNew-Package (Join-Path $PSScriptRoot \"src\\DatabaseMigrationTools\\DatabaseMigration.Gallery.nuspec\") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch\nNew-Package (Join-Path $PSScriptRoot \"src\\DatabaseMigrationTools\\DatabaseMigration.SupportRequest.nuspec\") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch\nNew-Package (Join-Path $PSScriptRoot \"src\\DatabaseMigrationTools\\DatabaseMigration.Validation.nuspec\") -Configuration $Configuration -BuildNumber $BuildNumber -Version $SemanticVersion -Branch $Branch\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/NuGetGallery.Services/NuGetGallery.Services.nuspec",
"diff": "+<?xml version=\"1.0\"?>\n+<package >\n+ <metadata>\n+ <id>NuGetGallery.Services</id>\n+ <version>$version$</version>\n+ <title>NuGetGallery.Services</title>\n+ <authors>.NET Foundation</authors>\n+ <owners>.NET Foundation</owners>\n+ <description>NuGetGallery.Services</description>\n+ <copyright>Copyright .NET Foundation</copyright>\n+ </metadata>\n+ <files>\n+ <file src=\"bin\\$configuration$\\**\\*.*\" target=\"bin\"/>\n+ </files>\n+</package>\n\\ No newline at end of file\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | create nupkg and snupkg for sharing NuGetGallery.Services |
455,736 | 28.01.2022 16:25:20 | 28,800 | 7875bf2b869d668f9729c0b151f3a1cae1376e24 | Add option to backfill tools for specific IDs list
* Add option to backfill tools for specific IDs list
* Add readme to csproj for ease
Fix | [
{
"change_type": "MODIFY",
"old_path": "src/GalleryTools/App.config",
"new_path": "src/GalleryTools/App.config",
"diff": "<add key=\"Gallery.FileStorageDirectory\" value=\"..\\..\\..\\NuGetGallery\\App_Data\\Files\"/>\n<add key=\"Gallery.LuceneIndexLocation\" value=\"Temp\"/>\n<add key=\"Gallery.IsHosted\" value=\"false\"/>\n-\n- <add key=\"Gallery.ServiceDiscoveryUri\" value=\"https://api.nuget.org/v3/index.json\" />\n</appSettings>\n<entityFramework>\n<defaultConnectionFactory type=\"System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework\">\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GalleryTools/Commands/BackfillCommand.cs",
"new_path": "src/GalleryTools/Commands/BackfillCommand.cs",
"diff": "using GalleryTools.Utils;\nusing Microsoft.IdentityModel.JsonWebTokens;\nusing NuGet.Services.Sql;\n+using NuGet.Packaging.Core;\n+using NuGet.Versioning;\n+using System.Collections.Concurrent;\n+using System.Threading;\nnamespace GalleryTools.Commands\n{\npublic abstract class BackfillCommand<TMetadata>\n{\n+ private const string MetadataUpdatedMessage = \"Metadata updated.\";\n+\nprotected abstract string MetadataFileName { get; }\nprotected virtual string ErrorsFileName => \"errors.txt\";\n@@ -48,8 +54,18 @@ public abstract class BackfillCommand<TMetadata>\nprotected virtual Expression<Func<Package, object>> QueryIncludes => null;\n-\nprotected IPackageService _packageService;\n+ private readonly HttpClient _httpClient;\n+\n+ public BackfillCommand()\n+ {\n+ _httpClient = new HttpClient();\n+\n+ // We want these downloads ignored by stats pipelines - this user agent is automatically skipped.\n+ // See https://github.com/NuGet/NuGet.Jobs/blob/262da48ed05d0366613bbf1c54f47879aad96dcd/src/Stats.ImportAzureCdnStatistics/StatisticsParser.cs#L41\n+ _httpClient.DefaultRequestHeaders.TryAddWithoutValidation(\"User-Agent\",\n+ \"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; AppInsights) Backfill Job: NuGet.Gallery GalleryTools\");\n+ }\npublic static void Configure<TCommand>(CommandLineApplication config) where TCommand : BackfillCommand<TMetadata>, new()\n{\n@@ -58,6 +74,7 @@ public static void Configure<TCommand>(CommandLineApplication config) where TCom\nvar lastCreateTimeOption = config.Option(\"-l | --lastcreatetime\", \"The latest creation time of packages we should check\", CommandOptionType.SingleValue);\nvar collectData = config.Option(\"-c | --collect\", \"Collect metadata and save it in a file\", CommandOptionType.NoValue);\nvar updateDB = config.Option(\"-u | --update\", \"Update the database with collected metadata\", CommandOptionType.NoValue);\n+ var updateSpecific = config.Option(\"-i | --updatespecific\", \"Run the collect and update operations immediately on a specific set of packages, specified by the --file option.\", CommandOptionType.NoValue);\nvar fileName = config.Option(\"-f | --file\", \"The file to use\", CommandOptionType.SingleValue);\nvar serviceDiscoveryUri = config.Option(\"-s | --servicediscoveryuri\", \"The ServiceDiscoveryUri.\", CommandOptionType.SingleValue);\n@@ -78,6 +95,12 @@ public static void Configure<TCommand>(CommandLineApplication config) where TCom\nvar metadataFileName = fileName.HasValue() ? fileName.Value() : command.MetadataFileName;\n+ if (updateSpecific.HasValue())\n+ {\n+ await command.UpdateSpecific(sqlConnection, serviceDiscoveryUriValue, metadataFileName);\n+ }\n+ else\n+ {\nif (collectData.HasValue())\n{\nvar lastCreateTime = DateTime.MaxValue;\n@@ -100,32 +123,128 @@ public static void Configure<TCommand>(CommandLineApplication config) where TCom\n{\nawait command.Update(sqlConnection, metadataFileName);\n}\n+ }\nreturn 0;\n});\n}\n- public async Task Collect(SqlConnection connection, Uri serviceDiscoveryUri, DateTime? lastCreateTime, string fileName)\n+ private async Task UpdateSpecific(SqlConnection connection, Uri serviceDiscoveryUri, string fileName)\n{\n- using (var context = new EntitiesContext(connection, readOnly: true))\n- using (var cursor = new FileCursor(CursorFileName))\n+ var remainingPackages = ReadPackageIdentityList(fileName);\n+ var completedPath = fileName + \".completed\";\n+ var completedPackages = ReadPackageIdentityList(completedPath);\n+ remainingPackages.ExceptWith(completedPackages);\n+ Console.WriteLine($\"Starting update on {remainingPackages.Count} packages. {completedPackages.Count} have already been completed.\");\n+\n+ var flatContainerUri = await GetFlatContainerUri(serviceDiscoveryUri);\n+\n+ using (var context = new EntitiesContext(connection, readOnly: false))\nusing (var logger = new Logger(ErrorsFileName))\n{\n- context.SetCommandTimeout(300); // large query\n+ var packages = GetPackagesQuery(context);\n+ var toDownload = new ConcurrentBag<(PackageIdentity Identity, Package Package)>();\n+ var toUpdate = new ConcurrentBag<(PackageIdentity Identity, Package Package, PackageMetadata Record)>();\n+ var batchSize = Math.Min(CollectBatchSize, UpdateBatchSize);\n- var startTime = await cursor.Read();\n+ while (remainingPackages.Count > 0)\n+ {\n+ var batch = remainingPackages.Take(batchSize).ToList();\n+ Console.WriteLine($\"Fetching {batch.Count} packages from DB.\");\n+ foreach (var identity in batch)\n+ {\n+ remainingPackages.Remove(identity);\n- logger.Log($\"Starting metadata collection - Cursor time: {startTime:u}\");\n+ var normalizedVersion = identity.Version.ToNormalizedString();\n+ var package = await GetPackageFromDbAsync(packages, identity.Id, normalizedVersion, logger);\n+ if (package == null)\n+ {\n+ continue;\n+ }\n- var repository = new EntityRepository<Package>(context);\n+ logger.LogPackage(package.Id, package.NormalizedVersion, \"DB record fetched.\");\n+ toDownload.Add((identity, package));\n+ }\n- var packages = repository.GetAll().Include(p => p.PackageRegistration);\n- if (QueryIncludes != null)\n+ // Execute the download in parallel to improve performance.\n+ Console.WriteLine($\"Fetching {batch.Count} {SourceType} files from storage.\");\n+ await Task.WhenAll(Enumerable\n+ .Range(0, 16)\n+ .Select(async x =>\n{\n- packages = packages.Include(QueryIncludes);\n+ while (toDownload.TryTake(out var data))\n+ {\n+ var record = await ReadPackageOrNullAsync(flatContainerUri, data.Package, logger);\n+ if (record == null)\n+ {\n+ continue;\n+ }\n+\n+ logger.LogPackage(data.Package.Id, data.Package.NormalizedVersion, \"File downloaded.\");\n+ toUpdate.Add((data.Identity, data.Package, record));\n+ }\n+ })\n+ .ToList());\n+\n+ while (toUpdate.TryTake(out var data))\n+ {\n+ UpdatePackage(data.Package, data.Record.Metadata, context);\n+ completedPackages.Add(data.Identity);\n+ }\n+\n+ await CommitBatch(batch.Count, completedPath, completedPackages, context, logger);\n+ }\n+ }\n}\n- packages = packages\n+ private static HashSet<PackageIdentity> ReadPackageIdentityList(string path)\n+ {\n+ var completedLines = File.Exists(path) ? File.ReadAllLines(path) : Array.Empty<string>();\n+ return completedLines\n+ .Where(x => !string.IsNullOrWhiteSpace(x))\n+ .Select(x => x.Split(','))\n+ .Where(x =>\n+ {\n+ if (x.Length == 2)\n+ {\n+ return true;\n+ }\n+\n+ Console.WriteLine($\"Skipping line without two comma-separated pieces: {string.Join(\",\", x)}\");\n+ return false;\n+ })\n+ .ToList()\n+ .Select(x => new PackageIdentity(x[0], NuGetVersion.Parse(x[1])))\n+ .Distinct()\n+ .OrderBy(x => x.Id, StringComparer.OrdinalIgnoreCase)\n+ .ThenBy(x => x.Version)\n+ .ToHashSet();\n+ }\n+\n+ private static async Task CommitBatch(\n+ int packageCount,\n+ string completedPath,\n+ HashSet<PackageIdentity> completedPackages,\n+ EntitiesContext context,\n+ Logger logger)\n+ {\n+ logger.Log(\"Committing batch...\");\n+ var count = await context.SaveChangesAsync();\n+ File.WriteAllLines(completedPath, completedPackages.Select(x => $\"{x.Id},{x.Version}\"));\n+ logger.Log($\"{packageCount} packages saved, {count} records saved.\");\n+ }\n+\n+ public async Task Collect(SqlConnection connection, Uri serviceDiscoveryUri, DateTime? lastCreateTime, string fileName)\n+ {\n+ using (var context = new EntitiesContext(connection, readOnly: true))\n+ using (var cursor = new FileCursor(CursorFileName))\n+ using (var logger = new Logger(ErrorsFileName))\n+ {\n+ var startTime = await cursor.Read();\n+\n+ logger.Log($\"Starting metadata collection - Cursor time: {startTime:u}\");\n+\n+ IQueryable<Package> packages = GetPackagesQuery(context)\n.Where(p => p.Created < lastCreateTime && p.Created > startTime)\n.Where(p => p.PackageStatusKey == PackageStatus.Available)\n.OrderBy(p => p.Created);\n@@ -137,17 +256,53 @@ public async Task Collect(SqlConnection connection, Uri serviceDiscoveryUri, Dat\nvar flatContainerUri = await GetFlatContainerUri(serviceDiscoveryUri);\nusing (var csv = CreateCsvWriter(fileName))\n- using (var http = new HttpClient())\n{\n- // We want these downloads ignored by stats pipelines - this user agent is automatically skipped.\n- // See https://github.com/NuGet/NuGet.Jobs/blob/262da48ed05d0366613bbf1c54f47879aad96dcd/src/Stats.ImportAzureCdnStatistics/StatisticsParser.cs#L41\n- http.DefaultRequestHeaders.TryAddWithoutValidation(\"User-Agent\",\n- \"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; AppInsights) Backfill Job: NuGet.Gallery GalleryTools\");\n-\nvar counter = 0;\nvar lastCreatedDate = default(DateTime?);\nforeach (var package in packages)\n+ {\n+ var record = await ReadPackageOrNullAsync(flatContainerUri, package, logger);\n+\n+ if (record != null)\n+ {\n+ csv.WriteRecord(record);\n+\n+ await csv.NextRecordAsync();\n+\n+ logger.LogPackage(package.Id, package.NormalizedVersion, $\"Metadata saved\");\n+ }\n+\n+ counter++;\n+\n+ if (!lastCreatedDate.HasValue || lastCreatedDate < package.Created)\n+ {\n+ lastCreatedDate = package.Created;\n+ }\n+\n+ if (counter >= CollectBatchSize)\n+ {\n+ logger.Log($\"Writing {package.Created:u} to cursor...\");\n+ await cursor.Write(package.Created);\n+ counter = 0;\n+\n+ // Write a monitoring cursor (not locked) so for a large job we can inspect progress\n+ if (!string.IsNullOrEmpty(MonitoringCursorFileName))\n+ {\n+ File.WriteAllText(MonitoringCursorFileName, package.Created.ToString(\"G\"));\n+ }\n+ }\n+ }\n+\n+ if (counter > 0 && lastCreatedDate.HasValue)\n+ {\n+ await cursor.Write(lastCreatedDate.Value);\n+ }\n+ }\n+ }\n+ }\n+\n+ private async Task<PackageMetadata> ReadPackageOrNullAsync(string flatContainerUri, Package package, Logger logger)\n{\nvar id = package.PackageRegistration.Id;\nvar version = package.NormalizedVersion;\n@@ -160,7 +315,7 @@ public async Task Collect(SqlConnection connection, Uri serviceDiscoveryUri, Dat\nvar nuspecUri =\n$\"{flatContainerUri}/{idLowered}/{versionLowered}/{idLowered}.nuspec\";\n- using (var nuspecStream = await http.GetStreamAsync(nuspecUri))\n+ using (var nuspecStream = await _httpClient.GetStreamAsync(nuspecUri))\n{\nvar document = LoadDocument(nuspecStream);\n@@ -174,19 +329,13 @@ public async Task Collect(SqlConnection connection, Uri serviceDiscoveryUri, Dat\n{\nvar nupkgUri =\n$\"{flatContainerUri}/{idLowered}/{versionLowered}/{idLowered}.{versionLowered}.nupkg\";\n- metadata = await FetchMetadataAsync(http, nupkgUri, nuspecReader, id, version, logger);\n+ metadata = await FetchMetadataAsync(nupkgUri, nuspecReader, id, version, logger);\n}\n}\nif (ShouldWriteMetadata(metadata))\n{\n- var record = new PackageMetadata(id, version, metadata, package.Created);\n-\n- csv.WriteRecord(record);\n-\n- await csv.NextRecordAsync();\n-\n- logger.LogPackage(id, version, $\"Metadata saved\");\n+ return new PackageMetadata(id, version, metadata, package.Created);\n}\n}\ncatch (Exception e)\n@@ -194,33 +343,7 @@ public async Task Collect(SqlConnection connection, Uri serviceDiscoveryUri, Dat\nawait logger.LogPackageError(id, version, e);\n}\n- counter++;\n-\n- if (!lastCreatedDate.HasValue || lastCreatedDate < package.Created)\n- {\n- lastCreatedDate = package.Created;\n- }\n-\n- if (counter >= CollectBatchSize)\n- {\n- logger.Log($\"Writing {package.Created:u} to cursor...\");\n- await cursor.Write(package.Created);\n- counter = 0;\n-\n- // Write a monitoring cursor (not locked) so for a large job we can inspect progress\n- if (!string.IsNullOrEmpty(MonitoringCursorFileName))\n- {\n- File.WriteAllText(MonitoringCursorFileName, package.Created.ToString(\"G\"));\n- }\n- }\n- }\n-\n- if (counter > 0 && lastCreatedDate.HasValue)\n- {\n- await cursor.Write(lastCreatedDate.Value);\n- }\n- }\n- }\n+ return null;\n}\npublic async Task Update(SqlConnection connection, string fileName)\n@@ -238,13 +361,7 @@ public async Task Update(SqlConnection connection, string fileName)\nlogger.Log($\"Starting database update - Cursor time: {startTime:u}\");\n- var repository = new EntityRepository<Package>(context);\n-\n- var packages = repository.GetAll().Include(p => p.PackageRegistration);\n- if (QueryIncludes != null)\n- {\n- packages = packages.Include(QueryIncludes);\n- }\n+ var packages = GetPackagesQuery(context);\nusing (var csv = CreateCsvReader(fileName))\n{\n@@ -259,12 +376,11 @@ public async Task Update(SqlConnection connection, string fileName)\nif (metadata.Created >= startTime)\n{\n- var package = packages.FirstOrDefault(p => p.PackageRegistration.Id == metadata.Id && p.NormalizedVersion == metadata.Version);\n-\n+ var package = await GetPackageFromDbAsync(packages, metadata.Id, metadata.Version, logger);\nif (package != null)\n{\nUpdatePackage(package, metadata.Metadata, context);\n- logger.LogPackage(metadata.Id, metadata.Version, \"Metadata updated.\");\n+ logger.LogPackage(metadata.Id, metadata.Version, MetadataUpdatedMessage);\ncounter++;\n@@ -273,10 +389,6 @@ public async Task Update(SqlConnection connection, string fileName)\nlastCreatedDate = metadata.Created;\n}\n}\n- else\n- {\n- await logger.LogPackageError(metadata.Id, metadata.Version, \"Could not find package in the database.\");\n- }\n}\nif (counter >= UpdateBatchSize)\n@@ -296,6 +408,36 @@ public async Task Update(SqlConnection connection, string fileName)\n}\n}\n+ private IQueryable<Package> GetPackagesQuery(EntitiesContext context)\n+ {\n+ context.SetCommandTimeout(300); // large query\n+\n+ var repository = new EntityRepository<Package>(context);\n+\n+ var packages = repository.GetAll().Include(p => p.PackageRegistration);\n+ if (QueryIncludes != null)\n+ {\n+ packages = packages.Include(QueryIncludes);\n+ }\n+\n+ return packages.Where(p => p.PackageStatusKey == PackageStatus.Available);\n+ }\n+\n+ private static async Task<Package> GetPackageFromDbAsync(\n+ IQueryable<Package> packages,\n+ string id,\n+ string normalizedVersion,\n+ Logger logger)\n+ {\n+ var package = packages.FirstOrDefault(p => p.PackageRegistration.Id == id && p.NormalizedVersion == normalizedVersion);\n+ if (package == null)\n+ {\n+ await logger.LogPackageError(id, normalizedVersion, \"Could not find package in the database.\");\n+ }\n+\n+ return package;\n+ }\n+\nprotected virtual TMetadata ReadMetadata(NuspecReader reader) => default;\nprotected virtual TMetadata ReadMetadata(IList<string> files, NuspecReader nuspecReader) => default;\n@@ -316,9 +458,9 @@ private static async Task<string> GetFlatContainerUri(Uri serviceDiscoveryUri)\n}\nprivate async Task<TMetadata> FetchMetadataAsync(\n- HttpClient httpClient, string nupkgUri, NuspecReader nuspecReader, string id, string version, Logger logger)\n+ string nupkgUri, NuspecReader nuspecReader, string id, string version, Logger logger)\n{\n- var httpZipProvider = new HttpZipProvider(httpClient);\n+ var httpZipProvider = new HttpZipProvider(_httpClient);\nvar zipDirectoryReader = await httpZipProvider.GetReaderAsync(new Uri(nupkgUri));\nvar zipDirectory = await zipDirectoryReader.ReadAsync();\n@@ -503,9 +645,11 @@ public Logger(string fileName)\nstream.Seek(0, SeekOrigin.Begin);\nWriter = new StreamWriter(stream) { AutoFlush = true };\n+ Lock = new SemaphoreSlim(1);\n}\nprivate StreamWriter Writer { get; }\n+ public SemaphoreSlim Lock { get; }\npublic void Log(string message)\n{\n@@ -526,9 +670,17 @@ public async Task LogPackageError(string id, string version, string message)\n{\nLogPackage(id, version, message);\n+ await Lock.WaitAsync();\n+ try\n+ {\nawait Writer.WriteLineAsync($\"[{id}@{version}] {message}\");\nawait Writer.WriteLineAsync();\n}\n+ finally\n+ {\n+ Lock.Release();\n+ }\n+ }\npublic void Dispose()\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GalleryTools/GalleryTools.csproj",
"new_path": "src/GalleryTools/GalleryTools.csproj",
"diff": "</ItemGroup>\n<ItemGroup>\n<None Include=\"App.config\" />\n+ <None Include=\"Readme.md\" />\n</ItemGroup>\n<ItemGroup>\n<ProjectReference Include=\"..\\GitHubVulnerabilities2Db\\GitHubVulnerabilities2Db.csproj\">\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GalleryTools/Readme.md",
"new_path": "src/GalleryTools/Readme.md",
"diff": "@@ -4,38 +4,68 @@ This project contains tools for performing manual one-time/maintenance operation\n---\n-## Backfill repository metadata\n+## Backfill tools\n-This tool collects repository metadata for all packages in the database using nuspec files in the V3 flat container and updates the database with this data.\n+There are several variants of the backfill tool, for different data properties. All of the tools have a similar pattern and set of capabilities. These tools collect repository metadata for packages in the database using .nuspec or .nupkg files in the V3 flat container and update the database with this data.\n+\n+There are two ways to use the backfill tools:\n+\n+- Collect metadata and the update metadata for all packages (two different executions of the tool, `-c` then `-u`)\n+ - Note that for test runs `-c` and `-u` can be used at the same time, but we have observed in PROD that the job hangs\n+ from time to time causing us to restart the job. Therefore doing `-c` and `-u` all at once is not practical.\n+- Collect and update metadata for specific packages (single execution of the tool, `-i`)\n+\n+The commands that are backfill tools are:\n+\n+- `fillrepodata` - updates repository URL metadata\n+ - The `-f` option defaults to `repositoryMetadata.txt`\n+- `filldevdeps` - sets the dev dependency bool\n+ - The `-f` option defaults to `developmentDependencyMetadata.txt`\n+- `filltfms` - updates framework compatibility\n+ - The `-f` option defaults to `tfmMetadata.txt`\n+\n+All errors are written to the `errors.txt` file, placed in the current working directory.\n+\n+---\n### Collecting metadata\n-1. Configure app.config with database information and service index url\n-1. Run this tool with: `GalleryTools.exe fillrepodata -c`\n+1. Configure app.config with database information\n+1. Run this tool with: `GalleryTools.exe {tool} -c -s {v3-url}`\n+\n+`{tool}` is one of the backfill tool names above, e.g. `fillrepodata`.\n-This will create a file `repositoryMetadata.txt` with all collected data. You can stop the job anytime and restart. `cursor.txt` contains current position.\n+`{v3-url}` is the V3 service index URL, e.g. `https://api.nuget.org/v3/index.json`.\n+\n+This will create a file at the default data file location (or whatever is specified by the `-f | --file` option) with all collected data. You can stop the job anytime and restart. `cursor.txt` contains current position.\n+\n+---\n### Updating the database with collected data\n-1. Run `GalleryTools.exe fillrepodata -u`\n+This is run after collecting metadata (the previous section).\n-This will update the database from file `repositoryMetadata.txt`. You can stop the job anytime and restart. `cursor.txt` contains current position.\n+1. Configure app.config with database information (should be already done for the `-c` invocation mentioned above)\n+1. Run `GalleryTools.exe {tool} -u`\n----\n+`{tool}` is one of the backfill tool names above, e.g. `fillrepodata`.\n-## Backfill development dependency metadata\n+This will update the database from the default data file (or whatever is specified by the `-f | --file` option). You can stop the job anytime and restart. `cursor.txt` contains current position.\n-This tool collects development dependency metadata for all packages in the database using nuspec files in the V3 flat container and updates the database with this data.\n+---\n-### Collecting metadata\n+### Update specific packages\n-1. Configure app.config with database information and service index url\n-1. Run this tool with: `GalleryTools.exe filldevdeps -c`\n+1. Configure app.config with database information\n+1. Create a data file with one package identity per line. The format is `{id},{version}`, e.g. `Newtonsoft.Json,9.0.1`.\n+1. Run `GalleryTools.exe {tool} -i -f {path-to-file} -s {v3-url}`\n-This will create a file `developmentDependencyMetadata.txt` with all collected data. You can stop the job anytime and restart. `cursor.txt` contains current position.\n+Instead of performing a time consuming collect and update flow for the entire data, you can perform the backfill on a specific set of package IDs and versions.\n-### Updating the database with collected data\n+`{tool}` is one of the backfill tool names above, e.g. `fillrepodata`.\n+\n+`{path-to-file}` is the path to the file with package identities, `{id},{version}` per line.\n-1. Run `GalleryTools.exe filldevdeps -u`\n+`{v3-url}` is the V3 service index URL, e.g. `https://api.nuget.org/v3/index.json`.\n-This will update the database from file `developmentDependencyMetadata.txt`. You can stop the job anytime and restart. `cursor.txt` contains current position.\n+A file will be created at `{path-to-file}.completed` containing the list of all package identities that have been completed. This can be deleted to redo the update.\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add option to backfill tools for specific IDs list (#8960)
* Add option to backfill tools for specific IDs list
* Add readme to csproj for ease
Fix https://github.com/NuGet/NuGetGallery/issues/8961 |
455,783 | 01.02.2022 19:29:45 | -3,600 | 028e25f19a75c934b4a66fdcfa215457d9a8d0f2 | Allow user selection in install command
Addresses | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -1382,10 +1382,6 @@ p.frameworktableinfo-text {\nborder-color: #002440;\nborder-style: solid;\nborder-width: 1px 0 1px 1px;\n- -webkit-user-select: all;\n- -moz-user-select: all;\n- -ms-user-select: all;\n- user-select: all;\nvertical-align: middle;\nword-break: break-word;\n}\n@@ -1734,10 +1730,6 @@ p.frameworktableinfo-text {\nborder-color: #002440;\nborder-style: solid;\nborder-width: 1px 0 1px 1px;\n- -webkit-user-select: all;\n- -moz-user-select: all;\n- -ms-user-select: all;\n- user-select: all;\nvertical-align: middle;\nword-break: break-word;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/page-display-package-v2.less",
"new_path": "src/Bootstrap/less/theme/page-display-package-v2.less",
"diff": "border-color: @panel-footer-bg;\nborder-style: solid;\nborder-width: 1px 0 1px 1px;\n- user-select: all;\nvertical-align: middle;\nword-break: break-word;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/page-display-package.less",
"new_path": "src/Bootstrap/less/theme/page-display-package.less",
"diff": "border-color: @panel-footer-bg;\nborder-style: solid;\nborder-width: 1px 0 1px 1px;\n- user-select: all;\nvertical-align: middle;\nword-break: break-word;\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Allow user selection in install command (#8892)
Addresses https://github.com/NuGet/NuGetGallery/issues/8886
Co-authored-by: Loic Sharma <[email protected]> |
455,778 | 01.02.2022 20:41:08 | 28,800 | f2c175946041567506bde93ed0faeb2ab48e31ba | Adds User's MFA status when an API key is created | [
{
"change_type": "MODIFY",
"old_path": "src/NuGet.Services.Entities/Credential.cs",
"new_path": "src/NuGet.Services.Entities/Credential.cs",
"diff": "@@ -84,6 +84,8 @@ public Credential(string type, string value, TimeSpan? expiration)\npublic CredentialRevocationSource? RevocationSourceKey { get; set; }\n+ public bool? WasCreatedSecurely { get; set; }\n+\npublic virtual User User { get; set; }\npublic virtual ICollection<Scope> Scopes { get; set; }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/UsersController.cs",
"new_path": "src/NuGetGallery/Controllers/UsersController.cs",
"diff": "@@ -1053,6 +1053,7 @@ private async Task<CredentialViewModel> GenerateApiKeyInternal(string descriptio\nvar newCredential = _credentialBuilder.CreateApiKey(expiration, out string plaintextApiKey);\nnewCredential.Description = description;\nnewCredential.Scopes = scopes;\n+ newCredential.WasCreatedSecurely = User.WasMultiFactorAuthenticated();\nawait AuthenticationService.AddCredential(user, newCredential);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Compile Include=\"Migrations\\202201242159337_AddUserStatusKeyColumn.designer.cs\">\n<DependentUpon>202201242159337_AddUserStatusKeyColumn.cs</DependentUpon>\n</Compile>\n+ <Compile Include=\"Migrations\\202202010109383_AddCreatedSecurelyToCredentials.cs\" />\n+ <Compile Include=\"Migrations\\202202010109383_AddCreatedSecurelyToCredentials.designer.cs\">\n+ <DependentUpon>202202010109383_AddCreatedSecurelyToCredentials.cs</DependentUpon>\n+ </Compile>\n<Compile Include=\"Modules\\CookieComplianceHttpModule.cs\" />\n<Compile Include=\"RequestModels\\DeletePackagesApiRequest.cs\" />\n<Compile Include=\"RequestModels\\UpdateListedRequest.cs\" />\n<EmbeddedResource Include=\"Migrations\\202201242159337_AddUserStatusKeyColumn.resx\">\n<DependentUpon>202201242159337_AddUserStatusKeyColumn.cs</DependentUpon>\n</EmbeddedResource>\n+ <EmbeddedResource Include=\"Migrations\\202202010109383_AddCreatedSecurelyToCredentials.resx\">\n+ <DependentUpon>202202010109383_AddCreatedSecurelyToCredentials.cs</DependentUpon>\n+ </EmbeddedResource>\n<EmbeddedResource Include=\"OData\\QueryAllowed\\Data\\apiv1packages.json\" />\n<EmbeddedResource Include=\"OData\\QueryAllowed\\Data\\apiv1search.json\" />\n<EmbeddedResource Include=\"OData\\QueryAllowed\\Data\\apiv2getupdates.json\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Controllers/UsersControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Controllers/UsersControllerFacts.cs",
"diff": "@@ -906,6 +906,58 @@ public async Task CreatesNewApiKeyCredential(string description, string[] scopes\nAssert.NotNull(apiKey);\nAssert.Equal(description, apiKey.Description);\nAssert.Equal(expectedScopes.Length, apiKey.Scopes.Count);\n+ Assert.False(apiKey.WasCreatedSecurely);\n+\n+ foreach (var expectedScope in expectedScopes)\n+ {\n+ var actualScope =\n+ apiKey.Scopes.First(x => x.AllowedAction == expectedScope.AllowedAction &&\n+ x.Subject == expectedScope.Subject);\n+ Assert.NotNull(actualScope);\n+ }\n+ }\n+\n+ [MemberData(nameof(CreatesNewApiKeyCredential_Input))]\n+ [Theory]\n+ public async Task CreatesNewApiKeyCredentialSecurely(string description, string[] scopes, string[] subjects, Scope[] expectedScopes)\n+ {\n+ // Arrange\n+ var user = new User(\"the-username\");\n+ GetMock<IUserService>()\n+ .Setup(u => u.FindByUsername(user.Username, false))\n+ .Returns(user);\n+\n+ GetMock<AuthenticationService>()\n+ .Setup(u => u.AddCredential(\n+ It.IsAny<User>(),\n+ It.IsAny<Credential>()))\n+ .Callback<User, Credential>((u, c) =>\n+ {\n+ u.Credentials.Add(c);\n+ c.User = u;\n+ })\n+ .Completes()\n+ .Verifiable();\n+\n+ var controller = GetController<UsersController>();\n+ controller.SetCurrentUser(user);\n+ controller.OwinContext.AddClaim(NuGetClaims.WasMultiFactorAuthenticated);\n+\n+ // Act\n+ await controller.GenerateApiKey(\n+ description: description,\n+ owner: user.Username,\n+ scopes: scopes,\n+ subjects: subjects,\n+ expirationInDays: null);\n+\n+ // Assert\n+ var apiKey = user.Credentials.FirstOrDefault(x => x.Type == CredentialTypes.ApiKey.V4);\n+\n+ Assert.NotNull(apiKey);\n+ Assert.Equal(description, apiKey.Description);\n+ Assert.Equal(expectedScopes.Length, apiKey.Scopes.Count);\n+ Assert.True(apiKey.WasCreatedSecurely);\nforeach (var expectedScope in expectedScopes)\n{\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Adds User's MFA status when an API key is created (#8947) |
455,781 | 07.02.2022 17:29:21 | 25,200 | ed514528f518d640fcc6f73a4eda936be22a8a81 | stop showing tfm when package is deleted or template. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"diff": "@@ -141,6 +141,11 @@ public bool CanDisplayFuGetLink()\nreturn IsFuGetLinksEnabled && !string.IsNullOrEmpty(FuGetUrl) && Available;\n}\n+ public bool CanDisplayTargetFrameworks()\n+ {\n+ return IsDisplayTargetFrameworkEnabled && !Deleted && !IsDotnetNewTemplatePackageType;\n+ }\n+\npublic bool BlockSearchEngineIndexing\n{\nget\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "</h1>\n</div>\n- @if (Model.IsDisplayTargetFrameworkEnabled)\n+ @if (Model.CanDisplayTargetFrameworks())\n{\[email protected](\"_SupportedFrameworksBadges\", Model.PackageFrameworkCompatibility.Badges);\n}\n</a>\n</li>\n- if (!Model.Deleted && Model.IsDisplayTargetFrameworkEnabled)\n+ if (Model.CanDisplayTargetFrameworks())\n{\nactiveBodyTab = activeBodyTab ?? \"supportedframeworks\";\n<li role=\"presentation\" id=\"show-supportedframeworks-container\">\n}\n</div>\n+ if (Model.CanDisplayTargetFrameworks())\n+ {\n<div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"supportedframeworks\" ? \"active\" : \"\")\" id=\"supportedframeworks-tab\">\n- @if (Model.IsDisplayTargetFrameworkEnabled && Model.PackageFrameworkCompatibility.Table.Count > 0)\n+ @if (Model.PackageFrameworkCompatibility.Table.Count > 0)\n{\[email protected](\"_SupportedFrameworksTable\", Model.PackageFrameworkCompatibility.Table)\n}\n<p class=\"frameworktableinfo-text\"><i>Learn more about <a href='https://docs.microsoft.com/dotnet/standard/frameworks' aria-label=\"Learn more about Target Frameworks\">Target Frameworks</a> and <a href='https://docs.microsoft.com/dotnet/standard/net-standard' aria-label=\"Learn more about .NET Standard\">.NET Standard</a>.</i></p>\n}\n</div>\n+ }\n<div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"dependencies\" ? \"active\" : \"\")\" id=\"dependencies-tab\">\n@if (!Model.Deleted)\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"new_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"diff": "@@ -290,6 +290,61 @@ public void CannotDisplayFuGetLinkWhenInvalid(bool isEnabled, string url, bool i\nAssert.False(model.CanDisplayFuGetLink());\n}\n+ [Theory]\n+ [InlineData(true, true, true)]\n+ [InlineData(false, true, true)]\n+ [InlineData(true, false, true)]\n+ [InlineData(true, true, false)]\n+ [InlineData(false, false, true)]\n+ [InlineData(false, true, false)]\n+ [InlineData(false, false, false)]\n+ public void CannotDisplayTargetFrameworksWhenInvalid(bool isEnabled, bool isDeleted, bool isTemplate)\n+ {\n+ var package = new Package\n+ {\n+ Version = \"1.0.0\",\n+ NormalizedVersion = \"1.0.0\",\n+ PackageRegistration = new PackageRegistration\n+ {\n+ Id = \"foo\",\n+ Owners = Enumerable.Empty<User>().ToList(),\n+ Packages = Enumerable.Empty<Package>().ToList()\n+ }\n+ };\n+\n+ var model = CreateDisplayPackageViewModel(package, currentUser: null, packageKeyToDeprecation: null, readmeHtml: null);\n+\n+ model.IsDisplayTargetFrameworkEnabled = isEnabled;\n+ model.Deleted = isDeleted;\n+ model.IsDotnetNewTemplatePackageType = isTemplate;\n+\n+ Assert.False(model.CanDisplayTargetFrameworks());\n+ }\n+\n+ [Fact]\n+ public void CanDisplayTargetFrameworksWhenValid()\n+ {\n+ var package = new Package\n+ {\n+ Version = \"1.0.0\",\n+ NormalizedVersion = \"1.0.0\",\n+ PackageRegistration = new PackageRegistration\n+ {\n+ Id = \"foo\",\n+ Owners = Enumerable.Empty<User>().ToList(),\n+ Packages = Enumerable.Empty<Package>().ToList()\n+ }\n+ };\n+\n+ var model = CreateDisplayPackageViewModel(package, currentUser: null, packageKeyToDeprecation: null, readmeHtml: null);\n+\n+ model.IsDisplayTargetFrameworkEnabled = true;\n+ model.Deleted = false;\n+ model.IsDotnetNewTemplatePackageType = false;\n+\n+ Assert.True(model.CanDisplayTargetFrameworks());\n+ }\n+\n[Theory]\n[InlineData(null, null)]\n[InlineData(\"not a url\", null)]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | stop showing tfm when package is deleted or template. (#8992) |
455,781 | 07.02.2022 17:32:14 | 25,200 | 3e9959370c200571018e289bb8a266a9c495a9c0 | border adjusted and background color fixed. | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -704,6 +704,7 @@ img.reserved-indicator-icon {\n-ms-flex-pack: center;\njustify-content: center;\ndisplay: inline-block;\n+ border: 1px solid #0078d4;\n}\n.framework-badge:not(:last-child) {\nmargin-right: 8px;\n@@ -716,6 +717,7 @@ img.reserved-indicator-icon {\n-ms-flex-pack: center;\njustify-content: center;\ndisplay: inline-block;\n+ border: 1px solid #0078d4;\nbackground: #0078d4;\ncolor: white;\n}\n@@ -728,7 +730,7 @@ img.reserved-indicator-icon {\njustify-content: center;\ndisplay: inline-block;\nborder: 1px solid #0078d4;\n- background: rgba(0, 183, 195, 0.1);\n+ background: rgba(0, 120, 212, 0.1);\n}\n.framework-table {\nmargin-bottom: 30px;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/common-supported-frameworks.less",
"new_path": "src/Bootstrap/less/theme/common-supported-frameworks.less",
"diff": "@badge-dark: #0078d4;\n-@badge-dark-opaque: rgba(0, 183, 195, 0.1);\n+@badge-dark-opaque: rgba(0, 120, 212, 0.1);\n@table-product-width: 232px;\n.framework {\nborder-radius: 2px;\njustify-content: center;\ndisplay: inline-block;\n+ border: 1px solid @badge-dark;\n}\n.framework-badge:not(:last-child) {\n.framework-badge-computed {\n.framework-badge;\n- border: 1px solid @badge-dark;\nbackground: @badge-dark-opaque\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/_SupportedFrameworksTable.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/_SupportedFrameworksTable.cshtml",
"diff": "<span class=\"frameworktableinfo-text\">Compatible target framework(s)</span>\n</div>\n<div>\n- <i class=\"ms-Icon ms-Icon--SquareShape frameworktableinfo-computed-icon\"></i>\n+ <i class=\"ms-Icon ms-Icon--SquareShape frameworktableinfo-computed-icon framework-badge-computed\"></i>\n<span class=\"frameworktableinfo-text\">Additional computed target framework(s)</span>\n</div>\n<span class=\"frameworktableinfo-text\"><i>Learn more about <a href='https://docs.microsoft.com/dotnet/standard/frameworks' aria-label=\"Learn more about Target Frameworks\">Target Frameworks</a> and <a href='https://docs.microsoft.com/dotnet/standard/net-standard' aria-label=\"Learn more about .NET Standard\">.NET Standard</a>.</i></span>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | border adjusted and background color fixed. (#8985) |
455,736 | 07.02.2022 18:37:21 | 28,800 | 6c475d9317e077367a30645ed84bbdc0f41fadda | Allow case insensitive comparison of X-Frame-Options | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.WebUITests.P2/ValidationRuleFindHeaderText.cs",
"new_path": "tests/NuGetGallery.WebUITests.P2/ValidationRuleFindHeaderText.cs",
"diff": "// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\nusing Microsoft.VisualStudio.TestTools.WebTesting;\n+using System;\nnamespace NuGetGallery.FunctionalTests.Helpers\n{\n@@ -12,15 +13,22 @@ public class ValidationRuleFindHeaderText\n: ValidationRule\n{\nprivate readonly string _findText;\n+ private readonly StringComparison _stringComparison;\n- public ValidationRuleFindHeaderText(string findText)\n+ public ValidationRuleFindHeaderText(string findText) : this(findText, StringComparison.Ordinal)\n{\n_findText = findText;\n}\n+ public ValidationRuleFindHeaderText(string findText, StringComparison stringComparison)\n+ {\n+ _findText = findText;\n+ _stringComparison = stringComparison;\n+ }\n+\npublic override void Validate(object sender, ValidationEventArgs e)\n{\n- e.IsValid = e.Response.Headers.ToString().Contains(_findText);\n+ e.IsValid = e.Response.Headers.ToString().IndexOf(_findText, _stringComparison) >= 0;\n}\n}\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Allow case insensitive comparison of X-Frame-Options (#8993) |
455,747 | 16.02.2022 12:30:09 | 28,800 | 4af23cfc739621107e292cfc90edce8ddf82c8ae | Increase blocking time for search indexing | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"diff": "@@ -47,6 +47,8 @@ public class DisplayPackageViewModel : ListPackageItemViewModel\npublic bool HasEmbeddedReadmeFile { get; set; }\npublic PackageDependents PackageDependents { get; set; }\n+ public const int NumberOfDaysToBlockIndexing = 21;\n+\npublic bool HasNewerPrerelease\n{\nget\n@@ -150,7 +152,7 @@ public bool BlockSearchEngineIndexing\n{\nget\n{\n- return !Listed || !Available || (IsRecentPackagesNoIndexEnabled && TotalDaysSinceCreated < 7);\n+ return !Listed || !Available || (IsRecentPackagesNoIndexEnabled && TotalDaysSinceCreated < NumberOfDaysToBlockIndexing);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"new_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"diff": "@@ -42,15 +42,7 @@ public void BlocksUnavailable()\n}\n[Theory]\n- [InlineData(0, true)]\n- [InlineData(1, true)]\n- [InlineData(2, true)]\n- [InlineData(3, true)]\n- [InlineData(4, true)]\n- [InlineData(5, true)]\n- [InlineData(6, true)]\n- [InlineData(7, false)]\n- [InlineData(8, false)]\n+ [MemberData(nameof(BlockSearchEngineIndexingData))]\npublic void BlocksNewSingleVersion(int days, bool expected)\n{\nTarget.TotalDaysSinceCreated = days;\n@@ -74,10 +66,22 @@ public TheBlockSearchEngineIndexingProperty()\nTarget.Listed = true;\nTarget.Available = true;\nTarget.IsRecentPackagesNoIndexEnabled = true;\n- Target.TotalDaysSinceCreated = 14;\n+ Target.TotalDaysSinceCreated = NumberOfDaysToBlockIndexing + 7;\n}\npublic DisplayPackageViewModel Target { get; }\n+\n+ public static IEnumerable<object[]> BlockSearchEngineIndexingData\n+ {\n+ get\n+ {\n+ for (int i = 0; i < NumberOfDaysToBlockIndexing + 5; i++)\n+ {\n+ yield return new object[] { i, i < NumberOfDaysToBlockIndexing };\n+ }\n+ }\n+ }\n+\n}\nprivate DateTime RandomDay()\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Increase blocking time for search indexing (#9006) |
455,781 | 23.02.2022 15:14:35 | 25,200 | b0e5d1640b8998187e264b2fe54e43840aed4daf | EmptyVersion now displays empty string. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/Frameworks/NuGetFrameworkExtensions.cs",
"new_path": "src/NuGetGallery.Core/Frameworks/NuGetFrameworkExtensions.cs",
"diff": "@@ -11,6 +11,11 @@ public static class NuGetFrameworkExtensions\n{\npublic static string GetBadgeVersion(this NuGetFramework framework)\n{\n+ if (framework.Version == FrameworkConstants.EmptyVersion)\n+ {\n+ return string.Empty;\n+ }\n+\nvar builder = new StringBuilder();\nbuilder.Append(framework.Version.Major);\nbuilder.Append(\".\");\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Core.Facts/Frameworks/NuGetFrameworkExtensionsFacts.cs",
"new_path": "tests/NuGetGallery.Core.Facts/Frameworks/NuGetFrameworkExtensionsFacts.cs",
"diff": "@@ -9,8 +9,10 @@ namespace NuGetGallery.Frameworks\npublic class NuGetFrameworkExtensionsFacts\n{\n[Theory]\n- [InlineData(\"\", \"0.0\")]\n- [InlineData(\"0\", \"0.0\")]\n+ [InlineData(\"\", \"\")]\n+ [InlineData(\"0\", \"\")]\n+ [InlineData(\"00\", \"\")]\n+ [InlineData(\"0.0.0.0\", \"\")]\n[InlineData(\"1\", \"1.0\")]\n[InlineData(\"01\", \"0.1\")]\n[InlineData(\"12\", \"1.2\")]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | EmptyVersion now displays empty string. (#9016) |
455,744 | 25.02.2022 15:19:49 | 28,800 | deb2fe7c07ed0f6cf72f098fb99184ce8a183061 | Only allowing lowercase 'tags' element in package metadata. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/Packaging/PackageMetadata.cs",
"new_path": "src/NuGetGallery.Core/Packaging/PackageMetadata.cs",
"diff": "@@ -40,6 +40,8 @@ public class PackageMetadata\n\"serviceable\",\n};\n+ private const string TagsElement = \"tags\";\n+\nprivate readonly Dictionary<string, string> _metadata;\nprivate readonly IReadOnlyCollection<PackageDependencyGroup> _dependencyGroups;\nprivate readonly IReadOnlyCollection<FrameworkSpecificGroup> _frameworkReferenceGroups;\n@@ -237,9 +239,18 @@ public static PackageMetadata FromNuspecReader(NuspecReader nuspecReader, bool s\n}\n}\n- // Reject invalid metadata element names. Today this only rejects element names that collide with\n- // properties generated downstream.\n- var metadataKeys = new HashSet<string>(metadataLookup.Select(g => g.Key));\n+ // Reject invalid metadata element names.\n+ var metadataElements = metadataLookup.Select(g => g.Key).ToList();\n+ var unexpectedTagsCasings = metadataElements.Where(element => element.Equals(TagsElement, StringComparison.OrdinalIgnoreCase) && element != TagsElement).ToList();\n+ if (unexpectedTagsCasings.Any())\n+ {\n+ throw new PackagingException(string.Format(\n+ CoreStrings.Manifest_InvalidMetadataElements,\n+ string.Join(\"', '\", unexpectedTagsCasings.OrderBy(x => x))));\n+ }\n+\n+ // This only rejects element names that collide with properties generated downstream.\n+ var metadataKeys = new HashSet<string>(metadataElements);\nmetadataKeys.IntersectWith(RestrictedMetadataElements);\nif (metadataKeys.Any())\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Core.Facts/Packaging/PackageMetadataFacts.cs",
"new_path": "tests/NuGetGallery.Core.Facts/Packaging/PackageMetadataFacts.cs",
"diff": "@@ -338,6 +338,48 @@ public void DoesNotThrowWhenInvalidDependencyVersionRangeDetectedAndParsingIsNot\nAssert.Equal(VersionRange.All, dependency.VersionRange);\n}\n+ [Theory]\n+ [InlineData(\"tagS\")]\n+ [InlineData(\"taGs\")]\n+ [InlineData(\"taGS\")]\n+ [InlineData(\"tAgs\")]\n+ [InlineData(\"tAgS\")]\n+ [InlineData(\"tAGs\")]\n+ [InlineData(\"tAGS\")]\n+ [InlineData(\"Tags\")]\n+ [InlineData(\"TagS\")]\n+ [InlineData(\"TaGs\")]\n+ [InlineData(\"TaGS\")]\n+ [InlineData(\"TAgs\")]\n+ [InlineData(\"TAgS\")]\n+ [InlineData(\"TAGs\")]\n+ [InlineData(\"TAGS\")]\n+ public void ThrowsForUppercaseTags(string tags)\n+ {\n+ var packageStream = CreateTestPackageStreamWithMetadataElementName(tags, \"foo bar baz\");\n+ var nupkg = new PackageArchiveReader(packageStream, leaveStreamOpen: false);\n+ var nuspec = nupkg.GetNuspecReader();\n+\n+ var ex = Assert.Throws<PackagingException>(() => PackageMetadata.FromNuspecReader(\n+ nuspec,\n+ strict: false));\n+ Assert.Equal($\"The package manifest contains invalid metadata elements: '{tags}'\", ex.Message);\n+ }\n+\n+ [Fact]\n+ public void DoesntThrowForLowercaseTags()\n+ {\n+ var packageStream = CreateTestPackageStreamWithMetadataElementName(\"tags\", \"foo bar baz\");\n+ var nupkg = new PackageArchiveReader(packageStream, leaveStreamOpen: false);\n+ var nuspec = nupkg.GetNuspecReader();\n+\n+ var ex = Record.Exception(() => PackageMetadata.FromNuspecReader(\n+ nuspec,\n+ strict: false));\n+\n+ Assert.Null(ex);\n+ }\n+\nprivate static Stream CreateTestPackageStream()\n{\nreturn CreateTestPackageStream(@\"<?xml version=\"\"1.0\"\"?>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Only allowing lowercase 'tags' element in package metadata. (#9022) |
455,781 | 28.02.2022 14:37:05 | 25,200 | cf887bd97bc94c276dc1e90b0c92322f28bbcab4 | [TFM Display] Fix font issue for safari. | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -686,12 +686,10 @@ img.reserved-indicator-icon {\npadding-bottom: 3em;\n}\n.framework {\n- font-family: Segoe UI;\nfont-size: 14px;\nline-height: 20px;\n}\n.framework-badges {\n- font-family: Segoe UI;\nfont-size: 14px;\nline-height: 20px;\nmargin-bottom: 14px;\n@@ -734,7 +732,6 @@ img.reserved-indicator-icon {\n}\n.framework-table {\nmargin-bottom: 30px;\n- font-family: Segoe UI;\nfont-size: 14px;\nline-height: 20px;\nwidth: 100%;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/common-supported-frameworks.less",
"new_path": "src/Bootstrap/less/theme/common-supported-frameworks.less",
"diff": "@table-product-width: 232px;\n.framework {\n- font-family: Segoe UI;\nfont-size: 14px;\nline-height: 20px;\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [TFM Display] Fix font issue for safari. (#9011) |
455,781 | 28.02.2022 14:37:35 | 25,200 | c8747f85b23379ef0cfc025871dd141076efc2b1 | [TFM Display] Added tooltip/popover for badges. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Scripts/gallery/common.js",
"new_path": "src/NuGetGallery/Scripts/gallery/common.js",
"diff": "setTimeout(function () {\npopoverElement.popover('destroy');\n},\n- 1000);\n+ 2000);\n});\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Scripts/gallery/page-display-package.js",
"new_path": "src/NuGetGallery/Scripts/gallery/page-display-package.js",
"diff": "}\n$(\".reserved-indicator\").each(window.nuget.setPopovers);\n+ $(\".framework-badge-asset\").each(window.nuget.setPopovers);\n$(\".package-warning-icon\").each(window.nuget.setPopovers);\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Strings.Designer.cs",
"new_path": "src/NuGetGallery/Strings.Designer.cs",
"diff": "@@ -2084,6 +2084,24 @@ public class Strings {\n}\n}\n+ /// <summary>\n+ /// Looks up a localized string similar to This package is compatible with all versions of this framework..\n+ /// </summary>\n+ public static string SupportedFrameworks_EmptyVersionTooltip {\n+ get {\n+ return ResourceManager.GetString(\"SupportedFrameworks_EmptyVersionTooltip\", resourceCulture);\n+ }\n+ }\n+\n+ /// <summary>\n+ /// Looks up a localized string similar to This package is compatible with this framework or higher..\n+ /// </summary>\n+ public static string SupportedFrameworks_Tooltip {\n+ get {\n+ return ResourceManager.GetString(\"SupportedFrameworks_Tooltip\", resourceCulture);\n+ }\n+ }\n+\n/// <summary>\n/// Looks up a localized string similar to Your support request has been sent to the gallery operators..\n/// </summary>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Strings.resx",
"new_path": "src/NuGetGallery/Strings.resx",
"diff": "@@ -1224,4 +1224,10 @@ The {1} Team</value>\n<data name=\"ApiKeyOwnerLocked\" xml:space=\"preserve\">\n<value>The specified API key is scoped to an owner that is locked. Please contact [email protected].</value>\n</data>\n+ <data name=\"SupportedFrameworks_EmptyVersionTooltip\" xml:space=\"preserve\">\n+ <value>This package is compatible with all versions of this framework.</value>\n+ </data>\n+ <data name=\"SupportedFrameworks_Tooltip\" xml:space=\"preserve\">\n+ <value>This package is compatible with this framework or higher.</value>\n+ </data>\n</root>\n\\ No newline at end of file\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [TFM Display] Added tooltip/popover for badges. (#9020) |
455,754 | 01.03.2022 08:33:13 | -36,000 | 359a21debe3f50e42ba6dc91105ae179f08a8ed4 | Improve inclusiveness of language used in code | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Authentication/AuthenticationServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Authentication/AuthenticationServiceFacts.cs",
"diff": "@@ -2448,9 +2448,9 @@ public static bool VerifyPasswordHash(string hash, string algorithm, string pass\nvar validator = CredentialValidator.Validators[algorithm];\nbool canAuthenticate = validator(password, new Credential { Value = hash });\n- bool sanity = validator(\"not_the_password\", new Credential { Value = hash });\n+ bool confidenceCheck = validator(\"not_the_password\", new Credential { Value = hash });\n- return canAuthenticate && !sanity;\n+ return canAuthenticate && !confidenceCheck;\n}\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.FunctionalTests/Commandline/NuGetCommandLineTests.cs",
"new_path": "tests/NuGetGallery.FunctionalTests/Commandline/NuGetCommandLineTests.cs",
"diff": "@@ -155,7 +155,7 @@ public async Task LockedPackageCannotBeModified()\nAssert.Contains(\"locked\", processResult.StandardError);\n// 2. Try unlisting the locked package\n- // Perform a sanity check that the package exists\n+ // Perform a spot check that the package exists\nawait _clientSdkHelper.VerifyPackageExistsInV2Async(LockedPackageId, LockedPackageVersion);\nTestOutputHelper.WriteLine($\"5. Trying to unlist locked package '{LockedPackageId}', version '{LockedPackageVersion}'.\");\nprocessResult = await _commandlineHelper.DeletePackageAsync(LockedPackageId, LockedPackageVersion, UrlHelper.V2FeedPushSourceUrl);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.FunctionalTests/Statistics/PackageStatisticsTests.cs",
"new_path": "tests/NuGetGallery.FunctionalTests/Statistics/PackageStatisticsTests.cs",
"diff": "@@ -18,7 +18,7 @@ public class PackageStatisticsTests\n[Description(\"Verify the webresponse for stats/downloads/last6weeks/ returns all 6 fields\")]\n[Priority(1)]\n[Category(\"P1Tests\")]\n- public async Task PackageFeedStatsSanityTest()\n+ public async Task PackageFeedStatsConfidenceTest()\n{\nvar requestUrl = UrlHelper.V2FeedRootUrl + @\"stats/downloads/last6weeks/\";\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Improve inclusiveness of language used in code |
455,778 | 08.03.2022 14:03:38 | 28,800 | 75a22450447affe9edef7dcc36be4a8ab3b9172d | [A11y] Improved contrast of buttons when in tab focus mode | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap.css",
"new_path": "src/Bootstrap/dist/css/bootstrap.css",
"diff": "@@ -2383,7 +2383,6 @@ fieldset[disabled] a.btn {\n.btn-default:focus,\n.btn-default.focus {\ncolor: #333;\n- background-color: #e6e6e6;\nborder-color: #3f3f3f;\n}\n.btn-default:hover {\n@@ -2436,7 +2435,6 @@ fieldset[disabled] .btn-default.focus {\n.btn-primary:focus,\n.btn-primary.focus {\ncolor: #fff;\n- background-color: #286090;\nborder-color: #122b40;\n}\n.btn-primary:hover {\n@@ -2489,7 +2487,6 @@ fieldset[disabled] .btn-primary.focus {\n.btn-success:focus,\n.btn-success.focus {\ncolor: #fff;\n- background-color: #449d44;\nborder-color: #255625;\n}\n.btn-success:hover {\n@@ -2542,7 +2539,6 @@ fieldset[disabled] .btn-success.focus {\n.btn-info:focus,\n.btn-info.focus {\ncolor: #fff;\n- background-color: #31b0d5;\nborder-color: #1b6d85;\n}\n.btn-info:hover {\n@@ -2595,7 +2591,6 @@ fieldset[disabled] .btn-info.focus {\n.btn-warning:focus,\n.btn-warning.focus {\ncolor: #fff;\n- background-color: #a56000;\nborder-color: #3f2500;\n}\n.btn-warning:hover {\n@@ -2648,7 +2643,6 @@ fieldset[disabled] .btn-warning.focus {\n.btn-danger:focus,\n.btn-danger.focus {\ncolor: #fff;\n- background-color: #ac0017;\nborder-color: #460009;\n}\n.btn-danger:hover {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/mixins/buttons.less",
"new_path": "src/Bootstrap/less/mixins/buttons.less",
"diff": "&:focus,\n&.focus {\ncolor: @color;\n- background-color: darken(@background, 10%);\nborder-color: darken(@border, 25%);\n}\n&:hover {\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [A11y] Improved contrast of buttons when in tab focus mode (#9031) |
455,778 | 08.03.2022 14:41:58 | 28,800 | 7f0de4e5e254d0bf5485942662f7f289961135e8 | [A11y] Improved contrast of focus outline on elements in the header and footer | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -68,6 +68,10 @@ body h3 {\n.footer a {\ncolor: #e3ebf1;\n}\n+.footer a:focus {\n+ outline: 3px solid white;\n+ outline-offset: 2px;\n+}\n.footer .footer-release-info {\nfont-size: 0.85em;\nmargin-top: 20px;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap.css",
"new_path": "src/Bootstrap/dist/css/bootstrap.css",
"diff": "@@ -3446,6 +3446,10 @@ select[multiple].input-group-sm > .input-group-btn > .btn {\nborder-radius: 0px;\n}\n}\n+.navbar a:focus {\n+ outline: 4px solid white;\n+ outline-offset: -2px;\n+}\n@media (min-width: 768px) {\n.navbar-header {\nfloat: left;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/navbar.less",
"new_path": "src/Bootstrap/less/navbar.less",
"diff": "@media (min-width: @grid-float-breakpoint) {\nborder-radius: @navbar-border-radius;\n}\n+\n+ a:focus {\n+ outline: 4px solid white;\n+ outline-offset: -2px;\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/base.less",
"new_path": "src/Bootstrap/less/theme/base.less",
"diff": "@@ -83,6 +83,11 @@ body {\na {\ncolor: @panel-footer-color;\n+\n+ &:focus {\n+ outline: 3px solid white;\n+ outline-offset: 2px;\n+ }\n}\n.footer-release-info {\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [A11y] Improved contrast of focus outline on elements in the header and footer (#9032) |
455,781 | 11.03.2022 15:20:38 | 28,800 | 07b85d1a2967305a08e60491a79eb06ad661cedc | add red start for required label in form groups. | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -338,6 +338,10 @@ img.reserved-indicator-icon {\n.sortable {\ncursor: pointer;\n}\n+.form-group label.required::after {\n+ color: red;\n+ content: \" *\";\n+}\n@media (max-width: 767.9px) {\n.hidden-xs {\ndisplay: none !important;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/base.less",
"new_path": "src/Bootstrap/less/theme/base.less",
"diff": "@@ -426,6 +426,11 @@ img.reserved-indicator-icon {\ncursor: pointer;\n}\n+.form-group label.required::after {\n+ color: red;\n+ content: \" *\";\n+}\n+\n// Workaround. See https://github.com/NuGet/NuGetGallery/issues/8264\n@media (max-width: 767.9px) {\n.hidden-xs {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ExtensionMethods.cs",
"new_path": "src/NuGetGallery/ExtensionMethods.cs",
"diff": "@@ -124,7 +124,7 @@ public static IQueryable<T> SortBy<T>(this IQueryable<T> source, string sortExpr\nreturn html.LabelFor(expression, labelText, new\n{\nid = $\"{propertyName}-label\",\n- @class = \"required\"\n+ @class = \"control-label required\"\n});\n}\nelse\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Users/ForgotPassword.cshtml",
"new_path": "src/NuGetGallery/Views/Users/ForgotPassword.cshtml",
"diff": "@Html.AntiForgeryToken()\n<div class=\"form-group @Html.HasErrorFor(m => m.Email)\">\n- @Html.ShowLabelFor(m => m.Email)\n+ @Html.ShowLabelFor(m => m.Email, isrequired: true)\[email protected](m => m.Email)\[email protected](m => m.Email)\n</div>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | add red start for required label in form groups. |
455,736 | 14.03.2022 09:13:11 | 25,200 | 875309c581c4a43279d55fac198258b41b9aa8c4 | Remove dependency on RazorEngine in tests to fix Component Governance error | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj",
"new_path": "tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj",
"diff": "<PackageReference Include=\"Moq\">\n<Version>4.8.2</Version>\n</PackageReference>\n- <PackageReference Include=\"RazorEngine\">\n- <Version>3.10.0</Version>\n- </PackageReference>\n<PackageReference Include=\"xunit.abstractions\">\n<Version>2.0.1</Version>\n</PackageReference>\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Views/Packages/ValidationIssueFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Views/Packages/ValidationIssueFacts.cs",
"diff": "using System;\nusing System.Collections.Generic;\n+using System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing NuGet.Services.Validation;\nusing NuGet.Services.Validation.Issues;\n-using RazorEngine.Configuration;\n-using RazorEngine.Templating;\nusing Xunit;\nusing Xunit.Abstractions;\n@@ -24,14 +23,15 @@ public ValidationIssueFacts(ITestOutputHelper output)\n_output = output;\n}\n+ [Theory]\n[MemberData(nameof(HasACaseForAllIssueTypesTestData))]\npublic void HasACaseForAllIssueTypes(ValidationIssue issue)\n{\n// Arrange & Act\n- var html = CompileView(issue);\n+ var template = GetTemplate();\n// Assert\n- Assert.DoesNotContain(UnknownIssueMessage, html);\n+ Assert.Contains(\"case ValidationIssueCode.\" + issue.IssueCode.ToString(), template);\n}\n[Theory]\n@@ -39,10 +39,10 @@ public void HasACaseForAllIssueTypes(ValidationIssue issue)\npublic void HasExpectedMessageForUnknownIssue(ValidationIssue issue)\n{\n// Arrange & Act\n- var html = CompileView(issue);\n+ var template = GetTemplate();\n// Assert\n- Assert.Equal(UnknownIssueMessage, html);\n+ Assert.DoesNotContain(issue.IssueCode.ToString(), template);\n}\n[Theory]\n@@ -57,34 +57,13 @@ public void AllIssueCodesAreHandled(ValidationIssueCode issueCode)\nAssert.Contains(issueCode, issueCodes);\n}\n- private string CompileView(ValidationIssue issue)\n- {\n- // Arrange\n- var config = new TemplateServiceConfiguration\n+ private string GetTemplate()\n{\n- TemplateManager = new EmbeddedResourceTemplateManager(GetType()),\n- DisableTempFileLocking = true,\n- };\n-\n- using (var razorEngine = RazorEngineService.Create(config))\n+ using (var stream = GetType().Assembly.GetManifestResourceStream(\"NuGetGallery.Views.Packages._ValidationIssue.cshtml\"))\n+ using (var streamReader = new StreamReader(stream))\n{\n- _output.WriteLine($\"Issue code: {issue.IssueCode}\");\n- _output.WriteLine($\"Serialized: {issue.Serialize()}\");\n-\n- // Act\n- var html = CollapseWhitespace(razorEngine.RunCompile(\"_ValidationIssue\", model: issue))\n- .Trim();\n-\n- _output.WriteLine($\"HTML:\");\n- _output.WriteLine(html);\n-\n- return html;\n- }\n+ return streamReader.ReadToEnd();\n}\n-\n- private string CollapseWhitespace(string input)\n- {\n- return Regex.Replace(input, @\"\\s+\", \" \");\n}\npublic static IEnumerable<ValidationIssue> KnownValidationIssues\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Remove dependency on RazorEngine in tests to fix Component Governance error (#9050) |
455,736 | 14.03.2022 15:44:34 | 25,200 | 5e1aeab14e06664e18c463fd2fdebd2f4f26d61b | Add namespace and package prefix search tools to namespace reservation admin panel
Progress on | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/Controllers/ReservedNamespaceController.cs",
"new_path": "src/NuGetGallery/Areas/Admin/Controllers/ReservedNamespaceController.cs",
"diff": "// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\nusing System;\n+using System.Data.Entity;\nusing System.Linq;\nusing System.Web.Mvc;\nusing System.Threading.Tasks;\n@@ -13,19 +14,23 @@ namespace NuGetGallery.Areas.Admin.Controllers\n{\npublic class ReservedNamespaceController : AdminControllerBase\n{\n- private IReservedNamespaceService _reservedNamespaceService;\n+ private readonly IReservedNamespaceService _reservedNamespaceService;\n+ private readonly IEntityRepository<PackageRegistration> _packageRegistrations;\nprotected ReservedNamespaceController() { }\n- public ReservedNamespaceController(IReservedNamespaceService reservedNamespaceService)\n+ public ReservedNamespaceController(\n+ IReservedNamespaceService reservedNamespaceService,\n+ IEntityRepository<PackageRegistration> packageRegistrations)\n{\n_reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));\n+ _packageRegistrations = packageRegistrations ?? throw new ArgumentNullException(nameof(packageRegistrations));\n}\n[HttpGet]\npublic ActionResult Index()\n{\n- return View();\n+ return View(new ReservedNamespaceViewModel());\n}\n[HttpGet]\n@@ -49,6 +54,37 @@ public JsonResult SearchPrefix(string query)\nreturn Json(results, JsonRequestBehavior.AllowGet);\n}\n+ [HttpGet]\n+ public ActionResult FindNamespacesByPrefix(string prefix)\n+ {\n+ var namespaces = _reservedNamespaceService\n+ .FindAllReservedNamespacesForPrefix(prefix, getExactMatches: false)\n+ .OrderBy(x => x.Value)\n+ .ThenBy(x => x.IsPrefix)\n+ .ToList();\n+ var model = new ReservedNamespaceViewModel { ReservedNamespacesQuery = prefix, ReservedNamespaces = namespaces };\n+ return View(nameof(Index), model);\n+ }\n+\n+ [HttpGet]\n+ public ActionResult FindPackagesByPrefix(string prefix)\n+ {\n+ if (string.IsNullOrWhiteSpace(prefix))\n+ {\n+ return RedirectToAction(nameof(Index));\n+ }\n+\n+ var packageRegistrations = _packageRegistrations\n+ .GetAll()\n+ .Include(x => x.Owners)\n+ .Include(x => x.ReservedNamespaces)\n+ .Where(x => x.Id.StartsWith(prefix))\n+ .OrderBy(x => x.Id)\n+ .ToList();\n+ var model = new ReservedNamespaceViewModel { PackageRegistrationsQuery = prefix, PackageRegistrations = packageRegistrations };\n+ return View(nameof(Index), model);\n+ }\n+\n[HttpPost]\n[ValidateAntiForgeryToken]\npublic async Task<JsonResult> AddNamespace(ReservedNamespace newNamespace)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/Views/ReservedNamespace/Index.cshtml",
"new_path": "src/NuGetGallery/Areas/Admin/Views/ReservedNamespace/Index.cshtml",
"diff": "@ViewHelpers.AjaxAntiForgeryToken(Html)\n<section role=\"main\" class=\"container main-container\">\n+\n+ <div class=\"row\">\n+ <div class=\"col-xs-12\">\n<div class=\"message-container\" data-bind=\"visible: message\">\[email protected](@<text><span class=\"message\" data-bind=\"text: message\"></span></text>)\n</div>\n- <h2>Reserve Namespace</h2>\n+ <h2>Reserve namespace</h2>\n<form data-bind=\"submit: prefixSearch\">\n<div class=\"form-horizontal\">\n- <input type=\"text\" placeholder=\"Search for a prefix\" autocomplete=\"on\" autofocus data-bind=\"value: prefixSearchQuery\" />\n- <input type=\"submit\" value=\"Search Prefix\" title=\"Search Prefix\" />\n+ <input type=\"text\" placeholder=\"Specific namespace\" autocomplete=\"on\" autofocus data-bind=\"value: prefixSearchQuery\" />\n+ <input type=\"submit\" value=\"Search\" title=\"Search\" />\n</div>\n- </form><br />\n+ </form>\n+ <br />\n<div data-bind=\"visible: allPrefixResults().length > 0\">\n@using (Html.BeginForm())\n</div>\n}\n</div>\n+ </div>\n+ </div>\n+\n+ <div class=\"row\">\n+ <div class=\"col-xs-12\">\n+ <h2>Find namespaces by prefix</h2>\n+ <form method=\"get\" action=\"@Url.Action(\"FindNamespacesByPrefix\")\">\n+ <div class=\"form-horizontal\">\n+ <input type=\"text\" placeholder=\"Namespace prefix\" autocomplete=\"on\" name=\"prefix\" value=\"@Model.ReservedNamespacesQuery\" />\n+ <input type=\"submit\" value=\"Search\" />\n+ </div>\n+ </form>\n+ <br />\n+ @if (Model.ReservedNamespaces != null)\n+ {\n+ if (Model.ReservedNamespaces.Count == 0)\n+ {\n+ <p>No reserved namespaces found.</p>\n+ }\n+ else\n+ {\n+ <table class=\"table\">\n+ <thead>\n+ <tr>\n+ <th>Value</th>\n+ <th>IsSharedNamespace</th>\n+ <th>IsPrefix</th>\n+ <th>Owners</th>\n+ </tr>\n+ </thead>\n+ <tbody>\n+ @foreach (var rn in Model.ReservedNamespaces)\n+ {\n+ <tr>\n+ <td>@(rn.Value + (rn.IsPrefix ? \"*\" : \"\"))</td>\n+ <td>@rn.IsSharedNamespace</td>\n+ <td>@rn.IsPrefix</td>\n+ <td>\n+ @foreach (var owner in rn.Owners)\n+ {\n+ <a href=\"@Url.User(owner)\">@owner.Username</a>\n+ }\n+ </td>\n+ </tr>\n+ }\n+ </tbody>\n+ </table>\n+ }\n+ }\n+ </div>\n+ </div>\n+\n+ <div class=\"row\">\n+ <div class=\"col-xs-12\">\n+ <h2>Find package registrations by prefix</h2>\n+ <form method=\"get\" action=\"@Url.Action(\"FindPackagesByPrefix\")\">\n+ <div class=\"form-horizontal\">\n+ <input type=\"text\" placeholder=\"Package ID prefix\" autocomplete=\"on\" name=\"prefix\" value=\"@Model.PackageRegistrationsQuery\" />\n+ <input type=\"submit\" value=\"Search\" />\n+ </div>\n+ </form>\n+ <br />\n+ @if (Model.PackageRegistrations != null)\n+ {\n+ if (Model.PackageRegistrations.Count == 0)\n+ {\n+ <p>No package registrations found.</p>\n+ }\n+ else\n+ {\n+ <table class=\"table\">\n+ <thead>\n+ <tr>\n+ <th>Package ID</th>\n+ <th>IsVerified</th>\n+ <th>Download count</th>\n+ <th>Owners</th>\n+ <th>Reserved Namespaces</th>\n+ </tr>\n+ </thead>\n+ <tbody>\n+ @foreach (var pr in Model.PackageRegistrations)\n+ {\n+ <tr>\n+ <td><a href=\"@Url.Package(pr.Id)\">@pr.Id</a></td>\n+ <td>\n+ @if (pr.IsVerified)\n+ {\n+ <img class=\"img-responsive\"\n+ src=\"~/Content/gallery/img/reserved-indicator.svg\"\n+ alt=\"Reserved namespace icon\"\n+ width=\"24\" height=\"24\"\n+ @ViewHelpers.ImageFallback(Url.Absolute(\"~/Content/gallery/img/reserved-indicator-256x256.png\"))\n+ title=\"@Strings.ReservedNamespace_ReservedIndicatorTooltip\" />\n+ }\n+ </td>\n+ <td>@pr.DownloadCount.ToNuGetNumberString()</td>\n+ <td>\n+ @foreach (var owner in pr.Owners)\n+ {\n+ <a href=\"@Url.User(owner)\">@owner.Username</a>\n+ }\n+ </td>\n+ <td>\n+ @foreach (var rn in pr.ReservedNamespaces)\n+ {\n+ @(rn.Value + (rn.IsPrefix ? \"* \" : \" \"))\n+ }\n+ </td>\n+ </tr>\n+ }\n+ </tbody>\n+ </table>\n+ }\n+ }\n+ </div>\n+ </div>\n</section>\n@section BottomScripts {\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Areas/Admin/Controllers/ReservedNamespaceControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Areas/Admin/Controllers/ReservedNamespaceControllerFacts.cs",
"diff": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n+using System.Threading.Tasks;\nusing System.Web.Mvc;\n+using Moq;\nusing NuGet.Services.Entities;\nusing NuGetGallery.Areas.Admin.ViewModels;\nusing NuGetGallery.TestUtils;\n@@ -17,8 +19,11 @@ public class ReservedNamespaceControllerFacts\n[Fact]\npublic void CtorThrowsIfReservedNamespaceServiceNull()\n{\n+ // Arrange.\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+\n// Act & Assert.\n- Assert.Throws<ArgumentNullException>(() => new ReservedNamespaceController(null));\n+ Assert.Throws<ArgumentNullException>(() => new ReservedNamespaceController(null, packageRegistrations.Object));\n}\n[Theory]\n@@ -31,7 +36,8 @@ public void SearchFindsMatchingPrefixes(string query, int foundCount, int notFou\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act.\nJsonResult jsonResult = controller.SearchPrefix(query);\n@@ -46,13 +52,14 @@ public void SearchFindsMatchingPrefixes(string query, int foundCount, int notFou\n}\n[Fact]\n- public async void AddNamespaceDoesNotReturnSuccessForInvalidNamespaces()\n+ public async Task AddNamespaceDoesNotReturnSuccessForInvalidNamespaces()\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\nvar newNamespace = namespaces.First();\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.AddNamespace(newNamespace);\n@@ -65,13 +72,14 @@ public async void AddNamespaceDoesNotReturnSuccessForInvalidNamespaces()\n[InlineData(\"abc\", false, false)]\n[InlineData(\"microsoft.aspnet.mvc.\", false, true)]\n[InlineData(\"microsoft.aspnet.extention.\", true, true)]\n- public async void AddNamespaceSuccessfullyAddsNewNamespaces(string value, bool isSharedNamespace, bool isPrefix)\n+ public async Task AddNamespaceSuccessfullyAddsNewNamespaces(string value, bool isSharedNamespace, bool isPrefix)\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\nvar newNamespace = new ReservedNamespace(value, isSharedNamespace, isPrefix);\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.AddNamespace(newNamespace);\n@@ -84,14 +92,15 @@ public async void AddNamespaceSuccessfullyAddsNewNamespaces(string value, bool i\n[InlineData(\"\")]\n[InlineData(\" \")]\n[InlineData(\"abc\")]\n- public async void RemoveNamespaceDoesNotReturnSuccessForInvalidNamespaces(string value)\n+ public async Task RemoveNamespaceDoesNotReturnSuccessForInvalidNamespaces(string value)\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\nvar invalidNamespace = new ReservedNamespace();\ninvalidNamespace.Value = value;\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.RemoveNamespace(invalidNamespace);\n@@ -103,13 +112,14 @@ public async void RemoveNamespaceDoesNotReturnSuccessForInvalidNamespaces(string\n[InlineData(\"microsoft.\")]\n[InlineData(\"jquery\")]\n[InlineData(\"jQuery.Extentions.\")]\n- public async void RemoveNamespaceSuccesfullyDeletesNamespace(string value)\n+ public async Task RemoveNamespaceSuccesfullyDeletesNamespace(string value)\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\nvar existingNamespace = namespaces.Where(rn => rn.Value.Equals(value, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.RemoveNamespace(existingNamespace);\n@@ -126,7 +136,7 @@ public async void RemoveNamespaceSuccesfullyDeletesNamespace(string value)\n[InlineData(\"microsoft.\", \"\")]\n[InlineData(\"microsoft.\", \" \")]\n[InlineData(\"microsoft.\", \"nonexistentuser\")]\n- public async void AddOwnerDoesNotReturnSuccessForInvalidData(string value, string username)\n+ public async Task AddOwnerDoesNotReturnSuccessForInvalidData(string value, string username)\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\n@@ -134,7 +144,8 @@ public async void AddOwnerDoesNotReturnSuccessForInvalidData(string value, strin\nvar existingNamespace = namespaces.Where(rn => rn.Value.Equals(value, StringComparison.OrdinalIgnoreCase)).FirstOrDefault() ?? new ReservedNamespace();\nexistingNamespace.Value = value;\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces, users: allUsers);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.AddOwner(existingNamespace, username);\n@@ -146,14 +157,15 @@ public async void AddOwnerDoesNotReturnSuccessForInvalidData(string value, strin\n[InlineData(\"microsoft.\", \"test1\")]\n[InlineData(\"jquery\", \"test1\")]\n[InlineData(\"jQuery.Extentions.\", \"test1\")]\n- public async void AddOwnerSuccessfullyAddsOwnerToReservedNamespace(string value, string username)\n+ public async Task AddOwnerSuccessfullyAddsOwnerToReservedNamespace(string value, string username)\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\nvar allUsers = ReservedNamespaceServiceTestData.GetTestUsers();\nvar existingNamespace = namespaces.Where(rn => rn.Value.Equals(value, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces, users: allUsers);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.AddOwner(existingNamespace, username);\n@@ -171,7 +183,7 @@ public async void AddOwnerSuccessfullyAddsOwnerToReservedNamespace(string value,\n[InlineData(\"microsoft.\", \" \")]\n[InlineData(\"microsoft.\", \"nonexistentuser\")]\n[InlineData(\"microsoft.\", \"test1\")]\n- public async void RemoveOwnerDoesNotReturnSuccessForInvalidData(string value, string username)\n+ public async Task RemoveOwnerDoesNotReturnSuccessForInvalidData(string value, string username)\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\n@@ -179,7 +191,8 @@ public async void RemoveOwnerDoesNotReturnSuccessForInvalidData(string value, st\nvar existingNamespace = namespaces.Where(rn => rn.Value.Equals(value, StringComparison.OrdinalIgnoreCase)).FirstOrDefault() ?? new ReservedNamespace();\nexistingNamespace.Value = value;\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces, users: allUsers);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.RemoveOwner(existingNamespace, username);\n@@ -191,7 +204,7 @@ public async void RemoveOwnerDoesNotReturnSuccessForInvalidData(string value, st\n[InlineData(\"microsoft.\")]\n[InlineData(\"jquery\")]\n[InlineData(\"jQuery.Extentions.\")]\n- public async void RemoveOwnerSuccessfullyRemovesOwnerToReservedNamespace(string value)\n+ public async Task RemoveOwnerSuccessfullyRemovesOwnerToReservedNamespace(string value)\n{\n// Arrange.\nvar namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\n@@ -200,12 +213,56 @@ public async void RemoveOwnerSuccessfullyRemovesOwnerToReservedNamespace(string\nvar existingNamespace = namespaces.Where(rn => rn.Value.Equals(value, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();\nexistingNamespace.Owners.Add(testUser);\nvar reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces, users: allUsers);\n- var controller = new ReservedNamespaceController(reservedNamespaceService);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n// Act & Assert.\nJsonResult result = await controller.RemoveOwner(existingNamespace, testUser.Username);\ndynamic data = result.Data;\nAssert.True(data.success);\n}\n+\n+ [Fact]\n+ public void FindsReservedNamespacesStartingWithValue()\n+ {\n+ // Arrange.\n+ var namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\n+ var allUsers = ReservedNamespaceServiceTestData.GetTestUsers();\n+ var reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces, users: allUsers);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n+\n+ // Act\n+ var result = controller.FindNamespacesByPrefix(\"m\");\n+\n+ // Assert\n+ var viewResult = Assert.IsType<ViewResult>(result);\n+ var model = Assert.IsType<ReservedNamespaceViewModel>(viewResult.Model);\n+ Assert.Equal(2, model.ReservedNamespaces.Count);\n+ Assert.Equal(\"Microsoft.\", model.ReservedNamespaces[0].Value);\n+ Assert.Equal(\"Microsoft.Aspnet.\", model.ReservedNamespaces[1].Value);\n+ }\n+\n+ [Fact]\n+ public void FindsPackageRegistrationsStartingWithValue()\n+ {\n+ // Arrange.\n+ var namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\n+ var allUsers = ReservedNamespaceServiceTestData.GetTestUsers();\n+ var reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces, users: allUsers);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ packageRegistrations\n+ .Setup(x => x.GetAll())\n+ .Returns(() => new[] { new PackageRegistration { Id = \"foo\" }, new PackageRegistration { Id = \"bar\" } }.AsQueryable());\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n+\n+ // Act\n+ var result = controller.FindPackagesByPrefix(\"f\");\n+\n+ // Assert\n+ var viewResult = Assert.IsType<ViewResult>(result);\n+ var model = Assert.IsType<ReservedNamespaceViewModel>(viewResult.Model);\n+ Assert.Equal(\"foo\", Assert.Single(model.PackageRegistrations).Id);\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Controllers/StatisticsControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Controllers/StatisticsControllerFacts.cs",
"diff": "@@ -348,7 +348,7 @@ public async Task StatisticsHomePage_PackageVersions_ValidateReportStructureAndA\n}\n[Fact]\n- public async void StatisticsHomePage_Per_Package_ValidateModel()\n+ public async Task StatisticsHomePage_Per_Package_ValidateModel()\n{\nstring PackageId = \"A\";\n@@ -531,7 +531,7 @@ public async Task StatisticsHomePage_Per_Package_ValidateReportStructureAndAvail\n}\n[Fact]\n- public async void Statistics_By_Client_Operation_ValidateModel()\n+ public async Task Statistics_By_Client_Operation_ValidateModel()\n{\nstring PackageId = \"A\";\nstring PackageVersion = \"2.0\";\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Queries/AutocompleteDatabasePackageIdsQueryFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Queries/AutocompleteDatabasePackageIdsQueryFacts.cs",
"diff": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n+using System.Threading.Tasks;\nusing Moq;\nusing NuGet.Services.Entities;\nusing Xunit;\n@@ -24,7 +25,7 @@ public void InvalidArgumentsThrowsArgumentNullException()\npublic class Execute : FactBase\n{\n[Fact]\n- public async void ValidPackageIdShouldReturnIdsWhosePackagesAreListed()\n+ public async Task ValidPackageIdShouldReturnIdsWhosePackagesAreListed()\n{\nvar queryResult = await _packageIdsQuery.Execute(\"n\", null, null);\n@@ -38,7 +39,7 @@ public async void ValidPackageIdShouldReturnIdsWhosePackagesAreListed()\n}\n[Fact]\n- public async void ValidPackageIdShouldReturnIdsWhosePackageStatusIsAvailable()\n+ public async Task ValidPackageIdShouldReturnIdsWhosePackageStatusIsAvailable()\n{\nvar queryResult = await _packageIdsQuery.Execute(\"n\", null, null);\n@@ -58,7 +59,7 @@ public async void ValidPackageIdShouldReturnIdsWhosePackageStatusIsAvailable()\n[InlineData(\"2.0.0-rc.1\")]\n[InlineData(\"1.0.0\")]\n[InlineData(\"1.0.0-beta\")]\n- public async void WithValidSemVerLevelReturnIdsWhosePackagesSemVerLevelCompliant(string semVerLevel)\n+ public async Task WithValidSemVerLevelReturnIdsWhosePackagesSemVerLevelCompliant(string semVerLevel)\n{\nvar queryResult = await _packageIdsQuery.Execute(\"nuget\", null, null, semVerLevel);\n@@ -74,7 +75,7 @@ public async void WithValidSemVerLevelReturnIdsWhosePackagesSemVerLevelCompliant\n[Theory]\n[InlineData(null)]\n[InlineData(false)]\n- public async void ValidPackageIdWithWithPrereleaseFalseOrNullReturnsIdsWhosePackagePrereleaseIsFalse(bool? includePrerelease)\n+ public async Task ValidPackageIdWithWithPrereleaseFalseOrNullReturnsIdsWhosePackagePrereleaseIsFalse(bool? includePrerelease)\n{\nvar queryResult = await _packageIdsQuery.Execute(\"nuget\", includePrerelease, null);\n@@ -88,7 +89,7 @@ public async void ValidPackageIdWithWithPrereleaseFalseOrNullReturnsIdsWhosePack\n}\n[Fact]\n- public async void InexistentPartialIdShouldReturnEmptyArray()\n+ public async Task InexistentPartialIdShouldReturnEmptyArray()\n{\nvar queryResult = await _packageIdsQuery.Execute(\"inexistent-partial-package-id\", null, null);\n@@ -96,7 +97,7 @@ public async void InexistentPartialIdShouldReturnEmptyArray()\n}\n[Fact]\n- public async void WithPrereleaseTrueReturnsIdsWThatStartsWithThatPartialId()\n+ public async Task WithPrereleaseTrueReturnsIdsWThatStartsWithThatPartialId()\n{\nvar queryResult = await _packageIdsQuery.Execute(\"nuget\", true, null);\n@@ -110,7 +111,7 @@ public async void WithPrereleaseTrueReturnsIdsWThatStartsWithThatPartialId()\n}\n[Fact]\n- public async void WithValidPartialIdReturnsIdsThatStartsWithThatPartialId()\n+ public async Task WithValidPartialIdReturnsIdsThatStartsWithThatPartialId()\n{\nvar queryResult = await _packageIdsQuery.Execute(\"n\", null, null);\n@@ -124,7 +125,7 @@ public async void WithValidPartialIdReturnsIdsThatStartsWithThatPartialId()\n}\n[Fact]\n- public async void WithValidPartialIdReturnsIdsThatAreOrderedById()\n+ public async Task WithValidPartialIdReturnsIdsThatAreOrderedById()\n{\nvar queryResult = await _packageIdsQuery.Execute(\"n\", null, null);\n@@ -143,7 +144,7 @@ public async void WithValidPartialIdReturnsIdsThatAreOrderedById()\n[Theory]\n[InlineData(\"\")]\n[InlineData(null)]\n- public async void WithNoPartialIdReturnsIdsThatAreOrderedDescByMaxDownloadCount(string partialId)\n+ public async Task WithNoPartialIdReturnsIdsThatAreOrderedDescByMaxDownloadCount(string partialId)\n{\nvar queryResult = await _packageIdsQuery.Execute(partialId, null, null);\n@@ -161,7 +162,7 @@ public async void WithNoPartialIdReturnsIdsThatAreOrderedDescByMaxDownloadCount(\n[Theory]\n[MemberData(nameof(ConstructorData))]\n- public async void Returns30IdsAtMost(IList<Package> packages)\n+ public async Task Returns30IdsAtMost(IList<Package> packages)\n{\n_packageRepository\n.Setup(context => context.GetAll())\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Queries/AutocompleteDatabasePackageVersionsQueryFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Queries/AutocompleteDatabasePackageVersionsQueryFacts.cs",
"diff": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n+using System.Threading.Tasks;\nusing Moq;\nusing NuGet.Services.Entities;\nusing Xunit;\n@@ -32,7 +33,7 @@ public void InvalidIdThrowsArgumentNullException(string id)\n}\n[Fact]\n- public async void OnlyReturnsVersionsOfTheSamePackage()\n+ public async Task OnlyReturnsVersionsOfTheSamePackage()\n{\nvar queryResult = await _packageVersionsQuery.Execute(\"nuget\", null, null);\n@@ -46,7 +47,7 @@ public async void OnlyReturnsVersionsOfTheSamePackage()\n}\n[Fact]\n- public async void InexistentIdShouldReturnEmptyVersionArray()\n+ public async Task InexistentIdShouldReturnEmptyVersionArray()\n{\nvar queryResult = await _packageVersionsQuery.Execute(\"inexistent-package-id\", null, null);\n@@ -54,7 +55,7 @@ public async void InexistentIdShouldReturnEmptyVersionArray()\n}\n[Fact]\n- public async void ValidPackageIdShouldReturnVersionsWhosePackageStatusIsAvailable()\n+ public async Task ValidPackageIdShouldReturnVersionsWhosePackageStatusIsAvailable()\n{\nvar queryResult = await _packageVersionsQuery.Execute(\"nuget\", null, null);\n@@ -68,7 +69,7 @@ public async void ValidPackageIdShouldReturnVersionsWhosePackageStatusIsAvailabl\n}\n[Fact]\n- public async void ValidPackageIdShouldReturnVersionsWhosePackagesAreListed()\n+ public async Task ValidPackageIdShouldReturnVersionsWhosePackagesAreListed()\n{\nvar queryResult = await _packageVersionsQuery.Execute(\"nuget\", null, null);\n@@ -88,7 +89,7 @@ public async void ValidPackageIdShouldReturnVersionsWhosePackagesAreListed()\n[InlineData(\"2.0.0-rc.1\")]\n[InlineData(\"1.0.0\")]\n[InlineData(\"1.0.0-beta\")]\n- public async void ValidPackageIdWithSemVerLevelReturnVersionsWhosePackagesHaveSemVerLevelCompliant(string semVerLevel)\n+ public async Task ValidPackageIdWithSemVerLevelReturnVersionsWhosePackagesHaveSemVerLevelCompliant(string semVerLevel)\n{\nvar queryResult = await _packageVersionsQuery.Execute(\"nuget\", null, null, semVerLevel);\n@@ -104,7 +105,7 @@ public async void ValidPackageIdWithSemVerLevelReturnVersionsWhosePackagesHaveSe\n[Theory]\n[InlineData(null)]\n[InlineData(false)]\n- public async void ValidPackageIdWithWithPrereleaseFalseOrNullReturnsVersionsWhosePackagePrereleaseIsFalse(bool? includePrerelease)\n+ public async Task ValidPackageIdWithWithPrereleaseFalseOrNullReturnsVersionsWhosePackagePrereleaseIsFalse(bool? includePrerelease)\n{\nvar queryResult = await _packageVersionsQuery.Execute(\"nuget\", includePrerelease, null);\n@@ -118,7 +119,7 @@ public async void ValidPackageIdWithWithPrereleaseFalseOrNullReturnsVersionsWhos\n}\n[Fact]\n- public async void WithPrereleaseTrueReturnsAllVersionsOfTheSamePackage()\n+ public async Task WithPrereleaseTrueReturnsAllVersionsOfTheSamePackage()\n{\nvar queryResult = await _packageVersionsQuery.Execute(\"nuget\", true, null);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/TestUtils/ContractAssert.cs",
"new_path": "tests/NuGetGallery.Facts/TestUtils/ContractAssert.cs",
"diff": "@@ -43,7 +43,7 @@ public static void ThrowsArgException(Action act, string paramName, string messa\nargEx.Message);\n}\n- public static async void ThrowsArgExceptionAsync(Func<Task> act, string paramName, string message = \"\")\n+ public static async Task ThrowsArgExceptionAsync(Func<Task> act, string paramName, string message = \"\")\n{\nvar argEx = await Assert.ThrowsAsync<ArgumentException>(async () => await act());\nAssert.Equal(paramName, argEx.ParamName);\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add namespace and package prefix search tools to namespace reservation admin panel (#9055)
Progress on https://github.com/NuGet/Engineering/issues/4269 |
455,781 | 16.03.2022 11:07:43 | 25,200 | 00606e58c2e05e6d0b57b8e592e3ab01c5abeaff | [Ally Bug] Remove table layout from installation commands. | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -1445,22 +1445,21 @@ p.frameworktableinfo-text {\nfont-weight: 600;\ntext-decoration: underline;\n}\n-.page-package-details .install-tabs .tab-content .tab-pane > div {\n- display: table;\n- height: 1px;\n-}\n.page-package-details .install-tabs .tab-content .tab-pane .install-script-row {\n- display: table-row;\n+ display: -webkit-box;\n+ display: -webkit-flex;\n+ display: -ms-flexbox;\n+ display: flex;\nheight: 100%;\n+ width: 100%;\n}\n.page-package-details .install-tabs .tab-content .tab-pane .install-script-row .install-script {\n- display: table-cell;\nbackground-color: #002440;\nfont-family: Consolas, Menlo, Monaco, \"Courier New\", monospace;\nfont-size: 1em;\ncolor: #fff;\n- width: 100%;\n- max-width: 1px;\n+ width: -webkit-calc(100% - 40px);\n+ width: calc(100% - 40px);\nline-height: 1.5;\nwhite-space: pre-wrap;\nborder-color: #002440;\n@@ -1468,9 +1467,7 @@ p.frameworktableinfo-text {\nborder-width: 1px 0 1px 1px;\nvertical-align: middle;\nword-break: break-word;\n-}\n-.page-package-details .install-tabs .tab-content .tab-pane .install-script-row .copy-button {\n- height: 100%;\n+ margin: 0px;\n}\n.page-package-details .install-tabs .tab-content .tab-pane .install-script-row .copy-button button {\nheight: 100%;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/page-display-package.less",
"new_path": "src/Bootstrap/less/theme/page-display-package.less",
"diff": ".tab-content {\n.tab-pane {\n- > div {\n- display: table;\n- height: 1px;\n- }\n.install-script-row {\n- display: table-row;\n+ display: flex;\nheight: 100%;\n+ width: 100%;\n.install-script {\n- display: table-cell;\nbackground-color: @panel-footer-bg;\nfont-family: @font-family-monospace;\nfont-size: 1em;\ncolor: #fff;\n- width: 100%;\n- max-width: 1px;\n+ width: calc(100% - 40px);\nline-height: 1.5;\nwhite-space: pre-wrap;\n// Add a border with the same color as the background to support visual callout\nborder-width: 1px 0 1px 1px;\nvertical-align: middle;\nword-break: break-word;\n+ margin: 0px;\n}\n- .copy-button {\n- height: 100%;\n-\n- button {\n+ .copy-button button {\nheight: 100%;\nmin-height: 42px;\nline-height: 1.5;\n}\n}\n- }\n.alert {\nmargin: 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "{\nvar thirdPartyPackageManager = packageManager as ThirdPartyPackageManagerViewModel;\n<div role=\"tabpanel\" class=\"tab-pane @(active ? \"active\" : string.Empty)\" id=\"@packageManager.Id\">\n- <div>\n<div class=\"install-script-row\">\n@{\nvar lastIndex = packageManager.InstallPackageCommands.Length - 1;\n</button>\n</div>\n</div>\n- </div>\n@switch (packageManager.AlertLevel)\n{\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [Ally Bug] Remove table layout from installation commands. (#9058) |
455,736 | 19.03.2022 21:13:31 | 25,200 | e90a2a2dfd3aa87ab9de88ace864c169dce461cf | Remove unused constants (found when investigating legacy README container) | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/GalleryConstants.cs",
"new_path": "src/NuGetGallery/GalleryConstants.cs",
"diff": "@@ -10,7 +10,6 @@ public static class GalleryConstants\n{\npublic const string AlphabeticSortOrder = \"package-title\";\npublic const int DefaultPackageListPageSize = 20;\n- public const string DefaultPackageListSortOrder = \"package-download-count\";\npublic const int PasswordResetTokenExpirationHours = 1;\npublic const int ColumnsAuthenticationSm = 6;\n@@ -19,39 +18,22 @@ public static class GalleryConstants\npublic const int ColumnsWideAuthenticationMd = 6;\npublic const int ColumnsFormMd = 12;\n- public const int VisibleVersions = 5;\n-\npublic const int GravatarElementSize = 32;\npublic const int GravatarImageSize = GravatarElementSize * 2;\npublic const int GravatarImageSizeLarge = 332;\npublic const int GravatarCacheDurationSeconds = 300;\n- public const int MaxEmailSubjectLength = 255;\npublic const int MaxFileLengthBytes = 1024 * 1024; // 1MB for License, Icon, readme file\ninternal static readonly NuGetVersion MaxSupportedMinClientVersion = new NuGetVersion(\"5.9.0.0\");\n- public const string PackageFileDownloadUriTemplate = \"packages/{0}/{1}/download\";\n-\n- public const string ReadMeFileSavePathTemplateActive = \"active/{0}/{1}{2}\";\n- public const string ReadMeFileSavePathTemplatePending = \"pending/{0}/{1}{2}\";\n- public const string PopularitySortOrder = \"package-download-count\";\npublic const string RecentSortOrder = \"package-created\";\n- public const string RelevanceSortOrder = \"relevance\";\n-\n- public const string PBKDF2HashAlgorithmId = \"PBKDF2\";\npublic const string UploadFileNameTemplate = \"{0}{1}\";\n- public const string NuGetCommandLinePackageId = \"NuGet.CommandLine\";\npublic static readonly string ReturnUrlViewDataKey = \"ReturnUrl\";\npublic static readonly string ReturnUrlMessageViewDataKey = \"ReturnUrlMessage\";\npublic const string AskUserToEnable2FA = \"AskUserToEnable2FA\";\n- public const string UrlValidationRegEx = @\"(https?):\\/\\/[^ \"\"]+$\";\n- public const string UrlValidationErrorMessage = \"This doesn't appear to be a valid HTTP/HTTPS URL\";\n-\n- public const string PackageBaseAddress = \"PackageBaseAddress/3.0.0\";\n-\n// Note: regexes must be tested to work in JavaScript\n// We do NOT follow strictly the RFCs at this time, and we choose not to support many obscure email address variants.\n// Specifically the following are not supported by-design:\n@@ -85,13 +67,10 @@ public static class GalleryConstants\n/// </summary>\ninternal const string CustomQueryHeaderName = \"X-NuGet-CustomQuery\";\n- public static readonly string ReturnUrlParameterName = \"ReturnUrl\";\n-\npublic const string LicenseDeprecationUrl = \"https://aka.ms/deprecateLicenseUrl\";\npublic static class ContentNames\n{\n- public static readonly string ReadOnly = \"ReadOnly\";\npublic static readonly string TermsOfUse = \"Terms-Of-Use\";\npublic static readonly string PrivacyPolicy = \"Privacy-Policy\";\npublic static readonly string Team = \"Team\";\n@@ -102,7 +81,6 @@ public static class StatisticsDimensions\npublic const string Version = \"Version\";\npublic const string ClientName = \"ClientName\";\npublic const string ClientVersion = \"ClientVersion\";\n- public const string Operation = \"Operation\";\n}\npublic static class FAQLinks\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Remove unused constants (found when investigating legacy README container) (#9062) |
455,778 | 22.03.2022 16:16:43 | 25,200 | db379b0d1bd19a00209667265ff66244da73b1b3 | [A11y] Added aria lables to tabs on Package Details page | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "<div class=\"tab-content body-tab-content\">\n@if (!Model.Deleted)\n{\n- <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"readme\" ? \"active\" : \"\")\" id=\"readme-tab\">\n+ <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"readme\" ? \"active\" : \"\")\" id=\"readme-tab\" aria-label=\"Readme tab content\">\n@if ((Model.Validating || Model.FailedValidation) && Model.HasEmbeddedReadmeFile)\n{\[email protected](\nif (Model.CanDisplayTargetFrameworks())\n{\n- <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"supportedframeworks\" ? \"active\" : \"\")\" id=\"supportedframeworks-tab\">\n+ <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"supportedframeworks\" ? \"active\" : \"\")\" id=\"supportedframeworks-tab\" aria-label=\"Supported frameworks tab content\">\n@if (Model.PackageFrameworkCompatibility.Table.Count > 0)\n{\[email protected](\"_SupportedFrameworksTable\", Model.PackageFrameworkCompatibility.Table)\n</div>\n}\n- <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"dependencies\" ? \"active\" : \"\")\" id=\"dependencies-tab\">\n+ <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"dependencies\" ? \"active\" : \"\")\" id=\"dependencies-tab\" aria-label=\"Dependencies tab content\">\n@if (!Model.Deleted)\n{\nif (Model.Dependencies.DependencySets == null)\n}\n</div>\n}\n- <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"usedby\" ? \"active\" : \"\")\" id=\"usedby-tab\">\n+ <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"usedby\" ? \"active\" : \"\")\" id=\"usedby-tab\" aria-label=\"Used by tab content\">\n@if (!Model.IsDotnetToolPackageType && (Model.IsGitHubUsageEnabled || Model.IsPackageDependentsEnabled))\n{\n<div class=\"used-by\" id=\"used-by\">\n</div>\n}\n</div>\n- <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"versions\" ? \"active\" : \"\")\" id=\"versions-tab\">\n+ <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"versions\" ? \"active\" : \"\")\" id=\"versions-tab\" aria-label=\"Versions tab content\">\n<div class=\"version-history\" id=\"version-history\">\n<table aria-label=\"Version History of @Model.Id\" class=\"table borderless\">\n<thead>\n</div>\n@if (!String.IsNullOrWhiteSpace(Model.ReleaseNotes))\n{\n- <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"releasenotes\" ? \"active\" : \"\")\" id=\"releasenotes-tab\">\n+ <div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"releasenotes\" ? \"active\" : \"\")\" id=\"releasenotes-tab\" aria-label=\"Release notes tab content\">\n<p>@Html.PreFormattedText(Model.ReleaseNotes, Config)</p>\n</div>\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [A11y] Added aria lables to tabs on Package Details page (#9067) |
455,778 | 24.03.2022 15:47:03 | 25,200 | e59a924a692cad3668b5e66ea3d0af99aaa24995 | [A11y] Added column header roles, made each cell accessible with keyboard navigation | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "<table class=\"table borderless\" aria-label=\"Packages that depend on @Model.Id\">\n<thead>\n<tr>\n- <th class=\"used-by-adjust-table-head\" tabindex=\"0\">Package</th>\n- <th class=\"used-by-adjust-table-head\" tabindex=\"0\">Downloads</th>\n+ <th class=\"used-by-adjust-table-head\" scope=\"col\" role=\"columnheader\" tabindex=\"0\">Package</th>\n+ <th class=\"used-by-adjust-table-head\" scope=\"col\" role=\"columnheader\" tabindex=\"0\">Downloads</th>\n</tr>\n</thead>\n<tbody class=\"no-border\">\n@foreach (var item in Model.PackageDependents.TopPackages)\n{\n<tr>\n- <td class=\"used-by-desc-column\">\n+ <td class=\"used-by-desc-column\" tabindex=\"0\">\n<a class=\"text-left ngp-link\" href=\"@Url.Package(item.Id)\">\n@(item.Id)\n</a>\n}\n<p class=\"used-by-desc\">@item.Description</p>\n</td>\n- <td>\n+ <td tabindex=\"0\">\n<i class=\"ms-Icon ms-Icon--Download used-by-download-icon\" aria-hidden=\"true\"></i> <label class=\"used-by-count\">@(item.DownloadCount.ToKiloFormat())</label>\n</td>\n</tr>\n<table class=\"table borderless\" aria-label=\"GitHub repositories that depend on @Model.Id\">\n<thead>\n<tr>\n- <th class=\"used-by-adjust-table-head\" tabindex=\"0\">Repository</th>\n- <th class=\"used-by-adjust-table-head\" tabindex=\"0\">Stars</th>\n+ <th class=\"used-by-adjust-table-head\" scope=\"col\" role=\"columnheader\" tabindex=\"0\">Repository</th>\n+ <th class=\"used-by-adjust-table-head\" scope=\"col\" role=\"columnheader\" tabindex=\"0\">Stars</th>\n</tr>\n</thead>\n<tbody class=\"no-border\">\n@foreach (var item in Model.GitHubDependenciesInformation.Repos.Select((elem, i) => new { Value = elem, Idx = i }))\n{\n<tr>\n- <td class=\"used-by-desc-column\">\n+ <td class=\"used-by-desc-column\" tabindex=\"0\">\n<a data-index-number=\"@item.Idx\" class=\"text-left gh-link\" href=\"@item.Value.Url\" target=\"_blank\">\n@(item.Value.Id)\n</a>\n<span>@(item.Value.Description)</span>\n</div>\n</td>\n- <td>\n+ <td tabindex=\"0\">\n<i class=\"ms-Icon ms-Icon--FavoriteStarFill gh-star\" aria-hidden=\"true\"></i> <label class=\"used-by-count\">@(item.Value.Stars.ToKiloFormat())</label>\n</td>\n</tr>\n<table aria-label=\"Version History of @Model.Id\" class=\"table borderless\">\n<thead>\n<tr>\n- <th scope=\"col\" tabindex=\"0\">Version</th>\n- <th scope=\"col\" tabindex=\"0\">Downloads</th>\n- <th scope=\"col\" tabindex=\"0\">Last updated</th>\n+ <th scope=\"col\" role=\"columnheader\" tabindex=\"0\">Version</th>\n+ <th scope=\"col\" role=\"columnheader\" tabindex=\"0\">Downloads</th>\n+ <th scope=\"col\" role=\"columnheader\" tabindex=\"0\">Last updated</th>\n@if (Model.CanDisplayPrivateMetadata)\n{\n- <th scope=\"col\" tabindex=\"0\">Status</th>\n+ <th scope=\"col\" role=\"columnheader\" tabindex=\"0\">Status</th>\n}\n@if (Model.IsCertificatesUIEnabled)\n{\n- <th scope=\"col\" aria-hidden=\"true\" abbr=\"Signature Information\"></th>\n+ <th scope=\"col\" role=\"columnheader\" aria-hidden=\"true\" abbr=\"Signature Information\"></th>\n}\n@if (Model.IsPackageDeprecationEnabled || Model.IsPackageVulnerabilitiesEnabled)\n{\n- <th scope=\"col\" aria-hidden=\"true\" abbr=\"Package Warnings\"></th>\n+ <th scope=\"col\" role=\"columnheader\" aria-hidden=\"true\" abbr=\"Package Warnings\"></th>\n}\n</tr>\n</thead>\n|| (!packageVersion.Deleted && Model.CanDisplayPrivateMetadata))\n{\n<tr class=\"@(packageVersion.IsCurrent(Model) ? \"bg-info\" : null)\">\n- <td>\n+ <td tabindex=\"0\">\n<a href=\"@Url.Package(packageVersion)\" title=\"@packageVersion.Version\">\[email protected](30)\n</a>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [A11y] Added column header roles, made each cell accessible with keyboard navigation (#9073) |
455,744 | 30.03.2022 18:15:21 | 25,200 | a0666d8a2136bbeaad24326f21a90f69968e499d | Not using metric identifier to get metric object. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Telemetry/TelemetryClientWrapper.cs",
"new_path": "src/NuGetGallery.Services/Telemetry/TelemetryClientWrapper.cs",
"diff": "@@ -63,14 +63,7 @@ public void TrackAggregatedMetric(string metricName, double value, string dimens\n{\ntry\n{\n- var metricIdentifier = new MetricIdentifier(\n- metricNamespace: \"Gallery\",\n- metricId: metricName,\n- dimensionNames: new List<string>\n- {\n- dimension0Name\n- });\n- var metric = UnderlyingClient.GetMetric(metricIdentifier);\n+ var metric = UnderlyingClient.GetMetric(metricName, dimension0Name);\nmetric.TrackValue(value, dimension0Value);\n}\ncatch\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Not using metric identifier to get metric object. (#9082) |
455,741 | 01.04.2022 11:39:27 | 25,200 | 1cdf0b3c01a5c7b6fedbb41606da75b6ddcc6c3d | blockqupte fontsize | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -682,6 +682,9 @@ img.reserved-indicator-icon {\n.readme-common li.task-list-item {\nlist-style-type: none;\n}\n+.readme-common blockquote {\n+ font-size: 16px;\n+}\n#readme-preview {\npadding-top: 0.25em;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/common-readme.less",
"new_path": "src/Bootstrap/less/theme/common-readme.less",
"diff": "ul.contains-task-list, li.task-list-item {\nlist-style-type: none;\n}\n+\n+ blockquote {\n+ font-size: @font-size-base;\n+ }\n}\n#readme-preview {\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | blockqupte fontsize (#9083) |
455,744 | 08.04.2022 15:56:45 | 25,200 | cef94bf0b88f1628e3108131761f9ff554401fa7 | SQL connection creation duration tracking
* Methods for tracking Sql connection creation duration.
* Reporting new metric
* Reporting milliseconds for create sql connection duration.
* Better check for all event names.
Testing both sync and async SQL creation duration metric | [
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/Gallery/ThrowingTelemetryService.cs",
"new_path": "src/GitHubVulnerabilities2Db/Gallery/ThrowingTelemetryService.cs",
"diff": "@@ -390,5 +390,15 @@ public void TrackVulnerabilitiesCacheRefreshDuration(TimeSpan duration)\n{\nthrow new NotImplementedException();\n}\n+\n+ public IDisposable TrackSyncSqlConnectionCreationDuration()\n+ {\n+ throw new NotImplementedException();\n+ }\n+\n+ public IDisposable TrackAsyncSqlConnectionCreationDuration()\n+ {\n+ throw new NotImplementedException();\n+ }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"new_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"diff": "<Compile Include=\"SupportRequest\\Models\\ISupportRequestDbContext.cs\" />\n<Compile Include=\"SupportRequest\\Models\\SupportRequestDbContext.cs\" />\n<Compile Include=\"SupportRequest\\SupportRequestService.cs\" />\n+ <Compile Include=\"Telemetry\\DurationMetric.cs\" />\n<Compile Include=\"Telemetry\\ITelemetryClient.cs\" />\n<Compile Include=\"Telemetry\\ITelemetryService.cs\" />\n<Compile Include=\"Telemetry\\Obfuscator.cs\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Telemetry/ITelemetryService.cs",
"new_path": "src/NuGetGallery.Services/Telemetry/ITelemetryService.cs",
"diff": "@@ -424,5 +424,8 @@ public interface ITelemetryService\n/// </summary>\n/// <param name=\"endpoint\"></param>\nvoid TrackApiRequest(string endpoint);\n+\n+ IDisposable TrackSyncSqlConnectionCreationDuration();\n+ IDisposable TrackAsyncSqlConnectionCreationDuration();\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Telemetry/TelemetryService.cs",
"new_path": "src/NuGetGallery.Services/Telemetry/TelemetryService.cs",
"diff": "@@ -19,7 +19,7 @@ namespace NuGetGallery\n{\npublic class TelemetryService : ITelemetryService, IFeatureFlagTelemetryService\n{\n- public class Events\n+ public static class Events\n{\npublic const string ODataQueryFilter = \"ODataQueryFilter\";\npublic const string ODataCustomQuery = \"ODataCustomQuery\";\n@@ -95,6 +95,7 @@ public class Events\npublic const string VulnerabilitiesCacheRefreshDurationMs = \"VulnerabilitiesCacheRefreshDurationMs\";\npublic const string InstanceUptime = \"InstanceUptimeInDays\";\npublic const string ApiRequest = \"ApiRequest\";\n+ public const string CreateSqlConnectionDurationMs = \"CreateSqlConnectionDurationMs\";\n}\nprivate readonly IDiagnosticsSource _diagnosticsSource;\n@@ -236,6 +237,10 @@ public class Events\npublic const string Endpoint = \"Endpoint\";\n+ public const string Kind = \"Kind\";\n+ public const string Sync = \"Sync\";\n+ public const string Async = \"Async\";\n+\npublic TelemetryService(IDiagnosticsSource diagnosticsSource, ITelemetryClient telemetryClient)\n{\n_telemetryClient = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));\n@@ -1138,6 +1143,18 @@ public void TrackApiRequest(string endpoint)\n_telemetryClient.TrackAggregatedMetric(Events.ApiRequest, 1, Endpoint, endpoint);\n}\n+ public IDisposable TrackSyncSqlConnectionCreationDuration()\n+ => TrackSqlConnectionCreationDuration(Sync);\n+\n+ public IDisposable TrackAsyncSqlConnectionCreationDuration()\n+ => TrackSqlConnectionCreationDuration(Async);\n+\n+ private IDisposable TrackSqlConnectionCreationDuration(string kind)\n+ {\n+ return new DurationTracker(duration =>\n+ _telemetryClient.TrackAggregatedMetric(Events.CreateSqlConnectionDurationMs, duration.TotalMilliseconds, Kind, kind));\n+ }\n+\n/// <summary>\n/// We use <see cref=\"ITelemetryClient.TrackMetric(string, double, IDictionary{string, string})\"/> instead of\n/// <see cref=\"ITelemetryClient.TrackEvent(string, IDictionary{string, string}, IDictionary{string, double})\"/>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/DefaultDependenciesModule.cs",
"new_path": "src/NuGetGallery/App_Start/DefaultDependenciesModule.cs",
"diff": "@@ -192,7 +192,7 @@ protected override void Load(ContainerBuilder builder)\n.As<ISqlConnectionFactory>()\n.SingleInstance();\n- builder.Register(c => new EntitiesContext(CreateDbConnection(galleryDbConnectionFactory), configuration.Current.ReadOnlyMode))\n+ builder.Register(c => new EntitiesContext(CreateDbConnection(galleryDbConnectionFactory, telemetryService), configuration.Current.ReadOnlyMode))\n.AsSelf()\n.As<IEntitiesContext>()\n.As<DbContext>()\n@@ -278,7 +278,7 @@ protected override void Load(ContainerBuilder builder)\n.As<IEntityRepository<PackageRename>>()\n.InstancePerLifetimeScope();\n- ConfigureGalleryReadOnlyReplicaEntitiesContext(builder, loggerFactory, configuration, secretInjector);\n+ ConfigureGalleryReadOnlyReplicaEntitiesContext(builder, loggerFactory, configuration, secretInjector, telemetryService);\nvar supportDbConnectionFactory = CreateDbConnectionFactory(\nloggerFactory,\n@@ -286,7 +286,7 @@ protected override void Load(ContainerBuilder builder)\nconfiguration.Current.SqlConnectionStringSupportRequest,\nsecretInjector);\n- builder.Register(c => new SupportRequestDbContext(CreateDbConnection(supportDbConnectionFactory)))\n+ builder.Register(c => new SupportRequestDbContext(CreateDbConnection(supportDbConnectionFactory, telemetryService)))\n.AsSelf()\n.As<ISupportRequestDbContext>()\n.InstancePerLifetimeScope();\n@@ -503,7 +503,7 @@ protected override void Load(ContainerBuilder builder)\nbreak;\n}\n- RegisterAsynchronousValidation(builder, loggerFactory, configuration, secretInjector);\n+ RegisterAsynchronousValidation(builder, loggerFactory, configuration, secretInjector, telemetryService);\nRegisterAuditingServices(builder, configuration.Current.StorageType);\n@@ -963,20 +963,27 @@ private static void RegisterAsynchronousEmailMessagingService(ContainerBuilder b\nreturn new AzureSqlConnectionFactory(connectionString, secretInjector, logger);\n}\n- public static DbConnection CreateDbConnection(ISqlConnectionFactory connectionFactory)\n+ public static DbConnection CreateDbConnection(ISqlConnectionFactory connectionFactory, ITelemetryService telemetryService)\n+ {\n+ using (telemetryService.TrackSyncSqlConnectionCreationDuration())\n{\nif (connectionFactory.TryCreate(out var connection))\n{\nreturn connection;\n}\n+ }\n+ using (telemetryService.TrackAsyncSqlConnectionCreationDuration())\n+ {\nreturn Task.Run(() => connectionFactory.CreateAsync()).Result;\n}\n+ }\nprivate static void ConfigureGalleryReadOnlyReplicaEntitiesContext(\nContainerBuilder builder,\nILoggerFactory loggerFactory,\nConfigurationService configuration,\n- ICachingSecretInjector secretInjector)\n+ ICachingSecretInjector secretInjector,\n+ ITelemetryService telemetryService)\n{\nvar galleryDbReadOnlyReplicaConnectionFactory = CreateDbConnectionFactory(\nloggerFactory,\n@@ -984,7 +991,7 @@ public static DbConnection CreateDbConnection(ISqlConnectionFactory connectionFa\nconfiguration.Current.SqlReadOnlyReplicaConnectionString ?? configuration.Current.SqlConnectionString,\nsecretInjector);\n- builder.Register(c => new ReadOnlyEntitiesContext(CreateDbConnection(galleryDbReadOnlyReplicaConnectionFactory)))\n+ builder.Register(c => new ReadOnlyEntitiesContext(CreateDbConnection(galleryDbReadOnlyReplicaConnectionFactory, telemetryService)))\n.As<IReadOnlyEntitiesContext>()\n.InstancePerLifetimeScope();\n@@ -997,7 +1004,8 @@ public static DbConnection CreateDbConnection(ISqlConnectionFactory connectionFa\nContainerBuilder builder,\nILoggerFactory loggerFactory,\nConfigurationService configuration,\n- ICachingSecretInjector secretInjector)\n+ ICachingSecretInjector secretInjector,\n+ ITelemetryService telemetryService)\n{\nvar validationDbConnectionFactory = CreateDbConnectionFactory(\nloggerFactory,\n@@ -1005,7 +1013,7 @@ public static DbConnection CreateDbConnection(ISqlConnectionFactory connectionFa\nconfiguration.Current.SqlConnectionStringValidation,\nsecretInjector);\n- builder.Register(c => new ValidationEntitiesContext(CreateDbConnection(validationDbConnectionFactory)))\n+ builder.Register(c => new ValidationEntitiesContext(CreateDbConnection(validationDbConnectionFactory, telemetryService)))\n.AsSelf()\n.InstancePerLifetimeScope();\n@@ -1026,7 +1034,8 @@ public static DbConnection CreateDbConnection(ISqlConnectionFactory connectionFa\nContainerBuilder builder,\nILoggerFactory loggerFactory,\nConfigurationService configuration,\n- ICachingSecretInjector secretInjector)\n+ ICachingSecretInjector secretInjector,\n+ ITelemetryService telemetryService)\n{\nbuilder\n.RegisterType<NuGet.Services.Validation.ServiceBusMessageSerializer>()\n@@ -1052,7 +1061,7 @@ public static DbConnection CreateDbConnection(ISqlConnectionFactory connectionFa\nif (configuration.Current.AsynchronousPackageValidationEnabled)\n{\n- ConfigureValidationEntitiesContext(builder, loggerFactory, configuration, secretInjector);\n+ ConfigureValidationEntitiesContext(builder, loggerFactory, configuration, secretInjector, telemetryService);\nbuilder\n.Register(c =>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/VerifyMicrosoftPackage/Fakes/FakeTelemetryService.cs",
"new_path": "src/VerifyMicrosoftPackage/Fakes/FakeTelemetryService.cs",
"diff": "@@ -392,5 +392,15 @@ public void TrackVulnerabilitiesCacheRefreshDuration(TimeSpan duration)\n{\nthrow new NotImplementedException();\n}\n+\n+ public IDisposable TrackSyncSqlConnectionCreationDuration()\n+ {\n+ throw new NotImplementedException();\n+ }\n+\n+ public IDisposable TrackAsyncSqlConnectionCreationDuration()\n+ {\n+ throw new NotImplementedException();\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/App_Start/DefaultDependenciesModuleFacts.cs",
"new_path": "tests/NuGetGallery.Facts/App_Start/DefaultDependenciesModuleFacts.cs",
"diff": "@@ -204,7 +204,7 @@ public void TriesSyncBeforeAsync()\n.Setup(cf => cf.TryCreate(out It.Ref<SqlConnection>.IsAny))\n.Returns(true);\n- DefaultDependenciesModule.CreateDbConnection(connectionFactoryMock.Object);\n+ DefaultDependenciesModule.CreateDbConnection(connectionFactoryMock.Object, Mock.Of<ITelemetryService>());\nconnectionFactoryMock\n.Verify(cf => cf.TryCreate(out It.Ref<SqlConnection>.IsAny), Times.Once);\nconnectionFactoryMock\n@@ -222,7 +222,7 @@ public void FallsBackToAsyncIfSyncFails()\n.Setup(cf => cf.CreateAsync())\n.ReturnsAsync((SqlConnection)null);\n- DefaultDependenciesModule.CreateDbConnection(connectionFactoryMock.Object);\n+ DefaultDependenciesModule.CreateDbConnection(connectionFactoryMock.Object, Mock.Of<ITelemetryService>());\nconnectionFactoryMock\n.Verify(cf => cf.TryCreate(out It.Ref<SqlConnection>.IsAny), Times.Once);\nconnectionFactoryMock\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Services/TelemetryServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Services/TelemetryServiceFacts.cs",
"diff": "@@ -360,16 +360,31 @@ public static IEnumerable<object[]> TrackMetricNames_Data\n(TrackAction)(s => s.TrackApiRequest(\"SomeEndpoint\")),\ntrue\n};\n+\n+ yield return new object[] { \"CreateSqlConnectionDurationMs\",\n+ (TrackAction)(s => s.TrackSyncSqlConnectionCreationDuration().Dispose()),\n+ true\n+ };\n+\n+ yield return new object[] { \"CreateSqlConnectionDurationMs\",\n+ (TrackAction)(s => s.TrackAsyncSqlConnectionCreationDuration().Dispose()),\n+ true\n+ };\n}\n}\n[Fact]\npublic void TrackEventNamesIncludesAllEvents()\n{\n- var expectedCount = typeof(TelemetryService.Events).GetFields().Length;\n- var actualCount = TrackMetricNames_Data.Count();\n+ var eventNames = typeof(TelemetryService.Events)\n+ .GetFields()\n+ .Where(f => f.IsLiteral && !f.IsInitOnly && f.FieldType == typeof(string))\n+ .Select(f => (string)f.GetValue(null))\n+ .ToList();\n+\n+ var testedNames = new HashSet<string>(TrackMetricNames_Data.Select(element => (string)element[0]));\n- Assert.Equal(expectedCount, actualCount);\n+ Assert.All(eventNames, name => testedNames.Contains(name));\n}\n[Theory]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | SQL connection creation duration tracking (#9086)
* Methods for tracking Sql connection creation duration.
* Reporting new metric
* Reporting milliseconds for create sql connection duration.
* Better check for all event names.
Testing both sync and async SQL creation duration metric |
455,744 | 11.04.2022 17:28:33 | 25,200 | 8570b5ab22ebae6250fcaf59e80f46db088d5e5d | Attempting to 'fix' admin panel link in support request items. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Scripts/gallery/page-support-requests.js",
"new_path": "src/NuGetGallery/Scripts/gallery/page-support-requests.js",
"diff": "@@ -210,13 +210,13 @@ var SupportRequestsViewModel = (function () {\nthis.generateUserProfileUrl = function (supportRequestViewModel) {\nif (supportRequestViewModel.CreatedBy.toUpperCase !== 'ANONYMOUS') {\n- return supportRequestViewModel.SiteRoot + 'Profiles/' + supportRequestViewModel.CreatedBy;\n+ return '/Profiles/' + supportRequestViewModel.CreatedBy;\n}\nreturn '#';\n};\nthis.generatePackageDetailsUrl = function (supportRequestViewModel) {\n- return supportRequestViewModel.SiteRoot + 'packages/' + supportRequestViewModel.PackageId + '/' + supportRequestViewModel.PackageVersion;\n+ return '/packages/' + supportRequestViewModel.PackageId + '/' + supportRequestViewModel.PackageVersion;\n};\nthis.generateHistoryUrl = function (supportRequestViewModel) {\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Attempting to 'fix' admin panel link in support request items. (#9089) |
455,747 | 18.04.2022 16:16:19 | 25,200 | b7ac17216bfe02ac7bbd0f44c950dce21f87c0fe | Hide package metadata for certain packages
Verified in DEV. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"new_path": "src/NuGetGallery/Controllers/PackagesController.cs",
"diff": "@@ -1365,6 +1365,9 @@ public virtual ActionResult ReportAbuse(string id, string version)\nPackageId = id,\nPackageVersion = package.Version,\nCopySender = true,\n+ IsPackageListed = package.Listed,\n+ IsOwnerLocked = package.User?.IsLocked ?? false,\n+ IsPackageLocked = package.PackageRegistration.IsLocked,\n};\nif (Request.IsAuthenticated)\n@@ -1418,6 +1421,9 @@ public virtual async Task<ActionResult> ReportMyPackage(string id, string versio\nPackageVersion = package.Version,\nCopySender = true,\nAllowDelete = allowDelete,\n+ IsPackageListed = package.Listed,\n+ IsPackageLocked = package.PackageRegistration.IsLocked,\n+ IsOwnerLocked = package.User?.IsLocked ?? false\n};\nreturn View(model);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Helpers/ViewModelExtensions/ListPackageItemViewModelFactory.cs",
"new_path": "src/NuGetGallery/Helpers/ViewModelExtensions/ListPackageItemViewModelFactory.cs",
"diff": "@@ -68,7 +68,12 @@ private static bool CanPerformAction(User currentUser, Package package, ActionRe\nprivate static BasicUserViewModel GetBasicUserViewModel(User user)\n{\n- return new BasicUserViewModel { Username = user.Username, EmailAddress = user.EmailAddress, IsOrganization = user is Organization };\n+ return new BasicUserViewModel {\n+ Username = user.Username,\n+ EmailAddress = user.EmailAddress,\n+ IsOrganization = user is Organization,\n+ IsLocked = user.IsLocked\n+ };\n}\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Helpers/ViewModelExtensions/PackageViewModelFactory.cs",
"new_path": "src/NuGetGallery/Helpers/ViewModelExtensions/PackageViewModelFactory.cs",
"diff": "@@ -47,6 +47,7 @@ public PackageViewModel Setup(PackageViewModel viewModel, Package package)\nviewModel.DevelopmentDependency = package.DevelopmentDependency;\nviewModel.LastUpdated = package.Published;\nviewModel.Listed = package.Listed;\n+ viewModel.Locked = package.PackageRegistration.IsLocked;\nviewModel.DownloadCount = package.DownloadCount;\nviewModel.Prerelease = package.IsPrerelease;\nviewModel.FailedValidation = package.PackageStatusKey == PackageStatus.FailedValidation;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/BasicUserViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/BasicUserViewModel.cs",
"diff": "@@ -8,5 +8,6 @@ public class BasicUserViewModel\npublic string EmailAddress { get; set; }\npublic string Username { get; set; }\npublic bool IsOrganization { get; set; }\n+ public bool IsLocked { get; set; }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"diff": "@@ -156,6 +156,14 @@ public bool BlockSearchEngineIndexing\n}\n}\n+ public bool ShowDetailsAndLinks\n+ {\n+ get\n+ {\n+ return Listed || !Locked || !Owners.Any(x => x.IsLocked);\n+ }\n+ }\n+\npublic enum RepositoryKind\n{\nUnknown,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/PackageViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/PackageViewModel.cs",
"diff": "@@ -19,6 +19,7 @@ public class PackageViewModel : IPackageVersionModel\npublic bool VersionRequestedWasNotFound { get; set; }\npublic int DownloadCount { get; set; }\npublic bool Listed { get; set; }\n+ public bool Locked { get; set; }\npublic bool FailedValidation { get; set; }\npublic bool Available { get; set; }\npublic bool Validating { get; set; }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/ReportAbuseViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/ReportAbuseViewModel.cs",
"diff": "@@ -27,5 +27,13 @@ public class ReportAbuseViewModel : ReportViewModel\n[StringLength(4000)]\n[Display(Name = \"Details\")]\npublic string Message { get; set; }\n+\n+ public bool ShowReportAbuseForm\n+ {\n+ get\n+ {\n+ return IsPackageListed || !IsPackageLocked || !IsOwnerLocked;\n+ }\n+ }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/ReportViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/ReportViewModel.cs",
"diff": "@@ -26,5 +26,9 @@ public abstract class ReportViewModel : IPackageVersionModel\npublic string Id => PackageId;\npublic string Version => PackageVersion;\n+\n+ public bool IsOwnerLocked { get; set; }\n+ public bool IsPackageLocked { get; set; }\n+ public bool IsPackageListed { get; set; }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "<h1>\n<span class=\"pull-left\">\n<img class=\"package-icon img-responsive\" aria-hidden=\"true\" alt=\"\"\n- src=\"@(PackageHelper.ShouldRenderUrl(Model.IconUrl) ? Model.IconUrl : Url.Absolute(\"~/Content/gallery/img/default-package-icon.svg\"))\"\n+ src=\"@(PackageHelper.ShouldRenderUrl(Model.IconUrl) && Model.ShowDetailsAndLinks ? Model.IconUrl : Url.Absolute(\"~/Content/gallery/img/default-package-icon.svg\"))\"\[email protected](Url.Absolute(\"~/Content/gallery/img/default-package-icon-256x256.png\")) />\n</span>\n<span class=\"title\" tabindex=\"0\">\n@if (!Model.Deleted)\n{\n<div role=\"tabpanel\" class=\"tab-pane @(activeBodyTab == \"readme\" ? \"active\" : \"\")\" id=\"readme-tab\" aria-label=\"Readme tab content\">\n- @if ((Model.Validating || Model.FailedValidation) && Model.HasEmbeddedReadmeFile)\n+ @if (!Model.ShowDetailsAndLinks)\n+ {\n+ @ViewHelpers.AlertWarning(\n+ @<text>\n+ This package's content is hidden as it violates our <a href=\"https://www.nuget.org/policies/terms\" title=\"Terms of use\">Terms of use</a>.\n+ </text>)\n+ }\n+ else if ((Model.Validating || Model.FailedValidation) && Model.HasEmbeddedReadmeFile)\n{\[email protected](\n@<text>\nThe readme will become available once package validation has completed successfully.\n- </text>\n-)\n+ </text>)\n}\nelse if (Model.ReadMeHtml != null)\n{\n<i class=\"ms-Icon ms-Icon--History\" aria-hidden=\"true\"></i>\nLast updated <span data-datetime=\"@Model.LastUpdated.ToString(\"O\")\">@Model.LastUpdated.ToNuGetShortDateString()</span>\n</li>\n- @if (!Model.Deleted && Model.ProjectUrl != null)\n+ @if (!Model.Deleted && Model.ProjectUrl != null && Model.ShowDetailsAndLinks)\n{\n<li>\n<i class=\"ms-Icon ms-Icon--Globe\" aria-hidden=\"true\"></i>\n</li>\n}\n- @if (!Model.Deleted && Model.RepositoryUrl != null)\n+ @if (!Model.Deleted && Model.RepositoryUrl != null && Model.ShowDetailsAndLinks)\n{\n<li>\n@switch (Model.RepositoryType)\n</li>\n}\n- @if (!Model.Deleted && Model.LicenseUrl != null)\n+ @if (!Model.Deleted && Model.LicenseUrl != null && Model.ShowDetailsAndLinks)\n{\nif (Model.EmbeddedLicenseType == EmbeddedLicenseFileType.Absent || !Model.Validating)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/ReportAbuse.cshtml",
"diff": "Model.PackageVersion,\n\"Report package\"))\n+ @if (!Model.ShowReportAbuseForm)\n+ {\n+ @ViewHelpers.AlertWarning(isAlertRole: true, htmlContent:\n+ @<text>\n+ This package has been locked and unlisted as it violates our <a href=\"https://www.nuget.org/policies/Terms\" title=\"Terms of use\">Terms of use</a>. Please contact [email protected] for further assistance.\n+ </text>\n+ )\n+ }\n+ else\n+ {\n<h2><strong>If this package has a bug/failed to install</strong></h2>\[email protected](isAlertRole: true, htmlContent:\n@<text>\n)\n<h2><strong>To report abuse, use this form</strong></h2>\n- @if (!Model.ConfirmedUser)\n+ if (!Model.ConfirmedUser)\n{\[email protected](isAlertRole: true, htmlContent:\n@<text>\n</text>\n</p>\n- @using (Html.BeginForm())\n+ using (Html.BeginForm())\n{\[email protected]()\n</div>\n</div>\n}\n+\n+ }\n</div>\n</div>\n</section>\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Controllers/PackagesControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Controllers/PackagesControllerFacts.cs",
"diff": "@@ -5401,6 +5401,34 @@ public void ShowsFormWhenNotOwner(User currentUser, User owner)\nAssert.Equal(PackageId, model.PackageId);\nAssert.Equal(PackageVersion, model.PackageVersion);\n+ Assert.True(model.ShowReportAbuseForm);\n+ }\n+\n+ [Theory]\n+ [MemberData(nameof(NotOwner_Data))]\n+ public void HidesFormForCertainPackages(User currentUser, User owner)\n+ {\n+ var package = new Package\n+ {\n+ PackageRegistration = new PackageRegistration { Id = PackageId, Owners = { owner }, IsLocked = true },\n+ Version = PackageVersion,\n+ Listed = false,\n+ User = new User()\n+ {\n+ UserStatusKey = UserStatus.Locked\n+ }\n+ };\n+\n+ var result = GetReportAbuseResultInternal(currentUser, owner, package);\n+ Assert.IsType<ViewResult>(result);\n+ var viewResult = result as ViewResult;\n+\n+ Assert.IsType<ReportAbuseViewModel>(viewResult.Model);\n+ var model = viewResult.Model as ReportAbuseViewModel;\n+\n+ Assert.Equal(PackageId, model.PackageId);\n+ Assert.Equal(PackageVersion, model.PackageVersion);\n+ Assert.False(model.ShowReportAbuseForm);\n}\n[Theory]\n@@ -5421,6 +5449,12 @@ public ActionResult GetReportAbuseResult(User currentUser, User owner, out Packa\nPackageRegistration = new PackageRegistration { Id = PackageId, Owners = { owner } },\nVersion = PackageVersion\n};\n+\n+ return GetReportAbuseResultInternal(currentUser, owner, package);\n+ }\n+\n+ private ActionResult GetReportAbuseResultInternal(User currentUser, User owner, Package package)\n+ {\nvar packageService = new Mock<IPackageService>();\npackageService.Setup(p => p.FindPackageByIdAndVersionStrict(PackageId, PackageVersion)).Returns(package);\nvar httpContext = new Mock<HttpContextBase>();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"new_path": "tests/NuGetGallery.Facts/ViewModels/DisplayPackageViewModelFacts.cs",
"diff": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n+using Microsoft.ApplicationInsights.Extensibility;\nusing Moq;\nusing NuGet.Services.Entities;\nusing NuGet.Versioning;\n@@ -349,6 +350,49 @@ public void CanDisplayTargetFrameworksWhenValid()\nAssert.True(model.CanDisplayTargetFrameworks());\n}\n+ [Theory]\n+ [MemberData(nameof(ShowPackageDetailsData))]\n+ public void HidesDetailsAndLinksForCertainPackages(bool listed, bool locked, bool lockedUser, bool shouldHide)\n+ {\n+ var ownersList = new List<User>()\n+ {\n+ new User() {\n+ UserStatusKey = lockedUser ? UserStatus.Locked : UserStatus.Unlocked\n+ }\n+ };\n+ var package = new Package\n+ {\n+ Version = \"1.0.0\",\n+ NormalizedVersion = \"1.0.0\",\n+ Listed = listed,\n+ PackageRegistration = new PackageRegistration\n+ {\n+ Id = \"foo\",\n+ Owners = ownersList,\n+ Packages = Enumerable.Empty<Package>().ToList(),\n+ IsLocked = locked\n+ }\n+ };\n+\n+ var model = CreateDisplayPackageViewModel(package, currentUser: null, packageKeyToDeprecation: null, readmeHtml: null);\n+ Assert.Equal(shouldHide, model.ShowDetailsAndLinks);\n+ }\n+\n+ public static IEnumerable<object[]> ShowPackageDetailsData\n+ {\n+ get\n+ {\n+ var operations = new bool[] { true, false };\n+ foreach (var listed in operations)\n+ foreach (var locked in operations)\n+ foreach (var userLocked in operations)\n+ {\n+ yield return new object[] { listed, locked, userLocked, listed || !locked || !userLocked };\n+ }\n+ }\n+ }\n+\n+\n[Theory]\n[InlineData(null, null)]\n[InlineData(\"not a url\", null)]\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Hide package metadata for certain packages (#9096)
Verified in DEV. |
455,781 | 19.04.2022 11:44:22 | 25,200 | 70c8a2f9c5268131c68c6d2850bbfaa94c1214b5 | [A11y Bug] Make TFM badges asset and compatible different for high contrast. | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -806,6 +806,16 @@ p.frameworktableinfo-text {\nline-height: 16px;\nmargin-top: 10px;\n}\n+@media (-ms-high-contrast: active), (forced-colors: active) {\n+ .framework-badge-asset {\n+ font-weight: bold;\n+ border: 2px solid #0078d4;\n+ padding: 0px 8px;\n+ }\n+ .frameworktableinfo-asset-icon {\n+ border: 2px solid #0078d4;\n+ }\n+}\n.user-package-list .manage-package-listing .package-icon {\nmax-height: 2em;\nmin-width: 20px;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/common-supported-frameworks.less",
"new_path": "src/Bootstrap/less/theme/common-supported-frameworks.less",
"diff": "@@ -91,3 +91,15 @@ p.frameworktableinfo-text {\n.frameworktableinfo-text;\nmargin-top: 10px;\n}\n+\n+@media (-ms-high-contrast: active), (forced-colors: active) {\n+ .framework-badge-asset {\n+ font-weight: bold;\n+ border: 2px solid @badge-dark;\n+ padding: 0px 8px;\n+ }\n+\n+ .frameworktableinfo-asset-icon {\n+ border: 2px solid @badge-dark;\n+ }\n+}\n\\ No newline at end of file\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [A11y Bug] Make TFM badges asset and compatible different for high contrast. (#9098) |
455,747 | 20.04.2022 10:19:40 | 25,200 | dd09f83971d063796cbf663d01c5d98196d3bb53 | Increase blocking duration to 90 days | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"new_path": "src/NuGetGallery/ViewModels/DisplayPackageViewModel.cs",
"diff": "@@ -47,7 +47,7 @@ public class DisplayPackageViewModel : ListPackageItemViewModel\npublic bool HasEmbeddedReadmeFile { get; set; }\npublic PackageDependents PackageDependents { get; set; }\n- public const int NumberOfDaysToBlockIndexing = 21;\n+ public const int NumberOfDaysToBlockIndexing = 90;\npublic bool HasNewerPrerelease\n{\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Increase blocking duration to 90 days (#9099) |
455,747 | 22.04.2022 10:59:55 | 25,200 | 2ae64d137e54cff5b3a0486ee56c6ddcf2f88524 | Fix org profile to show correct MFA status for site admins | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/ViewModels/UserProfileModel.cs",
"new_path": "src/NuGetGallery/ViewModels/UserProfileModel.cs",
"diff": "@@ -16,7 +16,6 @@ public UserProfileModel(User user, User currentUser, List<ListPackageItemViewMod\nUsername = user.Username;\nEmailAddress = user.EmailAddress;\nUnconfirmedEmailAddress = user.UnconfirmedEmailAddress;\n- HasEnabledMultiFactorAuthentication = user.EnableMultiFactorAuthentication;\nIsLocked = user.IsLocked;\nAllPackages = allPackages;\nTotalPackages = allPackages.Count;\n@@ -43,7 +42,25 @@ public UserProfileModel(User user, User currentUser, List<ListPackageItemViewMod\npublic string Username { get; private set; }\npublic string EmailAddress { get; private set; }\npublic string UnconfirmedEmailAddress { get; set; }\n- public bool HasEnabledMultiFactorAuthentication { get; set; }\n+ public bool HasEnabledMultiFactorAuthentication\n+ {\n+ get\n+ {\n+ if (UserIsOrganization)\n+ {\n+ var organization = (Organization)User;\n+ return organization\n+ .Members\n+ .Select(x => x.Member)\n+ .All(x => x.EnableMultiFactorAuthentication);\n+ }\n+ else\n+ {\n+ return User.EnableMultiFactorAuthentication;\n+ }\n+ }\n+ }\n+\npublic bool IsLocked { get; set; }\npublic ICollection<ListPackageItemViewModel> AllPackages { get; private set; }\npublic ICollection<ListPackageItemViewModel> PagedPackages { get; private set; }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Users/Profiles.cshtml",
"new_path": "src/NuGetGallery/Views/Users/Profiles.cshtml",
"diff": "<dt>Unconfirmed Email Address:</dt>\n<dd>@Model.UnconfirmedEmailAddress</dd>\n}\n+\n+ @if (Model.UserIsOrganization)\n+ {\n+ <dt>Org Multi-factor Authentication:</dt>\n+ }\n+ else\n+ {\n<dt>Multi-factor Authentication:</dt>\n+ }\n<dd>@(Model.HasEnabledMultiFactorAuthentication ? \"Enabled\" : \"Disabled\")</dd>\n<dt>Locked:</dt>\n<dd>@(Model.IsLocked ? \"Yes\" : \"No\")</dd>\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/ViewModels/UserProfileModelFacts.cs",
"new_path": "tests/NuGetGallery.Facts/ViewModels/UserProfileModelFacts.cs",
"diff": "@@ -34,6 +34,104 @@ public void TotalDownloadCount_DoesNotThrowIntegerOverflow()\nAssert.Equal(expected, profile.TotalPackageDownloadCount);\n}\n+ [Theory]\n+ [InlineData(true)]\n+ [InlineData(false)]\n+ public void HasEnabledMultiFactorAuthentication_ForUsers(bool userMfaStatus)\n+ {\n+ var controller = GetController<UsersController>();\n+ var user = new User(\"theUser\")\n+ {\n+ EnableMultiFactorAuthentication = userMfaStatus,\n+ };\n+ var currentUser = new User(\"theCurrentUser\");\n+ var packages = new List<ListPackageItemViewModel>\n+ {\n+ CreatePackageItemViewModel(\"1.0.0\"),\n+ CreatePackageItemViewModel(\"2.0.0\")\n+ };\n+\n+ // Act\n+ var profile = new UserProfileModel(user, currentUser, packages, 0, 10, controller.Url);\n+\n+ // Assert\n+ Assert.Equal(userMfaStatus, profile.HasEnabledMultiFactorAuthentication);\n+ }\n+\n+ [Theory]\n+ [InlineData(true, false, true, false)]\n+ [InlineData(true, true, false, false)]\n+ [InlineData(false, false, true, false)]\n+ [InlineData(true, true, true, true)]\n+ public void HasEnabledMultiFactorAuthentication_ForOrganizations(bool user1MfaStatus, bool user2MfaStatus, bool collabUserMfaStatus, bool expectedOrgMfaStatus)\n+ {\n+ var controller = GetController<UsersController>();\n+ var userList = new List<User>() {\n+ new User(\"theUser\")\n+ {\n+ EnableMultiFactorAuthentication = user1MfaStatus\n+ },\n+ new User(\"theOtherUser\")\n+ {\n+ EnableMultiFactorAuthentication = user2MfaStatus\n+ }\n+ };\n+\n+ var collabUser = new User(\"TheCollabUser\")\n+ {\n+ EnableMultiFactorAuthentication = collabUserMfaStatus\n+ };\n+\n+ var org = CreateTestOrganization(userList, collabUser);\n+ var currentUser = new User(\"theCurrentUser\");\n+ var packages = new List<ListPackageItemViewModel>\n+ {\n+ CreatePackageItemViewModel(\"1.0.0\"),\n+ CreatePackageItemViewModel(\"2.0.0\")\n+ };\n+\n+ // Act\n+ var profile = new UserProfileModel(org, currentUser, packages, 0, 10, controller.Url);\n+\n+ // Assert\n+ Assert.Equal(expectedOrgMfaStatus, profile.HasEnabledMultiFactorAuthentication);\n+ }\n+\n+ private Organization CreateTestOrganization(List<User> usersList, User collabUser)\n+ {\n+ var organization = new Organization()\n+ {\n+ Key = 1,\n+ Username = \"a\"\n+ };\n+\n+ foreach (var user in usersList)\n+ {\n+ organization.Members.Add(new Membership()\n+ {\n+ MemberKey = user.Key,\n+ Member = user,\n+ OrganizationKey = organization.Key,\n+ Organization = organization,\n+ IsAdmin = true\n+ });\n+ }\n+\n+ if (collabUser != null)\n+ {\n+ organization.Members.Add(new Membership()\n+ {\n+ MemberKey = collabUser.Key,\n+ Member = collabUser,\n+ OrganizationKey = organization.Key,\n+ Organization = organization,\n+ IsAdmin = false\n+ });\n+ }\n+\n+ return organization;\n+ }\n+\nprivate ListPackageItemViewModel CreatePackageItemViewModel(string version)\n{\nreturn new ListPackageItemViewModelFactory(Mock.Of<IIconUrlProvider>()).Create(new Package\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Fix org profile to show correct MFA status for site admins (#9106) |
455,781 | 27.04.2022 13:48:18 | 25,200 | 9baae9c89f33b0e3ad14edbb638d048e7bd895e0 | [A11y Bug] Remove focus from non-interactive elements on TFM badge and table. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "src=\"@(PackageHelper.ShouldRenderUrl(Model.IconUrl) && Model.ShowDetailsAndLinks ? Model.IconUrl : Url.Absolute(\"~/Content/gallery/img/default-package-icon.svg\"))\"\[email protected](Url.Absolute(\"~/Content/gallery/img/default-package-icon-256x256.png\")) />\n</span>\n- <span class=\"title\" tabindex=\"0\">\n+ <span class=\"title\">\[email protected](Model.Id)\n</span>\n- <span class=\"version-title\" tabindex=\"0\">\n+ <span class=\"version-title\">\[email protected]\n</span>\n@if (Model.IsVerified.HasValue && Model.IsVerified.Value)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/_SupportedFrameworksBadges.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/_SupportedFrameworksBadges.cshtml",
"diff": "@if (Model.Net != null)\n{\n<!-- .NET cannot be an empty version since the lowest version for this framework is \"net5.0\", if the package contains just \"net\" framework it will fall into .NET Framework badge instead.' -->\n- <span class=\"framework-badge-asset\" tabindex=\"0\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET @Model.Net.GetBadgeVersion()</span>\n+ <span class=\"framework-badge-asset\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET @Model.Net.GetBadgeVersion()</span>\n}\n@if (Model.NetCore != null)\n{\nif (Model.NetCore.GetBadgeVersion().IsEmpty())\n{\n- <span class=\"framework-badge-asset\" tabindex=\"0\" aria-label=\"@String.SupportedFrameworks_EmptyVersionTooltip\" data-content=\"@String.SupportedFrameworks_EmptyVersionTooltip\">.NET Core</span>\n+ <span class=\"framework-badge-asset\" aria-label=\"@String.SupportedFrameworks_EmptyVersionTooltip\" data-content=\"@String.SupportedFrameworks_EmptyVersionTooltip\">.NET Core</span>\n}\nelse\n{\n- <span class=\"framework-badge-asset\" tabindex=\"0\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET Core @Model.NetCore.GetBadgeVersion()</span>\n+ <span class=\"framework-badge-asset\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET Core @Model.NetCore.GetBadgeVersion()</span>\n}\n}\n@if (Model.NetStandard != null)\n{\nif (Model.NetStandard.GetBadgeVersion().IsEmpty())\n{\n- <span class=\"framework-badge-asset\" tabindex=\"0\" aria-label=\"@String.SupportedFrameworks_EmptyVersionTooltip\" data-content=\"@String.SupportedFrameworks_EmptyVersionTooltip\">.NET Standard</span>\n+ <span class=\"framework-badge-asset\" aria-label=\"@String.SupportedFrameworks_EmptyVersionTooltip\" data-content=\"@String.SupportedFrameworks_EmptyVersionTooltip\">.NET Standard</span>\n}\nelse\n{\n- <span class=\"framework-badge-asset\" tabindex=\"0\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET Standard @Model.NetStandard.GetBadgeVersion()</span>\n+ <span class=\"framework-badge-asset\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET Standard @Model.NetStandard.GetBadgeVersion()</span>\n}\n}\n@if (Model.NetFramework != null)\n{\nif (Model.NetFramework.GetBadgeVersion().IsEmpty())\n{\n- <span class=\"framework-badge-asset\" tabindex=\"0\" aria-label=\"@String.SupportedFrameworks_EmptyVersionTooltip\" data-content=\"@String.SupportedFrameworks_EmptyVersionTooltip\">.NET Framework</span>\n+ <span class=\"framework-badge-asset\" aria-label=\"@String.SupportedFrameworks_EmptyVersionTooltip\" data-content=\"@String.SupportedFrameworks_EmptyVersionTooltip\">.NET Framework</span>\n}\nelse\n{\n- <span class=\"framework-badge-asset\" tabindex=\"0\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET Framework @Model.NetFramework.GetBadgeVersion()</span>\n+ <span class=\"framework-badge-asset\" aria-label=\"@String.SupportedFrameworks_Tooltip\" data-content=\"@String.SupportedFrameworks_Tooltip\">.NET Framework @Model.NetFramework.GetBadgeVersion()</span>\n}\n}\n</div>\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/_SupportedFrameworksTable.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/_SupportedFrameworksTable.cshtml",
"diff": "if (compatibilityFramework.Value.Count > 0)\n{\n<tr>\n- <td class=\"framework-table-product\" tabindex=\"0\">\n+ <td class=\"framework-table-product\">\[email protected]\n</td>\n{\nif (frameworkVersion.IsComputed)\n{\n- <span class=\"framework-badge-computed framework-table-margin\" tabindex=\"0\">@frameworkVersion.Framework.GetShortFolderName()</span>\n+ <span class=\"framework-badge-computed framework-table-margin\">@frameworkVersion.Framework.GetShortFolderName()</span>\n}\nelse\n{\n- <span class=\"framework-badge-asset framework-table-margin\" tabindex=\"0\">@frameworkVersion.Framework.GetShortFolderName()</span>\n+ <span class=\"framework-badge-asset framework-table-margin\">@frameworkVersion.Framework.GetShortFolderName()</span>\n}\n}\n</td>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [A11y Bug] Remove focus from non-interactive elements on TFM badge and table. (#9108) |
455,747 | 27.04.2022 16:09:15 | 25,200 | 2bd5b23e8f370130f5ebfafe66a889fb109aa111 | Update server common libs to 2.100.0 | [
{
"change_type": "MODIFY",
"old_path": "src/DatabaseMigrationTools/DatabaseMigrationTools.csproj",
"new_path": "src/DatabaseMigrationTools/DatabaseMigrationTools.csproj",
"diff": "<PrivateAssets>all</PrivateAssets>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation\">\n- <Version>2.97.0</Version>\n+ <Version>2.100.0</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"new_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"diff": "<Version>6.0.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.FeatureFlags\">\n- <Version>2.97.0</Version>\n+ <Version>2.100.0</Version>\n</PackageReference>\n<PackageReference Include=\"WindowsAzure.Storage\">\n<Version>9.3.3</Version>\n<ItemGroup Condition=\"'$(TargetFramework)' == 'net472'\">\n<PackageReference Include=\"NuGet.Services.Messaging.Email\">\n- <Version>2.97.0</Version>\n+ <Version>2.100.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation\">\n- <Version>2.97.0</Version>\n+ <Version>2.100.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation.Issues\">\n- <Version>2.97.0</Version>\n+ <Version>2.100.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.StrongName.elmah.corelibrary\">\n<Version>1.2.2</Version>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update server common libs to 2.100.0 (#9110) |
455,754 | 17.05.2022 14:48:54 | -36,000 | e52cf37acac5d9e0bc5a351f596e0df91f7ba4c2 | Convert NuGetGallery.Services to SDK-style project | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/ConfigurationService.cs",
"new_path": "src/NuGetGallery.Services/Configuration/ConfigurationService.cs",
"diff": "using System.Threading.Tasks;\nusing System.Web;\nusing System.Web.Configuration;\n-using Microsoft.WindowsAzure.ServiceRuntime;\nusing NuGet.Services.Configuration;\nusing NuGet.Services.KeyVault;\nusing NuGetGallery.Configuration.SecretReader;\n@@ -167,22 +166,9 @@ public async Task<string> ReadSettingAsync(string settingName)\n}\npublic string ReadRawSetting(string settingName)\n- {\n- string value;\n-\n- value = GetCloudServiceSetting(settingName);\n-\n- if (value == \"null\")\n- {\n- value = null;\n- }\n- else if (string.IsNullOrEmpty(value))\n{\nvar cstr = GetConnectionString(settingName);\n- value = cstr != null ? cstr.ConnectionString : GetAppSetting(settingName);\n- }\n-\n- return value;\n+ return cstr != null ? cstr.ConnectionString : GetAppSetting(settingName); ;\n}\nprotected virtual HttpRequestBase GetCurrentRequest()\n@@ -210,39 +196,6 @@ private async Task<IPackageDeleteConfiguration> ResolvePackageDelete()\nreturn await ResolveConfigObject(new PackageDeleteConfiguration(), PackageDeletePrefix);\n}\n- protected virtual string GetCloudServiceSetting(string settingName)\n- {\n- // Short-circuit if we've already determined we're not in the cloud\n- if (_notInCloudService)\n- {\n- return null;\n- }\n-\n- string value = null;\n- try\n- {\n- if (RoleEnvironment.IsAvailable)\n- {\n- value = RoleEnvironment.GetConfigurationSettingValue(settingName);\n- }\n- else\n- {\n- _notInCloudService = true;\n- }\n- }\n- catch (TypeInitializationException)\n- {\n- // Not in the role environment...\n- _notInCloudService = true; // Skip future checks to save perf\n- }\n- catch (Exception)\n- {\n- // Value not present\n- return null;\n- }\n- return value;\n- }\n-\nprotected virtual string GetAppSetting(string settingName)\n{\nreturn WebConfigurationManager.AppSettings[settingName];\n"
},
{
"change_type": "DELETE",
"old_path": "src/NuGetGallery.Services/Properties/AssemblyInfo.cs",
"new_path": null,
"diff": "-using System;\n-using System.Reflection;\n-using System.Resources;\n-using System.Runtime.CompilerServices;\n-using System.Runtime.InteropServices;\n-\n-// General Information about an assembly is controlled through the following\n-// set of attributes. Change these attribute values to modify the information\n-// associated with an assembly.\n-[assembly: AssemblyTitle(\"NuGetGallery.Services\")]\n-[assembly: AssemblyDescription(\"\")]\n-[assembly: AssemblyCompany(\".NET Foundation\")]\n-[assembly: AssemblyProduct(\"NuGetGallery.Services\")]\n-[assembly: AssemblyCopyright(\"\\x00a9 .NET Foundation. All rights reserved.\")]\n-[assembly: AssemblyTrademark(\"\")]\n-[assembly: AssemblyCulture(\"\")]\n-\n-// Setting ComVisible to false makes the types in this assembly not visible\n-// to COM components. If you need to access a type in this assembly from\n-// COM, set the ComVisible attribute to true on that type.\n-#if !PORTABLE\n-[assembly: ComVisible(false)]\n-#endif\n-\n-// The following GUID is for the ID of the typelib if this project is exposed to COM\n-[assembly: Guid(\"c7d5e850-33fa-4ec5-8d7f-b1c8dd5d48f9\")]\n-\n-#if SIGNED_BUILD\n-[assembly: InternalsVisibleTo(\"NuGetGallery.Facts, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n-#else\n-[assembly: InternalsVisibleTo(\"NuGetGallery.Facts\")]\n-#endif\n-\n-#if DEBUG\n-[assembly: AssemblyConfiguration(\"Debug\")]\n-#else\n-[assembly: AssemblyConfiguration(\"Release\")]\n-#endif\n-\n-[assembly: CLSCompliant(false)]\n-[assembly: NeutralResourcesLanguage(\"en-us\")]\n-\n-// The build will automatically inject the following attributes:\n-// AssemblyVersion, AssemblyFileVersion, AssemblyInformationalVersion, AssemblyMetadata (for Branch, CommitId, and BuildDateUtc)\n-\n-[assembly: AssemblyMetadata(\"RepositoryUrl\", \"https://www.github.com/NuGet/NuGetGallery\")]\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/App_Start/ConfigurationServiceFacts.cs",
"new_path": "tests/NuGetGallery.Facts/App_Start/ConfigurationServiceFacts.cs",
"diff": "@@ -113,8 +113,6 @@ public TestableConfigurationService(ICachingSecretInjector secretInjector = null\npublic string ConnectionStringStub { get; set; }\n- public string CloudSettingStub { get; set; }\n-\npublic string AppSettingStub { get; set; }\nprotected override ConnectionStringSettings GetConnectionString(string settingName)\n@@ -122,11 +120,6 @@ protected override ConnectionStringSettings GetConnectionString(string settingNa\nreturn new ConnectionStringSettings(ConnectionStringStub, ConnectionStringStub);\n}\n- protected override string GetCloudServiceSetting(string settingName)\n- {\n- return CloudSettingStub;\n- }\n-\nprotected override string GetAppSetting(string settingName)\n{\nreturn AppSettingStub;\n@@ -139,28 +132,11 @@ private static ICachingSecretInjector CreateDefaultSecretInjector()\n}\n}\n- [Fact]\n- public async Task WhenCloudSettingIsNullStringNullIsReturned()\n- {\n- // Arrange\n- var configurationService = new TestableConfigurationService();\n- configurationService.CloudSettingStub = \"null\";\n- configurationService.AppSettingStub = \"bla\";\n- configurationService.ConnectionStringStub = \"abc\";\n-\n- // Act\n- string result = await configurationService.ReadSettingAsync(\"any\");\n-\n- // Assert\n- Assert. Null(result);\n- }\n-\n[Fact]\npublic async Task WhenCloudSettingIsEmptyAppSettingIsReturned()\n{\n// Arrange\nvar configurationService = new TestableConfigurationService();\n- configurationService.CloudSettingStub = null;\nconfigurationService.AppSettingStub = string.Empty;\nconfigurationService.ConnectionStringStub = \"abc\";\n@@ -172,7 +148,7 @@ public async Task WhenCloudSettingIsEmptyAppSettingIsReturned()\n}\n[Fact]\n- public async Task WhenSettingIsNotEmptySecretInjectorIsRan()\n+ public async Task WhenSettingIsNotEmptySecretInjectorIsRun()\n{\n// Arrange\nvar secretInjectorMock = new Mock<ICachingSecretInjector>();\n@@ -180,7 +156,7 @@ public async Task WhenSettingIsNotEmptySecretInjectorIsRan()\n.Returns<string>(s => Task.FromResult(s + \"parsed\"));\nvar configurationService = new TestableConfigurationService(secretInjectorMock.Object);\n- configurationService.CloudSettingStub = \"somevalue\";\n+ configurationService.ConnectionStringStub = \"somevalue\";\n// Act\nstring result = await configurationService.ReadSettingAsync(\"any\");\n@@ -198,7 +174,7 @@ public async Task WhenSettingIsNotEmptySecretInjectorIsRan()\n[InlineData(\"Gallery.sqlserverreadonlyreplica\")]\n[InlineData(\"Gallery.supportrequestsqlserver\")]\n[InlineData(\"Gallery.validationsqlserver\")]\n- public async Task GivenNotInjectedSettingNameSecretInjectorIsNotRan(string settingName)\n+ public async Task GivenNotInjectedSettingNameSecretInjectorIsNotRun(string settingName)\n{\n// Arrange\nvar secretInjectorMock = new Mock<ICachingSecretInjector>();\n@@ -206,7 +182,7 @@ public async Task GivenNotInjectedSettingNameSecretInjectorIsNotRan(string setti\n.Returns<string>(s => Task.FromResult(s + \"parsed\"));\nvar configurationService = new TestableConfigurationService(secretInjectorMock.Object);\n- configurationService.CloudSettingStub = \"somevalue\";\n+ configurationService.ConnectionStringStub = \"somevalue\";\n// Act\nstring result = await configurationService.ReadSettingAsync(settingName);\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Convert NuGetGallery.Services to SDK-style project |
455,754 | 18.05.2022 12:55:54 | -36,000 | d0757d33cf9dd386c13347f9d44f352cea65c66b | Remove unused field from ConfigurationService | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Configuration/ConfigurationService.cs",
"new_path": "src/NuGetGallery.Services/Configuration/ConfigurationService.cs",
"diff": "@@ -24,7 +24,6 @@ public class ConfigurationService : IGalleryConfigurationService, IConfiguration\nprotected const string ServiceBusPrefix = \"AzureServiceBus.\";\nprotected const string PackageDeletePrefix = \"PackageDelete.\";\n- private bool _notInCloudService;\nprivate readonly Lazy<string> _httpSiteRootThunk;\nprivate readonly Lazy<string> _httpsSiteRootThunk;\nprivate readonly Lazy<IAppConfiguration> _lazyAppConfiguration;\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Remove unused field from ConfigurationService |
455,736 | 02.06.2022 18:40:18 | 25,200 | 747039872c3211130704cafb9c6a101573bc82d8 | Mark backup folders as private
They are already set as private in Blob Storage. There is no known scenario that needs public (unauthenticated) access to these blobs. | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/Services/GalleryCloudBlobContainerInformationProvider.cs",
"new_path": "src/NuGetGallery.Core/Services/GalleryCloudBlobContainerInformationProvider.cs",
"diff": "@@ -11,10 +11,8 @@ public class GalleryCloudBlobContainerInformationProvider : ICloudBlobContainerI\n{\nprivate static readonly HashSet<string> KnownPublicFolders = new HashSet<string> {\nCoreConstants.Folders.PackagesFolderName,\n- CoreConstants.Folders.PackageBackupsFolderName,\nCoreConstants.Folders.DownloadsFolderName,\nCoreConstants.Folders.SymbolPackagesFolderName,\n- CoreConstants.Folders.SymbolPackageBackupsFolderName,\nCoreConstants.Folders.FlatContainerFolderName,\n};\n@@ -27,6 +25,8 @@ public class GalleryCloudBlobContainerInformationProvider : ICloudBlobContainerI\nCoreConstants.Folders.RevalidationFolderName,\nCoreConstants.Folders.StatusFolderName,\nCoreConstants.Folders.PackagesContentFolderName,\n+ CoreConstants.Folders.PackageBackupsFolderName,\n+ CoreConstants.Folders.SymbolPackageBackupsFolderName,\n};\npublic string GetCacheControl(string folderName)\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Mark backup folders as private (#9129)
They are already set as private in Blob Storage. There is no known scenario that needs public (unauthenticated) access to these blobs. |
455,736 | 03.06.2022 14:15:01 | 25,200 | e6dd16fd3462ba742543560cec45b0d332ae56d8 | Update grunt to 1.5.3 to remediate Dependabot warning | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/package-lock.json",
"new_path": "src/Bootstrap/package-lock.json",
"diff": "\"optional\": true\n},\n\"node_modules/grunt\": {\n- \"version\": \"1.4.1\",\n- \"resolved\": \"https://registry.npmjs.org/grunt/-/grunt-1.4.1.tgz\",\n- \"integrity\": \"sha512-ZXIYXTsAVrA7sM+jZxjQdrBOAg7DyMUplOMhTaspMRExei+fD0BTwdWXnn0W5SXqhb/Q/nlkzXclSi3IH55PIA==\",\n+ \"version\": \"1.5.3\",\n+ \"resolved\": \"https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz\",\n+ \"integrity\": \"sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==\",\n\"dev\": true,\n\"dependencies\": {\n\"dateformat\": \"~3.0.3\",\n\"exit\": \"~0.1.2\",\n\"findup-sync\": \"~0.3.0\",\n\"glob\": \"~7.1.6\",\n- \"grunt-cli\": \"~1.4.2\",\n+ \"grunt-cli\": \"~1.4.3\",\n\"grunt-known-options\": \"~2.0.0\",\n\"grunt-legacy-log\": \"~3.0.0\",\n\"grunt-legacy-util\": \"~2.0.1\",\n\"optional\": true\n},\n\"grunt\": {\n- \"version\": \"1.4.1\",\n- \"resolved\": \"https://registry.npmjs.org/grunt/-/grunt-1.4.1.tgz\",\n- \"integrity\": \"sha512-ZXIYXTsAVrA7sM+jZxjQdrBOAg7DyMUplOMhTaspMRExei+fD0BTwdWXnn0W5SXqhb/Q/nlkzXclSi3IH55PIA==\",\n+ \"version\": \"1.5.3\",\n+ \"resolved\": \"https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz\",\n+ \"integrity\": \"sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==\",\n\"dev\": true,\n\"requires\": {\n\"dateformat\": \"~3.0.3\",\n\"exit\": \"~0.1.2\",\n\"findup-sync\": \"~0.3.0\",\n\"glob\": \"~7.1.6\",\n- \"grunt-cli\": \"~1.4.2\",\n+ \"grunt-cli\": \"~1.4.3\",\n\"grunt-known-options\": \"~2.0.0\",\n\"grunt-legacy-log\": \"~3.0.0\",\n\"grunt-legacy-util\": \"~2.0.1\",\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update grunt to 1.5.3 to remediate Dependabot warning (#9130) |
455,756 | 08.06.2022 18:15:49 | 25,200 | 6624919f3f98fd22e44bc19f8a906653261d5235 | Remove the trailing slash when formatting the tab fragment
* Remove the trailing slash when it appears
* Revert "Remove the trailing slash when it appears"
This reverts commit
* Trim the end slash | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Shared/_ListPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Shared/_ListPackage.cshtml",
"diff": "<div class=\"col-sm-11\">\n<div class=\"package-header\">\n<a class=\"package-title\"\n- href=\"@Url.Package(Model.Id, Model.UseVersion ? Model.Version : null)\"\n+ href=\"@Url.Package(Model.Id, Model.UseVersion ? Model.Version : null).TrimEnd('/')\"\n@if (itemIndex.HasValue)\n{\n@:data-track=\"@eventName\" data-track-value=\"@itemIndex\"\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Remove the trailing slash when formatting the tab fragment (#9138)
* Remove the trailing slash when it appears
* Revert "Remove the trailing slash when it appears"
This reverts commit 855ea8fa0c4617b5c97c6f6e1e42600a4ea9c483.
* Trim the end slash |
455,736 | 10.06.2022 14:42:53 | 25,200 | 0cf362ab2287a0b2913e580b1d6a560898cb5610 | Remove in-memory caching from endpoints that are cached by APIM
Resolve | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/ServicesConstants.cs",
"new_path": "src/NuGetGallery.Services/ServicesConstants.cs",
"diff": "@@ -59,7 +59,6 @@ public static class ContentNames\npublic static readonly string TyposquattingConfiguration = \"Typosquatting-Configuration\";\npublic static readonly string NuGetPackagesGitHubDependencies = \"GitHubUsage.v1\";\npublic static readonly string ABTestConfiguration = \"AB-Test-Configuration\";\n- public static readonly string ODataCacheConfiguration = \"OData-Cache-Configuration\";\npublic static readonly string CacheConfiguration = \"Cache-Configuration\";\npublic static readonly string QueryHintConfiguration = \"Query-Hint-Configuration\";\npublic static readonly string TrustedImageDomains = \"Trusted-Image-Domains\";\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Storage/ContentObjectService.cs",
"new_path": "src/NuGetGallery.Services/Storage/ContentObjectService.cs",
"diff": "@@ -25,7 +25,6 @@ public ContentObjectService(IContentService contentService)\nTyposquattingConfiguration = new TyposquattingConfiguration();\nGitHubUsageConfiguration = new GitHubUsageConfiguration(Array.Empty<RepositoryInformation>());\nABTestConfiguration = new ABTestConfiguration();\n- ODataCacheConfiguration = new ODataCacheConfiguration();\nCacheConfiguration = new CacheConfiguration();\nQueryHintConfiguration = new QueryHintConfiguration();\nTrustedImageDomains = new TrustedImageDomains();\n@@ -37,7 +36,6 @@ public ContentObjectService(IContentService contentService)\npublic ITyposquattingConfiguration TyposquattingConfiguration { get; private set; }\npublic IGitHubUsageConfiguration GitHubUsageConfiguration { get; private set; }\npublic IABTestConfiguration ABTestConfiguration { get; private set; }\n- public IODataCacheConfiguration ODataCacheConfiguration { get; private set; }\npublic ICacheConfiguration CacheConfiguration { get; private set; }\npublic IQueryHintConfiguration QueryHintConfiguration { get; private set; }\npublic ITrustedImageDomains TrustedImageDomains { get; private set; }\n@@ -69,10 +67,6 @@ public async Task Refresh()\nawait Refresh<ABTestConfiguration>(ServicesConstants.ContentNames.ABTestConfiguration) ??\nnew ABTestConfiguration();\n- ODataCacheConfiguration =\n- await Refresh<ODataCacheConfiguration>(ServicesConstants.ContentNames.ODataCacheConfiguration) ??\n- new ODataCacheConfiguration();\n-\nCacheConfiguration =\nawait Refresh<CacheConfiguration>(ServicesConstants.ContentNames.CacheConfiguration) ??\nnew CacheConfiguration();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/Storage/IContentObjectService.cs",
"new_path": "src/NuGetGallery.Services/Storage/IContentObjectService.cs",
"diff": "@@ -14,7 +14,6 @@ public interface IContentObjectService\nITyposquattingConfiguration TyposquattingConfiguration { get; }\nIGitHubUsageConfiguration GitHubUsageConfiguration { get; }\nIABTestConfiguration ABTestConfiguration { get; }\n- IODataCacheConfiguration ODataCacheConfiguration { get; }\nICacheConfiguration CacheConfiguration { get; }\nIQueryHintConfiguration QueryHintConfiguration { get; }\nITrustedImageDomains TrustedImageDomains { get; }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/AccountsController.cs",
"new_path": "src/NuGetGallery/Controllers/AccountsController.cs",
"diff": "@@ -645,10 +645,6 @@ public virtual JsonResult GetCertificate(string accountName, string thumbprint)\n}\n[HttpGet]\n- [OutputCache(\n- Duration = GalleryConstants.GravatarCacheDurationSeconds,\n- Location = OutputCacheLocation.Downstream,\n- VaryByParam = \"imageSize\")]\npublic async Task<ActionResult> GetAvatar(\nstring accountName,\nint? imageSize = GalleryConstants.GravatarImageSize)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/ODataV1FeedController.cs",
"new_path": "src/NuGetGallery/Controllers/ODataV1FeedController.cs",
"diff": "@@ -53,7 +53,6 @@ public class ODataV1FeedController\n// /api/v1/Packages\n[HttpGet]\n[HttpPost]\n- [CacheOutput(NoCache = true)]\npublic IHttpActionResult Get(ODataQueryOptions<V1FeedPackage> options)\n{\n_telemetryService.TrackApiRequest(\"/api/v1/Packages\");\n@@ -62,7 +61,6 @@ public IHttpActionResult Get(ODataQueryOptions<V1FeedPackage> options)\n// /api/v1/Packages/$count\n[HttpGet]\n- [CacheOutput(NoCache = true)]\npublic IHttpActionResult GetCount(ODataQueryOptions<V1FeedPackage> options)\n{\n_telemetryService.TrackApiRequest(\"/api/v1/Packages/$count\");\n@@ -102,11 +100,6 @@ private IHttpActionResult Get(ODataQueryOptions<V1FeedPackage> options, bool isN\n// /api/v1/Packages(Id=,Version=)\n[HttpGet]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.GetSpecificPackage,\n- serverTimeSpan: ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds,\n- Private = true,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> Get(ODataQueryOptions<V1FeedPackage> options, string id, string version)\n{\n_telemetryService.TrackApiRequest(\"/api/v1/Packages(Id=,Version=)\");\n@@ -122,11 +115,6 @@ public async Task<IHttpActionResult> Get(ODataQueryOptions<V1FeedPackage> option\n// /api/v1/FindPackagesById()?id=\n[HttpGet]\n[HttpPost]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.FindPackagesById,\n- serverTimeSpan: ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds,\n- Private = true,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> FindPackagesById(ODataQueryOptions<V1FeedPackage> options, [FromODataUri]string id)\n{\n_telemetryService.TrackApiRequest(\"/api/v1/FindPackagesById()?id=\");\n@@ -138,10 +126,6 @@ public async Task<IHttpActionResult> FindPackagesById(ODataQueryOptions<V1FeedPa\n// /api/v1/FindPackagesById()/$count?id=\n[HttpGet]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.FindPackagesByIdCount,\n- serverTimeSpan: ODataCacheConfiguration.DefaultFindPackagesByIdCountCacheTimeInSeconds,\n- NoCache = true)]\npublic async Task<IHttpActionResult> FindPackagesByIdCount(ODataQueryOptions<V1FeedPackage> options, [FromODataUri] string id)\n{\n_telemetryService.TrackApiRequest(\"/api/v1/FindPackagesById()/$count?id=\");\n@@ -273,10 +257,6 @@ public IHttpActionResult GetPropertyFromPackages(string propertyName, string id,\n// /api/v1/Search()?searchTerm=&targetFramework=&includePrerelease=\n[HttpGet]\n[HttpPost]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.Search,\n- serverTimeSpan: ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> Search(\nODataQueryOptions<V1FeedPackage> options,\n[FromODataUri]string searchTerm = \"\",\n@@ -292,10 +272,6 @@ public IHttpActionResult GetPropertyFromPackages(string propertyName, string id,\n// /api/v1/Search()/$count?searchTerm=&targetFramework=&includePrerelease=\n[HttpGet]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.Search,\n- serverTimeSpan: ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> SearchCount(\nODataQueryOptions<V1FeedPackage> options,\n[FromODataUri]string searchTerm = \"\",\n@@ -398,7 +374,6 @@ public IHttpActionResult GetPropertyFromPackages(string propertyName, string id,\n}\n[HttpGet]\n- [CacheOutput(NoCache = true)]\npublic virtual HttpResponseMessage SimulateError([FromUri] string type = \"Exception\")\n{\nif (!Enum.TryParse<SimulatedErrorType>(type, out var parsedType))\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Controllers/ODataV2FeedController.cs",
"new_path": "src/NuGetGallery/Controllers/ODataV2FeedController.cs",
"diff": "@@ -56,7 +56,6 @@ public class ODataV2FeedController\n// /api/v2/Packages?semVerLevel=\n[HttpGet]\n[HttpPost]\n- [CacheOutput(NoCache = true)]\npublic async Task<IHttpActionResult> Get(\nODataQueryOptions<V2FeedPackage> options,\n[FromUri]string semVerLevel = null)\n@@ -70,7 +69,6 @@ public class ODataV2FeedController\n// /api/v2/Packages/$count?semVerLevel=\n[HttpGet]\n- [CacheOutput(NoCache = true)]\npublic async Task<IHttpActionResult> GetCount(\nODataQueryOptions<V2FeedPackage> options,\n[FromUri] string semVerLevel = null)\n@@ -189,11 +187,6 @@ public class ODataV2FeedController\n// /api/v2/Packages(Id=,Version=)\n[HttpGet]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.GetSpecificPackage,\n- serverTimeSpan: ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds,\n- Private = true,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> Get(\nODataQueryOptions<V2FeedPackage> options,\nstring id,\n@@ -219,11 +212,6 @@ public class ODataV2FeedController\n// /api/v2/FindPackagesById()?id=&semVerLevel=\n[HttpGet]\n[HttpPost]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.FindPackagesById,\n- serverTimeSpan: ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds,\n- Private = true,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultGetByIdAndVersionCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> FindPackagesById(\nODataQueryOptions<V2FeedPackage> options,\n[FromODataUri]string id,\n@@ -239,10 +227,6 @@ public class ODataV2FeedController\n// /api/v2/FindPackagesById()/$count?semVerLevel=\n[HttpGet]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.FindPackagesByIdCount,\n- serverTimeSpan: ODataCacheConfiguration.DefaultFindPackagesByIdCountCacheTimeInSeconds,\n- NoCache = true)]\npublic async Task<IHttpActionResult> FindPackagesByIdCount(\nODataQueryOptions<V2FeedPackage> options,\n[FromODataUri] string id,\n@@ -431,10 +415,6 @@ public IHttpActionResult GetPropertyFromPackages(string propertyName, string id,\n// /api/v2/Search()?searchTerm=&targetFramework=&includePrerelease=\n[HttpGet]\n[HttpPost]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.Search,\n- serverTimeSpan: ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> Search(\nODataQueryOptions<V2FeedPackage> options,\n[FromODataUri]string searchTerm = \"\",\n@@ -454,10 +434,6 @@ public IHttpActionResult GetPropertyFromPackages(string propertyName, string id,\n// /api/v2/Search()/$count?searchTerm=&targetFramework=&includePrerelease=&semVerLevel=\n[HttpGet]\n- [ODataCacheOutput(\n- ODataCachedEndpoint.Search,\n- serverTimeSpan: ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds,\n- ClientTimeSpan = ODataCacheConfiguration.DefaultSearchCacheTimeInSeconds)]\npublic async Task<IHttpActionResult> SearchCount(\nODataQueryOptions<V2FeedPackage> options,\n[FromODataUri] string searchTerm = \"\",\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Compile Include=\"Infrastructure\\Mail\\Messages\\TwoFactorFeedbackMessage.cs\" />\n<Compile Include=\"Infrastructure\\Mail\\Messages\\SearchSideBySideMessage.cs\" />\n<Compile Include=\"Infrastructure\\HijackSearchServiceFactory.cs\" />\n- <Compile Include=\"Infrastructure\\ODataCachedEndpoint.cs\" />\n- <Compile Include=\"Infrastructure\\ODataCacheOutputAttribute.cs\" />\n<Compile Include=\"Infrastructure\\UserDeletedErrorFilter.cs\" />\n<Compile Include=\"Infrastructure\\SearchServiceFactory.cs\" />\n<Compile Include=\"Migrations\\201903020136235_CvesCanBeEmpty.cs\" />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/VerifyMicrosoftPackage/Fakes/FakeContentObjectService.cs",
"new_path": "src/VerifyMicrosoftPackage/Fakes/FakeContentObjectService.cs",
"diff": "@@ -22,8 +22,6 @@ public class FakeContentObjectService : IContentObjectService\npublic IABTestConfiguration ABTestConfiguration => throw new NotImplementedException();\n- public IODataCacheConfiguration ODataCacheConfiguration => throw new NotImplementedException();\n-\npublic ICacheConfiguration CacheConfiguration => throw new NotImplementedException();\npublic IQueryHintConfiguration QueryHintConfiguration => throw new NotImplementedException();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj",
"new_path": "tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj",
"diff": "<Compile Include=\"Authentication\\TestCredentialHelper.cs\" />\n<Compile Include=\"Extensions\\CakeBuildManagerExtensionsFacts.cs\" />\n<Compile Include=\"Helpers\\PackageValidationHelperFacts.cs\" />\n- <Compile Include=\"Infrastructure\\ODataCacheOutputAttributeFacts.cs\" />\n<Compile Include=\"Queries\\AutocompleteDatabasePackageIdsQueryFacts.cs\" />\n<Compile Include=\"Queries\\AutocompleteDatabasePackageVersionsQueryFacts.cs\" />\n<Compile Include=\"Queries\\AutocompleteServiceQueryFacts.cs\" />\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Remove in-memory caching from endpoints that are cached by APIM (#9139)
Resolve https://github.com/NuGet/Engineering/issues/4370 |
455,739 | 27.06.2022 13:01:10 | 25,200 | 5fd09327f9b69c2d3777001551755cf7be65e2de | Fix A11y bugs
* no aria-required for labels
* Contrast and tabbing bugs
* Nit
* Revert "Nit"
This reverts commit
* reNit | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/theme/common-readme.less",
"new_path": "src/Bootstrap/less/theme/common-readme.less",
"diff": "tr:nth-child(even) {\nbackground-color: @readme-table-bg-color;\n+ a {\n+ color: @readme-table-link-color\n+ }\n}\n// We added boostrap extension in Markdig to render markdown file, it adds .img-fluid class to all images links <img>,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/less/variables.less",
"new_path": "src/Bootstrap/less/variables.less",
"diff": "@table-border-color: #ddd;\n@readme-table-bg-color: #f2f2f2;\n+@readme-table-link-color: #2d6da4;\n//== Buttons\n//\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Code/ViewHelpers.cshtml",
"new_path": "src/NuGetGallery/App_Code/ViewHelpers.cshtml",
"diff": "@@ -645,7 +645,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);\n$submit.before(\n'<div id=\"recaptcha\" class=\"g-recaptcha\" '\n+ 'data-sitekey=\"@reCaptchaPublicKey\" data-size=\"invisible\" '\n- + 'data-callback=\"onSubmit\" data-tabindex=\"-1\"></div>');\n+ + 'data-callback=\"onSubmit\" data-tabindex=\"1\"></div>');\nvar $form = $submit.parents('form')\n$submit.click(function (e) {\n@@ -660,7 +660,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);\n}\nwindow.onload = function () {\n- $('div.g-recaptcha iframe').attr({ tabindex: \"-1\" });\n+ $('div.g-recaptcha iframe').attr({ tabindex: \"1\" });\n}\n</script>\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Scripts/gallery/jquery.validate-1.16.0.js",
"new_path": "src/NuGetGallery/Scripts/gallery/jquery.validate-1.16.0.js",
"diff": "// Add aria-required to any Static/Data/Class required fields before first validation\n// Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html\n- $(this.currentForm).find(\"[required], [data-rule-required], .required\").attr(\"aria-required\", \"true\");\n+ // We exclude labels since it's not accessible\n+ $(this.currentForm).find(\"[required], [data-rule-required], .required\").not(\"label\").attr(\"aria-required\", \"true\");\n},\n// http://jqueryvalidation.org/Validator.form/\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Fix A11y bugs (#9148)
* no aria-required for labels
* Contrast and tabbing bugs
* Nit
* Revert "Nit"
This reverts commit d7e381a9fd7c6a652e1860ccf90417625e47548d.
* reNit
Co-authored-by: Advay Tandon <[email protected]> |
455,754 | 12.07.2022 07:33:00 | -36,000 | 9194611b3e0e5655dba66aa1cf50701e0a19f9da | Add netstandard2.1 target to NuGetGallery.Services
Add netstandard2.1 target to NuGetGallery.Services | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"new_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"diff": "<Import Project=\"..\\..\\SdkProjects.props\" />\n<PropertyGroup>\n- <TargetFramework>net472</TargetFramework>\n+ <TargetFrameworks>net472;netstandard2.1</TargetFrameworks>\n<Description>Services library for NuGet Gallery Frontend and Backend</Description>\n</PropertyGroup>\n</AssemblyAttribute>\n</ItemGroup>\n- <ItemGroup>\n+ <ItemGroup Condition=\"'$(TargetFramework)' == 'netstandard2.1'\">\n+ <Compile Remove=\"AccountManagement\\*.cs\" />\n+ <Compile Remove=\"Authentication\\**\\*.cs\" />\n+ <Compile Remove=\"Configuration\\**\\*.cs\" />\n+ <Compile Remove=\"Diagnostics\\*.cs\" />\n+ <Compile Remove=\"Extensions\\*.cs\" />\n+ <Compile Remove=\"Helpers\\*.cs\" />\n+ <Compile Remove=\"Mail\\**\\*.cs\" />\n+ <Compile Remove=\"Models\\*.cs\" />\n+ <Compile Remove=\"PackageManagement\\*.cs\" />\n+ <Compile Remove=\"Permissions\\*.cs\" />\n+ <Compile Remove=\"Properties\\*.cs\" />\n+ <Compile Remove=\"Providers\\*.cs\" />\n+ <Compile Remove=\"Security\\*.cs\" />\n+ <Compile Remove=\"Storage\\*.cs\" />\n+ <Compile Remove=\"SupportRequest\\ISupportRequestService.cs\" />\n+ <Compile Remove=\"SupportRequest\\SupportRequestService.cs\" />\n+ <Compile Remove=\"Telemetry\\ITelemetryService.cs\" />\n+ <Compile Remove=\"Telemetry\\Obfuscator.cs\" />\n+ <Compile Remove=\"Telemetry\\QuietLog.cs\" />\n+ <Compile Remove=\"Telemetry\\TelemetryService.cs\" />\n+ <Compile Remove=\"Telemetry\\UserPackageDeleteEvent.cs\" />\n+ <Compile Remove=\"Telemetry\\UserPackageDeleteOutcome.cs\" />\n+ <Compile Remove=\"UserManagement\\*.cs\" />\n+ </ItemGroup>\n+\n+ <ItemGroup Condition=\"'$(TargetFramework)' == 'net472'\">\n<Reference Include=\"System.Configuration\" />\n<Reference Include=\"System.Web.Extensions\" />\n</ItemGroup>\n</ItemGroup>\n<ItemGroup>\n- <PackageReference Include=\"EntityFramework\">\n- <Version>6.4.0-preview3-19553-01</Version>\n- </PackageReference>\n<PackageReference Include=\"Microsoft.ApplicationInsights\">\n<Version>2.12.0</Version>\n</PackageReference>\n+ </ItemGroup>\n+\n+ <ItemGroup Condition=\"'$(TargetFramework)' == 'net472'\">\n<PackageReference Include=\"Microsoft.AspNet.Mvc\">\n<Version>5.2.3</Version>\n</PackageReference>\n"
},
{
"change_type": "RENAME",
"old_path": "src/NuGetGallery.Services/Telemetry/DurationMetric.cs",
"new_path": "src/NuGetGallery.Services/Telemetry/DurationTracker.cs",
"diff": ""
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add netstandard2.1 target to NuGetGallery.Services (#9158)
Add netstandard2.1 target to NuGetGallery.Services |
455,736 | 14.07.2022 16:30:47 | 25,200 | 487be28b42cbaca5f120cb59009e98b26045d05e | Update SECURITY.md
Fix wording around how Microsoft's security policy applies to this .NET Foundation code repository. | [
{
"change_type": "MODIFY",
"old_path": "SECURITY.md",
"new_path": "SECURITY.md",
"diff": "Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).\n-If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.\n+Microsoft serves as the primary maintainer of this repository. If you believe you have found a security vulnerability that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.\n## Reporting Security Issues\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update SECURITY.md (#9164)
Fix wording around how Microsoft's security policy applies to this .NET Foundation code repository. |
455,754 | 19.07.2022 12:17:23 | -36,000 | 88727038d1977789d044672702f5969a3726445d | Add Models classes to netstandard2.1 | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"new_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"diff": "<Compile Remove=\"Extensions\\*.cs\" />\n<Compile Remove=\"Helpers\\*.cs\" />\n<Compile Remove=\"Mail\\**\\*.cs\" />\n- <Compile Remove=\"Models\\*.cs\" />\n<Compile Remove=\"PackageManagement\\*.cs\" />\n<Compile Remove=\"Permissions\\*.cs\" />\n<Compile Remove=\"Properties\\*.cs\" />\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add Models classes to netstandard2.1 (#9163) |
455,744 | 19.07.2022 19:47:50 | 25,200 | 2edeac8ab27019d4bc28bf69c8019b5276442f11 | Ran grunt after recent change to LESS files, to update actual used CSS | [
{
"change_type": "MODIFY",
"old_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"new_path": "src/Bootstrap/dist/css/bootstrap-theme.css",
"diff": "@@ -675,6 +675,9 @@ img.reserved-indicator-icon {\n.readme-common tr:nth-child(even) {\nbackground-color: #f2f2f2;\n}\n+.readme-common tr:nth-child(even) a {\n+ color: #2d6da4;\n+}\n.readme-common img.img-fluid {\nmax-width: 100%;\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Ran grunt after recent change to LESS files, to update actual used CSS (#9169) |
455,741 | 20.07.2022 13:46:22 | 25,200 | 441dbc7ab4068cf792b48ff84a3934ea5588e93b | Add newtonsoft.json package reference | [
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.LoadTests/NuGetGallery.LoadTests.csproj",
"new_path": "tests/NuGetGallery.LoadTests/NuGetGallery.LoadTests.csproj",
"diff": "<SccLocalPath>SAK</SccLocalPath>\n<SccAuxPath>SAK</SccAuxPath>\n<SccProvider>SAK</SccProvider>\n+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>\n<NuGetPackageImportStamp>\n</NuGetPackageImportStamp>\n<TargetFrameworkProfile />\n<PackageReference Include=\"FluentLinkChecker\">\n<Version>1.0.0.10</Version>\n</PackageReference>\n+ <PackageReference Include=\"Newtonsoft.Json\">\n+ <Version>13.0.1</Version>\n+ </PackageReference>\n</ItemGroup>\n<Choose>\n<When Condition=\"'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'\">\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add newtonsoft.json package reference (#9176) |
455,741 | 16.08.2022 12:21:10 | 25,200 | 945b6583d4cb871def07647c880d1ab7f0d0376e | bundle script | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/AppActivator.cs",
"new_path": "src/NuGetGallery/App_Start/AppActivator.cs",
"diff": "@@ -215,6 +215,10 @@ private static void BundlingPostStart()\n.Include(\"~/Scripts/gallery/md5.js\");\nBundleTable.Bundles.Add(addOrganizationScriptBundle);\n+ var syntaxhighlightScriptBundle = new ScriptBundle(\"~/Scripts/gallery/syntaxhighlight.min.js\")\n+ .Include(\"~/Scripts/gallery/syntaxhighlight.js\");\n+ BundleTable.Bundles.Add(syntaxhighlightScriptBundle);\n+\n// This is needed for the Admin database viewer.\nScriptManager.ScriptResourceMapping.AddDefinition(\"jquery\",\nnew ScriptResourceDefinition { Path = scriptBundle.Path });\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Content Include=\"Scripts\\gallery\\instrumentation.js\" />\n<Content Include=\"Scripts\\gallery\\knockout-3.5.1.js\" />\n<Content Include=\"Scripts\\gallery\\page-list-packages.js\" />\n+ <Content Include=\"Scripts\\gallery\\syntaxhighlight.js\" />\n<Content Include=\"Views\\Shared\\SiteMenu.cshtml\">\n<SubType>Code</SubType>\n</Content>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/Manage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/Manage.cshtml",
"diff": "@Scripts.Render(\"~/Scripts/gallery/page-manage-deprecation.min.js\")\[email protected](\"~/Scripts/gallery/page-delete-package.min.js\")\[email protected](\"~/Scripts/gallery/page-edit-readme.min.js\")\n- @Scripts.Render(\"~/Scripts/gallery/syntaxhighlight.js\")\n+ @Scripts.Render(\"~/Scripts/gallery/syntaxhighlight.min.js\")\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/UploadPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/UploadPackage.cshtml",
"diff": "@* Right now this is the only page that uses this script. If we increase our usage of it, we should put it in our bundles *@\[email protected](\"~/Scripts/gallery/page-edit-readme.min.js\")\[email protected](\"~/Scripts/gallery/async-file-upload.min.js\")\n- @Scripts.Render(\"~/Scripts/gallery/syntaxhighlight.js\")\n+ @Scripts.Render(\"~/Scripts/gallery/syntaxhighlight.min.js\")\n<script type=\"text/javascript\">\nvar InProgressPackage = @Html.Raw(Json.Encode(Model.InProgressUpload));\nwindow.nuget.configureExpanderHeading(\"upload-package-form\");\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.FunctionalTests/StaticAssets/StaticAssetsTests.cs",
"new_path": "tests/NuGetGallery.FunctionalTests/StaticAssets/StaticAssetsTests.cs",
"diff": "@@ -106,6 +106,13 @@ public StaticAssetsTests(ITestOutputHelper testOutputHelper) : base(testOutputHe\n\"Scripts/gallery/page-support-requests.js\",\n}\n},\n+ {\n+ \"Scripts/gallery/syntaxhighlight.min.js\",\n+ new[]\n+ {\n+ \"Scripts/gallery/syntaxhighlight.js\",\n+ }\n+ },\n};\nprivate static readonly HashSet<string> BundleInputPaths = new HashSet<string>(Bundles.SelectMany(x => x.Value));\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | bundle script (#9191) |
455,754 | 17.08.2022 14:43:17 | -36,000 | ee1bd6b6650c6c121d22c4c16a511badbe18bdff | Manage disposal of httpclient directly - autofac disposing early | [
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/Job.cs",
"new_path": "src/GitHubVulnerabilities2Db/Job.cs",
"diff": "@@ -134,7 +134,8 @@ protected void ConfigureQueryServices(ContainerBuilder containerBuilder)\n{\ncontainerBuilder\n.RegisterInstance(_client)\n- .As<HttpClient>();\n+ .As<HttpClient>()\n+ .ExternallyOwned(); // We don't want autofac disposing this--see https://github.com/NuGet/NuGetGallery/issues/9194\ncontainerBuilder\n.RegisterType<QueryService>()\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Manage disposal of httpclient directly - autofac disposing early (#9195) |
455,747 | 19.08.2022 11:51:36 | 25,200 | ed43f939f860b12352489af2869f3f7df0c4e523 | [Hotfix] Set download count to Int32.MaxValue for V2 feed packages exceeding this threshold | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/OData/PackageExtensions.cs",
"new_path": "src/NuGetGallery/OData/PackageExtensions.cs",
"diff": "@@ -88,7 +88,10 @@ public static IQueryable<V1FeedPackage> ToV1FeedPackageQuery(this IQueryable<Pac\nCreated = p.Created,\nDependencies = p.FlattenedDependencies,\nDescription = p.Description,\n- DownloadCount = p.PackageRegistration.DownloadCount,\n+ // Some of the older clients and packages (eg: NuGet.Core) suffer from integer overflow when the download count\n+ // exceeds the MaxValue due to usage of Int32 for \"DownloadCount\" field. As such, for the V2 Feed restrict the download\n+ // count to Int32.MaxValue in order to allow older clients to successfully fetch these values.\n+ DownloadCount = p.PackageRegistration.DownloadCount > Int32.MaxValue ? (long)Int32.MaxValue : p.PackageRegistration.DownloadCount,\nGalleryDetailsUrl = siteRoot + \"packages/\" + p.PackageRegistration.Id + \"/\" + p.NormalizedVersion,\nIconUrl = p.IconUrl,\n// We do not expose the internal IsLatestSemVer2 and IsLatestStableSemVer2 properties;\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/OData/Interceptors/PackageExtensionsFacts.cs",
"new_path": "tests/NuGetGallery.Facts/OData/Interceptors/PackageExtensionsFacts.cs",
"diff": "@@ -132,6 +132,29 @@ public void ReturnsNullLicenseReportInfoIfFeatureDisabled()\nAssert.Null(actual.LicenseNames);\nAssert.Null(actual.LicenseReportUrl);\n}\n+\n+ [Fact]\n+ public void RestrictsExceedingDownloadCountsToInt32MaxValue()\n+ {\n+ // Arrange\n+ var package = CreateFakeBasePackage();\n+ package.PackageRegistration.DownloadCount = long.MaxValue;\n+ var packages = new List<Package>\n+ {\n+ package\n+ }.AsQueryable();\n+\n+ // Act\n+ var projected = PackageExtensions.ProjectV2FeedPackage(\n+ packages,\n+ siteRoot: \"http://nuget.org\",\n+ includeLicenseReport: false,\n+ semVerLevelKey: SemVerLevelKey.Unknown).ToList();\n+\n+ // Assert\n+ var actual = projected.Single();\n+ Assert.Equal(Int32.MaxValue, actual.DownloadCount);\n+ }\n}\n/// <summary>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | [Hotfix] Set download count to Int32.MaxValue for V2 feed packages exceeding this threshold (#9199) |
455,734 | 26.08.2022 16:03:49 | -7,200 | 64b7e10bcf5be619769c6ffd8c900655db567f85 | Fully Qualify Install-Package command on website
* Update to fully qualified command name and give info
Fix | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"new_path": "src/NuGetGallery/Views/Packages/DisplayPackage.cshtml",
"diff": "{\nId = \"package-manager\",\nCommandPrefix = \"PM> \",\n- InstallPackageCommands = new [] { string.Format(\"Install-Package {0} -Version {1}\", Model.Id, Model.Version) },\n+ InstallPackageCommands = new [] { string.Format(\"NuGet\\\\Install-Package {0} -Version {1}\", Model.Id, Model.Version) },\n+ AlertLevel = AlertLevel.Info,\n+ AlertMessage = \"This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of <a href='https://docs.microsoft.com/en-us/nuget/reference/ps-reference/ps-ref-install-package'>Install-Package</a>.\"\n+\n},\nnew PackageManagerViewModel(\".NET CLI\")\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Fully Qualify Install-Package command on website (#9203)
* Update to fully qualified command name and give info
Co-authored-by: Joel Verhagen <[email protected]>
Fix https://github.com/NuGet/NuGetGallery/issues/9201 |
455,736 | 26.08.2022 15:05:40 | 14,400 | b7421a3c4478d968c36c87e3e2f28f19b9cfad68 | Add additional warning about blocked usernames
Fix | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Organizations/DeleteAccount.cshtml",
"new_path": "src/NuGetGallery/Views/Organizations/DeleteAccount.cshtml",
"diff": "@<text>Delete</text>)\[email protected](@<text><strong class=\"keywords\">Important</strong>\n- Once your organization is deleted you cannot undo it. <a href=\"https://go.microsoft.com/fwlink/?linkid=862770\">Read more.</a>\n+ Once your organization is deleted you cannot undo it. <b>The organization name will be reserved and it will not be able to be reused.</b> <a href=\"https://go.microsoft.com/fwlink/?linkid=862770\">Read more.</a>\n</text>)\n<p>\nWhen your organization is deleted we will:<br />\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Views/Users/DeleteAccount.cshtml",
"new_path": "src/NuGetGallery/Views/Users/DeleteAccount.cshtml",
"diff": "else\n{\[email protected](@<text><strong class=\"keywords\">Important</strong>\n- Once your account is deleted you cannot undo it. <a href=\"https://go.microsoft.com/fwlink/?linkid=862770\">Read more.</a>\n+ Once your account is deleted you cannot undo it. <b>The account name will be reserved and it will not be able to be reused.</b> <a href=\"https://go.microsoft.com/fwlink/?linkid=862770\">Read more.</a>\n</text>)\n<p>\nWhen you account is deleted we will:<br />\n<ul>\n- <li>Revoke your api key(s).</li>\n+ <li>Revoke your API key(s).</li>\n<li>Remove you as the owner for any packages you own.</li>\n<li>Remove your ownership from any ID prefix reservations and delete any ID prefix reservations that you were the only owner of.</li>\n<li>Remove you from any organizations that you are a member of.</li>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Add additional warning about blocked usernames (#9206)
Fix https://github.com/NuGet/NuGetGallery/issues/7447 |
455,736 | 26.08.2022 16:07:10 | 14,400 | 9473f506aac6aefc34db68fa5531a541823e5b9f | Update to the latest version of moment.js to resolve CG | [
{
"change_type": "MODIFY",
"old_path": ".eslintignore",
"new_path": ".eslintignore",
"diff": "# on specific relative paths.\n**/Scripts/gallery/jquery-3.4.1.js\n**/Scripts/gallery/knockout-3.5.1.js\n-**/Scripts/gallery/moment-2.29.2.js\n+**/Scripts/gallery/moment-2.29.4.js\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/App_Start/AppActivator.cs",
"new_path": "src/NuGetGallery/App_Start/AppActivator.cs",
"diff": "@@ -134,7 +134,7 @@ private static void BundlingPostStart()\n.Include(\"~/Scripts/gallery/jquery.validate.unobtrusive-3.2.6.js\")\n.Include(\"~/Scripts/gallery/knockout-3.5.1.js\")\n.Include(\"~/Scripts/gallery/bootstrap.js\")\n- .Include(\"~/Scripts/gallery/moment-2.29.2.js\")\n+ .Include(\"~/Scripts/gallery/moment-2.29.4.js\")\n.Include(\"~/Scripts/gallery/common.js\")\n.Include(\"~/Scripts/gallery/autocomplete.js\");\nBundleTable.Bundles.Add(scriptBundle);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Content Include=\"App_Data\\Files\\Content\\Symbols-Configuration.json\" />\n<Content Include=\"Scripts\\gallery\\instrumentation.js\" />\n<Content Include=\"Scripts\\gallery\\knockout-3.5.1.js\" />\n+ <Content Include=\"Scripts\\gallery\\moment-2.29.4.js\" />\n<Content Include=\"Scripts\\gallery\\page-list-packages.js\" />\n<Content Include=\"Scripts\\gallery\\syntaxhighlight.js\" />\n<Content Include=\"Views\\Shared\\SiteMenu.cshtml\">\n<Content Include=\"Scripts\\gallery\\jquery.validate.unobtrusive-3.2.6.js\" />\n<Content Include=\"Scripts\\gallery\\knockout-projections.js\" />\n<Content Include=\"Scripts\\gallery\\md5.js\" />\n- <Content Include=\"Scripts\\gallery\\moment-2.29.2.js\" />\n<Content Include=\"Scripts\\gallery\\page-about.js\" />\n<Content Include=\"Scripts\\gallery\\page-account.js\" />\n<Content Include=\"Scripts\\gallery\\page-add-organization.js\" />\n<Version>2.8.3</Version>\n</PackageReference>\n<PackageReference Include=\"Moment.js\">\n- <Version>2.29.2</Version>\n+ <Version>2.29.4</Version>\n</PackageReference>\n<PackageReference Include=\"MvcTreeView\">\n<Version>1.4.0</Version>\n"
},
{
"change_type": "RENAME",
"old_path": "src/NuGetGallery/Scripts/gallery/moment-2.29.2.js",
"new_path": "src/NuGetGallery/Scripts/gallery/moment-2.29.4.js",
"diff": "//! moment.js\n-//! version : 2.29.2\n+//! version : 2.29.4\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\nfunction preprocessRFC2822(s) {\n// Remove comments and folding whitespace and replace multiple-spaces with a single space\nreturn s\n- .replace(/\\([^)]*\\)|[\\n\\t]/g, ' ')\n+ .replace(/\\([^()]*\\)|[\\n\\t]/g, ' ')\n.replace(/(\\s\\s+)/g, ' ')\n.replace(/^\\s\\s*/, '')\n.replace(/\\s\\s*$/, '');\n//! moment.js\n- hooks.version = '2.29.2';\n+ hooks.version = '2.29.4';\nsetHookCallback(createLocal);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.FunctionalTests/StaticAssets/StaticAssetsTests.cs",
"new_path": "tests/NuGetGallery.FunctionalTests/StaticAssets/StaticAssetsTests.cs",
"diff": "@@ -67,7 +67,7 @@ public StaticAssetsTests(ITestOutputHelper testOutputHelper) : base(testOutputHe\n\"Scripts/gallery/jquery.validate.unobtrusive-3.2.6.js\",\n\"Scripts/gallery/knockout-3.4.2.js\",\n\"Scripts/gallery/bootstrap.js\",\n- \"Scripts/gallery/moment-2.29.2.js\",\n+ \"Scripts/gallery/moment-2.29.4.js\",\n\"Scripts/gallery/common.js\",\n\"Scripts/gallery/autocomplete.js\",\n}\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update to the latest version of moment.js to resolve CG (#9212) |
455,736 | 26.08.2022 17:15:06 | 14,400 | 41027e07cb1686ea146338e9454d35a616bd1e55 | Show information about parent namespaces on the ID prefix reservation admin panel
Progress on | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/Controllers/ReservedNamespaceController.cs",
"new_path": "src/NuGetGallery/Areas/Admin/Controllers/ReservedNamespaceController.cs",
"diff": "@@ -39,12 +39,28 @@ public JsonResult SearchPrefix(string query)\nvar prefixQueries = GetPrefixesFromQuery(query);\nvar foundPrefixes = _reservedNamespaceService.FindReservedNamespacesForPrefixList(prefixQueries);\n+ var valueToNamespace = foundPrefixes.ToDictionary(x => x.Value, StringComparer.OrdinalIgnoreCase);\n- var notFoundPrefixQueries = prefixQueries.Except(foundPrefixes.Select(p => p.Value), StringComparer.OrdinalIgnoreCase);\n- var notFoundPrefixes = notFoundPrefixQueries.Select(q => new ReservedNamespace(value: q, isSharedNamespace: false, isPrefix: true));\n+ var resultModel = new List<ReservedNamespaceResultModel>();\n+ foreach (var value in prefixQueries)\n+ {\n+ bool isExisting = valueToNamespace.TryGetValue(value, out var ns);\n+ if (!isExisting)\n+ {\n+ ns = new ReservedNamespace(value: value, isSharedNamespace: false, isPrefix: true);\n+ }\n- var resultModel = foundPrefixes.Select(fp => new ReservedNamespaceResultModel(fp, isExisting: true));\n- resultModel = resultModel.Concat(notFoundPrefixes.Select(nfp => new ReservedNamespaceResultModel(nfp, isExisting: false)).ToList());\n+ var existingPrefixes = _reservedNamespaceService.GetReservedNamespacesForId(value);\n+\n+ var parents = existingPrefixes\n+ .Where(x => value.StartsWith(x.Value, StringComparison.OrdinalIgnoreCase)\n+ && value.Length > x.Value.Length)\n+ .Select(x => x.Value + (x.IsPrefix ? \"*\" : string.Empty))\n+ .OrderBy(x => x.Length)\n+ .ToArray();\n+\n+ resultModel.Add(new ReservedNamespaceResultModel(ns, isExisting, parents));\n+ }\nvar results = new ReservedNamespaceSearchResult\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Areas/Admin/ViewModels/ReservedNamespaceResultModel.cs",
"new_path": "src/NuGetGallery/Areas/Admin/ViewModels/ReservedNamespaceResultModel.cs",
"diff": "@@ -18,9 +18,11 @@ public sealed class ReservedNamespaceResultModel\npublic string[] owners { get; }\n+ public string[] parents { get; }\n+\npublic ReservedNamespaceResultModel() { }\n- public ReservedNamespaceResultModel(ReservedNamespace reservedNamespace, bool isExisting)\n+ public ReservedNamespaceResultModel(ReservedNamespace reservedNamespace, bool isExisting, string[] parents)\n{\nif (reservedNamespace == null)\n{\n@@ -31,6 +33,7 @@ public ReservedNamespaceResultModel(ReservedNamespace reservedNamespace, bool is\nregistrations = reservedNamespace.PackageRegistrations?.Select(pr => pr.Id).ToArray();\nowners = reservedNamespace.Owners?.Select(u => u.Username).ToArray();\nthis.isExisting = isExisting;\n+ this.parents = parents;\n}\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/NuGetGallery.Facts/Areas/Admin/Controllers/ReservedNamespaceControllerFacts.cs",
"new_path": "tests/NuGetGallery.Facts/Areas/Admin/Controllers/ReservedNamespaceControllerFacts.cs",
"diff": "@@ -51,6 +51,34 @@ public void SearchFindsMatchingPrefixes(string query, int foundCount, int notFou\nAssert.Equal(notFoundCount, notFound.Count());\n}\n+\n+ [Theory]\n+ [InlineData(\"Zzz.\", \"\")]\n+ [InlineData(\"Microsoft.\", \"\")]\n+ [InlineData(\"Microsoft.Zzz.\", \"Microsoft.*\")]\n+ [InlineData(\"microsoft.zzz.\", \"Microsoft.*\")]\n+ [InlineData(\"Microsoft.AspNet.\", \"Microsoft.*\")]\n+ [InlineData(\"Microsoft.AspNet.Zzz\", \"Microsoft.*, Microsoft.Aspnet.*\")]\n+ [InlineData(\"jquery.\", \"\")]\n+ [InlineData(\"jquery.Extentions.Zzz\", \"jquery.Extentions.*\")]\n+ public void IncludesParentNamespaces(string query, string parents)\n+ {\n+ // Arrange.\n+ var namespaces = ReservedNamespaceServiceTestData.GetTestNamespaces();\n+ var reservedNamespaceService = new TestableReservedNamespaceService(reservedNamespaces: namespaces);\n+ var packageRegistrations = new Mock<IEntityRepository<PackageRegistration>>();\n+ var controller = new ReservedNamespaceController(reservedNamespaceService, packageRegistrations.Object);\n+\n+ // Act.\n+ JsonResult jsonResult = controller.SearchPrefix(query);\n+\n+ // Assert\n+ dynamic data = jsonResult.Data;\n+ var resultModelList = data.Prefixes as IEnumerable<ReservedNamespaceResultModel>;\n+ var match = Assert.Single(resultModelList);\n+ Assert.Equal(parents, string.Join(\", \", match.parents));\n+ }\n+\n[Fact]\npublic async Task AddNamespaceDoesNotReturnSuccessForInvalidNamespaces()\n{\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Show information about parent namespaces on the ID prefix reservation admin panel (#9208)
Progress on https://github.com/NuGet/Engineering/issues/4523 |
455,736 | 29.08.2022 15:38:37 | 14,400 | 3bd9c220182f768f657ed07512a51fa6ea36873b | Update ServerCommon 2.105.0
This resolves a Dependabot alert about Microsoft.Owin 4.1.0
Prune unnecessary dependencies in NuGetGallery csproj files
Delete unused sidecar files for NuGetGallery.csproj | [
{
"change_type": "MODIFY",
"old_path": "src/DatabaseMigrationTools/DatabaseMigrationTools.csproj",
"new_path": "src/DatabaseMigrationTools/DatabaseMigrationTools.csproj",
"diff": "<PrivateAssets>all</PrivateAssets>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/GitHubVulnerabilities2Db/GitHubVulnerabilities2Db.csproj",
"new_path": "src/GitHubVulnerabilities2Db/GitHubVulnerabilities2Db.csproj",
"diff": "<Version>4.3.0-dev-5590084</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Cursor\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n</ItemGroup>\n<ItemGroup>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"new_path": "src/NuGetGallery.Core/NuGetGallery.Core.csproj",
"diff": "<Version>6.0.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.FeatureFlags\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"WindowsAzure.Storage\">\n<Version>9.3.3</Version>\n<ItemGroup Condition=\"'$(TargetFramework)' == 'net472'\">\n<PackageReference Include=\"NuGet.Services.Messaging.Email\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Validation.Issues\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.StrongName.elmah.corelibrary\">\n<Version>1.2.2</Version>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"new_path": "src/NuGetGallery.Services/NuGetGallery.Services.csproj",
"diff": "<PackageReference Include=\"Microsoft.Owin.Security.OpenIdConnect\">\n<Version>4.1.0</Version>\n</PackageReference>\n- <PackageReference Include=\"NuGet.Packaging\">\n- <Version>6.0.0</Version>\n- </PackageReference>\n<PackageReference Include=\"NuGet.Protocol\">\n<Version>6.0.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Configuration\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Logging\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.StrongName.WebBackgrounder\">\n<Version>0.2.0</Version>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/NuGetGallery.csproj",
"new_path": "src/NuGetGallery/NuGetGallery.csproj",
"diff": "<Content Include=\"Scripts\\d3\\LICENSE\" />\n<Content Include=\"Scripts\\d3\\CHANGES.md\" />\n<Content Include=\"Scripts\\d3\\API.md\" />\n- <Content Include=\"NuGetGallery.dll.config\">\n- <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n- </Content>\n<Content Include=\"Areas\\Admin\\Views\\Revalidation\\Index.cshtml\" />\n<Content Include=\"App_Data\\Files\\Content\\Symbols-Configuration.json\" />\n<Content Include=\"Scripts\\gallery\\instrumentation.js\" />\n<PackageReference Include=\"NuGet.StrongName.DynamicData.EFCodeFirstProvider\">\n<Version>0.3.0</Version>\n</PackageReference>\n- <PackageReference Include=\"NuGet.StrongName.elmah.corelibrary\">\n- <Version>1.2.2</Version>\n- </PackageReference>\n<PackageReference Include=\"NuGet.StrongName.elmah.sqlserver\">\n<Version>1.2.2</Version>\n</PackageReference>\n<PackageReference Include=\"Microsoft.AspNet.Identity.Core\">\n<Version>1.0.0</Version>\n</PackageReference>\n- <PackageReference Include=\"Microsoft.AspNet.Mvc\">\n- <Version>5.2.3</Version>\n- </PackageReference>\n<PackageReference Include=\"Microsoft.AspNet.Razor\">\n<Version>3.2.3</Version>\n</PackageReference>\n<PackageReference Include=\"Microsoft.AspNetCore.Cryptography.Internal\">\n<Version>1.0.0</Version>\n</PackageReference>\n- <PackageReference Include=\"Microsoft.AspNetCore.Cryptography.KeyDerivation\">\n- <Version>1.0.0</Version>\n- </PackageReference>\n<PackageReference Include=\"Microsoft.Bcl.Compression\">\n<Version>3.9.85</Version>\n</PackageReference>\n<PackageReference Include=\"Microsoft.Net.Http\">\n<Version>2.2.29</Version>\n</PackageReference>\n- <PackageReference Include=\"Microsoft.Owin\">\n- <Version>4.1.0</Version>\n- </PackageReference>\n- <PackageReference Include=\"Microsoft.Owin.Host.SystemWeb\">\n- <Version>4.1.0</Version>\n- </PackageReference>\n- <PackageReference Include=\"Microsoft.Owin.Security\">\n- <Version>4.1.0</Version>\n- </PackageReference>\n- <PackageReference Include=\"Microsoft.Owin.Security.Cookies\">\n- <Version>4.1.0</Version>\n- </PackageReference>\n- <PackageReference Include=\"Microsoft.Owin.Security.MicrosoftAccount\">\n- <Version>4.1.0</Version>\n- </PackageReference>\n- <PackageReference Include=\"Microsoft.Owin.Security.OpenIdConnect\">\n- <Version>4.1.0</Version>\n- </PackageReference>\n<PackageReference Include=\"Microsoft.Web.Infrastructure\">\n<Version>1.0.0</Version>\n</PackageReference>\n<PackageReference Include=\"Microsoft.Web.Xdt\">\n<Version>2.1.2</Version>\n</PackageReference>\n- <PackageReference Include=\"Microsoft.WindowsAzure.ConfigurationManager\">\n- <Version>3.1.0</Version>\n- </PackageReference>\n<PackageReference Include=\"Modernizr\">\n<Version>2.8.3</Version>\n</PackageReference>\n<PackageReference Include=\"MvcTreeView\">\n<Version>1.4.0</Version>\n</PackageReference>\n- <PackageReference Include=\"NuGet.Configuration\">\n- <Version>6.0.0</Version>\n- </PackageReference>\n- <PackageReference Include=\"NuGet.Protocol\">\n- <Version>6.0.0</Version>\n- </PackageReference>\n<PackageReference Include=\"NuGet.Services.Licenses\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Owin\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"NuGet.Services.Sql\">\n- <Version>2.104.0</Version>\n+ <Version>2.105.0</Version>\n</PackageReference>\n<PackageReference Include=\"Owin\">\n<Version>1.0.0</Version>\n<PackageReference Include=\"NuGet.StrongName.WebBackgrounder.EntityFramework\">\n<Version>0.1.0</Version>\n</PackageReference>\n- <PackageReference Include=\"NuGet.StrongName.WebBackgrounder\">\n- <Version>0.2.0</Version>\n- </PackageReference>\n<PackageReference Include=\"WebGrease\">\n<Version>1.6.0</Version>\n</PackageReference>\n<PackageReference Include=\"WindowsAzure.Caching\">\n<Version>1.7.0</Version>\n</PackageReference>\n- <PackageReference Include=\"WindowsAzure.Storage\">\n- <Version>9.3.3</Version>\n- </PackageReference>\n</ItemGroup>\n<ItemGroup>\n<Content Include=\"App_Data\\Files\\Content\\Cache-Configuration.json\" />\n"
},
{
"change_type": "DELETE",
"old_path": "src/NuGetGallery/NuGetGallery.dll.config",
"new_path": null,
"diff": "-<!-- Binding redirects for WAIISHost.exe which can't access web.config when discovering role entry point. -->\n-<configuration>\n- <runtime>\n- <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Diagnostics.Tracing\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.Owin\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-3.0.1.0\" newVersion=\"3.0.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Web.Http\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-5.2.3.0\" newVersion=\"5.2.3.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"EntityFramework\" publicKeyToken=\"B77A5C561934E089\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-6.0.0.0\" newVersion=\"6.0.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Net.Http.Primitives\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.2.29.0\" newVersion=\"4.2.29.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Xml.ReaderWriter\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.0.0\" newVersion=\"4.1.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Autofac\" publicKeyToken=\"17863AF14B0044DA\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-3.5.0.0\" newVersion=\"3.5.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.IO\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Runtime\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Security.Cryptography.X509Certificates\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.Data.Edm\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-5.7.0.0\" newVersion=\"5.7.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.IdentityModel.Clients.ActiveDirectory.Platform\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-3.13.9.1126\" newVersion=\"3.13.9.1126\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Net.Http.Formatting\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-5.2.3.0\" newVersion=\"5.2.3.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Runtime.InteropServices\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.0.0\" newVersion=\"4.1.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.Extensions.Logging.Abstractions\" publicKeyToken=\"ADB9793829DDAE60\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-1.1.2.0\" newVersion=\"1.1.2.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Spatial\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-5.7.0.0\" newVersion=\"5.7.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.Extensions.Logging\" publicKeyToken=\"ADB9793829DDAE60\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-1.1.2.0\" newVersion=\"1.1.2.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Runtime.Extensions\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.ApplicationInsights\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-2.2.0.0\" newVersion=\"2.2.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.IO.Compression\" publicKeyToken=\"B77A5C561934E089\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.2.0\" newVersion=\"4.1.2.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.Data.OData\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-5.7.0.0\" newVersion=\"5.7.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Newtonsoft.Json\" publicKeyToken=\"30AD4FE6B2A6AEED\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-13.0.0.0\" newVersion=\"13.0.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Web.Mvc\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-5.2.3.0\" newVersion=\"5.2.3.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Net.Http\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"System.Reflection\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.Data.Services.Client\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-5.7.0.0\" newVersion=\"5.7.0.0\"/>\n- </dependentAssembly>\n- <dependentAssembly>\n- <assemblyIdentity name=\"Microsoft.IdentityModel.Clients.ActiveDirectory\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-3.13.9.1126\" newVersion=\"3.13.9.1126\"/>\n- </dependentAssembly>\n- </assemblyBinding>\n- </runtime>\n-</configuration>\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Web.config",
"new_path": "src/NuGetGallery/Web.config",
"diff": "</dependentAssembly>\n<dependentAssembly>\n<assemblyIdentity name=\"Microsoft.Owin\" publicKeyToken=\"31BF3856AD364E35\" culture=\"neutral\"/>\n- <bindingRedirect oldVersion=\"0.0.0.0-4.1.0.0\" newVersion=\"4.1.0.0\"/>\n+ <bindingRedirect oldVersion=\"0.0.0.0-4.1.1.0\" newVersion=\"4.1.1.0\"/>\n</dependentAssembly>\n<dependentAssembly>\n<assemblyIdentity name=\"System.Net.Http.Primitives\" publicKeyToken=\"B03F5F7F11D50A3A\" culture=\"neutral\"/>\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Update ServerCommon 2.105.0 (#9214)
This resolves a Dependabot alert about Microsoft.Owin 4.1.0
Prune unnecessary dependencies in NuGetGallery csproj files
Delete unused sidecar files for NuGetGallery.csproj |
455,736 | 09.09.2022 14:28:11 | 25,200 | f635f4ba2a0d8eeb3552048e06196ce858464055 | Use Application Insights JS SDK instead of Google Analytics
Also, delete an ancient clickonce line that is unused
Progress on | [
{
"change_type": "MODIFY",
"old_path": "src/NuGetGallery/Scripts/gallery/common.js",
"new_path": "src/NuGetGallery/Scripts/gallery/common.js",
"diff": ".filter(':visible:first')\n.trigger('focus');\n- // Handle Google analytics tracking event on specific links.\n- var emitClickEvent = function (e, emitDirectly) {\n- if (!window.nuget.isGaAvailable()) {\n+ // Handle Application Insights tracking event on specific links.\n+ var emitClickEvent = function (e) {\n+ if (!window.nuget.isAiAvailable()) {\nreturn;\n}\nvar href = $(this).attr('href');\nvar category = $(this).data().track;\n+\nvar trackValue = $(this).data().trackValue;\n+ if (typeof trackValue === 'undefined') {\n+ trackValue = 1;\n+ }\n+\nif (href && category) {\n- if (emitDirectly) {\n- window.nuget.sendAnalyticsEvent(category, 'click', href, trackValue);\n- } else {\n- // This path is used when the click will result in a page transition. Because of this we need to\n- // emit telemetry in a special way so that the event gets out before the page transition occurs.\n- e.preventDefault();\n- window.nuget.sendAnalyticsEvent(category, 'click', href, trackValue, {\n- 'transport': 'beacon',\n- 'hitCallback': window.nuget.createFunctionWithTimeout(function () {\n- document.location = href;\n- })\n+ window.nuget.sendMetric('BrowserClick', trackValue, {\n+ href: href,\n+ category: category\n});\n}\n- }\n};\n$.each($('a[data-track]'), function () {\n$(this).on('mouseup', function (e) {\nif (e.which === 2) { // Middle-mouse click\n- emitClickEvent.call(this, e, true);\n+ emitClickEvent.call(this, e);\n}\n});\n$(this).on('click', function (e) {\n- emitClickEvent.call(this, e, e.altKey || e.ctrlKey || e.metaKey);\n+ emitClickEvent.call(this, e);\n});\n});\n- // Show elements that require ClickOnce\n- (function () {\n- var userAgent = window.navigator.userAgent.toUpperCase();\n- var hasNativeDotNet = userAgent.indexOf('.NET CLR 3.5') >= 0;\n- if (hasNativeDotNet) {\n- $('.no-clickonce').removeClass('no-clickonce');\n- }\n- })();\n-\n// Don't close the dropdown on click events inside of the dropdown.\n$(document).on('click', '.dropdown-menu', function (e) {\ne.stopPropagation();\n"
}
]
| C# | Apache License 2.0 | nuget/nugetgallery | Use Application Insights JS SDK instead of Google Analytics (#9228)
Also, delete an ancient clickonce line that is unused
Progress on https://github.com/NuGet/Engineering/issues/4555 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.