Verify the Electron download against Electron's published checksums - #1
Open
jason-c-dev wants to merge 1 commit into
Open
jason-c-dev wants to merge 1 commit into
jason-c-dev wants to merge 1 commit into
Conversation
The script downloads a 100+ MB Electron runtime and unpacks it into the install directory without checking it. Electron publishes SHASUMS256.txt alongside every release, so verifying costs one small extra request. Verification runs against the cached zip too, so a truncated download from an interrupted run is caught rather than silently unpacked. A failed check deletes the zip so a re-run retries cleanly instead of failing forever. Also adds Arch and Fedora prerequisites. The existing 'command -v 7zz' check already prefers a system binary, so on distros that package modern 7-Zip the 7-zip.org download is skipped -- worth stating, since it removes a host from the set the script talks to.
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.
Thanks for this — I rebuilt Granola from a
.dmgby hand following the sixsteps in the README, specifically so I could satisfy myself the repo was safe
before running it. It reproduced exactly, and the write-up made that easy. Two
small things came out of the exercise.
The Electron runtime is downloaded but never verified
The script pulls a ~118 MB runtime and unpacks it straight into
$INSTALL_DIR. Electron publishes aSHASUMS256.txtnext to every release, sochecking it costs one small extra request:
This felt worth doing here in particular. The repo's pitch is that the
conversion is trustworthy and auditable, and this is the one large unsigned
binary the process ingests.
Details:
a truncated file left behind by an interrupted run is caught instead of
silently unpacked. That was the failure mode I actually wanted to guard
against.
failing forever against poisoned cache.
rm -rf "$INSTALL_DIR", so a bad download can't take outa working install. That ordering was already correct — I just kept it.
SHASUMS256.txtis cached per-version alongside the zip.Prerequisites are apt-only
The install line assumes Debian/Ubuntu. Added Arch and Fedora equivalents.
Worth noting explicitly in the README: the existing
command -v 7zzcheckalready prefers a system binary, so on distros packaging modern 7-Zip the
7-zip.org download never happens. Arch's
7zipis 26.02 — newer than thebundled static 25.01 — and
p7zipisn't in the Arch repos at all, so the"most distros ship p7zip" caveat doesn't apply there. That removes a host from
the set the script talks to, which seemed worth stating outright.
Testing
Ran the patched script end-to-end on Arch (gcc 16, glibc 2.42) against Granola
7.522.2 / Electron 42.7.0 — full build, native rebuild, and smoke test pass.
Then corrupted a byte in the cached zip and re-ran to confirm it fails closed:
Exit status 1, zip removed, nothing installed.
I also added that Arch run to the "Tested on" list, since it's a different
distro and a newer Granola than the table had. Happy to drop that if you'd
rather keep it to configurations you've verified yourself.
🤖 Generated with Claude Code
https://claude.ai/code/session_01EaTeCExac9ue2MGZt7LL8a