From a795b2a0c904ba9c3d7eb40865bcce123c289d04 Mon Sep 17 00:00:00 2001 From: Elie Bariche <33458222+ebariche@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:44:36 -0400 Subject: [PATCH 1/2] ci: Add dual obfuscation test --- .vsts-ci-windows-tests.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.vsts-ci-windows-tests.yml b/.vsts-ci-windows-tests.yml index 3ff51044b..dd8be2bb6 100644 --- a/.vsts-ci-windows-tests.yml +++ b/.vsts-ci-windows-tests.yml @@ -146,6 +146,23 @@ jobs: env: BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)" + # Static linking test with dual obfuscation enabled + - pwsh: | + cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6 + dotnet clean -c Release /p:DISABLE_CLIHOST_NET6=true + dotnet publish -c Release /m:1 /p:DISABLE_CLIHOST_NET6=true /p:WasmShellEmccLinkOptimization=false /p:WasmShellObfuscateAssemblies=true /p:WasmShellAssembliesFileNameObfuscationMode=NoDots /bl:$(build.artifactstagingdirectory)/SampleNet6-dual-win.binlog + displayName: Build StaticLinking.Aot.Net6 Sample (dual obfuscation) + + - pwsh: | + $(build.sourcesdirectory)\build\scripts\run-tests-windows.ps1 ` + "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.Net6\bin\Release\net6.0\dist" ` + "$(build.sourcesdirectory)\src\Uno.Wasm.StaticLinking.Aot.UITests" ` + "http://localhost:8000/" + + displayName: StaticLinking.Aot.Net6 Tests (net6 with dual obfuscation) + env: + BUILD_SOURCESDIRECTORY: "$(build.sourcesdirectory)" + # Static linking test (net5) - pwsh: | cd $(build.sourcesdirectory)/src/Uno.Wasm.StaticLinking.Aot.Net6 From 4aaf7ebfed1d0b2c4b249567ae41cec7b3d71503 Mon Sep 17 00:00:00 2001 From: Elie Bariche <33458222+ebariche@users.noreply.github.com> Date: Thu, 7 Sep 2023 08:24:50 -0400 Subject: [PATCH 2/2] fix: Ensure filename obfuscation works with obfuscation --- src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts index 6611e7934..20065d58e 100644 --- a/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts +++ b/src/Uno.Wasm.Bootstrap/ts/Uno/WebAssembly/Bootstrapper.ts @@ -436,7 +436,11 @@ namespace Uno.WebAssembly.Bootstrap { } private async deobfuscateFile(asset: string, response: Promise): Promise { - if (this._unoConfig.assemblyObfuscationKey && asset.endsWith(this._unoConfig.assemblyFileExtension)) { + const assemblyFileSuffix = this._unoConfig.assemblyFileNameObfuscationMode !== "NoDots" ? + this._unoConfig.assemblyFileExtension : + this._unoConfig.assemblyFileExtension.replace(".", "_"); + + if (this._unoConfig.assemblyObfuscationKey && asset.endsWith(assemblyFileSuffix)) { const responseValue = await response; if (responseValue) {