Skip to content

feat(update): sign release checksums and install updates automatically - #402

Merged
fcoury merged 2 commits into
mainfrom
feat/auto-update
Oct 17, 2026
Merged

fcoury merged 2 commits into
mainfrom
feat/auto-update

Conversation

@fcoury

@fcoury fcoury commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Why

Red's updater only notified: users had to run red update or :update themselves, so many sessions stayed on old releases. Installing unattended removes the person who would notice something odd. Today the only integrity check is SHA256SUMS.txt, which is published in the same GitHub release as the archives it describes. Anyone able to change that release could replace both.

What

Signed checksums

  • release.yml signs SHA256SUMS.txt with minisign. The secret key comes from the RED_MINISIGN_SECRET_KEY repository secret. The trusted comment is red <tag> SHA256SUMS.txt, which ties the signature to one release, so an older signed list can't be reused under a newer tag. Before uploading, the step checks the signature against install/release-signing.pub. The release notes explain how to verify releases manually.
  • The updater requires SHA256SUMS.txt.minisig and checks it against RELEASE_PUBLIC_KEYS with minisign-verify, which has no dependencies. It requires prehashed signatures and an exact trusted comment. This applies to manual and automatic installs alike. Keeping a list of keys allows key rotation.

Automatic installs

  • [updates] mode gains auto and makes it the default. notify and off still work. The starter config only has the defaults commented out, so existing users get auto unless they set a mode themselves.
  • The daily check now runs a hidden red update --auto. It installs when the standalone updater owns the executable. Homebrew and source builds fall back to a check only.
  • A held installation lock or an active detached session is a typed Deferred error: logged quietly, retried the next day. A real failure (bad signature, bad checksum, failed self-check) shows one warning, and the binary stays as it was.
  • After a successful install, Red shows "Updated Red X to Y … New sessions will use it." The notice details say the current session keeps running the old version.

How to Test

  1. cargo test --lib update. The fixture tests sign releases with a throwaway ed25519 key and cover:
    • a successful install
    • a checksum mismatch
    • a key that isn't trusted
    • a signature issued for another tag
    • key rotation (any trusted key verifies)
    • lock conflicts being deferred
    • the editor's choice of notice
  2. official_release_keys_are_well_formed ties install/release-signing.pub to the key embedded in Red.
  3. Live check against GitHub, which is how I tested it:
    • Build with Cargo.toml set to version = "0.9.0".
    • Copy the binary into a scratch bin/ with .red-install.toml (schema_version = 1, source = "standalone", target = "aarch64-apple-darwin") and an empty .red-update.lock.
    • Run red update --auto. It fails with latest Red release is missing SHA256SUMS.txt.minisig, because v0.9.1 is unsigned, and red --version still prints 0.9.0.
    • Launch the editor from there with a scratch XDG_CONFIG_HOME. After about a second it shows "Red could not install an update automatically".
  4. Regression path:
    • red update --check and red update --auto on an unmanaged build print "Red 0.9.1 is up to date."
    • mode = "notify" brings back the old notice-only behaviour.
    • mode = "off" disables the daily check.

Release note

The repository secret RED_MINISIGN_SECRET_KEY must exist before the next tag. Without it, the Sign checksums step fails the release on purpose. Releases before this one are unsigned. Users of this release will only ever be offered later, signed releases, so the transition never offers an unsigned candidate.

Red now installs newer stable releases in the background by default. Since
that removes the human from the loop, unattended installs need a stronger
trust anchor than a checksum list published next to the archives it
describes.

The release workflow signs SHA256SUMS.txt with minisign, using a trusted
comment that binds the signature to the release tag. The updater refuses
any release whose checksum list isn't signed by an embedded release key
for that exact tag, for both manual and automatic installs.

[updates] mode gains "auto" (the new default) next to "notify" and "off".
Builds the standalone updater doesn't own fall back to notifying; a held
installation lock or detached session defers to the next daily check; a
failed install warns once and keeps the current version.
@fcoury
fcoury merged commit f0be225 into main Oct 17, 2026
25 checks passed
@fcoury
fcoury deleted the feat/auto-update branch October 17, 2026 16:07
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