Hash-verify the Go toolchain in the release workflow (closes #105)
check / check (pull_request) Failing after 1s
check / check (pull_request) Failing after 1s
The release workflow installed Go via actions/setup-go, which pins the action but not the toolchain tarball it downloads at runtime -- the compiler that produces the published binaries was the last external input in the release path verified against nothing in the repo, against REPO_POLICIES.md's hash-pin rule. New script/install-go, modelled on script/install-goreleaser, downloads the exact go.dev archive for go.mod's `go` directive and refuses it unless its sha256 matches a value committed in the script. release.yml calls it instead of setup-go and sets GOTOOLCHAIN=local so that exact compiler builds the release. The version is not duplicated: go.mod owns it and install-go fails when its committed GO_VERSION disagrees, so bumping Go edits go.mod, the checksum, and the Dockerfile golang digest together. Model: opus-4-8
This commit is contained in:
@@ -659,6 +659,14 @@ them. We provide:
|
||||
called by `script/bootstrap`; the release workflow calls it directly
|
||||
because it needs `goreleaser` but not the Docker daemon
|
||||
`script/bootstrap` insists on.
|
||||
* `script/install-go` — install the Go toolchain named by `go.mod`'s
|
||||
`go` directive into `.tool/go` from a sha256-verified `go.dev`
|
||||
archive, and put it on `PATH`. Idempotent. Called only by the release
|
||||
workflow, which needs a host Go for `goreleaser` to shell out to;
|
||||
nothing else on the release runner does. `actions/setup-go` is not
|
||||
used because it verifies the downloaded toolchain against no value in
|
||||
this repo. Bumping Go edits `go.mod`, the checksum in this script, and
|
||||
the `Dockerfile` `golang` digest together.
|
||||
* `script/release` — cross-compile and publish the release artifacts
|
||||
with the pinned `goreleaser`. Refuses a `goreleaser` on `PATH` whose
|
||||
version is not the pinned one, on the same reasoning as `script/lint`.
|
||||
|
||||
Reference in New Issue
Block a user