Skip to content

build(cli): harden install.sh with checksum verification; validate release pipeline - #21

Merged
Hitesh-Sisara merged 1 commit into
mainfrom
feat/release-v0.1.0
Aug 7, 2026
Merged

Hitesh-Sisara merged 1 commit into
mainfrom
feat/release-v0.1.0

Conversation

@Hitesh-Sisara

Copy link
Copy Markdown
Contributor

The GoReleaser path had never actually executed, and install.sh had no release to fetch — so the documented one-line install was broken for anyone who tried it.

Validated locally before tagging anything

  • goreleaser check passes; release --snapshot produces all 6 archives (linux/darwin/windows x amd64/arm64) + checksums.txt
  • every cross-compile target builds and the version ldflag genuinely injects (the binary reports the version — not just "it compiled")
  • the archive contains the binary at the path install.sh expects, and extracting + running it works

install.sh hardening

Anything piped into a shell deserves scrutiny:

  • Verifies SHA-256 against the published checksums.txt before installing, with sha256sum/shasum fallback and an explicit warning when neither exists. A curl | sh installer that skips this trusts the transport alone.
  • Fails closed on: checksum mismatch, missing binary in the archive, failed download (previously a 404 body could be extracted as if it were an archive)
  • AGENTDRAFT_VERSION to pin a tag, AGENTDRAFT_INSTALL_DIR to relocate
  • Requires curl/tar up front; traps INT/TERM as well as EXIT for tmpdir cleanup

How tested

Ran the real installer against a local fake release:

Case Result
Happy path installs, binary runs
Deliberately corrupted archive rejected with checksum MISMATCH
Pinned AGENTDRAFT_VERSION resolves correctly

shellcheck and sh -n clean.

…lease pipeline

The GoReleaser path had never actually executed, and install.sh had no release to
fetch — so the documented one-line install was broken for anyone who tried it.

Validated locally before tagging anything:
- goreleaser check passes; `release --snapshot` produces all 6 archives
  (linux/darwin/windows x amd64/arm64) plus checksums.txt
- every cross-compile target builds and the version ldflag genuinely injects
  (binary reports the version, not just "it compiled")
- the archive contains the binary at the path install.sh expects, and extracting
  + running it works

install.sh hardening — anything piped into a shell deserves scrutiny:
- VERIFIES the SHA-256 against the published checksums.txt before installing, with
  sha256sum/shasum fallback and an explicit warning when neither exists. A
  curl|sh installer that skips this trusts the transport alone.
- fails closed on a checksum mismatch, on a missing binary in the archive, and on
  a failed download (previously a 404 body could be extracted as if it were an
  archive)
- AGENTDRAFT_VERSION to pin a tag, AGENTDRAFT_INSTALL_DIR to relocate
- requires curl/tar up front, traps INT/TERM as well as EXIT for tmpdir cleanup

Verified by running the real installer against a local fake release: happy path
installs and the binary runs; a deliberately corrupted archive is REJECTED with
"checksum MISMATCH"; a pinned version resolves. shellcheck and `sh -n` clean.
@Hitesh-Sisara
Hitesh-Sisara merged commit 7da455d into main Aug 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant