|
1 | 1 | <# |
2 | 2 | .SYNOPSIS |
3 | | - gitlawb installer for Windows — downloads pre-built binaries from GitHub Releases. |
| 3 | + gitlawb installer for Windows - downloads pre-built binaries from GitHub Releases. |
4 | 4 | .EXAMPLE |
5 | 5 | irm https://gitlawb.com/install.ps1 | iex |
6 | 6 | .EXAMPLE |
@@ -47,19 +47,16 @@ try { |
47 | 47 | Write-Host "Downloading..." |
48 | 48 | Invoke-WebRequest -Uri $url -OutFile $zipPath -Headers @{ "User-Agent" = "gitlawb-installer" } |
49 | 49 |
|
50 | | - # Verify checksum if available. |
51 | | - try { |
52 | | - $sumPath = "$zipPath.sha256" |
53 | | - Invoke-WebRequest -Uri "$url.sha256" -OutFile $sumPath -Headers @{ "User-Agent" = "gitlawb-installer" } |
54 | | - $expected = ((Get-Content $sumPath -Raw).Trim() -split '\s+')[0].ToLower() |
55 | | - $actual = (Get-FileHash $zipPath -Algorithm SHA256).Hash.ToLower() |
56 | | - if ($expected -ne $actual) { |
57 | | - throw "checksum mismatch! expected $expected got $actual" |
58 | | - } |
59 | | - Write-Host " checksum OK" |
60 | | - } catch [System.Net.WebException] { |
61 | | - Write-Host " (no checksum published, skipping verification)" |
| 50 | + # Verify checksum. Every published asset has a matching .sha256, so fail closed |
| 51 | + # if it cannot be fetched rather than installing an unverified binary. |
| 52 | + $sumPath = "$zipPath.sha256" |
| 53 | + Invoke-WebRequest -Uri "$url.sha256" -OutFile $sumPath -Headers @{ "User-Agent" = "gitlawb-installer" } |
| 54 | + $expected = ((Get-Content $sumPath -Raw).Trim() -split '\s+')[0].ToLower() |
| 55 | + $actual = (Get-FileHash $zipPath -Algorithm SHA256).Hash.ToLower() |
| 56 | + if ($expected -ne $actual) { |
| 57 | + throw "checksum mismatch! expected $expected got $actual" |
62 | 58 | } |
| 59 | + Write-Host " checksum OK" |
63 | 60 |
|
64 | 61 | Write-Host "Extracting..." |
65 | 62 | $extract = Join-Path $tmp "extract" |
|
0 commit comments