Skip to main content

Checking a release before it is downloaded

Bike4Mind
Engineering
Security
Supply Chain
Desktop

December 4, 2026

By Bike4Mind Engineering · also on erikbethke.com


Checking a release before it is downloaded

Two jobs make evidence from one checksum list; the installer checks the signature before it downloads the app.

Bike4Mind Desktop installs with one line of shell. We now publish three separate pieces of evidence with every release, and the installer checks the signed checksum list before it fetches a single byte of the app. This is how the release workflow produces that evidence, and where each check runs.

The usual way to install Desktop on a Mac or a Linux box is to pipe install.sh from the latest release into sh. The script picks the right file for the platform, downloads it, compares its SHA-256 with the line in the release’s SHA256SUMS.txt, and installs it. That comparison has always been there, and it proves less than it looks like it does: the checksum list and the installer come from the same release, so whoever could replace one could replace the other. A checksum check catches a truncated download. It does not say who made the file.

The change we shipped this week adds the “who”. Every release now carries build provenance for each checksummed file, a detached signature over the checksum list, and, on macOS, a pinned code signer. The interesting part is less the cryptography than the plumbing around it: which job holds which key, what a job refuses to do when a piece is missing, and why the installer verifies with a tool most people would not pick first.

Who holds what

The release workflow is a chain of jobs, and the point of splitting them is that each one holds as little as it can. build produces and signs the platform installers. validate checks that the asset set is exactly what it expects, writes the update manifests and SHA256SUMS.txt, and prepares install.sh. Two jobs then work from that checksum list in parallel, and neither can write to the distribution repository.

attest runs with id-token: write and attestations: write and nothing else. It hands SHA256SUMS.txt to GitHub’s build-provenance action, which signs a provenance statement for every file the list names using the workflow’s own OIDC identity. The comment above the job states the reason: the signature comes from this workflow’s identity, not from any token that can push releases. Anyone can check a downloaded file afterwards with gh attestation verify, naming the source repository and the release workflow as the expected signer.

sign runs in a separate GitHub environment, the only place the release signing key exists. It signs SHA256SUMS.txt into SHA256SUMS.txt.sig, and in the same job it signs the update manifests that the in-app updater reads, with a different key. Before it signs anything, the script derives the public half of the signing key it was given and compares it with the configured public key. A mismatch stops the job with a message that names the mismatch and nothing else; openssl’s own output is thrown away, because in that step it is the only text derived from the secret key. After signing, it verifies its own signature.

publish is where the evidence becomes mandatory. It lists attest as a dependency and requires it to have succeeded. It accepts a skipped sign only when neither signing key is configured at all; with either one set, a missing signature means no release. Before uploading, it verifies the checksum signature again with the public key, on a runner that never saw the signing key.

Baking the key into the installer

A signature is only useful to a verifier that already knows which key to trust. For install.sh that knowledge has to be in the script, and the script in the source tree carries two empty placeholders, RELEASE_KEY='' and MAC_REQUIREMENT=''. A source checkout runs with both empty. The validate job copies the script into the release and fills them in with a small Python step, and that step is strict about what it will write into a shell file.

The public key must match a pattern for a base64 SPKI DER ECDSA P-256 key: the fixed algorithm header every such key starts with, then exactly the right number of characters for the 64 key bytes. The macOS requirement must not contain a single quote or a newline, since it lands between single quotes. And each placeholder must appear exactly once, as a line of its own; zero or two matches is an error rather than a guess. Because the baked script is itself one of the files listed in SHA256SUMS.txt, it gets a provenance attestation like everything else in the release.

Why openssl and P-256

The in-app updater already verified signed manifests with Ed25519, and the obvious move would have been to reuse that key type, or to have the installer check the Sigstore provenance directly. Neither works from a shell script on a stock Mac. macOS ships LibreSSL as its openssl, and the README records that it verifies neither Ed25519 signatures nor Sigstore bundles. The other option, calling gh, would make the GitHub CLI a prerequisite for installing a desktop app. So the release checksum key is ECDSA P-256, and the check is one openssl dgst -sha256 -verify call that works with what the machine already has.

The PEM file the installer verifies with is assembled from the baked base64 in the shell, folded to 64 columns between the usual header lines. The signing script builds its PEM the same way, line for line, and says so in a comment, so that the format the CI verification exercises is the format the installer will see.

Order matters in the installer. It fetches SHA256SUMS.txt, then immediately fetches the signature and verifies it, and only then looks up the expected hash for this platform’s file and starts the large download. A missing signature, a missing openssl, or a signature that does not verify each stop the install with a message naming the release tag. The whole script body sits inside a main function called on the last line, so a curl | sh that is cut off partway runs nothing.

Pinning the signer on macOS

On a Mac the installer already ran codesign --verify --deep --strict on the staged app. That check passes for any validly signed bundle, including one signed by somebody else. The release now also bakes a code requirement, passed to codesign with -R, which depends on how the build was signed.

  • Developer ID builds must be anchored to Apple, carry the app’s bundle identifier, and have a leaf certificate whose organizational unit is our Apple Team ID. That ID comes from a repository variable, and the build job checks that the app it just signed actually carries it, so a misconfigured variable fails the build rather than producing an installer that rejects its own app.
  • Self-signed builds must carry the bundle identifier and a leaf certificate with a specific SHA-1 fingerprint, also from a variable and validated as 40 hex characters.
  • Ad-hoc builds name no signer, so there is nothing to pin. They keep the plain integrity check.

If the check fails, the staged copy of the app is deleted before the script exits with an error.

The updater stops trusting the feed’s word

The same change tightened the in-app updater. Before, a packaged build with an update feed but no update keys would read the feed’s manifests unsigned. Now the updater is only constructed when the build has a feed and update keys that all parse. Without keys, the build logs that updates are off and does not check for them at all. With keys, it fetches the detached signature beside each manifest, accepts the manifest only if the signature verifies under one of the keys, and after a download checks the file’s name and SHA-512 against the verified manifest, deleting it on a mismatch. Downloads still start only when the user asks, and nothing installs itself on quit.

We changed this because the fallback was the weakest path: a build that quietly accepts unsigned manifests when its keys are missing is only as safe as the build configuration. Turning updates off is a visible, recoverable state.

Where this stands today

The signed checksum list covers what install.sh downloads, not install.sh itself. The install command fetches the script from the same release it then checks, so the key it trusts arrived alongside the files it is checking. The README says this plainly and lists serving install.sh from outside the release, with the public key committed in source, as planned work. Until then, the stronger statement about the script comes from provenance, which someone has to check by hand with gh attestation verify; the installer does not do it.

The checksum signature is opt-in at the workflow level. With the public key variable unset, the baked RELEASE_KEY is empty and the installer skips the signature step. Each published script trusts the key it shipped with, so a key rotation only affects releases published after it. Linux AppImages and ad-hoc Mac builds get the signed checksum list but no code signer pin, and Windows users installing from the setup executable do not go through install.sh at all; for them the in-app updater’s signed manifests are the check that applies. And builds that predate signed feeds do not gain an updater after the fact: they need one manual install of a signed release first.