diff options
| author | Bob Arnson <bob@firegiant.com> | 2021-01-31 19:33:26 -0500 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2021-01-31 19:36:53 -0500 |
| commit | bf5c60ffc7488fc9eb12b7104ba7d567f11cc85e (patch) | |
| tree | ec24b5e1526bac7efa956dbb331ce3ef4f05d312 | |
| parent | 8e60e672e42202589f8827c06a69970b330d8d81 (diff) | |
| download | wix-bf5c60ffc7488fc9eb12b7104ba7d567f11cc85e.tar.gz wix-bf5c60ffc7488fc9eb12b7104ba7d567f11cc85e.tar.bz2 wix-bf5c60ffc7488fc9eb12b7104ba7d567f11cc85e.zip | |
Remove Burn Authenticode
Fixes https://github.com/wixtoolset/issues/issues/6301
| -rw-r--r-- | src/WixToolset.Converters/WixConverter.cs | 42 | ||||
| -rw-r--r-- | src/test/WixToolsetTest.Converters/ConverterFixture.cs | 61 |
2 files changed, 91 insertions, 12 deletions
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 | |||
| 44 | private static readonly XName BootstrapperApplicationDllElementName = WixNamespace + "BootstrapperApplicationDll"; | 44 | private static readonly XName BootstrapperApplicationDllElementName = WixNamespace + "BootstrapperApplicationDll"; |
| 45 | private static readonly XName BootstrapperApplicationRefElementName = WixNamespace + "BootstrapperApplicationRef"; | 45 | private static readonly XName BootstrapperApplicationRefElementName = WixNamespace + "BootstrapperApplicationRef"; |
| 46 | private static readonly XName EmbeddedChainerElementName = WixNamespace + "EmbeddedChainer"; | 46 | private static readonly XName EmbeddedChainerElementName = WixNamespace + "EmbeddedChainer"; |
| 47 | private static readonly XName CatalogElementName = WixNamespace + "Catalog"; | ||
| 47 | private static readonly XName ColumnElementName = WixNamespace + "Column"; | 48 | private static readonly XName ColumnElementName = WixNamespace + "Column"; |
| 48 | private static readonly XName ComponentElementName = WixNamespace + "Component"; | 49 | private static readonly XName ComponentElementName = WixNamespace + "Component"; |
| 49 | private static readonly XName ControlElementName = WixNamespace + "Control"; | 50 | private static readonly XName ControlElementName = WixNamespace + "Control"; |
| @@ -71,6 +72,7 @@ namespace WixToolset.Converters | |||
| 71 | private static readonly XName ProgressTextElementName = WixNamespace + "ProgressText"; | 72 | private static readonly XName ProgressTextElementName = WixNamespace + "ProgressText"; |
| 72 | private static readonly XName PublishElementName = WixNamespace + "Publish"; | 73 | private static readonly XName PublishElementName = WixNamespace + "Publish"; |
| 73 | private static readonly XName MultiStringValueElementName = WixNamespace + "MultiStringValue"; | 74 | private static readonly XName MultiStringValueElementName = WixNamespace + "MultiStringValue"; |
| 75 | private static readonly XName RemotePayloadElementName = WixNamespace + "RemotePayload"; | ||
| 74 | private static readonly XName RequiredPrivilegeElementName = WixNamespace + "RequiredPrivilege"; | 76 | private static readonly XName RequiredPrivilegeElementName = WixNamespace + "RequiredPrivilege"; |
| 75 | private static readonly XName ServiceArgumentElementName = WixNamespace + "ServiceArgument"; | 77 | private static readonly XName ServiceArgumentElementName = WixNamespace + "ServiceArgument"; |
| 76 | private static readonly XName SetDirectoryElementName = WixNamespace + "SetDirectory"; | 78 | private static readonly XName SetDirectoryElementName = WixNamespace + "SetDirectory"; |
| @@ -149,6 +151,7 @@ namespace WixToolset.Converters | |||
| 149 | { WixConverter.InstallExecuteSequenceElementName, this.ConvertSequenceElement }, | 151 | { WixConverter.InstallExecuteSequenceElementName, this.ConvertSequenceElement }, |
| 150 | { WixConverter.BootstrapperApplicationElementName, this.ConvertBootstrapperApplicationElement }, | 152 | { WixConverter.BootstrapperApplicationElementName, this.ConvertBootstrapperApplicationElement }, |
| 151 | { WixConverter.BootstrapperApplicationRefElementName, this.ConvertBootstrapperApplicationRefElement }, | 153 | { WixConverter.BootstrapperApplicationRefElementName, this.ConvertBootstrapperApplicationRefElement }, |
| 154 | { WixConverter.CatalogElementName, this.ConvertCatalogElement }, | ||
| 152 | { WixConverter.ColumnElementName, this.ConvertColumnElement }, | 155 | { WixConverter.ColumnElementName, this.ConvertColumnElement }, |
| 153 | { WixConverter.CustomTableElementName, this.ConvertCustomTableElement }, | 156 | { WixConverter.CustomTableElementName, this.ConvertCustomTableElement }, |
| 154 | { WixConverter.ControlElementName, this.ConvertControlElement }, | 157 | { WixConverter.ControlElementName, this.ConvertControlElement }, |
| @@ -172,6 +175,7 @@ namespace WixToolset.Converters | |||
| 172 | { WixConverter.ProgressTextElementName, this.ConvertProgressTextElement }, | 175 | { WixConverter.ProgressTextElementName, this.ConvertProgressTextElement }, |
| 173 | { WixConverter.PublishElementName, this.ConvertPublishElement }, | 176 | { WixConverter.PublishElementName, this.ConvertPublishElement }, |
| 174 | { WixConverter.MultiStringValueElementName, this.ConvertMultiStringValueElement }, | 177 | { WixConverter.MultiStringValueElementName, this.ConvertMultiStringValueElement }, |
| 178 | { WixConverter.RemotePayloadElementName, this.ConvertRemotePayloadElement }, | ||
| 175 | { WixConverter.RequiredPrivilegeElementName, this.ConvertRequiredPrivilegeElement }, | 179 | { WixConverter.RequiredPrivilegeElementName, this.ConvertRequiredPrivilegeElement }, |
| 176 | { WixConverter.CustomActionElementName, this.ConvertCustomActionElement }, | 180 | { WixConverter.CustomActionElementName, this.ConvertCustomActionElement }, |
| 177 | { WixConverter.ServiceArgumentElementName, this.ConvertServiceArgumentElement }, | 181 | { WixConverter.ServiceArgumentElementName, this.ConvertServiceArgumentElement }, |
| @@ -642,6 +646,14 @@ namespace WixToolset.Converters | |||
| 642 | } | 646 | } |
| 643 | } | 647 | } |
| 644 | 648 | ||
| 649 | private void ConvertCatalogElement(XElement element) | ||
| 650 | { | ||
| 651 | if (this.OnError(ConverterTestType.BundleSignatureValidationObsolete, element, "The Catalog element is obsolete. Signature validation is no longer supported. The elkement will be removed.")) | ||
| 652 | { | ||
| 653 | element.Remove(); | ||
| 654 | } | ||
| 655 | } | ||
| 656 | |||
| 645 | private void ConvertColumnElement(XElement element) | 657 | private void ConvertColumnElement(XElement element) |
| 646 | { | 658 | { |
| 647 | var category = element.Attribute("Category"); | 659 | var category = element.Attribute("Category"); |
| @@ -1044,6 +1056,21 @@ namespace WixToolset.Converters | |||
| 1044 | 1056 | ||
| 1045 | private void ConvertMultiStringValueElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); | 1057 | private void ConvertMultiStringValueElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); |
| 1046 | 1058 | ||
| 1059 | private void ConvertRemotePayloadElement(XElement element) | ||
| 1060 | { | ||
| 1061 | RemoveIfPresent(element.Attribute("CertificatePublicKey")); | ||
| 1062 | RemoveIfPresent(element.Attribute("CertificateThumbprint")); | ||
| 1063 | |||
| 1064 | void RemoveIfPresent(XAttribute xAttribute) | ||
| 1065 | { | ||
| 1066 | if (null != xAttribute | ||
| 1067 | && 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)) | ||
| 1068 | { | ||
| 1069 | xAttribute.Remove(); | ||
| 1070 | } | ||
| 1071 | } | ||
| 1072 | } | ||
| 1073 | |||
| 1047 | private void ConvertRequiredPrivilegeElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Name"); | 1074 | private void ConvertRequiredPrivilegeElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Name"); |
| 1048 | 1075 | ||
| 1049 | private void ConvertRowElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); | 1076 | private void ConvertRowElement(XElement element) => this.ConvertInnerTextToAttribute(element, "Value"); |
| @@ -1070,16 +1097,9 @@ namespace WixToolset.Converters | |||
| 1070 | { | 1097 | { |
| 1071 | var suppressSignatureValidation = element.Attribute("SuppressSignatureValidation"); | 1098 | var suppressSignatureValidation = element.Attribute("SuppressSignatureValidation"); |
| 1072 | 1099 | ||
| 1073 | if (null != suppressSignatureValidation) | 1100 | if (null != suppressSignatureValidation |
| 1101 | && 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)) | ||
| 1074 | { | 1102 | { |
| 1075 | if (this.OnError(ConverterTestType.SuppressSignatureValidationDeprecated, element, "The chain package element contains deprecated '{0}' attribute. Use the 'EnableSignatureValidation' attribute instead.", suppressSignatureValidation.Name)) | ||
| 1076 | { | ||
| 1077 | if ("no" == suppressSignatureValidation.Value) | ||
| 1078 | { | ||
| 1079 | element.Add(new XAttribute("EnableSignatureValidation", "yes")); | ||
| 1080 | } | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | suppressSignatureValidation.Remove(); | 1103 | suppressSignatureValidation.Remove(); |
| 1084 | } | 1104 | } |
| 1085 | } | 1105 | } |
| @@ -1579,9 +1599,9 @@ namespace WixToolset.Converters | |||
| 1579 | AssignAnonymousFileId, | 1599 | AssignAnonymousFileId, |
| 1580 | 1600 | ||
| 1581 | /// <summary> | 1601 | /// <summary> |
| 1582 | /// SuppressSignatureValidation attribute is deprecated and replaced with EnableSignatureValidation. | 1602 | /// SuppressSignatureValidation attribute is obsolete and corresponding functionality removed. |
| 1583 | /// </summary> | 1603 | /// </summary> |
| 1584 | SuppressSignatureValidationDeprecated, | 1604 | BundleSignatureValidationObsolete, |
| 1585 | 1605 | ||
| 1586 | /// <summary> | 1606 | /// <summary> |
| 1587 | /// WixCA Binary/@Id has been renamed to UtilCA. | 1607 | /// 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 | |||
| @@ -305,6 +305,65 @@ namespace WixToolsetTest.Converters | |||
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | [Fact] | 307 | [Fact] |
| 308 | public void CanConvertCatalogElement() | ||
| 309 | { | ||
| 310 | var parse = String.Join(Environment.NewLine, | ||
| 311 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 312 | " <Catalog Id='idCatalog' SourceFile='path\\to\\catalog.cat' />", | ||
| 313 | "</Wix>"); | ||
| 314 | |||
| 315 | var expected = String.Join(Environment.NewLine, | ||
| 316 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 317 | " ", | ||
| 318 | "</Wix>"); | ||
| 319 | |||
| 320 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 321 | |||
| 322 | var messaging = new MockMessaging(); | ||
| 323 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 324 | |||
| 325 | var errors = converter.ConvertDocument(document); | ||
| 326 | |||
| 327 | var actual = UnformattedDocumentString(document); | ||
| 328 | |||
| 329 | Assert.Equal(1, errors); | ||
| 330 | Assert.Equal(expected, actual); | ||
| 331 | } | ||
| 332 | |||
| 333 | [Fact] | ||
| 334 | public void CanConvertRemotePayloadElement() | ||
| 335 | { | ||
| 336 | var parse = String.Join(Environment.NewLine, | ||
| 337 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 338 | " <RemotePayload", | ||
| 339 | " Description='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", | ||
| 340 | " Hash='61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA'", | ||
| 341 | " CertificatePublicKey='3756E9BBF4461DCD0AA68E0D1FCFFA9CEA47AC18'", | ||
| 342 | " CertificateThumbprint='2485A7AFA98E178CB8F30C9838346B514AEA4769'", | ||
| 343 | " ProductName='Microsoft ASP.NET Core 3.1.8 - Shared Framework'", | ||
| 344 | " Size='7841880'", | ||
| 345 | " Version='3.1.8.20421' />", | ||
| 346 | "</Wix>"); | ||
| 347 | |||
| 348 | var expected = String.Join(Environment.NewLine, | ||
| 349 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 350 | " <RemotePayload Description=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Hash=\"61DC9EAA0C8968E48E13C5913ED202A2F8F94DBA\" ProductName=\"Microsoft ASP.NET Core 3.1.8 - Shared Framework\" Size=\"7841880\" Version=\"3.1.8.20421\" />", | ||
| 351 | "</Wix>"); | ||
| 352 | |||
| 353 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 354 | |||
| 355 | var messaging = new MockMessaging(); | ||
| 356 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 357 | |||
| 358 | var errors = converter.ConvertDocument(document); | ||
| 359 | |||
| 360 | var actual = UnformattedDocumentString(document); | ||
| 361 | |||
| 362 | Assert.Equal(2, errors); | ||
| 363 | Assert.Equal(expected, actual); | ||
| 364 | } | ||
| 365 | |||
| 366 | [Fact] | ||
| 308 | public void CanConvertSuppressSignatureValidationNo() | 367 | public void CanConvertSuppressSignatureValidationNo() |
| 309 | { | 368 | { |
| 310 | var parse = String.Join(Environment.NewLine, | 369 | var parse = String.Join(Environment.NewLine, |
| @@ -314,7 +373,7 @@ namespace WixToolsetTest.Converters | |||
| 314 | 373 | ||
| 315 | var expected = String.Join(Environment.NewLine, | 374 | var expected = String.Join(Environment.NewLine, |
| 316 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | 375 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", |
| 317 | " <MsiPackage EnableSignatureValidation=\"yes\" />", | 376 | " <MsiPackage />", |
| 318 | "</Wix>"); | 377 | "</Wix>"); |
| 319 | 378 | ||
| 320 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | 379 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); |
