Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,21 @@ try {
}
$archiveCounts[$entryName] = $archiveCounts[$entryName] + 1
}
foreach ($archiveName in $WindowsArchiveNames) {
$RequiredArchiveNames = @(
$BinName,
"LICENSE",
"install.ps1",
"THIRD_PARTY_NOTICES.md"
)
foreach ($archiveName in $RequiredArchiveNames) {
if ($archiveCounts[$archiveName] -ne 1) {
throw "archive must contain exactly one $archiveName"
}
}
if ($seen.Count -ne $WindowsArchiveNames.Count) {
if ($archiveCounts[$PayloadName] -gt 1) {
throw "archive contains duplicate $PayloadName"
}
if ($seen.Count -lt $RequiredArchiveNames.Count -or $seen.Count -gt $WindowsArchiveNames.Count) {
throw "archive does not match the exact Windows release allowlist"
}
} finally {
Expand All @@ -244,6 +253,10 @@ Expand-Archive -Path "$TmpDir\$Archive" -DestinationPath $TmpDir -Force

$DownloadedLauncher = Join-Path $TmpDir $BinName
$DownloadedPayload = Join-Path $TmpDir $PayloadName
if (-not (Test-Path -LiteralPath $DownloadedPayload -PathType Leaf) -and
(Test-Path -LiteralPath $DownloadedLauncher -PathType Leaf)) {
Copy-Item -LiteralPath $DownloadedLauncher -Destination $DownloadedPayload
}
if (-not (Test-Path -LiteralPath $DownloadedLauncher -PathType Leaf) -or
-not (Test-Path -LiteralPath $DownloadedPayload -PathType Leaf)) {
Write-Host "error: launcher or payload not found after extraction" -ForegroundColor Red
Expand Down
2 changes: 1 addition & 1 deletion tests/test_windows_bundle_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ require(
# attacker-controlled sixth member.
exact_archive_guards = {
"install.ps1": (
"$seen.Count -ne $WindowsArchiveNames.Count",
"$seen.Count -gt $WindowsArchiveNames.Count",
'"LICENSE"',
'"install.ps1"',
"THIRD_PARTY_NOTICES.md",
Expand Down
Loading