Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,31 @@ jobs:
"${{ matrix.target }}" "$ASSET" "dist/${{ matrix.target }}.metadata.json"

- name: Build Windows helper
if: matrix.platform == 'windows-latest'
shell: pwsh
run: cargo build -p strand-azdo --release --target "${{ matrix.target }}"

# Authenticode (docs/packaging.md § "Windows Authenticode"), in its own
# step so dependency build scripts never see the credentials.
- name: Windows signing client
id: winsign
if: matrix.platform == 'windows-latest' && vars.WINDOWS_SIGNING == 'true'
shell: pwsh
run: ./scripts/windows-signing-client.ps1

- name: Sign Windows helper
if: steps.winsign.outcome == 'success'
shell: pwsh
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
run: ./scripts/windows-sign.ps1 "target/${{ matrix.target }}/release/strand-azdo.exe"

- name: Package Windows helper
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
cargo build -p strand-azdo --release --target "${{ matrix.target }}"
New-Item -ItemType Directory -Force dist | Out-Null
$Asset = "strand-azdo-$env:HELPER_VERSION-${{ matrix.target }}.zip"
Compress-Archive -Path "target/${{ matrix.target }}/release/strand-azdo.exe" -DestinationPath "dist/$Asset"
Expand Down Expand Up @@ -242,11 +263,25 @@ jobs:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}

# Windows Authenticode (docs/packaging.md § "Windows Authenticode"):
# Tauri signs strand.exe and the MSI through scripts/windows-sign.ps1,
# and build-companion.mjs signs strand-cli.exe.
- name: Windows signing client
id: winsign
if: matrix.platform == 'windows-latest' && vars.WINDOWS_SIGNING == 'true'
shell: pwsh
run: ./scripts/windows-signing-client.ps1

- name: Build, sign, and release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# --- Windows Authenticode (Azure Artifact Signing) ---
AZURE_CLIENT_ID: ${{ steps.winsign.outcome == 'success' && secrets.AZURE_SIGNING_CLIENT_ID || '' }}
AZURE_TENANT_ID: ${{ steps.winsign.outcome == 'success' && secrets.AZURE_SIGNING_TENANT_ID || '' }}
AZURE_CLIENT_SECRET: ${{ steps.winsign.outcome == 'success' && secrets.AZURE_SIGNING_CLIENT_SECRET || '' }}

# --- macOS code signing (Developer ID) ---
# Base64 of the exported .p12 + its export password. tauri-action
# imports these into a throwaway keychain on the runner.
Expand All @@ -270,7 +305,7 @@ jobs:
releaseName: 'Strand ${{ github.event.inputs.tag || github.ref_name }}'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
args: ${{ steps.winsign.outputs.tauri_args || matrix.args }}

- name: Verify updater signature identity
run: pnpm release:check-updater-signatures
Expand All @@ -285,6 +320,26 @@ jobs:
./scripts/check-msi-shortcuts.ps1 -MsiPath $package.FullName
}

- name: Verify Windows Authenticode signatures
if: steps.winsign.outcome == 'success'
shell: pwsh
run: |
# The MSI itself, and every executable it installs (an administrative
# install unpacks it without running it).
$files = @(Get-ChildItem target/release/bundle/msi -Filter '*.msi')
if (!$files.Count) { throw 'No MSI artifacts found.' }
foreach ($msi in @($files)) {
$unpacked = Join-Path $env:RUNNER_TEMP "msi-$($msi.BaseName)"
$process = Start-Process msiexec.exe -Wait -PassThru -ArgumentList @('/a', "`"$($msi.FullName)`"", '/qn', "TARGETDIR=`"$unpacked`"")
if ($process.ExitCode -ne 0) { throw "Could not unpack $($msi.Name): $($process.ExitCode)" }
$files += @(Get-ChildItem $unpacked -Recurse -Filter '*.exe')
}
foreach ($file in $files) {
$signature = Get-AuthenticodeSignature -LiteralPath $file.FullName
if ($signature.Status -ne 'Valid') { throw "$($file.Name) signature is $($signature.Status): $($signature.StatusMessage)" }
Write-Host "$($file.Name): $($signature.SignerCertificate.Subject)"
}

- name: Sign and verify Linux AppImage with Sigstore
if: matrix.platform == 'ubuntu-22.04'
shell: bash
Expand Down
50 changes: 42 additions & 8 deletions docs/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Status (2026-07-29): release CI builds all three platforms, signs and notarizes
the universal macOS app, produces minisign-verified updater artifacts, and
keyless-signs Linux AppImages with Sigstore. Partner Center signing of the
production Microsoft Store MSIX closes the Windows trusted-distribution gate;
the standalone GitHub MSI remains unsigned. Remaining distribution work is
the standalone GitHub MSI is Authenticode-signed through Azure Artifact Signing
once the `WINDOWS_SIGNING` repository variable is on (§ "Windows Authenticode"). Remaining distribution work is
release-candidate validation on Windows, macOS, GNOME, and KDE. The 1.0 updater
is stable-only; a selectable beta channel is explicitly post-1.0.

Expand Down Expand Up @@ -114,8 +115,9 @@ removed. Verify a candidate with `WM_GETICON` for both `ICON_BIG` and
Windows (`.msi`) and Linux (`.deb`/`.rpm`/`.appimage`) targets are already in
`bundle.targets` and build without an Apple account. Release CI gives each
AppImage a keyless Sigstore bundle. The Partner Center-signed Store MSIX is the
trusted Windows distribution; a separate Windows publisher identity is needed
only for the unmanaged MSI/EXE fallback.
trusted Windows distribution; the unmanaged GitHub MSI and the Windows helper
are Authenticode-signed through Azure Artifact Signing (§ "Windows
Authenticode").

### Microsoft Store MSIX release

Expand Down Expand Up @@ -242,8 +244,8 @@ rebuilds or replaces desktop installers.

The macOS helper binary is Developer-ID signed before archiving and its archive
is submitted to Apple notarization. The separately downloaded Windows helper
binary is outside the Store MSIX trust boundary and remains coupled to any
future Windows Authenticode certificate work; its signed manifest is mandatory
binary is outside the Store MSIX trust boundary, so it is Authenticode-signed
before archiving when `WINDOWS_SIGNING` is on; its signed manifest is mandatory
on all platforms. Installation extracts only the expected regular file, refuses
links/traversal, and keeps the previous helper until the replacement verifies.

Expand Down Expand Up @@ -280,6 +282,36 @@ For helper-only tags, use `pnpm version:azdo <version|major|minor|patch>`.
That command changes only `crates/strand-azdo/Cargo.toml` and its Cargo.lock
entry and prints the required `strand-azdo-vX.Y.Z` tag.

### Windows Authenticode

With the repository **variable** `WINDOWS_SIGNING` set to `true`, the release
workflow signs every Windows binary it publishes outside the Store:

- `strand.exe` and the `.msi`: Tauri runs `scripts/windows-sign.ps1` as
`bundle.windows.signCommand`, from a config
`scripts/windows-signing-client.ps1` writes and passes as `--config`.
- `strand-cli.exe`, bundled as a resource that Tauri doesn't sign:
`scripts/build-companion.mjs`.
- The separately downloaded `strand-azdo.exe`: the helper job, before it is
archived and hashed into the manifest.

`scripts/windows-signing-client.ps1` fetches the SHA-256-pinned
`Microsoft.ArtifactSigning.Client` (SignTool's dlib) and writes the account
metadata. `scripts/windows-sign.ps1` signs with the newest Windows SDK SignTool
and Microsoft's timestamp server, then fails unless Windows reports the
signature `Valid`. After the build, every MSI is unpacked (administrative
install) and the MSI and each `.exe` in it must verify.

The certificate comes from the Azure Artifact Signing account
`halterio-signing` (resource group `rg-halterio-signing`, East US), certificate
profile `public-trust`, shared with the developer's other apps. Strand signs as
its own service principal, `strand-release-signing`, which has only the
Artifact Signing Certificate Profile Signer role on that account; its secret
was made 2026-11-11 for two years. Renew it with
`az ad sp credential reset --id <AZURE_SIGNING_CLIENT_ID> --years 2` and
`gh secret set AZURE_SIGNING_CLIENT_SECRET`. A newly signed MSI can still meet
a SmartScreen prompt until the certificate builds reputation.

### Secrets to add (Settings → Secrets and variables → Actions)

`GITHUB_TOKEN` is provided automatically — don't add it. Everything below is a
Expand All @@ -295,16 +327,18 @@ repo (or org) Actions **secret**.
| `APPLE_TEAM_ID` | macOS notarization | `57CBXS5P39` |
| `TAURI_SIGNING_PRIVATE_KEY` | **Every build** | Tauri updater private key (see below) |
| `TAURI_SIGNING_PRIVATE_KEY_PASSWORD` | **Every build** | Password for that key |
| `AZURE_SIGNING_CLIENT_ID` / `AZURE_SIGNING_TENANT_ID` / `AZURE_SIGNING_CLIENT_SECRET` | Windows Authenticode | Service principal `strand-release-signing` (§ "Windows Authenticode") |
| `WINDOWS_CERTIFICATE_BASE64` | Microsoft Store candidate | Base64 PKCS#12/PFX publisher certificate with private key |
| `WINDOWS_CERTIFICATE_PASSWORD` | Microsoft Store candidate | Password for the publisher PKCS#12/PFX |

The `APPLE_*` secrets are mandatory for the release workflow because both the
app and the universal helper must be signed/notarized. The
`TAURI_SIGNING_*` pair is also **mandatory**: it signs updater artifacts and
the helper manifest, and `bundle.createUpdaterArtifacts` is `true`. Any bundle
build (CI or local) fails without the private key. Windows Authenticode signing
is wired only for the unmanaged MSI/EXE fallback once those two external
certificate secrets exist; the Partner Center-signed MSIX needs neither secret.
build (CI or local) fails without the private key. Windows Authenticode for the
GitHub MSI and helper uses the `AZURE_SIGNING_*` secrets and the
`WINDOWS_SIGNING` variable (§ "Windows Authenticode"); the Partner
Center-signed MSIX needs none of them.
Linux AppImage publisher identity is keyless and needs no repository secret.

> **Local builds** now need the key too. Point Tauri at the generated file:
Expand Down
4 changes: 4 additions & 0 deletions scripts/build-companion.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ if (target === 'universal-apple-darwin') {
execFileSync('cargo', ['build', '-p', 'strand-headless', '--release', ...(target ? ['--target', target] : [])], { stdio: 'inherit' });
copyFileSync(resolve('target', ...(target ? [target] : []), 'release', name), `${out}/${name}`);
}
// Windows Authenticode, set up by release.yml when WINDOWS_SIGNING is on.
if (process.platform === 'win32' && process.env.WINDOWS_SIGN_DLIB) {
execFileSync('pwsh', ['-NoLogo', '-NoProfile', '-NonInteractive', '-File', resolve('scripts/windows-sign.ps1'), `${out}/${name}`], { stdio: 'inherit' });
}
if (process.platform === 'darwin' && process.env.APPLE_SIGNING_IDENTITY) {
execFileSync('codesign', ['--force', '--options', 'runtime', '--timestamp', '--sign', process.env.APPLE_SIGNING_IDENTITY, `${out}/${name}`], { stdio: 'inherit' });
}
11 changes: 10 additions & 1 deletion scripts/check-release-security.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,19 @@ for (const fragment of [
'CHANNEL="strand-azdo-protocol-$PROTOCOL_VERSION"',
'gh release create "$RELEASE_TAG"',
'node scripts/check-azdo-helper-metadata.mjs',
'run: ./scripts/windows-signing-client.ps1',
'./scripts/windows-sign.ps1 "target/${{ matrix.target }}/release/strand-azdo.exe"',
'args: ${{ steps.winsign.outputs.tauri_args || matrix.args }}',
'name: Verify Windows Authenticode signatures',
]) {
if (!releaseWorkflow.includes(fragment)) {
fail(`release workflow policy is missing: ${fragment}`);
}
}

console.log('Release CSP, capabilities, updater-safe Windows icons and MSI shortcuts, signed updater/helper channels, tag checkout, and Linux Sigstore policies are valid.');
const companionBuild = readFileSync('scripts/build-companion.mjs', 'utf8');
if (!companionBuild.includes("resolve('scripts/windows-sign.ps1')")) {
fail('the bundled strand-cli.exe is no longer Authenticode-signed with the app');
}

console.log('Release CSP, capabilities, updater-safe Windows icons and MSI shortcuts, signed updater/helper channels, tag checkout, Windows Authenticode, and Linux Sigstore policies are valid.');
44 changes: 44 additions & 0 deletions scripts/windows-sign.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Authenticode-sign Windows binaries through Azure Artifact Signing, then check
# that Windows trusts the signature.
#
# Usage: scripts/windows-sign.ps1 <file> [<file> ...] (.exe or .msi)
#
# Env (release.yml sets all five when WINDOWS_SIGNING is on; docs/packaging.md):
# WINDOWS_SIGN_DLIB Azure.CodeSigning.Dlib.dll from the pinned
# Microsoft.ArtifactSigning.Client package
# WINDOWS_SIGN_METADATA JSON with Endpoint, CodeSigningAccountName and
# CertificateProfileName
# AZURE_CLIENT_ID / AZURE_TENANT_ID / AZURE_CLIENT_SECRET
# the service principal the dlib signs as (Azure.Identity
# environment credential)
#
# Tauri runs this as bundle.windows.signCommand for strand.exe and the MSI;
# scripts/build-companion.mjs runs it for strand-cli.exe and release.yml for
# the strand-azdo helper.
param(
[Parameter(Mandatory, ValueFromRemainingArguments)][string[]]$Path
)
$ErrorActionPreference = 'Stop'

$dlib = $env:WINDOWS_SIGN_DLIB
$metadata = $env:WINDOWS_SIGN_METADATA
if (-not $dlib -or -not $metadata) { throw 'Signing needs WINDOWS_SIGN_DLIB and WINDOWS_SIGN_METADATA' }
foreach ($file in $dlib, $metadata) {
if (-not (Test-Path -LiteralPath $file)) { throw "Signing file not found: $file" }
}
# The dlib needs a recent SignTool: take the newest Windows SDK's.
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}/Windows Kits/10/bin/10.*/x64/signtool.exe" |
Sort-Object { [version]$_.Directory.Parent.Name } -Descending | Select-Object -First 1
if (-not $signtool) { throw 'Windows SDK signtool.exe is required to sign' }

foreach ($file in $Path) {
$full = (Resolve-Path -LiteralPath $file).Path
& $signtool.FullName sign /v /fd SHA256 /tr 'http://timestamp.acs.microsoft.com' /td SHA256 `
/dlib (Resolve-Path -LiteralPath $dlib).Path /dmdf (Resolve-Path -LiteralPath $metadata).Path $full
if ($LASTEXITCODE -ne 0) { throw "Signing failed: $full" }
$signature = Get-AuthenticodeSignature -LiteralPath $full
if ($signature.Status -ne 'Valid') {
throw "$full signature is $($signature.Status): $($signature.StatusMessage)"
}
Write-Host "Signed $full ($($signature.SignerCertificate.Subject))"
}
40 changes: 40 additions & 0 deletions scripts/windows-signing-client.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Fetch the pinned Artifact Signing client (SignTool's Azure.CodeSigning dlib),
# write its metadata, and point scripts/windows-sign.ps1 at both through
# $GITHUB_ENV. Also writes a Tauri config that makes the bundler sign through
# that script, and returns its `--config` argument as the step output
# `tauri_args`. CI only (release.yml, when WINDOWS_SIGNING is on).
$ErrorActionPreference = 'Stop'

# Bump both together; the hash is the .nupkg from nuget.org.
$version = '1.0.128'
$sha256 = '74bd7d27e6ce1051409c38d9b46bc8df0400ecd643d51ffbf2ac00869061e40b'
# The Artifact Signing account in Azure (rg-halterio-signing, East US).
$metadata = [ordered]@{
Endpoint = 'https://eus.codesigning.azure.net/'
CodeSigningAccountName = 'halterio-signing'
CertificateProfileName = 'public-trust'
}

$package = Join-Path $env:RUNNER_TEMP 'artifact-signing-client.zip'
Invoke-WebRequest -UseBasicParsing -OutFile $package `
-Uri "https://www.nuget.org/api/v2/package/Microsoft.ArtifactSigning.Client/$version"
$actual = (Get-FileHash -LiteralPath $package -Algorithm SHA256).Hash.ToLowerInvariant()
if ($actual -ne $sha256) { throw "Microsoft.ArtifactSigning.Client $version is $actual, expected $sha256" }
$client = Join-Path $env:RUNNER_TEMP 'artifact-signing-client'
Expand-Archive -LiteralPath $package -DestinationPath $client -Force
$dlib = Join-Path $client 'bin/x64/Azure.CodeSigning.Dlib.dll'
if (-not (Test-Path -LiteralPath $dlib)) { throw "No dlib in the package: $dlib" }

$metadataPath = Join-Path $env:RUNNER_TEMP 'artifact-signing.json'
$metadata | ConvertTo-Json | Set-Content -Encoding utf8NoBOM -LiteralPath $metadataPath
"WINDOWS_SIGN_DLIB=$dlib" >> $env:GITHUB_ENV
"WINDOWS_SIGN_METADATA=$metadataPath" >> $env:GITHUB_ENV

# Tauri splits signCommand on spaces and puts the file to sign in for %1, so
# the paths use forward slashes and have no spaces (GitHub's runner paths).
$script = (Join-Path $env:GITHUB_WORKSPACE 'scripts/windows-sign.ps1') -replace '\\', '/'
$tauriConfig = (Join-Path $env:RUNNER_TEMP 'tauri.windows-signing.conf.json') -replace '\\', '/'
if ("$script$tauriConfig" -match '\s') { throw "Signing paths must not contain spaces: $script, $tauriConfig" }
@{ bundle = @{ windows = @{ signCommand = "pwsh -NoLogo -NoProfile -NonInteractive -File $script %1" } } } |
ConvertTo-Json -Depth 4 | Set-Content -Encoding utf8NoBOM -LiteralPath $tauriConfig
"tauri_args=--config $tauriConfig" >> $env:GITHUB_OUTPUT
Loading