From 180fae342e9fdbe775f3ff13a2b6122b8c624e30 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Thu, 16 Mar 2023 20:32:54 +0100 Subject: [PATCH] Revert breaking changes from #13936 and remove CompatibilitySuppressions.xml (#13979) * Revert breaking changes introduced by PR #13936 * Update PackageValidationBaselineVersion to 11.0.0 (stable version) and remove all CompatibilitySuppressions.xml files * Fix build pipeline (pack solution again, avoiding trying to pack template projects) --- Directory.Build.props | 2 +- build/azure-pipelines.yml | 9 +-- .../CompatibilitySuppressions.xml | 73 ------------------- src/Umbraco.Core/Constants-HealthChecks.cs | 2 + .../Checks/Security/BaseHttpHeaderCheck.cs | 18 ++++- .../Checks/Security/XssProtectionCheck.cs | 2 +- .../CompatibilitySuppressions.xml | 45 ------------ 7 files changed, 21 insertions(+), 130 deletions(-) delete mode 100644 src/Umbraco.Core/CompatibilitySuppressions.xml delete mode 100644 src/Umbraco.Infrastructure/CompatibilitySuppressions.xml diff --git a/Directory.Build.props b/Directory.Build.props index 37b2e66977..01cd3b1064 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -31,7 +31,7 @@ false true - 11.0.0-rc1 + 11.0.0 true true diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index 56e6dccc1b..97e0a10f9c 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -86,10 +86,10 @@ stages: arguments: '--configuration $(buildConfiguration) --no-restore -p:ContinuousIntegrationBuild=true' - script: | version="$(Build.BuildNumber)" - echo "varsion: $version" + echo "Version: $version" major="$(echo $version | cut -d '.' -f 1)" - echo "major version: $major" + echo "Major version: $major" echo "##vso[task.setvariable variable=majorVersion;isOutput=true]$major" displayName: Set major version @@ -110,10 +110,7 @@ stages: } } - foreach($csproj in Get-ChildItem -Recurse -Filter *.csproj) - { - dotnet pack $csproj --configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)/nupkg - } + dotnet pack $(solution) --configuration $(buildConfiguration) --no-build --property:PackageOutputPath=$(Build.ArtifactStagingDirectory)/nupkg - script: | sha="$(Build.SourceVersion)" sha=${sha:0:7} diff --git a/src/Umbraco.Core/CompatibilitySuppressions.xml b/src/Umbraco.Core/CompatibilitySuppressions.xml deleted file mode 100644 index f580fa9458..0000000000 --- a/src/Umbraco.Core/CompatibilitySuppressions.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridItem.get_ForceLeft - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridItem.get_ForceRight - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridItem.set_ForceLeft(System.Boolean) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridItem.set_ForceRight(System.Boolean) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IDataTypeConfigurationConnector.FromArtifact(Umbraco.Cms.Core.Models.IDataType,System.String,Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IDataTypeConfigurationConnector.ToArtifact(Umbraco.Cms.Core.Models.IDataType,System.Collections.Generic.ICollection{Umbraco.Cms.Core.Deploy.ArtifactDependency},Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IServiceConnector.GetArtifact(System.Object,Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IServiceConnector.GetArtifact(Umbraco.Cms.Core.Udi,Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IValueConnector.FromArtifact(System.String,Umbraco.Cms.Core.Models.IPropertyType,System.Object,Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IValueConnector.ToArtifact(System.Object,Umbraco.Cms.Core.Models.IPropertyType,System.Collections.Generic.ICollection{Umbraco.Cms.Core.Deploy.ArtifactDependency},Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Core.dll - lib/net7.0/Umbraco.Core.dll - true - - \ No newline at end of file diff --git a/src/Umbraco.Core/Constants-HealthChecks.cs b/src/Umbraco.Core/Constants-HealthChecks.cs index 875f86cb4c..ffc1965199 100644 --- a/src/Umbraco.Core/Constants-HealthChecks.cs +++ b/src/Umbraco.Core/Constants-HealthChecks.cs @@ -45,6 +45,8 @@ public static partial class Constants public const string ClickJackingCheck = "https://umbra.co/healthchecks-click-jacking"; public const string HstsCheck = "https://umbra.co/healthchecks-hsts"; public const string NoSniffCheck = "https://umbra.co/healthchecks-no-sniff"; + [Obsolete("This link is not used anymore in the XSS protected check.")] + public const string XssProtectionCheck = "https://umbra.co/healthchecks-xss-protection"; public const string ExcessiveHeadersCheck = "https://umbra.co/healthchecks-excessive-headers"; public static class HttpsCheck diff --git a/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs b/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs index 40c5c0d87a..138ba87789 100644 --- a/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs +++ b/src/Umbraco.Core/HealthChecks/Checks/Security/BaseHttpHeaderCheck.cs @@ -13,7 +13,7 @@ namespace Umbraco.Cms.Core.HealthChecks.Checks.Security; /// public abstract class BaseHttpHeaderCheck : HealthCheck { - private static HttpClient? httpClient; + private static HttpClient? _httpClient; private readonly string _header; private readonly IHostingEnvironment _hostingEnvironment; private readonly string _localizedTextPrefix; @@ -23,13 +23,23 @@ public abstract class BaseHttpHeaderCheck : HealthCheck /// /// Initializes a new instance of the class. /// + [Obsolete("Use constructor that takes all parameters instead.")] + protected BaseHttpHeaderCheck( + IHostingEnvironment hostingEnvironment, + ILocalizedTextService textService, + string header, + string localizedTextPrefix, + bool metaTagOptionAvailable) + : this(hostingEnvironment, textService, header, localizedTextPrefix, metaTagOptionAvailable, false) + { } + protected BaseHttpHeaderCheck( IHostingEnvironment hostingEnvironment, ILocalizedTextService textService, string header, string localizedTextPrefix, bool metaTagOptionAvailable, - bool shouldNotExist = false) + bool shouldNotExist) { LocalizedTextService = textService ?? throw new ArgumentNullException(nameof(textService)); _hostingEnvironment = hostingEnvironment; @@ -45,9 +55,9 @@ public abstract class BaseHttpHeaderCheck : HealthCheck /// /// Gets a link to an external read more page. /// - protected abstract string? ReadMoreLink { get; } + protected abstract string ReadMoreLink { get; } - private static HttpClient HttpClient => httpClient ??= new HttpClient(); + private static HttpClient HttpClient => _httpClient ??= new HttpClient(); /// /// Get the status for this health check diff --git a/src/Umbraco.Core/HealthChecks/Checks/Security/XssProtectionCheck.cs b/src/Umbraco.Core/HealthChecks/Checks/Security/XssProtectionCheck.cs index d218baad8f..6fddb614fd 100644 --- a/src/Umbraco.Core/HealthChecks/Checks/Security/XssProtectionCheck.cs +++ b/src/Umbraco.Core/HealthChecks/Checks/Security/XssProtectionCheck.cs @@ -29,5 +29,5 @@ public class XssProtectionCheck : BaseHttpHeaderCheck } /// - protected override string? ReadMoreLink => null; + protected override string ReadMoreLink => string.Empty; } diff --git a/src/Umbraco.Infrastructure/CompatibilitySuppressions.xml b/src/Umbraco.Infrastructure/CompatibilitySuppressions.xml deleted file mode 100644 index f48f361244..0000000000 --- a/src/Umbraco.Infrastructure/CompatibilitySuppressions.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridLayoutItem.get_ForceLeft - lib/net7.0/Umbraco.Infrastructure.dll - lib/net7.0/Umbraco.Infrastructure.dll - true - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridLayoutItem.get_ForceRight - lib/net7.0/Umbraco.Infrastructure.dll - lib/net7.0/Umbraco.Infrastructure.dll - true - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridLayoutItem.set_ForceLeft(System.Boolean) - lib/net7.0/Umbraco.Infrastructure.dll - lib/net7.0/Umbraco.Infrastructure.dll - true - - - CP0002 - M:Umbraco.Cms.Core.Models.Blocks.BlockGridLayoutItem.set_ForceRight(System.Boolean) - lib/net7.0/Umbraco.Infrastructure.dll - lib/net7.0/Umbraco.Infrastructure.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IGridCellValueConnector.GetValue(Umbraco.Cms.Core.Models.GridValue.GridControl,System.Collections.Generic.ICollection{Umbraco.Cms.Core.Deploy.ArtifactDependency},Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Infrastructure.dll - lib/net7.0/Umbraco.Infrastructure.dll - true - - - CP0006 - M:Umbraco.Cms.Core.Deploy.IGridCellValueConnector.SetValue(Umbraco.Cms.Core.Models.GridValue.GridControl,Umbraco.Cms.Core.Deploy.IContextCache) - lib/net7.0/Umbraco.Infrastructure.dll - lib/net7.0/Umbraco.Infrastructure.dll - true - - \ No newline at end of file