11<#
22. SYNOPSIS
3- Verifies release payload executable signing policy.
3+ Verifies release payload binary signing policy.
44
55. DESCRIPTION
6- Classifies every .exe in a release payload. OpenClaw-owned executables must
7- be signed when -RequireSignedOpenClaw is passed. Third-party executables ,
6+ Classifies every .exe and .dll in a release payload. OpenClaw-owned binaries
7+ must be signed when -RequireSignedOpenClaw is passed. Third-party binaries ,
88 including wxc-exec.exe, must not be signed by the OpenClaw release signer.
9- Unknown executables fail closed.
9+ Unknown executables and unknown OpenClaw-named binaries fail closed.
1010
1111. PARAMETER PayloadPath
1212 Root directory of the release payload to inspect.
1313
1414. PARAMETER RequireSignedOpenClaw
15- Require OpenClaw-owned executables to have valid Authenticode signatures.
15+ Require OpenClaw-owned binaries to have valid Authenticode signatures.
1616
17- . PARAMETER OpenClawSignerPattern
18- Regex used to identify the OpenClaw release signer in signer subjects .
17+ . PARAMETER OpenClawSignerSubject
18+ Exact certificate subject required for OpenClaw-owned binaries .
1919#>
2020[CmdletBinding ()]
2121param (
2424
2525 [switch ]$RequireSignedOpenClaw ,
2626
27- [string ]$OpenClawSignerPattern = " OpenClaw Foundation"
27+ [string ]$OpenClawSignerSubject = " CN= OpenClaw Foundation, O=OpenClaw Foundation, L=Mill Valley, S=California, C=US "
2828)
2929
3030Set-StrictMode - Version Latest
@@ -41,70 +41,106 @@ function Get-RelativePath {
4141 [System.IO.Path ]::GetRelativePath($Root , $Path ).Replace(' /' , ' \' )
4242}
4343
44- function Get-ExecutableClassification {
44+ function Get-BinaryClassification {
4545 param ([Parameter (Mandatory = $true )][string ]$RelativePath )
4646
4747 switch - Regex ($RelativePath ) {
4848 ' ^OpenClaw\.Tray\.WinUI\.exe$' { return " OpenClawOwned" }
49+ ' ^OpenClaw\.Tray\.WinUI\.dll$' { return " OpenClawOwned" }
50+ ' ^OpenClaw\.Chat\.dll$' { return " OpenClawOwned" }
51+ ' ^OpenClaw\.Connection\.dll$' { return " OpenClawOwned" }
52+ ' ^OpenClaw\.SetupEngine\.UI\.dll$' { return " OpenClawOwned" }
53+ ' ^OpenClaw\.SetupEngine\.dll$' { return " OpenClawOwned" }
54+ ' ^OpenClaw\.Shared\.dll$' { return " OpenClawOwned" }
55+ ' ^OpenClawTray\.FunctionalUI\.dll$' { return " OpenClawOwned" }
4956 ' (^|\\)createdump\.exe$' { return " ThirdPartyExcluded" }
5057 ' (^|\\)RestartAgent\.exe$' { return " ThirdPartyExcluded" }
5158 ' ^tools\\mxc\\[^\\]+\\wxc-exec\.exe$' { return " ThirdPartyExcluded" }
52- default { return " Unknown" }
59+ ' (^|\\)OpenClaw[^\\]*\.(exe|dll)$' { return " UnknownOpenClaw" }
60+ ' \.dll$' { return " ThirdPartyExcluded" }
61+ default { return " UnknownExecutable" }
5362 }
5463}
5564
56- $executables = @ (
57- Get-ChildItem - LiteralPath $payloadRoot - Recurse - File - Filter * .exe |
65+ $binaries = @ (
66+ Get-ChildItem - LiteralPath $payloadRoot - Recurse - File |
67+ Where-Object { $_.Extension -in " .exe" , " .dll" } |
5868 Sort-Object FullName |
5969 ForEach-Object {
6070 $relativePath = Get-RelativePath - Root $payloadRoot - Path $_.FullName
6171 $signature = Get-AuthenticodeSignature - LiteralPath $_.FullName
6272 $signerSubject = if ($signature.SignerCertificate ) { $signature.SignerCertificate.Subject } else { " " }
6373 [pscustomobject ]@ {
6474 RelativePath = $relativePath
65- Classification = Get-ExecutableClassification - RelativePath $relativePath
75+ Classification = Get-BinaryClassification - RelativePath $relativePath
6676 SignatureStatus = $signature.Status.ToString ()
6777 SignerSubject = $signerSubject
6878 }
6979 }
7080)
7181
72- if ($executables .Count -eq 0 ) {
73- throw " No executables found under $payloadRoot ."
82+ if ($binaries .Count -eq 0 ) {
83+ throw " No executable or DLL binaries found under $payloadRoot ."
7484}
7585
76- $executables | Format-Table - AutoSize
86+ $binaries | Format-Table - AutoSize
7787
7888$errors = New-Object System.Collections.Generic.List[string ]
7989
80- foreach ($exe in $executables ) {
81- switch ($exe .Classification ) {
90+ foreach ($binary in $binaries ) {
91+ switch ($binary .Classification ) {
8292 " OpenClawOwned" {
83- if ($RequireSignedOpenClaw -and $exe.SignatureStatus -ne " Valid" ) {
84- $errors.Add (" OpenClaw executable is not validly signed: $ ( $exe.RelativePath ) [$ ( $exe.SignatureStatus ) ]" )
93+ if ($RequireSignedOpenClaw -and $binary.SignatureStatus -ne " Valid" ) {
94+ $errors.Add (" OpenClaw binary is not validly signed: $ ( $binary.RelativePath ) [$ ( $binary.SignatureStatus ) ]" )
95+ }
96+ elseif ($RequireSignedOpenClaw -and
97+ -not [string ]::Equals(
98+ $binary.SignerSubject ,
99+ $OpenClawSignerSubject ,
100+ [StringComparison ]::OrdinalIgnoreCase)) {
101+ $errors.Add (" OpenClaw binary is not signed by the expected OpenClaw signer: $ ( $binary.RelativePath ) [$ ( $binary.SignerSubject ) ]" )
85102 }
86103 }
87104 " ThirdPartyExcluded" {
88- if ($exe.SignatureStatus -eq " Valid" -and $exe.SignerSubject -match $OpenClawSignerPattern ) {
89- $errors.Add (" Third-party executable appears to be signed by OpenClaw release signer: $ ( $exe.RelativePath ) [$ ( $exe.SignerSubject ) ]" )
105+ if ($binary.SignatureStatus -eq " Valid" -and
106+ [string ]::Equals(
107+ $binary.SignerSubject ,
108+ $OpenClawSignerSubject ,
109+ [StringComparison ]::OrdinalIgnoreCase)) {
110+ $errors.Add (" Third-party binary appears to be signed by OpenClaw release signer: $ ( $binary.RelativePath ) [$ ( $binary.SignerSubject ) ]" )
90111 }
91112 }
113+ " UnknownOpenClaw" {
114+ $errors.Add (" Unknown OpenClaw binary in release payload: $ ( $binary.RelativePath ) " )
115+ }
92116 default {
93- $errors.Add (" Unknown executable in release payload: $ ( $exe .RelativePath ) " )
117+ $errors.Add (" Unknown executable in release payload: $ ( $binary .RelativePath ) " )
94118 }
95119 }
96120}
97121
98- if (-not ($executables | Where-Object RelativePath -eq " OpenClaw.Tray.WinUI.exe" )) {
99- $errors.Add (" Missing OpenClaw.Tray.WinUI.exe." )
122+ @ (
123+ " OpenClaw.Tray.WinUI.exe" ,
124+ " OpenClaw.Tray.WinUI.dll" ,
125+ " OpenClaw.Chat.dll" ,
126+ " OpenClaw.Connection.dll" ,
127+ " OpenClaw.SetupEngine.UI.dll" ,
128+ " OpenClaw.SetupEngine.dll" ,
129+ " OpenClaw.Shared.dll" ,
130+ " OpenClawTray.FunctionalUI.dll"
131+ ) | ForEach-Object {
132+ $requiredBinary = $_
133+ if (-not ($binaries | Where-Object RelativePath -eq $requiredBinary )) {
134+ $errors.Add (" Missing OpenClaw binary: $_ ." )
135+ }
100136}
101- if ($executables | Where-Object RelativePath -eq " SetupEngine\OpenClaw.SetupEngine.UI.exe" ) {
137+ if ($binaries | Where-Object RelativePath -eq " SetupEngine\OpenClaw.SetupEngine.UI.exe" ) {
102138 $errors.Add (" SetupEngine\OpenClaw.SetupEngine.UI.exe should not be present in the release payload." )
103139}
104- if ($executables | Where-Object RelativePath -eq " SetupEngine\OpenClaw.SetupEngine.exe" ) {
140+ if ($binaries | Where-Object RelativePath -eq " SetupEngine\OpenClaw.SetupEngine.exe" ) {
105141 $errors.Add (" SetupEngine\OpenClaw.SetupEngine.exe should not be present in the release payload." )
106142}
107- if (-not ($executables | Where-Object RelativePath -match ' ^tools\\mxc\\[^\\]+\\wxc-exec\.exe$' )) {
143+ if (-not ($binaries | Where-Object RelativePath -match ' ^tools\\mxc\\[^\\]+\\wxc-exec\.exe$' )) {
108144 $errors.Add (" Missing tools\mxc\<arch>\wxc-exec.exe third-party executable." )
109145}
110146
@@ -113,4 +149,4 @@ if ($errors.Count -gt 0) {
113149 exit 1
114150}
115151
116- Write-Host " Release executable signing policy passed." - ForegroundColor Green
152+ Write-Host " Release binary signing policy passed." - ForegroundColor Green
0 commit comments