Commit 227b5ed
committed
verify-action-build: recognize fileSHA256()-style file-hash helpers as verification
opentofu/setup-opentofu's `lib/setup-tofu.js` downloads the CLI zip via
`tc.downloadTool()` and then validates it:
const checksum = await fileSHA256(pathToCLIZip);
if (!checksums.includes(checksum)) throw new Error(...); // SHA256SUMS
`fileSHA256` is imported from the sibling `lib/util.js`, where the actual
`createHash('sha256')` body lives. Within the downloader file the only
verification evidence is the `fileSHA256(...)` call name — but none of the
`_JS_VERIFICATION_PATTERNS` matched that shape, so the v2.0.1 -> v2.0.2 bump
(#980) was false-flagged as an unverified download and the `verify` job failed.
This is the same class as the astral-sh/setup-uv `validateChecksum()` fix
(#910/#916): the hashing implementation lives in a sibling module and the
call name is the surviving in-file evidence.
Add a pattern that recognizes a helper call whose name contains an explicit
SHA algorithm (`fileSHA256(`, `getSHA512(`, `sha256File(`, ...). It stays
tight enough not to match `createHash('sha256')` (the paren precedes the
algorithm there) or non-SHA hashes. Covered by two regression tests: the bare
helper-name family and a faithful trim of the real opentofu download->verify
sequence.
Generated-by: Claude Code (Opus 4.8)1 parent 762de79 commit 227b5ed
2 files changed
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
1363 | 1400 | | |
1364 | 1401 | | |
1365 | 1402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1220 | 1220 | | |
1221 | 1221 | | |
1222 | 1222 | | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1223 | 1233 | | |
1224 | 1234 | | |
1225 | 1235 | | |
| |||
0 commit comments