Repository navigation
Commit 31e73d0
feat(install): verify release archive checksums in both installers (#942)
* feat(install): verify release archive checksums (both installers)
Raises the integrity bar for the standalone installers (follow-up to #930).
- release.yml: generate a checksums.txt (sha256sum format) over the release
archives and publish it as a release asset.
- install (bash) + install.ps1: fetch checksums.txt and verify the downloaded
archive's SHA256 before extracting. Hard-fail on mismatch; soft-skip with a
notice when checksums.txt is absent (older pinned releases) or unreachable, so
existing version-pinned installs keep working.
- Cross-platform sha in bash (sha256sum or shasum -a 256); Get-FileHash on
Windows. Verification runs before extraction in both.
- Tests: checksum-verification.test.ts asserts release.yml publishes the file
and both installers fetch + compare + hard-fail on mismatch.
Verified: bash -n clean; install.ps1 parses clean and the Pester suite (6/6)
still passes on PowerShell 7.6.2.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(install): address checksum-verification review
- install.ps1: decode a Byte[] checksums.txt body so verification works on
Windows PowerShell 5.1. GitHub serves release assets as octet-stream, so on
PS 5.1 Invoke-WebRequest returns .Content as Byte[]; it coerced to a decimal
string and every check silently soft-skipped (sahrizvi, P1).
- install.ps1: pin the archive and checksums.txt to the resolved release tag
instead of the mutable latest/ URL, so a release published mid-install can't
hand back mismatched assets and trigger a spurious hard-fail (cubic, P2).
Falls back to latest/ only when the version can't be resolved.
- install: in verify_checksum, clean up via $(dirname "$file") rather than the
caller's dynamically-scoped $tmp_dir local — self-contained (cubic, P2).
- tests: Pester coverage for Test-Checksum (String + Byte[] + mismatch paths,
verified to fail without the decode) and TS guards for the decode and the
PowerShell same-release pinning.
Note: the bash installer is intentionally left on the latest/download path here
to keep this PR disjoint from #946 (which owns the bash latest-version block);
the two PRs then merge in either order with no conflict.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
* fix(install.ps1): ASCII-only so it parses on Windows PowerShell 5.1
install.ps1 had no BOM and used a few non-ASCII characters (em dash, ellipsis,
right arrow) in comments and messages. Windows PowerShell 5.1 — the default
shell on Windows 10 and preinstalled on Windows 11 — reads a BOM-less file as
the system ANSI codepage, not UTF-8, so those multi-byte characters corrupt the
token stream and the whole script fails to parse (verified on real PS 5.1:
"The '<' operator is reserved", cascading to "Missing closing '}'").
This is a pre-existing issue (the characters predate this PR) that CI doesn't
catch because the Pester job runs under pwsh (PowerShell 7, UTF-8 by default).
Replacing the three characters with ASCII equivalents (-, ..., ->) makes the
installer parse and run on PS 5.1 while keeping pwsh behavior identical. Verified
end-to-end on real Windows PowerShell 5.1: resolve version -> download -> extract
-> place the binary all succeed.
Same transliteration is applied verbatim in #946 so the two PRs merge cleanly.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
* fix(install): guard the verify_checksum cleanup against a pathological path
Defensive depth (coderabbit): only `rm -rf` the cleanup dir when dirname
resolves to a real subdirectory, never "." or "/", so an unexpectedly empty or
root-level $file can't wipe the cwd or worse.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
* test: update #930 release-validation for the checksum URL refactor
The #952 release-validation suite asserted the exact #930 URL literals. This PR
builds the archive and checksums.txt from a shared $base (so they always come
from the same release), so update those assertions to the $base/$url form, and
convert the now-obsolete "verification deferred" test.todo into a real assertion
that Test-Checksum verifies SHA256 before extraction.
(This test never ran on this PR until it was retargeted from the merged
feat/windows-powershell-installer branch to main.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: ralphstodomingo <ralphstodomingo@users.noreply.github.com>1 parent f8b3454 commit 31e73d0
6 files changed
Lines changed: 284 additions & 23 deletions
File tree
- .github/workflows
- packages/opencode/test
- install
- release-validation
- test/windows
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
360 | 367 | | |
361 | 368 | | |
362 | 369 | | |
| |||
366 | 373 | | |
367 | 374 | | |
368 | 375 | | |
| 376 | + | |
369 | 377 | | |
370 | 378 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
359 | 412 | | |
360 | 413 | | |
361 | 414 | | |
| |||
367 | 420 | | |
368 | 421 | | |
369 | 422 | | |
| 423 | + | |
| 424 | + | |
370 | 425 | | |
371 | 426 | | |
372 | 427 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
80 | 120 | | |
81 | 121 | | |
82 | 122 | | |
| |||
101 | 141 | | |
102 | 142 | | |
103 | 143 | | |
104 | | - | |
| 144 | + | |
105 | 145 | | |
106 | 146 | | |
107 | 147 | | |
108 | 148 | | |
109 | 149 | | |
110 | 150 | | |
111 | | - | |
| 151 | + | |
112 | 152 | | |
113 | 153 | | |
114 | 154 | | |
| |||
170 | 210 | | |
171 | 211 | | |
172 | 212 | | |
173 | | - | |
174 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
175 | 221 | | |
176 | | - | |
| 222 | + | |
177 | 223 | | |
| 224 | + | |
| 225 | + | |
178 | 226 | | |
179 | 227 | | |
180 | 228 | | |
| |||
184 | 232 | | |
185 | 233 | | |
186 | 234 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | 235 | | |
194 | 236 | | |
195 | 237 | | |
| |||
201 | 243 | | |
202 | 244 | | |
203 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
204 | 250 | | |
205 | 251 | | |
206 | 252 | | |
| |||
210 | 256 | | |
211 | 257 | | |
212 | 258 | | |
213 | | - | |
| 259 | + | |
214 | 260 | | |
215 | 261 | | |
216 | 262 | | |
| |||
237 | 283 | | |
238 | 284 | | |
239 | 285 | | |
240 | | - | |
| 286 | + | |
241 | 287 | | |
242 | 288 | | |
243 | 289 | | |
| |||
Lines changed: 75 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
68 | 76 | | |
69 | 77 | | |
70 | 78 | | |
| |||
0 commit comments