fix(install): verify sha256 checksum of downloaded release tarball#1395
Open
if414013 wants to merge 1 commit intortk-ai:developfrom
Open
fix(install): verify sha256 checksum of downloaded release tarball#1395if414013 wants to merge 1 commit intortk-ai:developfrom
if414013 wants to merge 1 commit intortk-ai:developfrom
Conversation
The installer previously downloaded the release tarball and extracted it without any integrity check. A tampered release asset, a MITM on the download, or a replaced asset on an already-published release would be installed silently. After the download, fetch checksums.txt from the same release, look up the expected sha256 for the archive by exact filename match, compute the actual sha256 of what was downloaded, and abort before extraction on mismatch. Uses sha256sum (GNU coreutils) when available and falls back to shasum -a 256 (present by default on macOS and BSD) so the script stays portable across Linux and macOS without adding dependencies. Aborts explicitly when neither tool is available, rather than silently skipping verification. The release workflow already publishes checksums.txt alongside each release (.github/workflows/release.yml uses "sha256sum * > checksums.txt"), so no pipeline changes are required.
|
|
Collaborator
📊 Automated PR Analysis
SummaryAdds SHA-256 checksum verification to the install.sh script to validate downloaded release tarballs before extraction. The change introduces a portable sha256_of() helper that works on both GNU and BSD/macOS systems, fetches checksums.txt from the release, and aborts installation if the hash doesn't match. Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
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.
Summary
The
install.shscript (used by the documentedcurl | shinstallation path) downloads the release tarball and extracts it without any integrity check. A tampered release asset, a MITM on the download, or a replaced asset on an already-published release is installed silently.This PR adds sha256 verification by fetching
checksums.txtfrom the same release and checking the downloaded archive against it before extraction.Threat this closes
Given that
rtkis installed into the agent's command path and rewrites output that an LLM consumes, a modified binary has an unusually high blast radius (it can silently alter whatgit diff,cat,npm test, etc. look like to the model). The current installer has a single point of trust — whoever can write to the release assets. After this PR, an attacker needs to modify the tarball and re-sign the checksums file served from the same release, which at minimum raises the bar.This does not replace artifact signing (cosign / SLSA provenance) — those are separate hardening steps — but closes the specific case of "release-asset tampered after publication" on the installer path.
What changed
install.shsha256_of()helper: usessha256sum(GNU coreutils) when available, falls back toshasum -a 256(default on macOS/BSD). Aborts explicitly if neither is present rather than silently skipping.checksums.txtfrom the same release, looks up the expected sha256 for the archive by exact filename match (awk $2 == f, so we don't match on partial filenames), compares against the computed hash, and aborts before extraction on mismatch.No workflow changes needed — the release workflow already publishes
checksums.txt:Test plan
sh -n install.sh— syntax check passeschecksums.txtforv0.37.1:checksums.txtcontaining a filename that is a substring of another)Notes / scope
Keeping this PR small and focused on the single highest-impact change. Related hardening that should land separately:
softprops/action-gh-release@v2,googleapis/release-please-action@v4,actions/github-script@v7track mutable tags).HOMEBREW_TAP_TOKENPAT scope; consider a Homebrew bump-formula-pr flow instead of directgh api PUT.CODEOWNERSto enforce the tier-1 critical-file review policy described inSECURITY.md.Happy to open follow-ups for any/all of these if useful.