Skip to content

Add a self-updater verified against the key - #15

Merged
v0id-user merged 63 commits into
mainfrom
claude/quirky-cerf-o88z2h
Nov 30, 2026
Merged

v0id-user merged 63 commits into
mainfrom
claude/quirky-cerf-o88z2h

Conversation

@v0id-user

@v0id-user v0id-user commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

The self-updater from #13 (its three commits, unchanged), with main merged in and the review's findings fixed. It replaces #13.

What the updater does (from #13): the app checks https://dl.hbx.sh/desktop/downloads.json for a newer version, fetches this platform's package from the same origin over HTTPS with no redirects, verifies its ML-DSA-65 statement against keys/desktop-release.pem before downloading the package, checks its size and SHA-512 against the signed statement, then installs it (AppImage swap on Linux, bundle swap from the disk image on macOS, the NSIS installer silently on Windows) and restarts. Any refused check removes what it downloaded and installs nothing.

Fixed here:

  • A server that stalls after connecting could hold the updater forever: every read now times out after 30 s, small requests after 60 s in all, the package after an hour in all. A test serves a connection that never answers and one that stops mid-body; both are given up on in under a second with a short timeout, and the test fails (after 60 s) when the read timeout is removed.
  • A package left behind when installing failed: it is removed on every failed install, the Windows handoff removes the installer whether the install succeeded or not, and packages a crashed run left in the stage are removed when the next update starts.
  • Between verifying and installing, the package was reopened by path. Linux now hashes exactly the bytes it copies beside the AppImage and renames them in only when they are the verified SHA-512; macOS checks the disk image's digest again right before attaching it, and Windows right before handing the installer over and again in the handoff script before running it.

Checked: cargo fmt, clippy with warnings as errors, and the 44 Rust tests (new: the stall, the failed-install cleanup, stale packages, a package changed after verification on Linux and through the recheck); biome ci. The three-platform builds and the updater's own CI step run in this pull request's Build.

Reviewed and kept: the packaged test path (the self-test-update flag) accepts only a loopback feed, and whoever can start the app with arguments can already replace it, so it gives nothing to anyone. The Windows installer is per-user, so the handoff never asks for elevation.

A Tauri 2 app with a Svelte 5 window in the vendored design system.
It installs hermitbox v0.2.0 with the release's own installer, natively
on Linux, in a Lima VM on macOS and in its own WSL2 distribution on
Windows; shows the sandboxes live; opens a shell and previews; and
connects agents with their own tools. CI builds and self-tests the
packages on all three; dl.hbx.sh serves them.
Lima's guest lets its user linger so hermitbox's systemd user service
outlives the shell that started it. The self-test's shell check waits
only for the echo answer, which the process tier's static shell gives.
Build runs on pull requests and main. The download page puts its copy
on the sky and gives the one-click targets their plug icon. Adds the
script that pins a published hermitbox release.
dl.hbx.sh serves /desktop/downloads.json (id, url, bytes, sha512) and
each version's files under /desktop/<version>/, named Hermitbox-*.
A version publishes once, when Cargo.toml raises it. The page reads
the same list and shows SHA-512 sums.
When the release environment holds the desktop's key, publishing writes
a statement per file (product, version, target, SHA-512), signs it with
ML-DSA-65 and lists it in downloads.json. Without the key, files go out
with their SHA-512 alone.
keys/desktop-release.pem is the public half of the release environment's
ML-DSA-65 key. Publishing derives it from the secret and stops on a
difference. The download page shows each file's statement and how to
check it once they are published.
LIMA_HOME moves to ~/.hermitbox-lima: under Application Support the
instance's SSH socket path reached 104 bytes, macOS's UNIX_PATH_MAX,
and limactl refused to start. A test keeps the longest socket under it
for a 32-character user name. Downloads report progress per 8 MiB.
Bundling leaves target/release's exe unsigned; the installer and the
app it installs are what users run, so those are checked.
pins.json takes v0.2.0's install.sh by its SHA-256, and the window's SDK
is the release's own hermitbox-0.2.0.tgz in place of the copy packed
from the release commit.
The app makes its directories 0755 (its data 0700) whatever the umask:
a desktop session's 002 left a new ~/.local group-writable, and the
installer refuses that. The self-test starts the preview server with an
idempotency key, as the sandbox agent requires, and checks Claude Code's
own health check reports hermitbox connected.
Samples are placed by their own ISO time (the stream's outer time is
Postgres text), the axis shows the last two minutes, plots fill their
card, and a number hermitbox does not report reads as no samples, not
an empty axis. IDs show their first 8 characters. test/real.mjs drives
the built window against a running hermitbox: create, type in the
shell, read the answer, delete.
The copy buttons copy the canonical agent prompt from the docs' agents
page, the row reads 'or add to your agent', ChatGPT has no button, and
the download page's links go to the docs' agents page or Cursor's
installed-path link. The page says no build is published, with the
Linux install line, until downloads.json lists one, and shows signing
only then. The README follows. The self-test waits for the preview
server's port and, if it fails, reports the server's state and output.
CI runs the Worker's types and tests.
On the plain process tier a sandbox may not write /tmp (the CI runner's
policy refused mkdir /tmp/preview); the sandbox's working directory is
its own.
scripts/check-download.ts downloads what dl.hbx.sh lists and checks each
file's SHA-512 and ML-DSA-65 statement against keys/desktop-release.pem;
the publish job runs it after uploading. A push now waits for the
running build instead of cancelling it.
claude mcp add reads --env as a list, so with a variable (LIMA_HOME on
macOS) the server's name after it was taken as one more variable and the
add failed. The name now comes first, as both CLIs' usage allows.
Copy buttons say copied only once the clipboard took the text, and
offer the text to copy by hand otherwise; the design system's bindCopy
reports copied either way. The page's headings, casing and macOS signing
line, the README's structure and commands, and the decision record's
casing follow the docs style guide.
The next version publishes on dl.hbx.sh once main builds it; it will
carry hermitbox v0.2.1 when that release is out.
pins.json takes v0.2.1's install.sh by its SHA-256 and the window's SDK
is the release's hermitbox-0.2.1.tgz. Where an older hermitbox is
installed, the app runs the pinned installer and then hermitbox upgrade,
since hermitbox up keeps the bundle it has; tested here from 0.2.0 to
0.2.1 as an ordinary user.
The Actions cache restores src-tauri/target, older versions' bundles
included, so 0.1.1's first publish found the 0.1.0 rpm beside the new
one and uploaded it under the 0.1.1 name. CI now clears the bundle
directory before packaging, and publish.sh takes only files that carry
the version and refuses two packages for one target.
biome.json, .editorconfig and rustfmt.toml take hermitbox's settings;
the vendored design system and generated files are left out.
Formatting and Biome's recommended fixes only (template literals, one
forEach body); no behaviour changes. cargo test, clippy, svelte-check,
the window smoke test and the Worker's tests pass as before.
The Window job runs biome ci; the App jobs already run cargo fmt
--check. Biome 2.4.8 is recorded in docs/decisions.md.
The download page asks the browser for its platform and architecture
(client hints, then navigator.platform and the user agent), puts that
card first, marks it and gives it the page's one main button. A Mac
whose browser does not say its chip gets both Mac builds and how to tell
them apart. Unknown machines keep the usual order. Each card's files
follow its own order, so Linux's main download is the AppImage.
test/machine.mjs checks six visitors in Chromium in the Window job.
Build on main runs scripts/github-release.sh after publishing: it takes
the version's files, statements, signatures, SHA512SUMS and key from
dl.hbx.sh, checks each again, and creates release v<version> on the
commit that built it, saying plainly that the macOS and Windows builds
are self-signed. The Release workflow does the same, on dispatch, for a
version published before.
Biome's lineWidth is 80 (its default) and rustfmt's max_width 100 with
its default heuristics, so code breaks across lines rather than filling
the width; .editorconfig says the same. As hermitbox and site.
Formatting only, with the new widths; cargo test, clippy, svelte-check,
the window smoke test, the Worker's tests and machine.mjs pass.
claude and others added 27 commits November 29, 2026 05:02
Checks https://dl.hbx.sh/desktop/downloads.json for a newer semantic version with no new setting, downloads this platform's package, verifies its SHA-512 and ML-DSA-65 statement against keys/desktop-release.pem before touching the installed app, then installs and restarts.

- src-tauri/src/updater/verify.rs: parses keys/desktop-release.pem via spki, checks pure ML-DSA-65 signatures with ml-dsa 0.1.2, verifies exact release statements, semver ordering, SHA-512 hex digests, and same-origin HTTPS URLs.
- src-tauri/src/updater/mod.rs: checks downloads.json, enforces signed statements and bounded streaming downloads with SHA-512 verification, and cleans up staged files on every refusal.
- src-tauri/src/updater/install.rs: replaces Linux AppImage atomically and relaunches without APPIMAGE_ONLY variables, mounts and swaps Hermitbox.app from verified macOS disk images, and hands off to the verified NSIS /S installer after exit on Windows.
- src-tauri/src/lib.rs and main.rs: exposes update_check and update_install commands plus loopback-only --self-test-update and --write-started flags for CI verification.
- ui/: checks for updates on launch, shows the update action in the top bar and This machine tab, and surfaces any refusal reason in a danger banner.
- scripts/test-updater.ts and .github/workflows/build.yml: proves refusal cases and full install and restart on Linux AppImage, macOS arm64 and x64, and Windows NSIS without changing publish or signing.
- docs/decisions.md: records the updater design and ml-dsa 0.1.2, spki 0.8.1, and semver 1.0.28.

Checked locally: cargo fmt, clippy and test (38 passed, including verifying a published 0.1.3 statement against keys/desktop-release.pem); biome ci; svelte-check; vite build; window smoke test; check-brand.mjs; actionlint; scripts/test-updater.ts on Linux. Packaged Linux, macOS and Windows updater proofs run in CI.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T14:46:06.282181Z 0a12e0e PR opened
🔒 Security Review ✅ Completed 2026-11-30T14:48:45.117594Z 0a12e0e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@v0id-user
v0id-user merged commit eec54ec into main Nov 30, 2026
8 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.

2 participants