Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(release): restore configured desktop signing requirements (#853)
Generbec00c1cc0c7
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex d5347dae9..f4891d523 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -84,7 +84,7 @@ jobs:TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}run: |set -euo pipefail- for name in APPLE_CERTIFICATE APPLE_CERTIFICATE_PASSWORD APPLE_SIGNING_IDENTITY APPLE_TEAM_ID APPLE_API_ISSUER APPLE_API_KEY APPLE_API_PRIVATE_KEY TAURI_SIGNING_PRIVATE_KEY TAURI_SIGNING_PRIVATE_KEY_PASSWORD; do+ for name in APPLE_CERTIFICATE APPLE_CERTIFICATE_PASSWORD APPLE_SIGNING_IDENTITY APPLE_TEAM_ID APPLE_API_ISSUER APPLE_API_KEY APPLE_API_PRIVATE_KEY TAURI_SIGNING_PRIVATE_KEY; dotest -n "${!name}" || { echo "::error::Missing required macOS release input: $name"; exit 1; }done[[ "$APPLE_TEAM_ID" =~ ^[A-Z0-9]{10}$ ]]@@ -214,7 +214,6 @@ jobs:timeout-minutes: 45permissions:contents: read- id-token: writesteps:- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7@@ -251,74 +250,21 @@ jobs:- name: Preflight Windows release inputsshell: pwshenv:- AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}- AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}- AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}- ALOOK_ARTIFACT_SIGNING_ENDPOINT: ${{ vars.AZURE_ARTIFACT_SIGNING_ENDPOINT }}- ALOOK_ARTIFACT_SIGNING_ACCOUNT_NAME: ${{ vars.AZURE_ARTIFACT_SIGNING_ACCOUNT_NAME }}- ALOOK_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ vars.AZURE_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME }}- ALOOK_WINDOWS_SIGNING_PUBLISHER: ${{ vars.WINDOWS_SIGNING_PUBLISHER }}TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}run: |- $required = @(- "AZURE_CLIENT_ID", "AZURE_TENANT_ID", "AZURE_SUBSCRIPTION_ID",- "ALOOK_ARTIFACT_SIGNING_ENDPOINT", "ALOOK_ARTIFACT_SIGNING_ACCOUNT_NAME",- "ALOOK_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME", "ALOOK_WINDOWS_SIGNING_PUBLISHER",- "TAURI_SIGNING_PRIVATE_KEY", "TAURI_SIGNING_PRIVATE_KEY_PASSWORD"- )- foreach ($name in $required) {- if ([string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($name))) {- throw "Missing required Windows release input: $name"- }+ if ([string]::IsNullOrWhiteSpace($env:TAURI_SIGNING_PRIVATE_KEY)) {+ throw "Missing required Windows release input: TAURI_SIGNING_PRIVATE_KEY"}- [Uri]$endpoint = $null- if (-not [Uri]::TryCreate($env:ALOOK_ARTIFACT_SIGNING_ENDPOINT, [UriKind]::Absolute, [ref]$endpoint) -or- $endpoint.Scheme -ne [Uri]::UriSchemeHttps -or- $endpoint.DnsSafeHost -notmatch '^[a-z0-9-]+\.codesigning\.azure\.net$' -or- -not $endpoint.IsDefaultPort -or- $endpoint.AbsolutePath -ne '/' -or- $endpoint.UserInfo -ne '' -or- $endpoint.Query -ne '' -or- $endpoint.Fragment -ne '') {- throw "Artifact Signing endpoint must be an HTTPS regional codesigning.azure.net root URL"- }-- - name: Login to Azure with GitHub OIDC- uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0- with:- client-id: ${{ vars.AZURE_CLIENT_ID }}- tenant-id: ${{ vars.AZURE_TENANT_ID }}- subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}- - name: Prepare digest-verified Artifact Signing module- shell: pwsh- run: |- $destination = Join-Path $env:RUNNER_TEMP "alook-artifact-signing-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT"- "ALOOK_ARTIFACT_SIGNING_ROOT=$destination" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8- ./scripts/ci/prepare-desktop-windows-signing.ps1 -DestinationRoot $destination-- - name: Prepare canonical Tauri signing root- shell: pwsh- run: |- $root = [IO.Path]::GetFullPath((Join-Path $env:GITHUB_WORKSPACE "src\desktop\src-tauri\target\x86_64-pc-windows-msvc\release"))- $temp = Join-Path $root "tauri-sign-temp"- New-Item -Path $temp -ItemType Directory -Force | Out-Null- "ALOOK_WINDOWS_SIGNING_ROOT=$root" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8- "TEMP=$temp" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8- "TMP=$temp" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8-- - name: Build signed Windows app+ - name: Build Windows appuses: tauri-apps/tauri-action@1deb371b0cd8bd54025b384f1cd735e725c4060f # v1.0.0env:TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}- ALOOK_ARTIFACT_SIGNING_ENDPOINT: ${{ vars.AZURE_ARTIFACT_SIGNING_ENDPOINT }}- ALOOK_ARTIFACT_SIGNING_ACCOUNT_NAME: ${{ vars.AZURE_ARTIFACT_SIGNING_ACCOUNT_NAME }}- ALOOK_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ vars.AZURE_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME }}with:projectPath: src/desktop- args: --target x86_64-pc-windows-msvc --config src-tauri/tauri.windows.signing.conf.json+ args: --target x86_64-pc-windows-msvc- name: Stage exact Windows release bytesshell: pwsh@@ -333,10 +279,9 @@ jobs:- name: Verify staged Windows bytesshell: pwshenv:- EXPECTED_PUBLISHER: ${{ vars.WINDOWS_SIGNING_PUBLISHER }}VERSION: ${{ steps.version.outputs.version }}run: |- ./scripts/ci/verify-desktop-windows.ps1 -StageDirectory $env:DESKTOP_STAGE -ExpectedVersion $env:VERSION -ExpectedPublisher $env:EXPECTED_PUBLISHER -TauriConfigPath "src/desktop/src-tauri/tauri.conf.json"+ ./scripts/ci/verify-desktop-windows.ps1 -StageDirectory $env:DESKTOP_STAGE -ExpectedVersion $env:VERSION -TauriConfigPath "src/desktop/src-tauri/tauri.conf.json"- name: Upload private verified Windows stageuses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7@@ -346,21 +291,6 @@ jobs:if-no-files-found: errorretention-days: 7- - name: Clean temporary Windows signing state- if: always()- shell: pwsh- run: |- $ErrorActionPreference = "SilentlyContinue"- $PSNativeCommandUseErrorActionPreference = $false- az logout 2>$null- az account clear 2>$null- if ($env:ALOOK_ARTIFACT_SIGNING_ROOT) {- Remove-Item -LiteralPath $env:ALOOK_ARTIFACT_SIGNING_ROOT -Recurse -Force -ErrorAction SilentlyContinue- }- if ($env:TEMP -and $env:ALOOK_WINDOWS_SIGNING_ROOT -and $env:TEMP.StartsWith($env:ALOOK_WINDOWS_SIGNING_ROOT)) {- Remove-Item -LiteralPath $env:TEMP -Recurse -Force -ErrorAction SilentlyContinue- }-publish:needs: [build-unix, build-windows]runs-on: ubuntu-latest@@ -493,7 +423,7 @@ jobs:### Windows[.exe Installer](${base}/Alook_${VERSION}_x64-setup.exe) | [.msi](${base}/Alook_${VERSION}_x64_en-US.msi)- Authenticode signed with SHA-256 and an RFC 3161 timestamp. Embedded application executables and exact updater signatures are verified before publication.+ These Windows builds are not Authenticode code-signed. Windows may show an unknown publisher or a SmartScreen warning. Exact-byte updater signatures are verified before publication.### Linux[.deb](${base}/Alook_${VERSION}_amd64.deb) | [.rpm](${base}/Alook-${VERSION}-1.x86_64.rpm) | [.AppImage](${base}/Alook_${VERSION}_amd64.AppImage)diff --git a/scripts/ci/desktop-release-artifacts.test.ts b/scripts/ci/desktop-release-artifacts.test.tsindex d98b2b4e9..1e6753f96 100644--- a/scripts/ci/desktop-release-artifacts.test.ts+++ b/scripts/ci/desktop-release-artifacts.test.ts@@ -1,7 +1,8 @@+import { spawnSync } from "node:child_process"import { createHash, generateKeyPairSync, randomBytes, sign } from "node:crypto"import { mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs"import { tmpdir } from "node:os"-import { dirname, join } from "node:path"+import { dirname, join, resolve } from "node:path"import { pathToFileURL } from "node:url"import { afterEach, describe, expect, it } from "vitest"@@ -79,6 +80,66 @@ afterEach(() => {for (const directory of temporaryDirectories.splice(0)) rmSync(directory, { force: true, recursive: true })})+const hasPowerShell = spawnSync("pwsh", ["-NoLogo", "-NoProfile", "-Command", "exit 0"], {+ timeout: 10_000,+}).status === 0++function verifyWindowsStage(fixture: Awaited<ReturnType<typeof createAllStages>>) {+ return spawnSync("pwsh", [+ "-NoLogo", "-NoProfile", "-NonInteractive", "-File",+ resolve(import.meta.dirname, "verify-desktop-windows.ps1"),+ "-StageDirectory", join(fixture.stages, "desktop-release-windows-x86_64"),+ "-ExpectedVersion", version,+ "-TauriConfigPath", fixture.configPath,+ ], { encoding: "utf8", timeout: 30_000 })+}++describe.skipIf(!hasPowerShell)("actual Windows staged installer verifier (requires pwsh)", () => {+ it("accepts both installers with valid updater signatures and no Authenticode signatures", async () => {+ const result = verifyWindowsStage(await createAllStages())+ expect(result.error).toBeUndefined()+ expect(result.status, result.stdout + result.stderr).toBe(0)+ expect(result.stdout).toContain("not Authenticode code-signed")+ })++ it.each(["x64-setup.exe", "x64_en-US.msi"])("rejects tampered %s even if its manifest digest was updated", async suffix => {+ const fixture = await createAllStages()+ const stage = join(fixture.stages, "desktop-release-windows-x86_64")+ const name = `Alook_${version}_${suffix}`+ const data = Buffer.from("tampered installer bytes")+ writeFileSync(join(stage, "files", name), data)+ const path = join(stage, "manifest.json")+ const manifest = JSON.parse(readFileSync(path, "utf8"))+ const file = manifest.files.find((entry: { name: string }) => entry.name === name)+ file.size = data.length+ file.sha256 = createHash("sha256").update(data).digest("hex")+ writeFileSync(path, JSON.stringify(manifest))+ const result = verifyWindowsStage(fixture)+ expect(result.error).toBeUndefined()+ expect(result.status).not.toBe(0)+ expect(result.stdout + result.stderr).toContain("Invalid Minisign file signature")+ })++ it("rejects a different updater public key", async () => {+ const fixture = await createAllStages()+ const signer = createSigningFixture()+ writeFileSync(fixture.configPath, JSON.stringify({ plugins: { updater: { pubkey: signer.encodedPublicKey } } }))+ const result = verifyWindowsStage(fixture)+ expect(result.error).toBeUndefined()+ expect(result.status).not.toBe(0)+ expect(result.stdout + result.stderr).toContain("key id does not match")+ })++ it("rejects an absent installer signature before publication", async () => {+ const fixture = await createAllStages()+ rmSync(join(fixture.stages, "desktop-release-windows-x86_64", "files", `Alook_${version}_x64-setup.exe.sig`))+ const result = verifyWindowsStage(fixture)+ expect(result.error).toBeUndefined()+ expect(result.status).not.toBe(0)+ expect(result.stdout + result.stderr).toContain("files directory contains an unexpected entry")+ })+})+describe("desktop release artifact staging", () => {it("rejects unsupported target metadata and source path escapes", () => {expect(() => targetSpec("linux-x86_64", "v1.2.3")).toThrow("numeric semver")diff --git a/scripts/ci/desktop-release-inputs.test.ts b/scripts/ci/desktop-release-inputs.test.tsnew file mode 100644index 000000000..23b2a638a--- /dev/null+++ b/scripts/ci/desktop-release-inputs.test.ts@@ -0,0 +1,91 @@+import { spawnSync } from "node:child_process"+import { readFileSync } from "node:fs"+import { resolve } from "node:path"+import { describe, expect, it } from "vitest"++const workflow = readFileSync(+ resolve(import.meta.dirname, "../../.github/workflows/desktop-release.yml"),+ "utf8",+).replace(/\r\n/g, "\n")++function preflight(step: string, boundary?: string): string {+ const start = workflow.indexOf(` - name: ${step}\n`)+ const end = workflow.indexOf(" - name:", start + 1)+ const body = workflow.slice(start, end).split(" run: |\n")[1]+ const stop = boundary ? body?.indexOf(boundary) ?? -1 : body?.length ?? -1+ if (start < 0 || stop < 0) throw new Error(`Missing safe preflight boundary: ${step}`)+ return body.slice(0, stop).replace(/^ /gm, "")+}++const macScript = preflight("Prepare fail-closed macOS signing", " umask 077")+const windowsScript = preflight("Preflight Windows release inputs")+const shellEnvironment = {+ PATH: process.env.PATH,+ SystemRoot: process.env.SystemRoot,+ TEMP: process.env.TEMP,+ TMP: process.env.TMP,+}+const macInputs: Record<string, string> = {+ APPLE_CERTIFICATE: "offline-certificate",+ APPLE_CERTIFICATE_PASSWORD: "offline-password",+ APPLE_SIGNING_IDENTITY: "Developer ID Application: Offline Test (AAAAAAAAAA)",+ APPLE_TEAM_ID: "AAAAAAAAAA",+ APPLE_API_ISSUER: "offline-issuer",+ APPLE_API_KEY: "offline-api-key",+ APPLE_API_PRIVATE_KEY: "offline-api-private-key",+ TAURI_SIGNING_PRIVATE_KEY: "offline-updater-private-key",+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: "",+}+const windowsInputs: Record<string, string> = {+ TAURI_SIGNING_PRIVATE_KEY: "offline-updater-private-key",+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: "",+}++function run(shell: "bash" | "pwsh", script: string, inputs: Record<string, string>) {+ const args = shell === "bash"+ ? ["-c", script]+ : ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", script]+ const result = spawnSync(shell, args, {+ encoding: "utf8",+ env: { ...shellEnvironment, ...inputs },+ timeout: 10_000,+ })+ if (result.error) throw result.error+ return { status: result.status, output: result.stdout + result.stderr }+}++describe("macOS actual release preflight", () => {+ it.each(["", "offline-encrypted-key-password"])("accepts updater password %j", password => {+ expect(run("bash", macScript, { ...macInputs, TAURI_SIGNING_PRIVATE_KEY_PASSWORD: password }).status).toBe(0)+ })++ it.each(["TAURI_SIGNING_PRIVATE_KEY", "APPLE_CERTIFICATE", "APPLE_API_PRIVATE_KEY"])(+ "rejects missing required %s even with an empty updater password",+ name => {+ const inputs = { ...macInputs, [name]: "" }+ const result = run("bash", macScript, inputs)+ expect(result.status).not.toBe(0)+ expect(result.output).toContain(`Missing required macOS release input: ${name}`)+ },+ )+})++const hasPowerShell = spawnSync("pwsh", ["-NoLogo", "-NoProfile", "-Command", "exit 0"], {+ timeout: 10_000,+}).status === 0++describe.skipIf(!hasPowerShell)("Windows actual release preflight (requires pwsh)", () => {+ it.each(["", "offline-encrypted-key-password"])("accepts updater password %j", password => {+ expect(run("pwsh", windowsScript, { ...windowsInputs, TAURI_SIGNING_PRIVATE_KEY_PASSWORD: password }).status).toBe(0)+ })++ it.each(["TAURI_SIGNING_PRIVATE_KEY"])(+ "rejects missing required %s even with an empty updater password",+ name => {+ const inputs = { ...windowsInputs, [name]: "" }+ const result = run("pwsh", windowsScript, inputs)+ expect(result.status).not.toBe(0)+ expect(result.output).toContain(`Missing required Windows release input: ${name}`)+ },+ )+})diff --git a/scripts/ci/desktop-signing-dependencies.json b/scripts/ci/desktop-signing-dependencies.jsondeleted file mode 100644index fc15d6332..000000000--- a/scripts/ci/desktop-signing-dependencies.json+++ /dev/null@@ -1,33 +0,0 @@-{- "schemaVersion": 1,- "packages": [- {- "name": "ArtifactSigning",- "version": "0.1.8",- "source": "https://www.powershellgallery.com/api/v2/package/ArtifactSigning/0.1.8",- "sha256": "3221344b8c627915d3870f23e80816f31a5d8c2bae1d7c0cdd6c9652f6c4e089",- "kind": "module"- },- {- "name": "Microsoft.Windows.SDK.BuildTools",- "version": "10.0.26100.4188",- "source": "https://api.nuget.org/v3-flatcontainer/microsoft.windows.sdk.buildtools/10.0.26100.4188/microsoft.windows.sdk.buildtools.10.0.26100.4188.nupkg",- "sha256": "180deb372659029864c10a0c04787833234d64aacd1d2c0661d2c00295d8e022",- "kind": "dependency"- },- {- "name": "Microsoft.ArtifactSigning.Client",- "version": "1.0.128",- "source": "https://api.nuget.org/v3-flatcontainer/microsoft.artifactsigning.client/1.0.128/microsoft.artifactsigning.client.1.0.128.nupkg",- "sha256": "74bd7d27e6ce1051409c38d9b46bc8df0400ecd643d51ffbf2ac00869061e40b",- "kind": "dependency"- },- {- "name": "sign",- "version": "0.9.1-beta.26227.3",- "source": "https://api.nuget.org/v3-flatcontainer/sign/0.9.1-beta.26227.3/sign.0.9.1-beta.26227.3.nupkg",- "sha256": "34fd0d4aeabdbc363a48883881865b4dd65e6c11ba916028082fa23f3e1b1ba1",- "kind": "dependency"- }- ]-}diff --git a/scripts/ci/prepare-desktop-windows-signing.ps1 b/scripts/ci/prepare-desktop-windows-signing.ps1deleted file mode 100644index 39af9ff9f..000000000--- a/scripts/ci/prepare-desktop-windows-signing.ps1+++ /dev/null@@ -1,113 +0,0 @@-[CmdletBinding()]-param(- [Parameter()]- [string]$ManifestPath = (Join-Path $PSScriptRoot "desktop-signing-dependencies.json"),-- [Parameter(Mandatory)]- [string]$DestinationRoot-)--Set-StrictMode -Version Latest-$ErrorActionPreference = "Stop"--$expectedPackages = @{- "ArtifactSigning" = "0.1.8"- "Microsoft.Windows.SDK.BuildTools" = "10.0.26100.4188"- "Microsoft.ArtifactSigning.Client" = "1.0.128"- "sign" = "0.9.1-beta.26227.3"-}--$manifest = Get-Content -LiteralPath $ManifestPath -Raw | ConvertFrom-Json-if ($manifest.schemaVersion -ne 1) {- throw "Unsupported signing dependency manifest schema: $($manifest.schemaVersion)"-}-if ($manifest.packages.Count -ne $expectedPackages.Count) {- throw "Signing dependency manifest must contain exactly $($expectedPackages.Count) packages"-}--$seen = @{}-foreach ($package in $manifest.packages) {- if (-not $expectedPackages.ContainsKey($package.name)) {- throw "Unexpected signing dependency: $($package.name)"- }- if ($seen.ContainsKey($package.name)) {- throw "Duplicate signing dependency: $($package.name)"- }- $seen[$package.name] = $true- if ($package.version -ne $expectedPackages[$package.name]) {- throw "Unexpected version for $($package.name): $($package.version)"- }- if ($package.source -notmatch '^https://(www\.powershellgallery\.com|api\.nuget\.org)/') {- throw "Unapproved package source for $($package.name)"- }- if ($package.sha256 -notmatch '^[0-9a-f]{64}$') {- throw "Invalid SHA-256 for $($package.name)"- }-}--$destination = [IO.Path]::GetFullPath($DestinationRoot)-if (Test-Path -LiteralPath $destination) {- throw "Signing dependency destination must be fresh: $destination"-}--$packagesRoot = Join-Path $destination "packages"-$moduleRoot = Join-Path $destination "modules\ArtifactSigning\0.1.8"-$localAppData = Join-Path $destination "localappdata"-New-Item -Path $packagesRoot -ItemType Directory | Out-Null-New-Item -Path $moduleRoot -ItemType Directory | Out-Null-New-Item -Path $localAppData -ItemType Directory | Out-Null--Add-Type -AssemblyName System.IO.Compression.FileSystem--foreach ($package in $manifest.packages) {- $archive = Join-Path $packagesRoot "$($package.name).$($package.version).nupkg"- & curl.exe --fail --location --silent --show-error `- --proto '=https' --tlsv1.2 `- --connect-timeout 15 --max-time 600 `- --retry 3 --retry-delay 2 --retry-all-errors `- --output $archive $package.source- if ($LASTEXITCODE -ne 0) {- throw "Official package download failed for $($package.name) after bounded retries"- }-- $actualHash = (Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant()- if ($actualHash -ne $package.sha256) {- throw "SHA-256 mismatch for $($package.name): expected $($package.sha256), got $actualHash"- }-- if ($package.kind -eq "module") {- $extractPath = $moduleRoot- } else {- $packageVersionsPath = Join-Path $localAppData "ArtifactSigning\$($package.name)"- $extractPath = Join-Path $packageVersionsPath "$($package.name).$($package.version)"- New-Item -Path $packageVersionsPath -ItemType Directory -Force | Out-Null- }-- [IO.Compression.ZipFile]::ExtractToDirectory($archive, $extractPath)-}--$modulePath = Join-Path $moduleRoot "ArtifactSigning.psd1"-if (-not (Test-Path -LiteralPath $modulePath -PathType Leaf)) {- throw "ArtifactSigning module was not extracted to the expected path"-}--$requiredContent = @(- (Join-Path $localAppData "ArtifactSigning\Microsoft.Windows.SDK.BuildTools\Microsoft.Windows.SDK.BuildTools.10.0.26100.4188\bin\10.0.26100.0\x64\signtool.exe"),- (Join-Path $localAppData "ArtifactSigning\Microsoft.ArtifactSigning.Client\Microsoft.ArtifactSigning.Client.1.0.128\bin\x64\Azure.CodeSigning.Dlib.dll"),- (Join-Path $localAppData "ArtifactSigning\sign\sign.0.9.1-beta.26227.3\tools\net8.0\any\sign.dll")-)-foreach ($requiredPath in $requiredContent) {- if (-not (Test-Path -LiteralPath $requiredPath -PathType Leaf)) {- throw "Signing dependency is missing expected content: $requiredPath"- }-}--if (-not $env:GITHUB_ENV) {- throw "GITHUB_ENV is required so Tauri's child signing commands inherit the verified paths"-}--"LOCALAPPDATA=$localAppData" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8-"ALOOK_ARTIFACT_SIGNING_MODULE_PATH=$modulePath" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8-"PSModulePath=$(Split-Path $moduleRoot -Parent);$env:PSModulePath" | Out-File -LiteralPath $env:GITHUB_ENV -Append -Encoding utf8--Write-Host "Prepared four digest-verified signing packages in a fresh runner-temporary directory."diff --git a/scripts/ci/sign-desktop-windows.ps1 b/scripts/ci/sign-desktop-windows.ps1deleted file mode 100644index f76075c1d..000000000--- a/scripts/ci/sign-desktop-windows.ps1+++ /dev/null@@ -1,92 +0,0 @@-[CmdletBinding()]-param(- [Parameter(Mandatory, Position = 0)]- [string]$FilePath-)--Set-StrictMode -Version Latest-$ErrorActionPreference = "Stop"--$requiredEnvironment = @(- "ALOOK_WINDOWS_SIGNING_ROOT",- "ALOOK_ARTIFACT_SIGNING_MODULE_PATH",- "ALOOK_ARTIFACT_SIGNING_ENDPOINT",- "ALOOK_ARTIFACT_SIGNING_ACCOUNT_NAME",- "ALOOK_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME"-)-foreach ($name in $requiredEnvironment) {- $value = [Environment]::GetEnvironmentVariable($name)- if ([string]::IsNullOrWhiteSpace($value)) {- throw "Required signing environment variable is missing: $name"- }-}--[Uri]$endpoint = $null-if (-not [Uri]::TryCreate($env:ALOOK_ARTIFACT_SIGNING_ENDPOINT, [UriKind]::Absolute, [ref]$endpoint) -or- $endpoint.Scheme -ne [Uri]::UriSchemeHttps -or- $endpoint.DnsSafeHost -notmatch '^[a-z0-9-]+\.codesigning\.azure\.net$' -or- -not $endpoint.IsDefaultPort -or- $endpoint.AbsolutePath -ne '/' -or- $endpoint.UserInfo -ne '' -or- $endpoint.Query -ne '' -or- $endpoint.Fragment -ne '') {- throw "Artifact Signing endpoint must be an HTTPS regional codesigning.azure.net root URL"-}--$root = (Resolve-Path -LiteralPath $env:ALOOK_WINDOWS_SIGNING_ROOT).Path.TrimEnd('\', '/')-$resolved = (Resolve-Path -LiteralPath $FilePath).Path-$item = Get-Item -LiteralPath $resolved-if (-not $item.PSIsContainer -and $item.LinkType -eq $null) {- $relative = [IO.Path]::GetRelativePath($root, $resolved)-} else {- throw "Tauri signCommand accepts exactly one regular file"-}--if ([IO.Path]::IsPathRooted($relative) -or $relative -eq ".." -or $relative.StartsWith("..$([IO.Path]::DirectorySeparatorChar)")) {- throw "Refusing to sign a path outside the expected Tauri release root: $resolved"-}--$normalized = $relative.Replace('/', '\')-# NSIS !uninstfinalize writes the generated uninstaller beneath %TEMP%\~nsu.tmp.-$allowed = @(- '^alook-desktop\.exe$',- '^bundle\\msi\\Alook_[0-9]+\.[0-9]+\.[0-9]+_x64_en-US\.msi$',- '^bundle\\nsis\\Alook_[0-9]+\.[0-9]+\.[0-9]+_x64-setup\.exe$',- '^wix\\x64\\wix\\Wix(?:UI|Util)Extension\.dll$',- '^nsis\\x64\\Plugins\\x86-unicode\\(?:NSISdl|StartMenu|System|nsDialogs)\.dll$',- '^nsis\\x64\\Plugins\\x86-unicode\\additional\\nsis_tauri_utils\.dll$',- '^tauri-sign-temp\\~nsu\.tmp\\Un_[A-Za-z0-9]+\.exe$'-)-if (-not ($allowed | Where-Object { $normalized -match $_ })) {- throw "Refusing unexpected Tauri signing path: $relative"-}--$modulePath = (Resolve-Path -LiteralPath $env:ALOOK_ARTIFACT_SIGNING_MODULE_PATH).Path-Import-Module $modulePath -Force--$signingParameters = @{- Endpoint = $env:ALOOK_ARTIFACT_SIGNING_ENDPOINT- CodeSigningAccountName = $env:ALOOK_ARTIFACT_SIGNING_ACCOUNT_NAME- CertificateProfileName = $env:ALOOK_ARTIFACT_SIGNING_CERTIFICATE_PROFILE_NAME- Files = $resolved- FileDigest = "SHA256"- TimestampRfc3161 = "http://timestamp.acs.microsoft.com"- TimestampDigest = "SHA256"- ExcludeEnvironmentCredential = $true- ExcludeWorkloadIdentityCredential = $true- ExcludeManagedIdentityCredential = $true- ExcludeSharedTokenCacheCredential = $true- ExcludeVisualStudioCredential = $true- ExcludeVisualStudioCodeCredential = $true- ExcludeAzureCliCredential = $false- ExcludeAzurePowerShellCredential = $true- ExcludeAzureDeveloperCliCredential = $true- ExcludeInteractiveBrowserCredential = $true-}--Invoke-ArtifactSigning @signingParameters--$signature = Get-AuthenticodeSignature -LiteralPath $resolved-if ($signature.Status -ne [System.Management.Automation.SignatureStatus]::Valid) {- throw "Artifact Signing returned without a valid Authenticode signature: $relative ($($signature.Status))"-}diff --git a/scripts/ci/verify-desktop-windows.ps1 b/scripts/ci/verify-desktop-windows.ps1index 73d5f2ded..b8fa69d86 100644--- a/scripts/ci/verify-desktop-windows.ps1+++ b/scripts/ci/verify-desktop-windows.ps1@@ -6,9 +6,6 @@ param([Parameter(Mandatory)][string]$ExpectedVersion,- [Parameter(Mandatory)]- [string]$ExpectedPublisher,-[Parameter(Mandatory)][string]$TauriConfigPath)@@ -26,66 +23,12 @@ if ($LASTEXITCODE -ne 0) { throw "Windows staged artifact manifest validation fa$msi = Join-Path $stage "files\Alook_${ExpectedVersion}_x64_en-US.msi"$nsis = Join-Path $stage "files\Alook_${ExpectedVersion}_x64-setup.exe"-function Assert-Authenticode {- param(- [Parameter(Mandatory)]- [string]$Path,-- [Parameter(Mandatory)]- [string]$Label- )-- $output = & signtool.exe verify /pa /all /v $Path 2>&1 | Out-String- if ($LASTEXITCODE -ne 0) { throw "signtool rejected $Label`n$output" }- if ($output -notmatch '(?im)^Hash of file \(sha256\): [0-9a-f]+$') { throw "$Label does not use a SHA-256 Authenticode file digest" }- if ($output -notmatch '(?im)^The signature is timestamped:') { throw "$Label is missing a verified timestamp" }- if ($output -notmatch '(?im)^Timestamp Verified by:') { throw "$Label is missing a timestamp certificate chain" }- if (($output | Select-String -Pattern '(?im)^Signing Certificate Chain:' -AllMatches).Matches.Count -ne 1) {- throw "$Label must contain exactly one Authenticode signature"- }-- $signature = Get-AuthenticodeSignature -LiteralPath $Path- if ($signature.Status -ne [System.Management.Automation.SignatureStatus]::Valid) {- throw "$Label Authenticode status is $($signature.Status)"- }- if ($signature.SignerCertificate.Subject -ne $ExpectedPublisher) {- throw "$Label publisher mismatch: $($signature.SignerCertificate.Subject)"- }- if ($null -eq $signature.TimeStamperCertificate) { throw "$Label has no timestamp certificate" }-}--function Assert-EmbeddedMainExecutable {- param(- [Parameter(Mandatory)]- [string]$Installer,-- [Parameter(Mandatory)]- [string]$Label- )-- $extractRoot = Join-Path $env:RUNNER_TEMP "alook-$Label-$([Guid]::NewGuid().ToString('N'))"- New-Item -Path $extractRoot -ItemType Directory | Out-Null- try {- & 7z.exe x -y "-o$extractRoot" $Installer | Out-Null- if ($LASTEXITCODE -ne 0) { throw "7-Zip could not extract $Label" }- $executables = @(Get-ChildItem -LiteralPath $extractRoot -Recurse -File -Filter "alook-desktop.exe")- if ($executables.Count -ne 1) { throw "$Label must contain exactly one alook-desktop.exe" }- Assert-Authenticode -Path $executables[0].FullName -Label "$Label embedded main executable"- } finally {- Remove-Item -LiteralPath $extractRoot -Recurse -Force -ErrorAction SilentlyContinue- }-}-foreach ($installer in @($msi, $nsis)) {$signaturePath = "$installer.sig"& node (Join-Path $repositoryRoot "scripts\ci\verify-minisign.mjs") `--file $installer --signature $signaturePath --config $TauriConfigPath `--version $ExpectedVersion --trusted-file ([IO.Path]::GetFileName($installer))if ($LASTEXITCODE -ne 0) { throw "Minisign verification failed for $installer" }- Assert-Authenticode -Path $installer -Label ([IO.Path]::GetFileName($installer))}-Assert-EmbeddedMainExecutable -Installer $msi -Label "msi"-Assert-EmbeddedMainExecutable -Installer $nsis -Label "nsis"--Write-Host "Verified staged Windows installers, embedded main executables, and exact-byte updater signatures."+Write-Host "Verified staged Windows installer manifests and exact-byte updater signatures; installers are not Authenticode code-signed."diff --git a/scripts/ci/workflow-contract.test.ts b/scripts/ci/workflow-contract.test.tsindex d4211626b..e8a7c649a 100644--- a/scripts/ci/workflow-contract.test.ts+++ b/scripts/ci/workflow-contract.test.ts@@ -77,23 +77,6 @@ const desktopWindowsVerifier = readFileSync(resolve(repositoryRoot, "scripts/ci/verify-desktop-windows.ps1"),"utf8",)-const desktopWindowsSigner = readFileSync(- resolve(repositoryRoot, "scripts/ci/sign-desktop-windows.ps1"),- "utf8",-)-const desktopWindowsSigningSetup = readFileSync(- resolve(repositoryRoot, "scripts/ci/prepare-desktop-windows-signing.ps1"),- "utf8",-)-const desktopWindowsSigningConfig = JSON.parse(- readFileSync(- resolve(repositoryRoot, "src/desktop/src-tauri/tauri.windows.signing.conf.json"),- "utf8",- ),-) as { bundle: { windows: { signCommand: { cmd: string; args: string[] } } } }-const desktopSigningDependencies = JSON.parse(- readFileSync(resolve(repositoryRoot, "scripts/ci/desktop-signing-dependencies.json"), "utf8"),-) as { schemaVersion: number; packages: Array<{ name: string; version: string; source: string; sha256: string }> }const mobileReleaseWorkflowPath = resolve(workflowRoot, "mobile-release.yml")const mobileReleaseWorkflow = normalizeWorkflow(readFileSync(mobileReleaseWorkflowPath, "utf8"))const desktopConfig = JSON.parse(@@ -1111,7 +1094,7 @@ describe("Desktop updater release", () => {it("keeps every build private until one publisher revalidates all four stages", () => {expect(autoTagReleaseWorkflow).toContain('--title "$TAG"')expect(desktopReleaseWorkflow.match(/contents: write/g)).toHaveLength(1)- expect(desktopReleaseWorkflow.match(/id-token: write/g)).toHaveLength(1)+ expect(desktopReleaseWorkflow).not.toContain("id-token: write")expect(desktopReleaseWorkflow).toContain("group: desktop-release-${{ github.ref }}")expect(desktopReleaseWorkflow).toContain("cancel-in-progress: false")expect(desktopReleaseWorkflow).toContain("needs: [build-unix, build-windows]")@@ -1219,115 +1202,31 @@ describe("Desktop updater release", () => {expect(desktopReleaseWorkflow).toContain("Developer ID signed")expect(desktopReleaseWorkflow).not.toContain("ad-hoc signed and are not notarized")expect(desktopReleaseWorkflow).not.toContain("Privacy & Security")- expect(desktopReleaseWorkflow).not.toContain("not Authenticode code-signed")- expect(desktopReleaseWorkflow).not.toContain("Run anyway")})- it("uses OIDC-only Microsoft Artifact Signing inside Tauri's exact sign hook", () => {- expect(desktopReleaseWorkflow).toContain(- "azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0",- )- expect(desktopReleaseWorkflow).toContain("tauri.windows.signing.conf.json")- expect(desktopReleaseWorkflow).not.toContain("AZURE_CLIENT_SECRET")- expect(desktopReleaseWorkflow).not.toContain(".pfx")- expect(desktopWindowsSigningConfig.bundle.windows.signCommand).toEqual({- cmd: "pwsh",- args: [- "-NoLogo",- "-NoProfile",- "-NonInteractive",- "-File",- "../../../scripts/ci/sign-desktop-windows.ps1",- "%1",- ],- })- expect(desktopSigningDependencies.schemaVersion).toBe(1)- expect(desktopSigningDependencies.packages).toEqual([- {- name: "ArtifactSigning",- version: "0.1.8",- source: "https://www.powershellgallery.com/api/v2/package/ArtifactSigning/0.1.8",- sha256: "3221344b8c627915d3870f23e80816f31a5d8c2bae1d7c0cdd6c9652f6c4e089",- kind: "module",- },- {- name: "Microsoft.Windows.SDK.BuildTools",- version: "10.0.26100.4188",- source:- "https://api.nuget.org/v3-flatcontainer/microsoft.windows.sdk.buildtools/10.0.26100.4188/microsoft.windows.sdk.buildtools.10.0.26100.4188.nupkg",- sha256: "180deb372659029864c10a0c04787833234d64aacd1d2c0661d2c00295d8e022",- kind: "dependency",- },- {- name: "Microsoft.ArtifactSigning.Client",- version: "1.0.128",- source:- "https://api.nuget.org/v3-flatcontainer/microsoft.artifactsigning.client/1.0.128/microsoft.artifactsigning.client.1.0.128.nupkg",- sha256: "74bd7d27e6ce1051409c38d9b46bc8df0400ecd643d51ffbf2ac00869061e40b",- kind: "dependency",- },- {- name: "sign",- version: "0.9.1-beta.26227.3",- source:- "https://api.nuget.org/v3-flatcontainer/sign/0.9.1-beta.26227.3/sign.0.9.1-beta.26227.3.nupkg",- sha256: "34fd0d4aeabdbc363a48883881865b4dd65e6c11ba916028082fa23f3e1b1ba1",- kind: "dependency",- },- ])- for (const dependency of desktopSigningDependencies.packages) {- expect(dependency.source).toMatch(/^https:\/\/(?:www\.powershellgallery\.com|api\.nuget\.org)\//)- expect(dependency.sha256).toMatch(/^[0-9a-f]{64}$/)- }- expect(desktopWindowsSigningSetup).toContain("Get-FileHash -LiteralPath $archive -Algorithm SHA256")- expect(desktopWindowsSigningSetup).toContain("destination must be fresh")- expect(desktopWindowsSigningSetup).toContain("--connect-timeout 15 --max-time 600")- expect(desktopWindowsSigningSetup).toContain("--retry 3 --retry-delay 2 --retry-all-errors")- expect(desktopWindowsSigningSetup).not.toContain("Invoke-WebRequest")- expect(desktopWindowsSigningSetup).toContain("[IO.Compression.ZipFile]::ExtractToDirectory")- for (const requiredPackageFile of [- "ArtifactSigning.psd1",- "signtool.exe",- "Azure.CodeSigning.Dlib.dll",- "sign.dll",- ]) {- expect(desktopWindowsSigningSetup).toContain(requiredPackageFile)- }- const windowsCleanupRoot = desktopReleaseWorkflow.indexOf('"ALOOK_ARTIFACT_SIGNING_ROOT=$destination"')- const windowsPreparation = desktopReleaseWorkflow.indexOf("./scripts/ci/prepare-desktop-windows-signing.ps1")- expect(windowsCleanupRoot).toBeGreaterThan(-1)- expect(windowsCleanupRoot).toBeLessThan(windowsPreparation)- expect(desktopWindowsSigner).toContain("GetRelativePath")- expect(desktopWindowsSigner).toContain("^[a-z0-9-]+\\.codesigning\\.azure\\.net$")- expect(desktopWindowsSigner).toContain("IsDefaultPort")- expect(desktopWindowsSigner).toContain("AbsolutePath -ne '/'")- expect(desktopReleaseWorkflow).toContain("^[a-z0-9-]+\\.codesigning\\.azure\\.net$")- expect(desktopWindowsSigner).toContain("Wix(?:UI|Util)Extension")- expect(desktopWindowsSigner).toContain("(?:NSISdl|StartMenu|System|nsDialogs)")- expect(desktopWindowsSigner).toContain("additional\\\\nsis_tauri_utils\\.dll")- expect(desktopWindowsSigner).not.toContain("[A-Za-z0-9_.-]+\\.dll")- expect(desktopWindowsSigner).toContain('FileDigest = "SHA256"')- expect(desktopWindowsSigner).toContain('TimestampRfc3161 = "http://timestamp.acs.microsoft.com"')- expect(desktopWindowsSigner).toContain('TimestampDigest = "SHA256"')- expect(desktopWindowsSigner).toContain("ExcludeAzureCliCredential = $false")- for (const credential of [- "Environment",- "WorkloadIdentity",- "ManagedIdentity",- "SharedTokenCache",- "VisualStudio",- "VisualStudioCode",- "AzurePowerShell",- "AzureDeveloperCli",- "InteractiveBrowser",+ it("publishes Windows without Azure while retaining exact-byte updater verification", () => {+ expect(desktopReleaseWorkflow).not.toContain("AZURE_")+ expect(desktopReleaseWorkflow).not.toContain("ALOOK_ARTIFACT_SIGNING")+ expect(desktopReleaseWorkflow).not.toContain("azure/login@")+ expect(desktopReleaseWorkflow).not.toContain("tauri.windows.signing.conf.json")+ expect(desktopReleaseWorkflow).not.toContain("EXPECTED_PUBLISHER")+ expect(desktopReleaseWorkflow).toContain("args: --target x86_64-pc-windows-msvc")+ expect(desktopReleaseWorkflow).toContain("not Authenticode code-signed")+ expect(desktopReleaseWorkflow).not.toContain("Authenticode signed with SHA-256")+ expect(desktopWindowsVerifier).toContain("desktop-release-artifacts.mjs")+ expect(desktopWindowsVerifier).toContain("verify-minisign.mjs")+ expect(desktopWindowsVerifier).toContain('foreach ($installer in @($msi, $nsis))')+ expect(desktopWindowsVerifier).not.toContain("ExpectedPublisher")+ expect(desktopWindowsVerifier).not.toContain("Assert-Authenticode")+ expect(desktopWindowsVerifier).not.toContain("signtool.exe")+ for (const removed of [+ "scripts/ci/desktop-signing-dependencies.json",+ "scripts/ci/prepare-desktop-windows-signing.ps1",+ "scripts/ci/sign-desktop-windows.ps1",+ "src/desktop/src-tauri/tauri.windows.signing.conf.json",]) {- expect(desktopWindowsSigner).toContain(`Exclude${credential}Credential = $true`)+ expect(existsSync(resolve(repositoryRoot, removed))).toBe(false)}- expect(desktopWindowsVerifier).toContain("signtool.exe verify /pa /all /v")- expect(desktopWindowsVerifier).toContain("Hash of file \\(sha256\\)")- expect(desktopWindowsVerifier).toContain("TimeStamperCertificate")- expect(desktopWindowsVerifier).toContain('Filter "alook-desktop.exe"')- expect(desktopWindowsVerifier).toContain("verify-minisign.mjs")})})diff --git a/src/desktop/src-tauri/tauri.windows.signing.conf.json b/src/desktop/src-tauri/tauri.windows.signing.conf.jsondeleted file mode 100644index 084275585..000000000--- a/src/desktop/src-tauri/tauri.windows.signing.conf.json+++ /dev/null@@ -1,17 +0,0 @@-{- "bundle": {- "windows": {- "signCommand": {- "cmd": "pwsh",- "args": [- "-NoLogo",- "-NoProfile",- "-NonInteractive",- "-File",- "../../../scripts/ci/sign-desktop-windows.ps1",- "%1"- ]- }- }- }-}