fix(launcher): guard orphan bake publication

This commit is contained in:
Erik 2026-08-14 21:02:27 +02:00
parent 3f68895120
commit 208a70ac83
14 changed files with 829 additions and 55 deletions

View file

@ -0,0 +1,46 @@
using AcDream.Launcher.Core.Installation;
using AcDream.Platform;
namespace AcDream.Launcher.Core.Tests.Installation;
public sealed class BakeProcessRunnerTests
{
[Fact]
public void PublicationNonceIsEnvironmentOnlyAndVisibleArgumentsStayPinned()
{
string nonce = Guid.Parse("01234567-89ab-cdef-0123-456789abcdef")
.ToString("N");
var request = new BakeProcessRequest(
"acdream-bake",
"retail-dats",
"data/pak/acdream.pak",
7,
nonce);
System.Diagnostics.ProcessStartInfo startInfo =
SystemBakeProcessRunner.CreateStartInfo(request);
Assert.Equal(request.Arguments, startInfo.ArgumentList);
Assert.DoesNotContain(nonce, startInfo.ArgumentList);
Assert.Equal(
nonce,
startInfo.Environment[
BakePublicationGuardPaths.NonceEnvironmentVariable]);
}
[Fact]
public void UnguardedRequestExplicitlyRemovesInheritedAuthorization()
{
var request = new BakeProcessRequest(
"acdream-bake",
"retail-dats",
"data/pak/acdream.pak",
1);
System.Diagnostics.ProcessStartInfo startInfo =
SystemBakeProcessRunner.CreateStartInfo(request);
Assert.False(startInfo.Environment.ContainsKey(
BakePublicationGuardPaths.NonceEnvironmentVariable));
}
}