Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(install.ps1): initialise SigNoted so the clean-machine path does not crash under StrictMode (CUA-1771) (#5330)

Francesco Bonacci9c335ca2f783
diff --git a/scripts/install/install.ps1 b/scripts/install/install.ps1
index 64349dc0e4..c8654e9855 100644
--- a/scripts/install/install.ps1
+++ b/scripts/install/install.ps1
@@ -106,6 +106,7 @@ $script:Picked = $false
# Cua Spaces ships for Windows as the Electron app's NSIS setup.exe
# (cd-cua-spaces.yml). Set this to $false to skip a selected `spaces` with a note.
$script:SpacesSupported = $true
+$script:SigNoted = $false
function Get-Sha256Hex([string]$Path) {
# .NET directly: Get-FileHash is missing when the Utility module is not
diff --git a/scripts/install/tests/install.Tests.ps1 b/scripts/install/tests/install.Tests.ps1
index 43925bd636..f619f0e0bb 100644
--- a/scripts/install/tests/install.Tests.ps1
+++ b/scripts/install/tests/install.Tests.ps1
@@ -206,6 +206,27 @@ Describe 'install.ps1' {
$out | Should -Not -Match 'cua-cli-1.2.3'
}
+ # Clean machine: the manifest lists signatures but neither minisign nor
+ # cosign is installed. The "checked sha256" note reads $script:SigNoted,
+ # which crashed under Set-StrictMode when it was never initialised.
+ It 'installs under StrictMode when the manifest has signatures but no verifier is installed' {
+ $sig = Join-Path $env:CUA_TEST_ROOT 'sig'
+ New-Item -ItemType Directory -Force -Path $sig | Out-Null
+ Copy-Item (Join-Path $env:CUA_TEST_ROOT 'release/*') $sig
+ Get-ChildItem $sig -Filter 'cua-cli-*.zip' | ForEach-Object { Set-Content -LiteralPath "$($_.FullName).minisig" -Value 'sig' }
+ $sigManifest = Join-Path $sig 'release-artifacts.json'
+ & $Python.Source $Tool --component cli --version 1.2.3 --dir $sig --out $sigManifest
+ (Get-Content -Raw $sigManifest) | Should -Match 'minisig'
+ $prefix = Join-Path $env:CUA_TEST_ROOT 'p-sig'
+ $out = Invoke-Installer @{ CliOnly = $true; Yes = $true; NoOnboarding = $true; NoModifyPath = $true; Prefix = $prefix } @{
+ CUA_INSTALL_MANIFEST_URL = (ConvertTo-FileUrl $sigManifest)
+ PATH = ((Get-Command python3).Source | Split-Path)
+ }
+ $out | Should -Not -Match 'has not been set'
+ $out | Should -Match 'checked sha256'
+ Join-Path $prefix 'bin/cua.exe' | Should -Exist
+ }
+
It 'aborts on a checksum mismatch' {
$bad = Join-Path $env:CUA_TEST_ROOT 'bad'
New-Item -ItemType Directory -Force -Path $bad | Out-Null