diff options
| author | Bob Arnson <bob@firegiant.com> | 2019-11-08 14:54:15 -0500 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2019-11-08 15:07:28 -0500 |
| commit | e29c25090e26c8cca52232d580528840d1161b73 (patch) | |
| tree | 8adc655455a219574318131d89501350a9364861 /src | |
| parent | 8a7d727f1ab0dfef956db726d64985311291505e (diff) | |
| download | wix-e29c25090e26c8cca52232d580528840d1161b73.tar.gz wix-e29c25090e26c8cca52232d580528840d1161b73.tar.bz2 wix-e29c25090e26c8cca52232d580528840d1161b73.zip | |
Ensure upgrade action properties are secure.
Diffstat (limited to 'src')
4 files changed, 21 insertions, 8 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs index 8f769904..0d165f80 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateSpecialPropertiesCommand.cs | |||
| @@ -51,6 +51,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 51 | .Select(ca => ca.Id.Id); | 51 | .Select(ca => ca.Id.Id); |
| 52 | hiddenProperties.UnionWith(hideTargetCustomActions); | 52 | hiddenProperties.UnionWith(hideTargetCustomActions); |
| 53 | 53 | ||
| 54 | // Ensure upgrade action properties are secure. | ||
| 55 | var actionProperties = this.Section.Tuples.OfType<UpgradeTuple>().Select(u => u.ActionProperty); | ||
| 56 | secureProperties.UnionWith(actionProperties); | ||
| 57 | |||
| 54 | if (0 < adminProperties.Count) | 58 | if (0 < adminProperties.Count) |
| 55 | { | 59 | { |
| 56 | var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "AdminProperties")); | 60 | var tuple = new PropertyTuple(null, new Identifier(AccessModifier.Private, "AdminProperties")); |
diff --git a/src/WixToolset.Core/Compiler_2.cs b/src/WixToolset.Core/Compiler_2.cs index 2f578e61..3e50a32d 100644 --- a/src/WixToolset.Core/Compiler_2.cs +++ b/src/WixToolset.Core/Compiler_2.cs | |||
| @@ -4919,9 +4919,6 @@ namespace WixToolset.Core | |||
| 4919 | 4919 | ||
| 4920 | this.Core.AddTuple(tuple); | 4920 | this.Core.AddTuple(tuple); |
| 4921 | 4921 | ||
| 4922 | // Ensure the action property is secure. | ||
| 4923 | this.AddWixPropertyRow(sourceLineNumbers, new Identifier(AccessModifier.Private, actionProperty), false, true, false); | ||
| 4924 | |||
| 4925 | // Ensure that RemoveExistingProducts is authored in InstallExecuteSequence | 4922 | // Ensure that RemoveExistingProducts is authored in InstallExecuteSequence |
| 4926 | // if at least one row in Upgrade table lacks the OnlyDetect attribute. | 4923 | // if at least one row in Upgrade table lacks the OnlyDetect attribute. |
| 4927 | if (!onlyDetect) | 4924 | if (!onlyDetect) |
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index 21b6e9ce..4d1e35f9 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | |||
| @@ -372,16 +372,27 @@ namespace WixToolsetTest.CoreIntegration | |||
| 372 | 372 | ||
| 373 | Assert.Equal(0, result); | 373 | Assert.Equal(0, result); |
| 374 | 374 | ||
| 375 | var pdbPath = Path.Combine(intermediateFolder, @"bin\test.wixpdb"); | ||
| 375 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); | 376 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msi"))); |
| 376 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | 377 | Assert.True(File.Exists(pdbPath)); |
| 377 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\MsiPackage\test.txt"))); | 378 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\MsiPackage\test.txt"))); |
| 378 | 379 | ||
| 379 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | 380 | var intermediate = Intermediate.Load(pdbPath); |
| 380 | var section = intermediate.Sections.Single(); | 381 | var section = intermediate.Sections.Single(); |
| 381 | 382 | ||
| 382 | var fileTuple = section.Tuples.OfType<FileTuple>().Single(); | 383 | var upgradeTuple = section.Tuples.OfType<UpgradeTuple>().Single(); |
| 383 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), fileTuple[FileTupleFields.Source].AsPath().Path); | 384 | Assert.False(upgradeTuple.ExcludeLanguages); |
| 384 | Assert.Equal(@"test.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); | 385 | Assert.True(upgradeTuple.IgnoreRemoveFailures); |
| 386 | Assert.False(upgradeTuple.VersionMaxInclusive); | ||
| 387 | Assert.True(upgradeTuple.VersionMinInclusive); | ||
| 388 | Assert.Equal("13.0.0", upgradeTuple.VersionMax); | ||
| 389 | Assert.Equal("12.0.0", upgradeTuple.VersionMin); | ||
| 390 | Assert.False(upgradeTuple.OnlyDetect); | ||
| 391 | Assert.Equal("BLAHBLAHBLAH", upgradeTuple.ActionProperty); | ||
| 392 | |||
| 393 | var pdb = WindowsInstallerData.Load(pdbPath, suppressVersionCheck: false); | ||
| 394 | var secureProperties = pdb.Tables["Property"].Rows.Where(row => row.GetKey() == "SecureCustomProperties").Single(); | ||
| 395 | Assert.Contains("BLAHBLAHBLAH", secureProperties.FieldAsString(1)); | ||
| 385 | } | 396 | } |
| 386 | } | 397 | } |
| 387 | 398 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ManualUpgrade/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/ManualUpgrade/Package.wxs index d674eb59..38125b57 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/ManualUpgrade/Package.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ManualUpgrade/Package.wxs | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | <Upgrade Id="01120000-00E0-0000-0000-0000000FF1CE"> | 6 | <Upgrade Id="01120000-00E0-0000-0000-0000000FF1CE"> |
| 7 | <UpgradeVersion ExcludeLanguages="no" IgnoreRemoveFailure="yes" IncludeMaximum="no" IncludeMinimum="yes" Maximum="13.0.0" Minimum="12.0.0" OnlyDetect="no" Property="BLAHBLAHBLAH" /> | 7 | <UpgradeVersion ExcludeLanguages="no" IgnoreRemoveFailure="yes" IncludeMaximum="no" IncludeMinimum="yes" Maximum="13.0.0" Minimum="12.0.0" OnlyDetect="no" Property="BLAHBLAHBLAH" /> |
| 8 | </Upgrade> | 8 | </Upgrade> |
| 9 | <!--<Property Id="BLAHBLAHBLAH" Secure="yes" />--> | ||
| 9 | 10 | ||
| 10 | <InstallExecuteSequence> | 11 | <InstallExecuteSequence> |
| 11 | <RemoveExistingProducts After="InstallValidate" /> | 12 | <RemoveExistingProducts After="InstallValidate" /> |
