Skip to content

Commit

Permalink
Merge up to v4.0.6
Browse files Browse the repository at this point in the history
WiX Toolset v4.0.4

Start WiX Toolset v4.0.5

Protect elevated working folder from malicious data

When running elevated, Burn uses the Windows Temp folder as its working folder
to prevent normal processes from tampering with the files. Windows Temp does
allow non-elevated processes to write to the folder but they cannot see the
files there. Unfortunately, contrary to our belief, non-elevated processes
can read the files in Windows Temp by watching for directory changes. This
allows a malicious process to lie in wait, watching the Windows Temp folder
until a Burn process is launched elevated, then attack the working folder.
Mitigate that attack by protecting the working folder to only elevated users.

Managed custom actions also fall back to using the Windows Temp folder in
some cases and thus can be exposed in a similar fashion as an elevated Burn
process. Remove that possibility.

Work around lack of upper-bound limit on extension versions

See issue 8033 for more details

WiX Toolset v4.0.5

Start WiX Toolset v4.0.6

Update deprecated GitHub action upload-artifacts

Build native code with VC v143 toolset only.

v143 output is compatible back to VS2017 (at least).

Fixes wixtoolset/issues#8211.

Prevent unnecessary refreshes that move focus.

Spillover from having more interactive controls. In WiX v3, showing a
page moved the focus as a typical person might expect. When WiX v4
added interactivity, the same code was used to update controls (e.g.,
when checking a checkbox set a property used in a `VisibleCondition` or
`EnableCondition` for another control on the same page). This change
prevents the focus-setting behavior if the same page is being shown.

Fixes wixtoolset/issues#8144

Update dependencies

Fixes 8569

Reset current directory so SFXCA directory can be cleaned up

Fixes 8630

Fix faulty memory access in Util's User custom actions

Generally, clean up the handling of getting the domain from a server name by
centralizing and simplifying it behind an improved GetDomainFromServerName()
based on the buggy GetServerName().

Fixes 8576

Re-enable insignificant zeros in PackageVersion

Closes 8589

Fix crash with use of File/@patchgroup.

Fix crash when adding file in patch when filtering

Add overloads to support create-only Wixouts.

This prevents the .NET ZipArchive (and friends) from keeping the whole
thing in memory, to support updating when we don't need to update the
Wixout when building a binary Wixlib.

WiX Toolset v4.0.6
  • Loading branch information
robmen authored and nirbar committed Dec 1, 2024
1 parent 2d30292 commit e8497b6
Show file tree
Hide file tree
Showing 34 changed files with 366 additions and 195 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0

Expand Down Expand Up @@ -66,7 +66,10 @@ jobs:
run: ./src/build_official.cmd
env:
RuntimeTestsEnabled: true
SigningVaultUri: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_VAULTURI || '' }}
SigningKeyVaultUri: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_VAULTURI || '' }}
SigningTenantId: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_TENANTID || '' }}
SigningClientId: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_CLIENTID || '' }}
SigningClientSecret: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_SECRET || '' }}
SigningCertName: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_CERTNAME || '' }}
BuildRunNumber: ${{ github.run_number }}

Expand All @@ -85,7 +88,7 @@ jobs:

- name: Save build
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.4.3
with:
name: artifacts
path: build/artifacts/
Expand All @@ -108,7 +111,7 @@ jobs:
# Do NOT publish logs on `master` branch as they may contain secrets in them.
- name: Save logs
if: github.ref != 'refs/heads/master' && (success() || failure())
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4.4.3
with:
name: logs_${{ github.run_id }}
path: build/logs/
Expand Down
7 changes: 3 additions & 4 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

<Project>
<PropertyGroup>
<SigningToolFolder>$(ToolsFolder)</SigningToolFolder>
<SigningToolExe>$(SigningToolFolder)\sign.exe</SigningToolExe>
<SigningFilelist>$(MSBuildThisFileDirectory)signing-empty-file-list.txt</SigningFilelist>
<SigningConfiguration>--description "WiX Toolset" --description-url "https://wixtoolset.org/" --timestamp-url "http://timestamp.digicert.com" --file-list "$(SigningFilelist)" --azure-key-vault-managed-identity true --azure-key-vault-url "$(SigningVaultUri)" --azure-key-vault-certificate "$(SigningCertName)"</SigningConfiguration>
<SigningToolExe>$(ToolsFolder)\sign.exe</SigningToolExe>
<SigningCommand>code azure-key-vault</SigningCommand>
<SigningConfiguration>--description "WiX Toolset" --description-url "https://wixtoolset.org/" --file-list "$(MSBuildThisFileDirectory)signing-empty-file-list.txt" --azure-key-vault-url $(SigningKeyVaultUri) --azure-key-vault-tenant-id $(SigningTenantId) --azure-key-vault-client-id $(SigningClientId) --azure-key-vault-client-secret $(SigningClientSecret) --azure-key-vault-certificate $(SigningCertName) --timestamp-url "http://timestamp.digicert.com"</SigningConfiguration>
</PropertyGroup>

<PropertyGroup Condition=" '$(IsWixTestSupportProject)'=='true' ">
Expand Down
3 changes: 1 addition & 2 deletions src/Directory.vcxproj.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
<OutDir>$(OutputPath)$(PlatformFolder)\</OutDir>
</PropertyGroup>

<!-- This is needed for v141 toolset, which doesn't understand `10.0` -->
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''">
<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(CLRSupport)'!='true' ">
Expand Down
14 changes: 14 additions & 0 deletions src/api/wix/WixToolset.Data/Intermediate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,20 @@ public void Save(string path)
}
}

/// <summary>
/// Saves an intermediate that can only be written to to a path on disk.
/// </summary>
/// <param name="path">Path to save intermediate file to disk.</param>
public void SaveNew(string path)
{
Directory.CreateDirectory(Path.GetDirectoryName(Path.GetFullPath(path)));

using (var wixout = WixOutput.CreateNew(path))
{
this.Save(wixout);
}
}

/// <summary>
/// Saves an intermediate to a WixOutput.
/// </summary>
Expand Down
32 changes: 29 additions & 3 deletions src/api/wix/WixToolset.Data/WixOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private WixOutput(Uri uri, ZipArchive archive, Stream stream)
}

/// <summary>
///
///
/// </summary>
public Uri Uri { get; }

Expand Down Expand Up @@ -189,7 +189,10 @@ public void ExtractEmbeddedFile(string embeddedId, string outputPath)
/// <returns>Stream to the data of the file.</returns>
public Stream CreateDataStream(string name)
{
this.DeleteExistingEntry(name);
if (this.archive.Mode == ZipArchiveMode.Update)
{
this.DeleteExistingEntry(name);
}

var entry = this.archive.CreateEntry(name);

Expand All @@ -203,7 +206,10 @@ public Stream CreateDataStream(string name)
/// <param name="path">Path to file on disk to include in the output.</param>
public void ImportDataStream(string name, string path)
{
this.DeleteExistingEntry(name);
if (this.archive.Mode == ZipArchiveMode.Update)
{
this.DeleteExistingEntry(name);
}

this.archive.CreateEntryFromFile(path, name, System.IO.Compression.CompressionLevel.Optimal);
}
Expand Down Expand Up @@ -240,6 +246,26 @@ public string GetData(string name)
}
}

/// <summary>
/// Creates a new file structure on disk that can only be written to.
/// </summary>
/// <param name="path">Path to write file structure to.</param>
/// <returns>Newly created <c>WixOutput</c>.</returns>
internal static WixOutput CreateNew(string path)
{
var fullPath = Path.GetFullPath(path);

Directory.CreateDirectory(Path.GetDirectoryName(fullPath));

var uri = new Uri(fullPath);

var stream = File.Create(path);

var archive = new ZipArchive(stream, ZipArchiveMode.Create, leaveOpen: true);

return new WixOutput(uri, archive, stream);
}

/// <summary>
/// Disposes of the internal state of the file structure.
/// </summary>
Expand Down
19 changes: 19 additions & 0 deletions src/dtf/WixToolset.Dtf.WindowsInstaller/CustomActionProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ public static int InvokeCustomAction(int sessionHandle, string entryPoint,
return (int) ActionResult.Failure;
}

string originalDirectory = null;

try
{
// Remember the original directory so we can restore it later.
originalDirectory = Environment.CurrentDirectory;

// Set the current directory to the location of the extracted files.
Environment.CurrentDirectory =
AppDomain.CurrentDomain.BaseDirectory;
Expand Down Expand Up @@ -142,6 +147,20 @@ public static int InvokeCustomAction(int sessionHandle, string entryPoint,
session.Log(ex.ToString());
return (int) ActionResult.Failure;
}
finally
{
try
{
if (!String.IsNullOrEmpty(originalDirectory))
{
Environment.CurrentDirectory = originalDirectory;
}
}
catch (Exception ex)
{
session.Log("Failed to restore current directory after running custom action: {0}", ex.Message);
}
}
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/ext/Util/ca/RemoveFoldersEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ extern "C" UINT WINAPI WixRemoveFoldersEx(

hr = PathExpand(&sczExpandedPath, sczPath, PATH_EXPAND_ENVIRONMENT);
ExitOnFailure(hr, "Failed to expand path: %S for row: %S", sczPath, sczId);

hr = PathBackslashTerminate(&sczExpandedPath);
ExitOnFailure(hr, "Failed to backslash-terminate path: %S", sczExpandedPath);

WcaLog(LOGMSG_STANDARD, "Recursing path: %S for row: %S.", sczExpandedPath, sczId);
hr = RecursePath(sczExpandedPath, sczId, sczComponent, sczProperty, iMode, f64BitComponent, &dwCounter, &hTable, &hColumns);
ExitOnFailure(hr, "Failed while navigating path: %S for row: %S", sczPath, sczId);
Expand Down
3 changes: 2 additions & 1 deletion src/ext/Util/ca/precomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <msxml2.h>
#include <Iads.h>
#include <activeds.h>
#include <activeds.h>
#include <lm.h> // NetApi32.lib
#include <Ntsecapi.h>
#include <Dsgetdc.h>
Expand Down Expand Up @@ -50,5 +50,6 @@
#include "scauser.h"
#include "scasmb.h"
#include "scasmbexec.h"
#include "utilca.h"

#include "..\..\caDecor.h"
Loading

0 comments on commit e8497b6

Please sign in to comment.