ci: fetch the SSM plugin before every build; check it ships
Both build workflows fetch the pinned plugin before tauri build on Linux, macOS (universal: both slices plus the lipo'd file) and Windows. The test job needs no fetch: debug builds get build.rs's placeholder. finalize-appimage.sh asserts usr/bin/session-manager-plugin is a running ELF and THIRD_PARTY_NOTICES is in the image. Windows: the plugin ships under AWS's Authenticode signature and is not re-signed (Tauri skips a sidecar signtool verify accepts). windows-sign.ps1 refuses it if it is ever presented rather than letting the allowlist skip it unsigned; windows-verify-signatures.ps1 requires it in the MSI, valid, timestamped and signed by Amazon Web Services, Inc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39f502dcdf
commit
cb28d1da39
5 files changed
+120
-2
No files matched your search
@@ -334,7 +334,9 @@ jobs:
|
||||
run: npx vitest run
|
||||
|
||||
# `--locked`: test against the committed Cargo.lock, never a re-resolved
|
||||
# one, for the same reason the frontend uses `npm ci`.
|
||||
# one, for the same reason the frontend uses `npm ci`. No plugin fetch
|
||||
# here: a debug build gets a placeholder for the session-manager-plugin
|
||||
# sidecar from build.rs, so tests never depend on AWS's S3.
|
||||
- name: Backend tests (cargo test)
|
||||
working-directory: ./app/src-tauri
|
||||
run: |
|
||||
@@ -416,6 +418,9 @@ jobs:
|
||||
curl \
|
||||
wget \
|
||||
file \
|
||||
gnupg \
|
||||
gpgv \
|
||||
unzip \
|
||||
xdg-utils
|
||||
|
||||
- name: Install Rust stable
|
||||
@@ -468,6 +473,13 @@ jobs:
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
npx tauri --version || npm install @tauri-apps/cli
|
||||
|
||||
# The AWS Session Manager plugin, bundled as a sidecar (bundle.externalBin)
|
||||
# so AWS workspaces work without the user installing it. Pinned version,
|
||||
# SHA-256 and AWS's GPG signature checked; fails the job on any mismatch.
|
||||
# A release build refuses to start without it (build.rs).
|
||||
- name: Fetch the AWS Session Manager plugin
|
||||
run: bash scripts/fetch-ssm-plugin.sh x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Build Tauri app
|
||||
working-directory: ./app
|
||||
env:
|
||||
@@ -597,6 +609,15 @@ jobs:
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
npx tauri --version || npm install @tauri-apps/cli
|
||||
|
||||
# The AWS Session Manager plugin sidecar (bundle.externalBin): both thin
|
||||
# slices (tauri-build checks each arch it compiles) and the lipo'd
|
||||
# universal one the bundler copies into Contents/MacOS. Pinned version and
|
||||
# SHA-256s; fails the job on any mismatch. Not re-signed here: the app is
|
||||
# not code-signed on macOS, so the plugin keeps AWS's Developer ID
|
||||
# signature (with APPLE_* signing configured, Tauri would sign it too).
|
||||
- name: Fetch the AWS Session Manager plugin
|
||||
run: bash scripts/fetch-ssm-plugin.sh universal-apple-darwin
|
||||
|
||||
- name: Build Tauri app (universal)
|
||||
working-directory: ./app
|
||||
env:
|
||||
@@ -729,6 +750,13 @@ jobs:
|
||||
set "PATH=%USERPROFILE%\.cargo\bin;C:\Program Files\nodejs;%PATH%"
|
||||
npm run build
|
||||
|
||||
# The AWS Session Manager plugin sidecar (bundle.externalBin). Pinned
|
||||
# version and SHA-256s, and AWS's Authenticode signature required; fails
|
||||
# the job on any mismatch. It ships under AWS's signature, not ours (see
|
||||
# the script and windows-sign.ps1).
|
||||
- name: Fetch the AWS Session Manager plugin
|
||||
run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\fetch-ssm-plugin.ps1
|
||||
|
||||
- name: Build Tauri app
|
||||
working-directory: ./app
|
||||
# Previews are not code-signed: signing is metered, previews are built
|
||||
|
||||
@@ -174,6 +174,9 @@ jobs:
|
||||
curl \
|
||||
wget \
|
||||
file \
|
||||
gnupg \
|
||||
gpgv \
|
||||
unzip \
|
||||
xdg-utils
|
||||
|
||||
- name: Install Rust stable
|
||||
@@ -227,6 +230,13 @@ jobs:
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
npx tauri --version || npm install @tauri-apps/cli
|
||||
|
||||
# The AWS Session Manager plugin, bundled as a sidecar (bundle.externalBin)
|
||||
# so AWS workspaces work without the user installing it. Pinned version,
|
||||
# SHA-256 and AWS's GPG signature checked; fails the job on any mismatch.
|
||||
# A release build refuses to start without it (build.rs).
|
||||
- name: Fetch the AWS Session Manager plugin
|
||||
run: bash scripts/fetch-ssm-plugin.sh x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Build Tauri app
|
||||
working-directory: ./app
|
||||
run: |
|
||||
@@ -417,6 +427,15 @@ jobs:
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
npx tauri --version || npm install @tauri-apps/cli
|
||||
|
||||
# The AWS Session Manager plugin sidecar (bundle.externalBin): both thin
|
||||
# slices (tauri-build checks each arch it compiles) and the lipo'd
|
||||
# universal one the bundler copies into Contents/MacOS. Pinned version and
|
||||
# SHA-256s; fails the job on any mismatch. Not re-signed here: the app is
|
||||
# not code-signed on macOS, so the plugin keeps AWS's Developer ID
|
||||
# signature (with APPLE_* signing configured, Tauri would sign it too).
|
||||
- name: Fetch the AWS Session Manager plugin
|
||||
run: bash scripts/fetch-ssm-plugin.sh universal-apple-darwin
|
||||
|
||||
- name: Build Tauri app (universal)
|
||||
working-directory: ./app
|
||||
run: |
|
||||
@@ -656,6 +675,13 @@ jobs:
|
||||
set "PATH=%USERPROFILE%\.cargo\bin;C:\Program Files\nodejs;%PATH%"
|
||||
npm run build
|
||||
|
||||
# The AWS Session Manager plugin sidecar (bundle.externalBin). Pinned
|
||||
# version and SHA-256s, and AWS's Authenticode signature required; fails
|
||||
# the job on any mismatch. It ships under AWS's signature, not ours (see
|
||||
# the script and windows-sign.ps1).
|
||||
- name: Fetch the AWS Session Manager plugin
|
||||
run: powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts\fetch-ssm-plugin.ps1
|
||||
|
||||
# Releases are signed with Azure Artifact Signing (scripts/windows-*.ps1).
|
||||
# The setup fetches the signing client and a job-local .NET runtime, and
|
||||
# writes the Tauri config holding the sign command, which "Build Tauri
|
||||
|
||||
@@ -317,6 +317,22 @@ if [ "$pw_removed" = true ]; then
|
||||
fi
|
||||
[ -x "$out/usr/bin/triple-c" ] || fail "no executable usr/bin/triple-c."
|
||||
|
||||
# The bundled AWS Session Manager plugin (bundle.externalBin, fetched by
|
||||
# fetch-ssm-plugin.sh) is what AWS workspaces connect through. Tauri copies it
|
||||
# beside the app binary with the target triple stripped, which is where
|
||||
# `host::ssm::find_plugin` looks. It must be the real plugin: an ELF, not the
|
||||
# placeholder a debug build writes (build.rs refuses that for release, and this
|
||||
# is the check on what actually shipped).
|
||||
plugin="$out/usr/bin/session-manager-plugin"
|
||||
[ -x "$plugin" ] || fail "no executable usr/bin/session-manager-plugin (the bundled AWS plugin)."
|
||||
[ "$(head -c 4 "$plugin" | od -An -c | tr -d ' ')" = "177ELF" ] \
|
||||
|| fail "usr/bin/session-manager-plugin is not an ELF binary (a placeholder?)."
|
||||
"$plugin" --version >/dev/null 2>&1 \
|
||||
|| fail "usr/bin/session-manager-plugin does not run (--version)."
|
||||
# Its license and notices travel with it (bundle.resources).
|
||||
notices=("$out"/usr/lib/*/THIRD_PARTY_NOTICES)
|
||||
[ -f "${notices[0]}" ] || fail "THIRD_PARTY_NOTICES is not in the image."
|
||||
|
||||
# Every file readable by all, every program executable by all — what the
|
||||
# `chmod -R a+rX` before the repack promised (AppRun.wrapped used to ship 0770).
|
||||
# Files only: the AppImage runtime's --appimage-extract creates every
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
# each signature is metered (about 1000 a month), so those are skipped. The
|
||||
# allowlist below is the whole of what reaches users: the app binary, the MSI,
|
||||
# the NSIS installer, and the uninstaller makensis writes to the job's temp
|
||||
# directory. A file that already carries a valid signature is skipped too:
|
||||
# directory. The bundled session-manager-plugin sidecar is AWS-signed and is
|
||||
# refused rather than re-signed (see below). A file that already carries a valid signature is skipped too:
|
||||
# Tauri presents the app binary once per bundle type.
|
||||
#
|
||||
# This may run as 32-bit PowerShell: the NSIS uninstaller is signed from inside
|
||||
@@ -46,6 +47,17 @@ try {
|
||||
$full = (Resolve-Path -LiteralPath $Path).ProviderPath
|
||||
Write-Log "== $full"
|
||||
|
||||
# The bundled AWS session-manager-plugin (bundle.externalBin) ships AWS's own
|
||||
# signature and is deliberately never re-signed: fetch-ssm-plugin.ps1 checks it
|
||||
# is AWS-signed and timestamped, and Tauri skips a sidecar `signtool verify /pa`
|
||||
# accepts. Being asked to sign it means that check failed on this machine, so
|
||||
# stop rather than put our name on it - or, via the allowlist below, skip it
|
||||
# and ship it unsigned.
|
||||
if ($full -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$') {
|
||||
Write-Log 'refused: the session-manager-plugin sidecar must carry AWS''s signature, not ours (see fetch-ssm-plugin.ps1)'
|
||||
exit 1
|
||||
}
|
||||
|
||||
$ships = ($full -match '\\target\\release\\[^\\]+\.exe$') -or
|
||||
($full -match '\\target\\release\\bundle\\(msi|nsis)\\[^\\]+\.(msi|exe)$') -or
|
||||
$full.StartsWith($env:TRIPLE_C_SIGN_TMP.TrimEnd('\') + '\', [StringComparison]::OrdinalIgnoreCase)
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
# unpacked with an administrative install and its binaries checked directly;
|
||||
# the NSIS installer cannot be unpacked that way, so for it the signing log
|
||||
# must show the app binary and the uninstaller were signed.
|
||||
#
|
||||
# The bundled AWS session-manager-plugin is checked too - present in the MSI,
|
||||
# and in both installers signed, timestamped and signed by AWS, because it is
|
||||
# shipped under AWS's signature rather than re-signed by us.
|
||||
|
||||
param([Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)][string[]]$Patterns)
|
||||
|
||||
@@ -47,6 +51,20 @@ function Test-Signature([IO.FileInfo]$File, [string]$Label) {
|
||||
return $false
|
||||
}
|
||||
|
||||
# The bundled AWS session-manager-plugin sidecar is deliberately left under
|
||||
# AWS's own signature (see fetch-ssm-plugin.ps1), so beyond being valid and
|
||||
# timestamped it must be AWS's, not ours.
|
||||
$sidecarName = 'session-manager-plugin.exe'
|
||||
$sidecarSource = Join-Path (Split-Path -Parent $PSScriptRoot) 'app\src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe'
|
||||
function Test-AwsSigner([IO.FileInfo]$File, [string]$Label) {
|
||||
if (-not (Test-Signature $File $Label)) { return $false }
|
||||
$subject = (Get-AuthenticodeSignature -FilePath $File.FullName).SignerCertificate.Subject
|
||||
# .NET quotes a DN value holding a comma: O="Amazon Web Services, Inc.".
|
||||
if ($subject -match '(^|,\s*)O="?Amazon Web Services, Inc\."?(,|$)') { return $true }
|
||||
Write-Host "FAIL $Label - signed by '$subject', expected Amazon Web Services, Inc."
|
||||
return $false
|
||||
}
|
||||
|
||||
function Get-SignedLog {
|
||||
if ($env:TRIPLE_C_SIGN_LOG -and (Test-Path $env:TRIPLE_C_SIGN_LOG)) { return @(Get-Content $env:TRIPLE_C_SIGN_LOG) }
|
||||
return @()
|
||||
@@ -74,6 +92,16 @@ foreach ($file in $files) {
|
||||
foreach ($f in $inner) {
|
||||
if (-not (Test-Signature $f "$($file.Name) > $($f.Name)")) { $failed += "$($file.Name) > $($f.Name)" }
|
||||
}
|
||||
# The bundled AWS plugin must be in there, and still under AWS's signature.
|
||||
if ($proc.ExitCode -eq 0) {
|
||||
$plugin = @($inner | Where-Object { $_.Name -eq $sidecarName })
|
||||
if ($plugin.Count -ne 1) {
|
||||
Write-Host "FAIL $($file.Name) - carries $($plugin.Count) $sidecarName, expected 1"
|
||||
$failed += "$($file.Name) > $sidecarName (missing)"
|
||||
} elseif (-not (Test-AwsSigner $plugin[0] "$($file.Name) > $sidecarName")) {
|
||||
$failed += "$($file.Name) > $sidecarName (signer)"
|
||||
}
|
||||
}
|
||||
Remove-Item -Recurse -Force $extract -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
@@ -92,6 +120,14 @@ if ($nsisBuilt) {
|
||||
} else {
|
||||
Write-Host "OK app binary - signed before packaging ($($appSigned.Count)x)"
|
||||
}
|
||||
# makensis packs the sidecar straight from app\src-tauri\binaries, so the
|
||||
# file it read is the one to check.
|
||||
if (-not (Test-Path -LiteralPath $sidecarSource)) {
|
||||
Write-Host "FAIL $sidecarName - $sidecarSource is missing"
|
||||
$failed += "NSIS > $sidecarName (missing)"
|
||||
} elseif (-not (Test-AwsSigner (Get-Item -LiteralPath $sidecarSource) "NSIS > $sidecarName (as packed)")) {
|
||||
$failed += "NSIS > $sidecarName (signer)"
|
||||
}
|
||||
$tmp = $env:TRIPLE_C_SIGN_TMP
|
||||
$uninstaller = @()
|
||||
if ($tmp) { $uninstaller = @($log | Where-Object { $_.StartsWith($tmp, [StringComparison]::OrdinalIgnoreCase) }) }
|
||||
|
||||
Reference in new issue
Block a user