param( [Parameter(Mandatory = $true)] [ValidatePattern('^[0-9a-f]{40}$')] [string]$ExpectedCommit, [Parameter(Mandatory = $true)] [string]$BundlePath, [Parameter(Mandatory = $true)] [ValidatePattern('^[0-9a-f]{64}$')] [string]$ExpectedBundleSha256 ) $ErrorActionPreference = 'Stop' $python = 'C:\Python313\python.exe' $git = 'C:\Program Files\Git\cmd\git.exe' $ssh = 'C:\Windows\System32\OpenSSH\ssh.exe' $powershell = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' $appRoot = 'C:\Program Files\Akyldash' $app = Join-Path $appRoot "client-$ExpectedCommit" $programData = 'C:\ProgramData\Akyldash' $trigger = Join-Path $programData 'release-trigger.json' $autoApply = Join-Path $programData 'release-auto-apply.json' $mutationRights = [System.Security.AccessControl.FileSystemRights]( [int][System.Security.AccessControl.FileSystemRights]::WriteData -bor [int][System.Security.AccessControl.FileSystemRights]::AppendData -bor [int][System.Security.AccessControl.FileSystemRights]::WriteExtendedAttributes -bor [int][System.Security.AccessControl.FileSystemRights]::WriteAttributes -bor [int][System.Security.AccessControl.FileSystemRights]::DeleteSubdirectoriesAndFiles -bor [int][System.Security.AccessControl.FileSystemRights]::Delete -bor [int][System.Security.AccessControl.FileSystemRights]::ChangePermissions -bor [int][System.Security.AccessControl.FileSystemRights]::TakeOwnership ) $pathReplacementRights = [System.Security.AccessControl.FileSystemRights]( [int][System.Security.AccessControl.FileSystemRights]::DeleteSubdirectoriesAndFiles -bor [int][System.Security.AccessControl.FileSystemRights]::Delete -bor [int][System.Security.AccessControl.FileSystemRights]::ChangePermissions -bor [int][System.Security.AccessControl.FileSystemRights]::TakeOwnership ) $identity = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = [Security.Principal.WindowsPrincipal]::new($identity) if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { throw 'Run this reviewed bootstrap from an elevated administrator session.' } $signature = Get-AuthenticodeSignature -LiteralPath $python if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch 'Python Software Foundation') { throw 'The pinned Python interpreter does not have the verified Python Software Foundation signature.' } function Assert-ProtectedPath([string]$Path, [bool]$AllowOwnerWrite = $false) { $item = Get-Item -LiteralPath $Path -Force if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw "Refusing reparse path: $Path" } $acl = Get-Acl -LiteralPath $Path $ownerSid = $acl.GetOwner([Security.Principal.SecurityIdentifier]).Value $rules = $acl.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier]) $trustedInstaller = 'S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464' if ($AllowOwnerWrite) { $approvedOwners = @('S-1-5-18', 'S-1-5-32-544', $identity.User.Value) } else { $approvedOwners = @('S-1-5-18', 'S-1-5-32-544', $trustedInstaller) } if ($ownerSid -notin $approvedOwners) { throw "Protected path has an unapproved owner: $Path" } if ($AllowOwnerWrite) { $allowed = @('S-1-5-18', 'S-1-5-32-544', $identity.User.Value) foreach ($rule in $rules) { $sid = $rule.IdentityReference.Value if ($rule.AccessControlType -ne 'Allow' -or $sid -notin $allowed -or ($rule.FileSystemRights -band [System.Security.AccessControl.FileSystemRights]::FullControl) -ne [System.Security.AccessControl.FileSystemRights]::FullControl) { throw "Private state path ACL must grant only full control to owner/SYSTEM/Administrators: $Path" } } $ownerHasFullControl = @($rules | Where-Object { $_.AccessControlType -eq 'Allow' -and $_.IdentityReference.Value -eq $identity.User.Value -and ($_.FileSystemRights -band [System.Security.AccessControl.FileSystemRights]::FullControl) -eq [System.Security.AccessControl.FileSystemRights]::FullControl }).Count -gt 0 if (-not $ownerHasFullControl) { throw "Task owner needs full control on protected state path: $Path" } } else { $writableUntrusted = @($rules | Where-Object { $_.AccessControlType -eq 'Allow' -and (([int]$_.FileSystemRights -band [int]$mutationRights) -ne 0) -and $_.IdentityReference.Value -notin @('S-1-5-18', 'S-1-5-32-544', $trustedInstaller) }) if ($writableUntrusted.Count -gt 0) { throw "Protected path grants write access outside SYSTEM/Administrators: $Path" } } } function Set-TrustedCodeOwner([string]$Path) { $acl = Get-Acl -LiteralPath $Path $administratorSid = [Security.Principal.SecurityIdentifier]::new('S-1-5-32-544') $acl.SetOwner($administratorSid) Set-Acl -LiteralPath $Path -AclObject $acl } function Assert-TrustedPath([string]$Path, [bool]$ParentsOnly = $false) { $item = Get-Item -LiteralPath $Path -Force if (($item -isnot [IO.FileInfo] -and $item -isnot [IO.DirectoryInfo]) -or ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw "Refusing missing, non-filesystem, or reparse protected path: $Path" } $trustedInstaller = 'S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464' $current = if ($ParentsOnly) { $item.Parent } else { $item } $isLeaf = -not $ParentsOnly while ($null -ne $current) { if (($current.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw "Protected path contains a reparse point: $($current.FullName)" } $acl = Get-Acl -LiteralPath $current.FullName $ownerSid = $acl.GetOwner([Security.Principal.SecurityIdentifier]).Value if ($ownerSid -notin @('S-1-5-18', 'S-1-5-32-544', $trustedInstaller)) { throw "Protected path has an untrusted owner: $($current.FullName)" } $checkedRights = if ($isLeaf) { $mutationRights } else { $pathReplacementRights } $rules = $acl.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier]) foreach ($rule in $rules) { $sid = $rule.IdentityReference.Value if (($rule.PropagationFlags -band [System.Security.AccessControl.PropagationFlags]::InheritOnly) -ne 0) { continue } if ($rule.AccessControlType -eq 'Allow' -and (([int]$rule.FileSystemRights -band [int]$checkedRights) -ne 0) -and $sid -notin @('S-1-5-18', 'S-1-5-32-544', $trustedInstaller)) { throw "Protected path grants replacement/write access outside trusted system owners: $($current.FullName)" } } $current = $current.Parent $isLeaf = $false } } foreach ($tool in @($python, $git, $ssh, $powershell)) { Assert-TrustedPath $tool } Assert-ProtectedPath (Split-Path -Parent $python) Assert-ProtectedPath $python if (-not (Test-Path -LiteralPath $appRoot -PathType Container)) { throw 'Protected receiver directory is missing; provision it through the reviewed owner procedure first.' } Assert-TrustedPath $appRoot Assert-ProtectedPath $appRoot if (Test-Path -LiteralPath $app) { throw 'Versioned receiver destination already exists; inspect it manually instead of overwriting.' } if (-not (Test-Path -LiteralPath $programData -PathType Container)) { throw 'Protected ProgramData directory is missing; provision it through the reviewed owner procedure first.' } Assert-ProtectedPath $programData -AllowOwnerWrite $true Assert-TrustedPath $programData -ParentsOnly $true if (Test-Path -LiteralPath $trigger) { Assert-ProtectedPath $trigger -AllowOwnerWrite $true } if (Test-Path -LiteralPath $trigger) { $triggerItem = Get-Item -LiteralPath $trigger if ($triggerItem.Length -gt 4096) { throw 'Existing trigger configuration exceeds its size limit.' } $triggerConfig = Get-Content -LiteralPath $trigger -Raw | ConvertFrom-Json $triggerFields = @($triggerConfig.PSObject.Properties.Name | Sort-Object) -join ',' if ($triggerConfig.schema_version -ne 1 -or $triggerConfig.enabled -ne $false -or $triggerConfig.repository -ne 'D:\Dev\akyldash' -or $triggerConfig.ssh_alias -ne 'akyldash_release' -or $triggerFields -ne 'enabled,repository,schema_version,ssh_alias') { throw 'Existing trigger configuration is not the fixed disabled configuration.' } } if (Test-Path -LiteralPath $autoApply) { Assert-ProtectedPath $autoApply -AllowOwnerWrite $true $autoItem = Get-Item -LiteralPath $autoApply if ($autoItem.Length -gt 1024) { throw 'Existing auto-apply configuration exceeds its size limit.' } $autoConfig = Get-Content -LiteralPath $autoApply -Raw | ConvertFrom-Json $autoFields = @($autoConfig.PSObject.Properties.Name | Sort-Object) -join ',' if ($autoConfig.schema_version -ne 1 -or $autoConfig.enabled -ne $false -or $autoFields -ne 'enabled,schema_version') { throw 'Existing auto-apply configuration must be disabled and match its fixed schema.' } } function Read-BoundedZipEntry($Entry, [long]$Maximum) { if ($Entry.Length -gt $Maximum) { throw "Receiver bundle entry exceeds its size limit: $($Entry.FullName)" } $inputStream = $Entry.Open() $buffer = [IO.MemoryStream]::new() try { $chunk = New-Object byte[] 8192 while (($count = $inputStream.Read($chunk, 0, $chunk.Length)) -gt 0) { if ($buffer.Length + $count -gt $Maximum) { throw "Receiver bundle entry exceeds its size limit: $($Entry.FullName)" } $buffer.Write($chunk, 0, $count) } if ($buffer.Length -ne $Entry.Length) { throw "Receiver bundle entry length is invalid: $($Entry.FullName)" } return ,$buffer.ToArray() } finally { $inputStream.Dispose() $buffer.Dispose() } } function Assert-ReceiverBundleEntryMode($Entry) { $entryMode = (([long]$Entry.ExternalAttributes -shr 16) -band 0xFFFF) if ($entryMode -ne 0x8180) { throw "Receiver bundle entry has an unsafe file mode: $($Entry.FullName)" } } function Get-LowerHex([byte[]]$Bytes, [bool]$UseSha1 = $false) { $algorithm = if ($UseSha1) { [Security.Cryptography.SHA1]::Create() } else { [Security.Cryptography.SHA256]::Create() } try { return [BitConverter]::ToString($algorithm.ComputeHash($Bytes)).Replace('-', '').ToLowerInvariant() } finally { $algorithm.Dispose() } } function Get-GitObjectHex([string]$Kind, [byte[]]$Bytes) { $header = [Text.Encoding]::ASCII.GetBytes("$Kind $($Bytes.Length)`0") $payload = New-Object byte[] ($header.Length + $Bytes.Length) [Array]::Copy($header, 0, $payload, 0, $header.Length) [Array]::Copy($Bytes, 0, $payload, $header.Length, $Bytes.Length) return Get-LowerHex -Bytes $payload -UseSha1 $true } function Get-GitTreeEntries([byte[]]$Bytes) { $entries = @{} $offset = 0 $utf8Strict = [Text.UTF8Encoding]::new($false, $true) while ($offset -lt $Bytes.Length) { $space = [Array]::IndexOf($Bytes, [byte]32, $offset) if ($space -lt $offset) { throw 'Git tree object has a malformed mode field.' } $nul = [Array]::IndexOf($Bytes, [byte]0, $space + 1) if ($nul -lt $space -or $nul + 21 -gt $Bytes.Length) { throw 'Git tree object has a malformed entry.' } $mode = [Text.Encoding]::ASCII.GetString($Bytes, $offset, $space - $offset) $name = $utf8Strict.GetString($Bytes, $space + 1, $nul - $space - 1) if (-not $name -or $name -in @('.', '..') -or $entries.ContainsKey($name)) { throw 'Git tree object has an invalid or duplicate name.' } $objectBytes = New-Object byte[] 20 [Array]::Copy($Bytes, $nul + 1, $objectBytes, 0, 20) $entries[$name] = [PSCustomObject]@{ mode = $mode sha1 = [BitConverter]::ToString($objectBytes).Replace('-', '').ToLowerInvariant() } $offset = $nul + 21 } return ,$entries } # The package is opened once with write/delete sharing denied. Its bytes are # hashed and held in memory before any installation write; no checkout or Git # command participates in this elevated stage. $bundleItem = Get-Item -LiteralPath $BundlePath -Force if ($bundleItem -isnot [IO.FileInfo] -or ($bundleItem.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw 'Receiver bundle must be a regular non-reparse file.' } $bundleStream = [IO.File]::Open([IO.Path]::GetFullPath($BundlePath), [IO.FileMode]::Open, [IO.FileAccess]::Read, [IO.FileShare]::Read) $zip = $null $verifiedFiles = @{} try { if ($bundleStream.Length -le 0 -or $bundleStream.Length -gt 524288) { throw 'Receiver bundle has an invalid size.' } $bundleHasher = [Security.Cryptography.SHA256]::Create() try { $bundleHash = [BitConverter]::ToString($bundleHasher.ComputeHash($bundleStream)).Replace('-', '').ToLowerInvariant() } finally { $bundleHasher.Dispose() } if ($bundleHash -ne $ExpectedBundleSha256) { throw 'Receiver bundle SHA-256 does not match ExpectedBundleSha256.' } $bundleStream.Position = 0 Add-Type -AssemblyName System.IO.Compression $zip = [System.IO.Compression.ZipArchive]::new($bundleStream, [IO.Compression.ZipArchiveMode]::Read, $true) $expectedEntries = @('manifest.json', 'objects/commit.bin', 'objects/root-tree.bin', 'objects/infra-tree.bin', 'objects/backup-tree.bin', 'objects/deploy-tree.bin', 'files/archive.py', 'files/external_session.py', 'files/receive_external.py', 'files/windows-release-trigger.example.xml', 'files/windows_release_launcher.py') $entryNames = @($zip.Entries | ForEach-Object { $_.FullName }) if ($entryNames.Count -ne $expectedEntries.Count -or (@($entryNames | Select-Object -Unique).Count -ne $expectedEntries.Count)) { throw 'Receiver bundle contains duplicate or unexpected entries.' } foreach ($expectedEntry in $expectedEntries) { if ($entryNames -cnotcontains $expectedEntry) { throw "Receiver bundle is missing an exact required entry: $expectedEntry" } } foreach ($zipEntry in $zip.Entries) { Assert-ReceiverBundleEntryMode -Entry $zipEntry } $manifestBytes = Read-BoundedZipEntry -Entry $zip.GetEntry('manifest.json') -Maximum 16384 $utf8Strict = [Text.UTF8Encoding]::new($false, $true) $manifest = $utf8Strict.GetString($manifestBytes) | ConvertFrom-Json $manifestFields = @($manifest.PSObject.Properties.Name | Sort-Object) -join ',' if ($manifestFields -ne 'commit,files,schema_version,trees' -or ($manifest.schema_version -isnot [int] -and $manifest.schema_version -isnot [long]) -or $manifest.schema_version -ne 1 -or $manifest.commit -isnot [string] -or $manifest.commit -cne $ExpectedCommit -or $manifest.files -isnot [Array] -or @($manifest.files).Count -ne 5 -or $manifest.trees -isnot [Array] -or @($manifest.trees).Count -ne 4) { throw 'Receiver bundle manifest does not match the expected commit and schema.' } $commitBytes = Read-BoundedZipEntry -Entry $zip.GetEntry('objects/commit.bin') -Maximum 16384 if ((Get-GitObjectHex -Kind 'commit' -Bytes $commitBytes) -cne $ExpectedCommit) { throw 'Receiver bundle Git commit object does not match ExpectedCommit.' } $commitText = [Text.Encoding]::ASCII.GetString($commitBytes) $headerEnd = $commitText.IndexOf("`n`n", [StringComparison]::Ordinal) if ($headerEnd -lt 1) { throw 'Receiver bundle commit header is malformed.' } $treeHeaders = [regex]::Matches($commitText.Substring(0, $headerEnd), '(?m)^tree ([0-9a-f]{40})$') if ($treeHeaders.Count -ne 1) { throw 'Receiver bundle commit has no unique root tree reference.' } $treeEntries = @{} $treeObjectNames = @{ '' = 'objects/root-tree.bin' infra = 'objects/infra-tree.bin' 'infra/backup' = 'objects/backup-tree.bin' 'infra/deploy' = 'objects/deploy-tree.bin' } $seenTrees = @{} foreach ($tree in $manifest.trees) { $treeFields = @($tree.PSObject.Properties.Name | Sort-Object) -join ',' if ($treeFields -ne 'path,sha1' -or $tree.path -isnot [string] -or $tree.path -cnotin @('', 'infra', 'infra/backup', 'infra/deploy') -or $seenTrees.ContainsKey($tree.path) -or $tree.sha1 -cnotmatch '^[0-9a-f]{40}$') { throw 'Receiver bundle tree manifest is invalid.' } $treeData = Read-BoundedZipEntry -Entry $zip.GetEntry($treeObjectNames[$tree.path]) -Maximum 262144 if ((Get-GitObjectHex -Kind 'tree' -Bytes $treeData) -cne $tree.sha1) { throw "Receiver bundle tree object identity does not match its manifest: $($tree.path)" } $treeEntries[$tree.path] = Get-GitTreeEntries -Bytes $treeData $seenTrees[$tree.path] = $tree.sha1 } if ($seenTrees.Count -ne 4 -or $treeHeaders[0].Groups[1].Value -cne $seenTrees['']) { throw 'Receiver bundle commit does not bind the declared root tree.' } $rootInfra = $treeEntries['']['infra'] $infraBackup = $treeEntries['infra']['backup'] $infraDeploy = $treeEntries['infra']['deploy'] if ($rootInfra.mode -notin @('40000', '040000') -or $rootInfra.sha1 -cne $seenTrees['infra'] -or $infraBackup.mode -notin @('40000', '040000') -or $infraBackup.sha1 -cne $seenTrees['infra/backup'] -or $infraDeploy.mode -notin @('40000', '040000') -or $infraDeploy.sha1 -cne $seenTrees['infra/deploy']) { throw 'Receiver bundle directory tree chain does not match the commit.' } $allowedFiles = @('archive.py', 'external_session.py', 'receive_external.py', 'windows-release-trigger.example.xml', 'windows_release_launcher.py') $seenFiles = @{} foreach ($file in $manifest.files) { $fileFields = @($file.PSObject.Properties.Name | Sort-Object) -join ',' if ($fileFields -ne 'git_blob_sha1,path,sha256,size' -or $file.path -isnot [string] -or $file.path -cnotin $allowedFiles -or $seenFiles.ContainsKey($file.path) -or $file.git_blob_sha1 -isnot [string] -or $file.git_blob_sha1 -cnotmatch '^[0-9a-f]{40}$' -or $file.sha256 -isnot [string] -or $file.sha256 -cnotmatch '^[0-9a-f]{64}$' -or ($file.size -isnot [int] -and $file.size -isnot [long]) -or $file.size -lt 0 -or $file.size -gt 262144) { throw 'Receiver bundle manifest contains an invalid file record.' } $entry = $zip.GetEntry("files/$($file.path)") $data = Read-BoundedZipEntry -Entry $entry -Maximum 262144 if ($data.Length -ne [long]$file.size -or (Get-LowerHex -Bytes $data) -cne $file.sha256) { throw "Receiver bundle file digest or size does not match its manifest: $($file.path)" } if ((Get-GitObjectHex -Kind 'blob' -Bytes $data) -cne $file.git_blob_sha1) { throw "Receiver bundle Git blob identity does not match its manifest: $($file.path)" } $treePath = if ($file.path -in @('archive.py', 'external_session.py', 'receive_external.py')) { 'infra/backup' } else { 'infra/deploy' } $treeFile = $treeEntries[$treePath][$file.path] if ($null -eq $treeFile -or $treeFile.mode -ne '100644' -or $treeFile.sha1 -cne $file.git_blob_sha1) { throw "Receiver bundle commit tree does not contain the exact source file: $($file.path)" } $seenFiles[$file.path] = $true $verifiedFiles[$file.path] = $data } if ($seenFiles.Count -ne $allowedFiles.Count) { throw 'Receiver bundle manifest omitted a required file.' } } finally { if ($null -ne $zip) { $zip.Dispose() } $bundleStream.Dispose() } $appSecurity = Get-Acl -LiteralPath $appRoot $appSecurity.SetOwner([Security.Principal.SecurityIdentifier]::new('S-1-5-32-544')) $null = [IO.Directory]::CreateDirectory($app, $appSecurity) Set-TrustedCodeOwner $app Assert-ProtectedPath $app foreach ($name in @('receive_external.py', 'archive.py', 'external_session.py', 'windows_release_launcher.py')) { $destination = Join-Path $app $name [IO.File]::WriteAllBytes($destination, $verifiedFiles[$name]) Set-TrustedCodeOwner $destination Assert-ProtectedPath $destination } if (-not (Test-Path -LiteralPath $trigger)) { $config = '{"schema_version":1,"enabled":false,"repository":"D:\\Dev\\akyldash","ssh_alias":"akyldash_release"}' Set-Content -LiteralPath $trigger -Value $config -Encoding Ascii -NoNewline } if (-not (Test-Path -LiteralPath $autoApply)) { Set-Content -LiteralPath $autoApply -Value '{"schema_version":1,"enabled":false}' -Encoding Ascii -NoNewline } Assert-ProtectedPath $trigger -AllowOwnerWrite $true Assert-ProtectedPath $autoApply -AllowOwnerWrite $true $template = [xml][Text.Encoding]::UTF8.GetString($verifiedFiles['windows-release-trigger.example.xml']) $ns = [System.Xml.XmlNamespaceManager]::new($template.NameTable) $ns.AddNamespace('t', 'http://schemas.microsoft.com/windows/2004/02/mit/task') $sid = $identity.User.Value $template.SelectSingleNode('/t:Task/t:Principals/t:Principal/t:UserId', $ns).InnerText = $sid $template.SelectSingleNode('/t:Task/t:Actions/t:Exec/t:Command', $ns).InnerText = $python $launcher = Join-Path $app 'windows_release_launcher.py' $template.SelectSingleNode('/t:Task/t:Actions/t:Exec/t:Arguments', $ns).InnerText = "-B -E -s -S `"$launcher`" --once" $template.SelectSingleNode('/t:Task/t:Actions/t:Exec/t:WorkingDirectory', $ns).InnerText = $app $template.SelectSingleNode('/t:Task/t:Triggers/t:CalendarTrigger/t:StartBoundary', $ns).InnerText = (Get-Date).AddDays(1).ToString('yyyy-MM-ddTHH:mm:ss') $templatePath = Join-Path $programData 'Akyldash-ReleaseTrigger-disabled.xml' $template.Save($templatePath) $applyTemplate = [xml][Text.Encoding]::UTF8.GetString($verifiedFiles['windows-release-trigger.example.xml']) $applyNs = [System.Xml.XmlNamespaceManager]::new($applyTemplate.NameTable) $applyNs.AddNamespace('t', 'http://schemas.microsoft.com/windows/2004/02/mit/task') $applyTemplate.SelectSingleNode('/t:Task/t:RegistrationInfo/t:URI', $applyNs).InnerText = '\Akyldash\ReleaseAutoApply' $applyTemplate.SelectSingleNode('/t:Task/t:Principals/t:Principal/t:UserId', $applyNs).InnerText = $sid $applyTemplate.SelectSingleNode('/t:Task/t:Actions/t:Exec/t:Command', $applyNs).InnerText = $python $applyTemplate.SelectSingleNode('/t:Task/t:Actions/t:Exec/t:Arguments', $applyNs).InnerText = "-B -E -s -S `"$launcher`" --auto-apply-prepared" $applyTemplate.SelectSingleNode('/t:Task/t:Actions/t:Exec/t:WorkingDirectory', $applyNs).InnerText = $app $applyTemplate.SelectSingleNode('/t:Task/t:Triggers/t:CalendarTrigger/t:StartBoundary', $applyNs).InnerText = (Get-Date).AddDays(1).ToString('yyyy-MM-ddTHH:mm:ss') $applyTemplate.Save((Join-Path $programData 'Akyldash-ReleaseAutoApply-disabled.xml')) Write-Output "Prepared disabled receiver files from verified source commit $ExpectedCommit." Write-Output 'No task was registered or enabled; both configuration gates remain disabled.'