From bf5c60ffc7488fc9eb12b7104ba7d567f11cc85e Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sun, 31 Jan 2021 19:33:26 -0500 Subject: Remove Burn Authenticode Fixes https://github.com/wixtoolset/issues/issues/6301 --- src/WixToolset.Converters/WixConverter.cs | 42 +++++++++++---- .../WixToolsetTest.Converters/ConverterFixture.cs | 61 +++++++++++++++++++++- 2 files changed, 91 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/WixToolset.Converters/WixConverter.cs b/src/WixToolset.Converters/WixConverter.cs index c78e2245..be3e6b70 100644 --- a/src/WixToolset.Converters/WixConverter.cs +++ b/src/WixToolset.Converters/WixConverter.cs @@ -44,6 +44,7 @@ namespace WixToolset.Converters private static readonly XName BootstrapperApplicationDllElementName = WixNamespace + "BootstrapperApplicationDll"; private static readonly XName BootstrapperApplicationRefElementName = WixNamespace + "BootstrapperApplicationRef"; private static readonly XName EmbeddedChainerElementName = WixNamespace + "EmbeddedChainer"; + private static readonly XName CatalogElementName = WixNamespace + "Catalog"; private static readonly XName ColumnElementName = WixNamespace + "Column"; private static readonly XName ComponentElementName = WixNamespace + "Component"; private static readonly XName ControlElementName = WixNamespace + "Control"; @@ -71,6 +72,7 @@ namespace WixToolset.Converters private static readonly XName ProgressTextElementName = WixNamespace + "ProgressText"; private static readonly XName PublishElementName = WixNamespace + "Publish"; private static readonly XName MultiStringValueElementName = WixNamespace + "MultiStringValue"; + private static readonly XName RemotePayloadElementName = WixNamespace + "RemotePayload"; private static readonly XName RequiredPrivilegeElementName = WixNamespace + "RequiredPrivilege"; private static readonly XName ServiceArgumentElementName = WixNamespace + "ServiceArgument"; private static readonly XName SetDirectoryElementName = WixNamespace + "SetDirectory"; @@ -149,6 +151,7 @@ namespace WixToolset.Converters { WixConverter.InstallExecuteSequenceElementName, this.ConvertSequenceElement }, { WixConverter.BootstrapperApplicationElementName, this.ConvertBootstrapperApplicationElement }, { WixConverter.BootstrapperApplicationRefElementName, this.ConvertBootstrapperApplicationRefElement }, + { WixConverter.CatalogElementName, this.ConvertCatalogElement }, { WixConverter.ColumnElementName, this.ConvertColumnElement }, { WixConverter.CustomTableElementName, this.ConvertCustomTableElement }, { WixConverter.ControlElementName, this.ConvertControlElement }, @@ -172,6 +175,7 @@ namespace WixToolset.Converters { WixConverter.ProgressTextElementName, this.ConvertProgressTextElement }, { WixConverter.PublishElementName, this.ConvertPublishElement }, { WixConverter.MultiStringValueElementName, this.ConvertMultiStringValueElement }, + { WixConverter.RemotePayloadElementName, this.ConvertRemotePayloadElement }, { WixConverter.RequiredPrivilegeElementName, this.ConvertRequiredPrivilegeElement }, { WixConverter.CustomActionElementName, this.ConvertCustomActionElement }, { WixConverter.ServiceArgumentElementName, this.ConvertServiceArgumentElement }, @@ -642,6 +646,14 @@ namespace WixToolset.Converters } } + private void ConvertCatalogElement(XElement element) + { + if (this.OnError(ConverterTestType.BundleSignatureValidationObsolete, element, "The Catalog element is obsolete. Signature validation is no longer supported. The elkement will be removed.")) + { + element.Remove(); + } + } + private void ConvertColumnElement(XElement element) { var category = element.Attribute("Category"); @@ -1044,6 +1056,21 @@ namespace WixToolset.Converters private void ConvertMultiStringValueElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); + private void ConvertRemotePayloadElement(XElement element) + { + RemoveIfPresent(element.Attribute("CertificatePublicKey")); + RemoveIfPresent(element.Attribute("CertificateThumbprint")); + + void RemoveIfPresent(XAttribute xAttribute) + { + if (null != xAttribute + && this.OnError(ConverterTestType.BundleSignatureValidationObsolete, element, "The chain package element contains obsolete '{0}' attribute. Signature validation is no longer supported. The attribute will be removed.", xAttribute.Name)) + { + xAttribute.Remove(); + } + } + } + private void ConvertRequiredPrivilegeElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Name"); private void ConvertRowElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); @@ -1070,16 +1097,9 @@ namespace WixToolset.Converters { var suppressSignatureValidation = element.Attribute("SuppressSignatureValidation"); - if (null != suppressSignatureValidation) + if (null != suppressSignatureValidation + && this.OnError(ConverterTestType.BundleSignatureValidationObsolete, element, "The chain package element contains obsolete '{0}' attribute. Signature validation is no longer supported. The attribute will be removed.", suppressSignatureValidation.Name)) { - if (this.OnError(ConverterTestType.SuppressSignatureValidationDeprecated, element, "The chain package element contains deprecated '{0}' attribute. Use the 'EnableSignatureValidation' attribute instead.", suppressSignatureValidation.Name)) - { - if ("no" == suppressSignatureValidation.Value) - { - element.Add(new XAttribute("EnableSignatureValidation", "yes")); - } - } - suppressSignatureValidation.Remove(); } } @@ -1579,9 +1599,9 @@ namespace WixToolset.Converters AssignAnonymousFileId, /// - /// SuppressSignatureValidation attribute is deprecated and replaced with EnableSignatureValidation. + /// SuppressSignatureValidation attribute is obsolete and corresponding functionality removed. /// - SuppressSignatureValidationDeprecated, + BundleSignatureValidationObsolete, /// /// WixCA Binary/@Id has been renamed to UtilCA. diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs index c74ef121..20f42068 100644 --- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs +++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs @@ -304,6 +304,65 @@ namespace WixToolsetTest.Converters Assert.Equal(expected, actual); } + [Fact] + public void CanConvertCatalogElement() + { + var parse = String.Join(Environment.NewLine, + "", + " ", + ""); + + var expected = String.Join(Environment.NewLine, + "", + " ", + ""); + + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); + + var messaging = new MockMessaging(); + var converter = new WixConverter(messaging, 2, null, null); + + var errors = converter.ConvertDocument(document); + + var actual = UnformattedDocumentString(document); + + Assert.Equal(1, errors); + Assert.Equal(expected, actual); + } + + [Fact] + public void CanConvertRemotePayloadElement() + { + var parse = String.Join(Environment.NewLine, + "", + " ", + ""); + + var expected = String.Join(Environment.NewLine, + "", + " ", + ""); + + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); + + var messaging = new MockMessaging(); + var converter = new WixConverter(messaging, 2, null, null); + + var errors = converter.ConvertDocument(document); + + var actual = UnformattedDocumentString(document); + + Assert.Equal(2, errors); + Assert.Equal(expected, actual); + } + [Fact] public void CanConvertSuppressSignatureValidationNo() { @@ -314,7 +373,7 @@ namespace WixToolsetTest.Converters var expected = String.Join(Environment.NewLine, "", - " ", + " ", ""); var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); -- cgit v1.2.3-55-g6feb