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

- 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:
shadowdaoandClaude Opus 5.5 committed 2026-11-17 08:20:09 -08:00
1 parent 5b23dc1aec
commit b62f472d79
7 files changed
+78 -16

No files matched your search

+13 -3
View File
@@ -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" }
}
+7 -2
View File
@@ -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"
+1 -1
View File
@@ -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)
+14 -6
View File
@@ -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)"
}