fix(ssm-plugin): review fixes for the source build and signing checks
Secret Scan / scan (push) Successful in 11s
Build App (Preview) / compute-version (pull_request) Successful in 11s
Secret Scan / scan (pull_request) Successful in 12s
Build App (Preview) / create-release (pull_request) Successful in 1s
Build App (Preview) / build-macos (pull_request) Successful in 6m42s
Build App (Preview) / test (pull_request) Successful in 15m11s
Build App (Preview) / build-linux (pull_request) Successful in 13m45s
Build App (Preview) / build-windows (pull_request) Successful in 13m59s
Build App (Preview) / prune-previews (pull_request) Successful in 2s
Secret Scan / scan (push) Successful in 11s
Build App (Preview) / compute-version (pull_request) Successful in 11s
Secret Scan / scan (pull_request) Successful in 12s
Build App (Preview) / create-release (pull_request) Successful in 1s
Build App (Preview) / build-macos (pull_request) Successful in 6m42s
Build App (Preview) / test (pull_request) Successful in 15m11s
Build App (Preview) / build-linux (pull_request) Successful in 13m45s
Build App (Preview) / build-windows (pull_request) Successful in 13m59s
Build App (Preview) / prune-previews (pull_request) Successful in 2s
- build-ssm-plugin.{sh,ps1}: skip the vendored SDK's Java codegen/ and
test snapshot/ trees when extracting (codegen paths reach 258 chars,
past MAX_PATH on Windows); the .ps1 works under a short
%SystemDrive%\ssm-<8hex> root and falls back to rd /s /q on cleanup.
Pinned output hashes unchanged (rebuilt every target).
- build-ssm-plugin.sh: the header no longer claims a git commit-id check.
- windows-verify-signatures.ps1: compare signer Subject + Issuer, not the
thumbprint (Artifact Signing certificates rotate); require
THIRD_PARTY_NOTICES in the MSI.
- windows-sign.ps1: allowlist exactly
src-tauri\binaries\session-manager-plugin-x86_64-pc-windows-msvc.exe.
- macOS jobs: check the .app carries the two-slice plugin and
Contents/Resources/THIRD_PARTY_NOTICES.
- CLAUDE.md: a local release build must re-run the build script.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b23dc1aec
commit
b62f472d79
7 files changed
+78
-16
No files matched your search
@@ -625,6 +625,21 @@ jobs:
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
npx tauri build --target universal-apple-darwin
|
||||
|
||||
# The sidecar and its notices must be in the bundle Tauri made: the
|
||||
# plugin in Contents/MacOS with both slices, THIRD_PARTY_NOTICES in
|
||||
# Contents/Resources (bundle.resources).
|
||||
- name: Check the bundled Session Manager plugin
|
||||
run: |
|
||||
app_dir="$(ls -d app/src-tauri/target/universal-apple-darwin/release/bundle/macos/*.app | head -n1)"
|
||||
[ -n "$app_dir" ] || { echo "no .app bundle"; exit 1; }
|
||||
plugin="$app_dir/Contents/MacOS/session-manager-plugin"
|
||||
[ -x "$plugin" ] || { echo "missing $plugin"; exit 1; }
|
||||
archs="$(lipo -archs "$plugin")"
|
||||
case " $archs " in *" x86_64 "*) ;; *) echo "plugin lacks x86_64 ($archs)"; exit 1 ;; esac
|
||||
case " $archs " in *" arm64 "*) ;; *) echo "plugin lacks arm64 ($archs)"; exit 1 ;; esac
|
||||
"$plugin" --version
|
||||
[ -f "$app_dir/Contents/Resources/THIRD_PARTY_NOTICES" ] || { echo "missing Contents/Resources/THIRD_PARTY_NOTICES"; exit 1; }
|
||||
|
||||
- name: Collect artifacts
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
|
||||
@@ -440,6 +440,21 @@ jobs:
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
npx tauri build --target universal-apple-darwin
|
||||
|
||||
# The sidecar and its notices must be in the bundle Tauri made: the
|
||||
# plugin in Contents/MacOS with both slices, THIRD_PARTY_NOTICES in
|
||||
# Contents/Resources (bundle.resources).
|
||||
- name: Check the bundled Session Manager plugin
|
||||
run: |
|
||||
app_dir="$(ls -d app/src-tauri/target/universal-apple-darwin/release/bundle/macos/*.app | head -n1)"
|
||||
[ -n "$app_dir" ] || { echo "no .app bundle"; exit 1; }
|
||||
plugin="$app_dir/Contents/MacOS/session-manager-plugin"
|
||||
[ -x "$plugin" ] || { echo "missing $plugin"; exit 1; }
|
||||
archs="$(lipo -archs "$plugin")"
|
||||
case " $archs " in *" x86_64 "*) ;; *) echo "plugin lacks x86_64 ($archs)"; exit 1 ;; esac
|
||||
case " $archs " in *" arm64 "*) ;; *) echo "plugin lacks arm64 ($archs)"; exit 1 ;; esac
|
||||
"$plugin" --version
|
||||
[ -f "$app_dir/Contents/Resources/THIRD_PARTY_NOTICES" ] || { echo "missing Contents/Resources/THIRD_PARTY_NOTICES"; exit 1; }
|
||||
|
||||
- name: Collect artifacts
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
|
||||
@@ -1241,7 +1241,10 @@ unit-tested (`host/ssm/tests.rs`, `plugin_resolution`).
|
||||
as "AWS Content" under the AWS Customer Agreement; the source (github.com/aws/session-manager-plugin)
|
||||
is Apache-2.0. `scripts/build-ssm-plugin.sh <triple>…` (Linux/macOS; any triple, it
|
||||
cross-compiles) and `scripts/build-ssm-plugin.ps1` (the Windows runner, which has no bash) take
|
||||
the tag's **commit** as GitHub's archive (pinned SHA-256, checked before extraction) and a
|
||||
the tag's **commit** as GitHub's archive (pinned SHA-256, checked before extraction; the
|
||||
vendored SDK's Java `codegen/` and test `snapshot/` trees are not extracted — they reach 258
|
||||
characters, past Windows' MAX_PATH, so the `.ps1` also works under a short `C:\ssm-<8hex>` root)
|
||||
and a
|
||||
**pinned Go** from go.dev (go.dev's published SHA-256), and run the repo's own build — GOPATH
|
||||
mode over its vendored deps, `-ldflags "-s -w"`, `sessionmanagerplugin-main` — with `VERSION`
|
||||
stamped to the tag (the repo's file says `1.3.0.0`; AWS's pipeline stamps the real one, so
|
||||
@@ -1266,15 +1269,21 @@ unit-tested (`host/ssm/tests.rs`, `plugin_resolution`).
|
||||
`PROFILE=debug`, so `cargo test`/`cargo check`/`tauri dev` and CI's `test` job need neither Go
|
||||
nor the network, and `find_plugin()` skips it (falling back to an installed plugin). With
|
||||
`PROFILE=release` a missing file **or** a placeholder stops the build, so a local `cargo build
|
||||
--release` needs the build script first. `finalize-appimage.sh` asserts the shipped
|
||||
--release` needs the build script first. **build.rs rejects only a missing file or the
|
||||
placeholder, not a stale or wrong binary**: re-run `scripts/build-ssm-plugin.sh` before every
|
||||
local release build (it is a no-op when the file already matches the pin, and rebuilds it
|
||||
otherwise — e.g. after a pin bump, or after a Windows release build signed it in place). `finalize-appimage.sh` asserts the shipped
|
||||
`usr/bin/session-manager-plugin` is an ELF that runs `--version`.
|
||||
- **Windows: our build is unsigned, so the release signs it with our certificate.** Tauri runs
|
||||
`signtool verify /pa` on each sidecar and hands the unsigned one to the sign command, in place
|
||||
under `app\src-tauri\binaries` before any bundle (both MSI and NSIS pack that file);
|
||||
`windows-sign.ps1`'s allowlist includes it (one more metered signature per release: 6).
|
||||
`windows-verify-signatures.ps1` requires exactly one `session-manager-plugin.exe` in the MSI and
|
||||
the file NSIS packed to be validly signed, timestamped, **by the same certificate as the
|
||||
installer**, and the signing log to show it. Previews ship it unsigned, like the app.
|
||||
the file NSIS packed to be validly signed, timestamped, **by the same signing identity
|
||||
(subject + issuer) as the installer** — not the thumbprint: Artifact Signing certificates are
|
||||
short-lived and rotate — and the signing log to show it. The MSI must also carry
|
||||
`THIRD_PARTY_NOTICES`; on macOS a workflow step checks the `.app` holds the two-slice plugin in
|
||||
`Contents/MacOS` and the notices in `Contents/Resources`. Previews ship it unsigned, like the app.
|
||||
- **macOS: signed exactly like the app.** The app is not code-signed (no `APPLE_*`/`signingIdentity`
|
||||
in the workflows); Go's linker ad-hoc signs the arm64 slice (needed to run on Apple Silicon). If
|
||||
signing is ever configured, Tauri signs externalBin with the app's identity, inside-out.
|
||||
|
||||
@@ -52,7 +52,10 @@ if ((Test-Path -LiteralPath $dest) -and ((Get-Sha256 $dest) -eq $BinarySha)) {
|
||||
exit 0
|
||||
}
|
||||
|
||||
$work = Join-Path ([IO.Path]::GetTempPath()) ('ssm-plugin-' + [guid]::NewGuid().ToString('N'))
|
||||
# A short work root, not %TEMP% (on the runner that is deep under
|
||||
# systemprofile): the longest extracted path is ~200 characters, and MAX_PATH
|
||||
# is 260 for Windows PowerShell 5.1, tar.exe and the Go build alike.
|
||||
$work = Join-Path "$env:SystemDrive\" ('ssm-' + [guid]::NewGuid().ToString('N').Substring(0, 8))
|
||||
New-Item -ItemType Directory -Path $work | Out-Null
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
try {
|
||||
@@ -71,7 +74,10 @@ try {
|
||||
if ($actual -ne $SourceSha) { throw "SHA-256 mismatch for the plugin source: got $actual, pinned $SourceSha" }
|
||||
$srcDir = Join-Path $work 'src'
|
||||
New-Item -ItemType Directory -Path $srcDir | Out-Null
|
||||
& tar.exe -xzf $srcTgz -C $srcDir
|
||||
# Only what the build reads, as build-ssm-plugin.sh does: the vendored SDK's
|
||||
# Java codegen/ tree reaches 258 characters inside the archive, past
|
||||
# MAX_PATH, and its snapshot/ files are test data.
|
||||
& tar.exe --exclude='*/codegen/*' --exclude='*/snapshot/*' -xzf $srcTgz -C $srcDir
|
||||
if ($LASTEXITCODE -ne 0) { throw "tar.exe could not extract the source ($LASTEXITCODE)" }
|
||||
$goSpace = Join-Path $srcDir "session-manager-plugin-$PluginCommit"
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $goSpace 'src\sessionmanagerplugin-main'))) {
|
||||
@@ -120,5 +126,9 @@ try {
|
||||
Move-Item -LiteralPath $out -Destination $dest -Force
|
||||
Write-Host "session-manager-plugin-$Triple.exe: session-manager-plugin $PluginVersion (unsigned; signed by the release build)"
|
||||
} finally {
|
||||
Remove-Item -Recurse -Force -LiteralPath $work -ErrorAction SilentlyContinue
|
||||
Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue
|
||||
# PS 5.1's Remove-Item can give up on read-only files and deep trees;
|
||||
# rd /s /q is the fallback.
|
||||
if (Test-Path -LiteralPath $work) { cmd /c rd /s /q "`"$work`"" | Out-Null }
|
||||
if (Test-Path -LiteralPath $work) { Write-Warning "could not remove $work" }
|
||||
}
|
||||
@@ -32,7 +32,12 @@
|
||||
# Trust and reproducibility - the build fails on any miss:
|
||||
# 1. The source is AWS's tag 1.2.896.0, pinned by COMMIT, downloaded as
|
||||
# GitHub's archive of that commit and checked against a pinned SHA-256
|
||||
# and the commit id git embeds in the archive, BEFORE extraction.
|
||||
# BEFORE extraction (the SHA-256 is the check; the archive's top
|
||||
# directory, which names the commit, must also be there). Only what the
|
||||
# build reads is extracted: the vendored SDK's Java `codegen/` tree and its
|
||||
# test `snapshot/` files are skipped, which also keeps every path under
|
||||
# Windows' MAX_PATH (the .ps1 extracts the same way, so both build the
|
||||
# same tree).
|
||||
# 2. The Go toolchain is a pinned release from go.dev, checked against the
|
||||
# SHA-256 go.dev publishes (https://go.dev/dl/?mode=json), before use.
|
||||
# 3. The build is AWS's own (its makefile: GOPATH mode over the vendored
|
||||
@@ -133,7 +138,7 @@ prepare() {
|
||||
[ "$(sha256 "$src_tgz")" = "$SOURCE_SHA256" ] \
|
||||
|| die "SHA-256 mismatch for the plugin source: got $(sha256 "$src_tgz"), pinned $SOURCE_SHA256"
|
||||
mkdir -p "$work/src"
|
||||
tar -xzf "$src_tgz" -C "$work/src"
|
||||
tar --exclude='*/codegen/*' --exclude='*/snapshot/*' -xzf "$src_tgz" -C "$work/src"
|
||||
GO_SPACE="$work/src/session-manager-plugin-${PLUGIN_COMMIT}"
|
||||
[ -d "$GO_SPACE/src/sessionmanagerplugin-main" ] || die "the source archive is not the pinned commit's tree"
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ try {
|
||||
# build from AWS's source (scripts/build-ssm-plugin.ps1) and so ship unsigned
|
||||
# unless signed here. Tauri presents a sidecar to the sign command, in place
|
||||
# under app\src-tauri\binaries, only when `signtool verify /pa` rejects it.
|
||||
$ships = ($full -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$') -or
|
||||
$ships = ($full -match '\\src-tauri\\binaries\\session-manager-plugin-x86_64-pc-windows-msvc\.exe$') -or
|
||||
($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)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#
|
||||
# The bundled session-manager-plugin (built from source, signed by us) is
|
||||
# checked too: present in the MSI, and in both installers validly signed,
|
||||
# timestamped, and by the same certificate as the installer itself.
|
||||
# timestamped, and by the same signing identity as the installer itself.
|
||||
|
||||
param([Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)][string[]]$Patterns)
|
||||
|
||||
@@ -53,16 +53,19 @@ function Test-Signature([IO.FileInfo]$File, [string]$Label) {
|
||||
|
||||
# The session-manager-plugin sidecar is built from AWS's source
|
||||
# (build-ssm-plugin.ps1), so it is unsigned until windows-sign.ps1 signs it. It
|
||||
# must carry OUR signature: valid, timestamped, and from the same certificate
|
||||
# as the installer that ships it.
|
||||
# must carry OUR signature: valid, timestamped, and from the same signing
|
||||
# identity (subject and issuer) as the installer that ships it.
|
||||
$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-OurSigner([IO.FileInfo]$File, [string]$Label, [IO.FileInfo]$Installer) {
|
||||
if (-not (Test-Signature $File $Label)) { return $false }
|
||||
$ours = (Get-AuthenticodeSignature -FilePath $Installer.FullName).SignerCertificate
|
||||
$theirs = (Get-AuthenticodeSignature -FilePath $File.FullName).SignerCertificate
|
||||
if ($ours -and $theirs -and $ours.Thumbprint -eq $theirs.Thumbprint) { return $true }
|
||||
Write-Host "FAIL $Label - signed by '$($theirs.Subject)', not the certificate that signed $($Installer.Name)"
|
||||
# Subject + Issuer, not the thumbprint: Azure Artifact Signing issues a
|
||||
# fresh short-lived certificate (daily), so the plugin and the installer
|
||||
# can legitimately carry different thumbprints within one build.
|
||||
if ($ours -and $theirs -and $ours.Subject -eq $theirs.Subject -and $ours.Issuer -eq $theirs.Issuer) { return $true }
|
||||
Write-Host "FAIL $Label - signed by '$($theirs.Subject)' (issuer '$($theirs.Issuer)'), not the identity that signed $($Installer.Name)"
|
||||
return $false
|
||||
}
|
||||
|
||||
@@ -93,6 +96,11 @@ foreach ($file in $files) {
|
||||
foreach ($f in $inner) {
|
||||
if (-not (Test-Signature $f "$($file.Name) > $($f.Name)")) { $failed += "$($file.Name) > $($f.Name)" }
|
||||
}
|
||||
# Its licence notices travel with it (bundle.resources).
|
||||
if ($proc.ExitCode -eq 0 -and -not @(Get-ChildItem -Path $extract -Recurse -File -Filter 'THIRD_PARTY_NOTICES').Count) {
|
||||
Write-Host "FAIL $($file.Name) - carries no THIRD_PARTY_NOTICES"
|
||||
$failed += "$($file.Name) > THIRD_PARTY_NOTICES (missing)"
|
||||
}
|
||||
# The bundled plugin must be in there, under our signature.
|
||||
if ($proc.ExitCode -eq 0) {
|
||||
$plugin = @($inner | Where-Object { $_.Name -eq $sidecarName })
|
||||
@@ -129,7 +137,7 @@ if ($nsisBuilt) {
|
||||
$failed += "NSIS > $sidecarName (missing)"
|
||||
} elseif (-not (Test-OurSigner (Get-Item -LiteralPath $sidecarSource) "NSIS > $sidecarName (as packed)" $nsisInstaller)) {
|
||||
$failed += "NSIS > $sidecarName (signer)"
|
||||
} elseif (-not @($log | Where-Object { $_ -match '\\binaries\\session-manager-plugin-[^\\]+\.exe$' }).Count) {
|
||||
} elseif (-not @($log | Where-Object { $_ -match '\\src-tauri\\binaries\\session-manager-plugin-x86_64-pc-windows-msvc\.exe$' }).Count) {
|
||||
Write-Host "FAIL $sidecarName - no signature was logged for it"
|
||||
$failed += "NSIS > $sidecarName (not logged)"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user