Repository navigation
fix(deploy): verify the installer checksum before running it as root - #586
Open
walsykerem wants to merge 3 commits into
Open
walsykerem wants to merge 3 commits into
walsykerem wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b47ec57. Configure here.
The user-data bootstrap runs under `set -o pipefail`, and the lookup piped the GitHub releases JSON into `grep -m1`. That reader exits at the first match and closes the pipe while curl is still writing, so curl exits 23 and pipefail aborts provisioning before the installer is downloaded and its checksum verified. Read the tag from the redirect target of releases/latest instead: one curl call, no second process consuming the body, so nothing can break the pipe. Pinned versions still use HypemanVersion, and an empty or unexpected tag still fails closed before the checksum check runs. proof/curl_pipefail.sh extracts the real user-data block from the template and runs it under `set -euo pipefail` with a fake curl: the old lookup aborts with exit 23, the new one resolves the tag, a pinned version makes no network call, and both failure paths still abort. proof/template_parse.py parses the template with CloudFormation intrinsics allowed.
This branch has not been deployed
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.

The EC2 quickstart template used to install the API by piping a script straight from the repository's main branch into a root shell. Whoever could merge to main could change what every new deployment ran as root, and a stack kept no record of which script version had executed.
Provisioning now downloads the installer from the release tag named by HypemanVersion, and when that parameter is set to latest it resolves one concrete tag through the GitHub releases API first. The file is written to /tmp/hypeman-install.sh, so nothing is executed straight from a pipe.
Before the script runs, its SHA-256 digest is compared with a new stack parameter, HypemanVersionSha256, whose default matches the installer at v0.3.0. A mismatch, an unreachable tag, or a value that is not a release tag stops provisioning with a plain error instead of running unverified code. The check uses sha256sum in check mode, so an edited or truncated download fails closed.
The release pipeline only publishes checksums for its binary archives, not for the installer, so the digest lives in the template and must be updated whenever the version changes. That limit is written down rather than hidden. The template's Go test now asserts the tag-scoped URL and the digest check instead of the old pipe, and the provisioning repro passes.
Note
Medium Risk
Changes root-level EC2 bootstrap and adds a manual digest pin that must stay in sync with HypemanVersion; wrong pairing would block new stacks.
Overview
EC2 quickstart provisioning no longer pipes
scripts/install.shfrom main straight into a root shell. It resolves a concrete release tag from HypemanVersion (or GitHub’s latest-release redirect when set tolatest), downloads the script to/tmp/hypeman-install.sh, and only runs it after a SHA-256 check against the new stack parameter HypemanVersionSha256 (default matches the installer at v0.3.0).Tag resolution failures, non-release tags, or checksum mismatches abort bootstrap with a clear error instead of executing unverified code. HypemanVersion’s description now notes that it also pins the installer script. The CloudFormation template test asserts the tag-scoped download URL and digest verification instead of the old
curl | bashpattern.Reviewed by Cursor Bugbot for commit df1f407. Bugbot is set up for automated code reviews on this repo. Configure here.