diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 74a8691..c5e3102 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -36,7 +36,12 @@ jobs: run: ./tests/windows/Test-DesktopContracts.ps1 - name: Test Desktop security - run: dotnet test tests/ServerMonitorManager.Desktop.Security.Tests/ServerMonitorManager.Desktop.Security.Tests.csproj --configuration Release -p:RestoreLockedMode=true + run: dotnet test tests/ServerMonitorManager.Desktop.Security.Tests/ServerMonitorManager.Desktop.Security.Tests.csproj --configuration Release -p:RestoreLockedMode=true --filter Category!=LiveRelease + + - name: Test Desktop security (live release) + env: + SMM_TEST_RELEASE_TAG: v0.1.0-alpha.18 + run: dotnet test tests/ServerMonitorManager.Desktop.Security.Tests/ServerMonitorManager.Desktop.Security.Tests.csproj --configuration Release -p:RestoreLockedMode=true --filter Category=LiveRelease - name: Build test-signed MSIX installer shell: pwsh diff --git a/tests/ServerMonitorManager.Desktop.Security.Tests/LiveReleaseUpdateVerificationTests.cs b/tests/ServerMonitorManager.Desktop.Security.Tests/LiveReleaseUpdateVerificationTests.cs index 5c62655..5e8ab03 100644 --- a/tests/ServerMonitorManager.Desktop.Security.Tests/LiveReleaseUpdateVerificationTests.cs +++ b/tests/ServerMonitorManager.Desktop.Security.Tests/LiveReleaseUpdateVerificationTests.cs @@ -121,10 +121,20 @@ public sealed class LiveReleaseUpdateVerificationTests : IAsyncDisposable // Alter manifest content by tampering with the hash var originalManifest = await File.ReadAllTextAsync(manifestPath, TestContext.Current.CancellationToken); - var tamperedManifest = originalManifest.Replace( - "710813668ac5efacc245472afd4da6dca6739c042b5189bd12c2bbbd3c6b7e19", - "0000000000000000000000000000000000000000000000000000000000000000", - StringComparison.Ordinal); + var node = JsonNode.Parse(originalManifest); + Assert.NotNull(node); + if (node["hashes"]?["ServerMonitorManager-win-x64.msix"] is not null) + { + node["hashes"]!["ServerMonitorManager-win-x64.msix"] = "0000000000000000000000000000000000000000000000000000000000000000"; + } + else + { + node["hashes"] = new JsonObject + { + ["ServerMonitorManager-win-x64.msix"] = "0000000000000000000000000000000000000000000000000000000000000000" + }; + } + var tamperedManifest = node.ToJsonString(); var tamperedManifestPath = Path.Combine(_tempDir, "tampered-manifest.json"); await File.WriteAllTextAsync(tamperedManifestPath, tamperedManifest, TestContext.Current.CancellationToken);