Repository navigation
feat(install): a script that verifies what it downloads (#138) - #421
Merged
Merged
Conversation
Part (b) of #138, and deliberately not the script that issue specifies. That one detects the package manager and adds a repository at packages.objectfs.io -- a host that does not exist. Both objectfs.io and packages.objectfs.io resolve to registrar parking IPs and neither completes a TLS handshake, so a script written to that spec could not be run, could not be tested, and would fail at its first curl with a TLS error naming a domain the reader cannot interpret. What GitHub already hosts is a tarball per platform with a checksum beside it, which needs no hosting decision. The checksum is verified and there is no flag to skip it. The reason to publish a checksum is that the download path is not trusted, and an installer treating verification as skippable has spent the cost without buying the property. What it establishes is stated rather than implied: the .sha256 travels the same channel as the tarball, so this detects corruption and a mangling mirror, not a compromise of the release host. The default prefix is ~/.local rather than /usr/local, reversing the usual convention on purpose. This project's users are frequently on a shared login node with no root, and an installer whose default needs sudo teaches them to run the whole thing under sudo -- which writes a root-owned binary and root-owned cache directories into a home their own jobs use. shellcheck passed from the first draft and the local run succeeded, and the script still failed on two of the three images #138 names, both times with an error naming the wrong cause: - ubuntu:24.04 ships neither curl nor wget. The download helper handled that, but release resolution called wget unconditionally when curl was absent, so the user was told "could not reach the GitHub API to find the latest release. Pass --version to skip this step" -- advice that cannot work on a machine with no downloader. - opensuse/leap:15.6 ships neither tar nor gzip. The script downloaded the archive, verified its checksum, then reported "a tar that cannot read the archive rather than a corrupt file" -- a confident claim about the file when tar was not installed. Installing only tar moved the same misattribution one layer down: tar -xzf shells out to gzip and reports the child's status as its own. A wrong cause is the expensive direction: it sends the reader to check the release, the network and the file, and never mentions the missing package. Both are now one preflight check that runs before anything touches the network, reports every missing tool at once -- openSUSE would otherwise need three attempts -- and names the package to install. It runs ahead of --dry-run too, since a dry run's job is to report whether this would work. The CI job asserts refusal AND success per image; a job checking only the refusal would pass against a script that can no longer install anything. It does not use LocalStack, which #138 specifies: nothing here touches S3. internal/config/install_script_test.go covers what that job cannot. It runs on x86_64, so it exercises one row of the platform mapping -- a mapping wrong for arm64, armv7 or darwin passes all three images. So the script's uname translation is coupled to release.yml's build matrix in both directions. One mutation is recorded as unverified locally rather than claimed as caught: reversing the x86_64 mapping was expected to fail the container run and did not, because podman on an Apple Silicon host runs an arm64 binary inside an emulated amd64 container through binfmt, so the wrong-architecture binary executed and printed its version. Ten mutations run, one initially survived: moving preflight to sit immediately above the download still passed, because it was still before the download -- but by then the API has been queried, which on a machine with no downloader is the failure preflight exists to pre-empt. The check is now anchored to the API call, and both orderings are asserted. Three docs claimed no packages are built, which part (a) made false, and README.md said `make build` produces ./objectfs rather than ./bin/objectfs.
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.
Part (b) of #138. Part (a) merged in #420; part (c) still needs a hosting decision.
Not the script #138 specifies, and why
#138's
install.shdetects the package manager and adds a repository atpackages.objectfs.io. That host does not exist — bothobjectfs.ioandpackages.objectfs.ioresolve to registrar parking IPs and neither completes a TLS handshake. A script written to that spec could not be run, could not be tested, and would fail at its firstcurlwith a TLS error naming a domain the reader has no way to interpret.What GitHub already hosts is a tarball per platform with a SHA-256 beside it. That needs no hosting decision, so it is what this installs.
The checksum is verified and there is no flag to skip it
The reason to publish a checksum is that the download path is not trusted, and an installer that treats verification as skippable has spent the cost without buying the property. What it establishes is stated on the page rather than implied: the
.sha256travels the same channel as the tarball, so this detects corruption and a mangling mirror — not a compromise of the release host. That is a signature's job, and this project does not sign releases.The default prefix is
~/.local, not/usr/local, reversing the usual convention on purpose. This project's users are frequently on a shared login node with no root, and an installer whose default needssudoteaches them to run the whole thing undersudo— which writes a root-owned binary and root-owned cache directories into a home their own jobs use.shellcheck passed and it was still broken on two of three images
shellcheckwas clean from the first draft. The local macOS run installed successfully against the real v0.13.0 release. And the script failed on two of the three images #138 names — both times with an error naming the wrong cause:ubuntu:24.04curlnorwget--versionto skip this step"opensuse/leap:15.6tarnorgzipInstalling only
taron openSUSE moved the same misattribution one layer down:tar -xzfshells out togzipand reports the child's status as its own, givingtar: Child returned status 2.A wrong cause is the expensive failure direction — it sends the reader to check the release, the network and the file, and never mentions the missing package. Both are now one
preflightthat runs before anything touches the network, reports every missing tool at once (openSUSE would otherwise need three attempts to learn what it needs), and names the package to install. It runs ahead of--dry-runtoo, since a dry run's job is to report whether this would work.The CI job
install-script, matrix over #138's three images. It asserts refusal and success per row — a job that checked only the refusal would pass against a script that can no longer install anything — plus that the checksum line appears, that the installed binary prints a version, and that two runs leave the identical binary.rockylinux:9installs nothing beforehand, which makes it the row that would catch a preflight demanding something the script does not need.It does not use LocalStack, which #138 specifies: nothing here touches S3. The script downloads a GitHub release asset and runs
objectfs --version, so a mock S3 endpoint would be machinery with nothing behind it. It also tests the last release's binary rather than the PR's, which is the right subject — the thing under test is the install path, and pointing it at an artifact built in this workflow would test a URL no user will ever fetch.The gate covers what CI cannot
That job runs on x86_64, so it exercises exactly one row of the platform mapping: a mapping wrong for arm64, armv7 or darwin passes all three images. So
TestInstallScriptNamesEveryPublishedAssetcouples the script'sunametranslation torelease.yml's build matrix in both directions.One mutation is recorded as unverified locally rather than claimed as caught: reversing the x86_64 mapping was expected to fail the container run and did not, because podman on an Apple Silicon host runs an arm64 binary inside an emulated amd64 container through binfmt — so the wrong-architecture binary executed and printed its version. On a real x86_64 runner the script's final
--versioncheck catches it; the static assertion is what makes that independent of the host.Ten mutations, and one initially survived:
--skip-checksumescape hatch addedG8 is the instructive one: moving
preflightto sit immediately above the download still passed, because it was still before the download — but by then the script has already queried the GitHub API, which on a machine with no downloader is precisely the failure preflight exists to pre-empt. The check is now anchored to the API call rather than the download, and both orderings are asserted.Verification
ubuntu:24.04with onlywgetinstalled — exercises the wget branch of release resolution, which is the path that produced the original wrong errorshellcheckclean;gofmt,go vet,golangci-lint0 issues;ci.ymlparses, 15 jobsDocs
Three pages claimed no packages are built, which part (a) made false —
docs-platform/guide/getting-started.md,docs/index.md, and the README's install section. The README also saidmake buildproduces./objectfswhen it produces./bin/objectfs.Still open on #138
Part (c) — the apt/yum repository setup scripts and the
curl | bashone-liner against a project domain — needs a hosting decision, not code: stand uppackages.objectfs.io, use Cloudsmith/Fury/a Pages apt-yum repo/COPR/OBS, or skip repositories entirely. Measurements and the recommended split are on #138. #138 stays open.