fix(worker): verify the release binary before replacing the running one - #441
Open
KillerX wants to merge 1 commit into
Open
fix(worker): verify the release binary before replacing the running one#441KillerX wants to merge 1 commit into
KillerX wants to merge 1 commit into
Conversation
The worker polled GitHub every five minutes and installed whatever it found, with no selfupdate.Validator: no checksum, no signature, no size check. A truncated download, a proxy that served the wrong bytes, or a partially uploaded release asset all became the running binary on the whole fleet within minutes. publish.yml now writes <binary>.sha256 next to each matrix artifact and attaches it to the release, and the worker builds its updater with selfupdate.SHAValidator. That makes the update fail closed: if the checksum asset is missing or does not match, nothing is installed and the error is logged. Both changes have to ship together — the first release built after this carries the file the new binary demands. What this does not do is authenticate the release. The hash is produced by the same job, in the same workflow, and attached to the same release, so anyone who can write the binary can write the hash. Closing that needs a signature checked against a key the pipeline cannot mint — an ECDSA keypair with the public half compiled into the worker and the private half a repository secret. That needs a key generated out of band, so it is left as a follow-up rather than done halfway here. Tests pin the one thing that silently breaks: that the name publish.yml uploads is the name the validator looks for, and that the two-column output of sha256sum is a form the validator accepts — BINARY_NAME contains a slash, so the second column is a path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
2/n of a stack. Base:
fix/activity-counter-on-activity-worker(#440).The worker polled GitHub every five minutes and installed whatever it found, with no
selfupdate.Validator: no checksum, no signature, no size check. A truncated download, a proxy that served the wrong bytes, or a partially uploaded release asset all became the running binary on the whole fleet within minutes.publish.ymlnow writes<binary>.sha256next to each matrix artifact and attaches it to the release, and the worker builds its updater withselfupdate.SHAValidator. That makes the update fail closed: if the checksum asset is missing or does not match, nothing is installed and the error is logged. Both changes have to ship together — the first release built after this carries the file the new binary demands.What this does not do is authenticate the release. The hash is produced by the same job, in the same workflow, and attached to the same release, so anyone who can write the binary can write the hash. Closing that needs a signature checked against a key the pipeline cannot mint — an ECDSA keypair with the public half compiled into the worker and the private half a repository secret. That needs a key generated out of band, so it is left as a follow-up rather than done halfway here. Happy to do it as the next branch if you generate the keypair.
Tests pin the one thing that silently breaks: that the name
publish.ymluploads is the name the validator looks for, and that the two-column output ofsha256sumis a form the validator accepts —BINARY_NAMEcontains a slash, so the second column is a path.🤖 Generated with Claude Code