What it does
- 9-step verification, signature first
- Defenses against downgrade, freeze, path traversal and bombs
- Resumable download, mirror failover and bandwidth limit
- Journaled apply with recovery at startup
- Automatic rollback after 3 unconfirmed startups
- bsdiff-style deltas
- <code>etl-update</code> publisher: keygen, pack, delta, manifest, verify
Measured
- 4 GiB artifact downloaded and verified with zero allocations
- Simulated power loss at each of the 42 disk operations of an apply: none leaves a mixed installation
- Up to 65,536 files per artifact, with the file list inside the package
Known limits
- Apply on reboot (<code>eOnReboot</code>) and platform packages are not implemented
- Deflate and gzip only (no zstd or lzma). The staging area must be on the same volume as the installation
Ethereal::Updater · Tier 1
An updater is a remote code execution channel built on purpose. Every design decision follows from that sentence. If the signature check is wrong, or runs in the wrong order, or can be skipped, the customer has shipped a back door to every machine that runs their product. A build without
ETL_UPDATERcontains none of this, byte for byte.
---
What this module does
Asymmetric, Ed25519 over a signed manifest, plus a SHA-256 hash per artifact and per file inside that manifest. The module does not link Crypto: it declares ISignatureVerifier and IHasher and receives the implementations through the Ethereal::UpdaterCryptoGlue glue (Glue::CEd25519ManifestVerifier, Glue::CSha256UpdateHasher). It starts no thread and opens no socket on its own. The network comes in through the ITransport (the manifest) and IDownloadTransport (the artifact) seams, and the integrator calls Tick. The idle cost is exactly zero.
It supports four integration forms (spec §0), and check-only is first-class: an integrator on Linux with a distro package, on macOS with MDM, or under a policy that forbids self-update, uses the module as a version and manifest client and delivers through their own path.
---
The verification order, structural
The sequence in spec §2.2 is mandatory, and the design of the code enforces it. It does not depend on convention:
- Fetch the manifest bytes (
ITransportseam). - Verify the signature.
DecodeAndVerifyis the only gate. - Parse the manifest. No payload byte is touched before step 2 passes.
- Freshness and version floor.
- Download to
<stage>/<hash>.part, computing the hash as the bytes arrive. - Check the artifact hash against the signed manifest. Only then does the
.partbecome.artifact. - Decompress and unpack as a stream into
<stage>/stage. - Check each staged file against the signed file list (path and hash. The mode applied is the signed one). An extra, duplicated, missing or differently hashed file stops everything.
- Apply with a journal (see below).
All nine are implemented and tested. A step only starts when the previous one finished cleanly: there is no path in which unchecked bytes reach the installation folder.
---
The attacks handled by name (spec §2.3)
| Attack | Mitigation | Where |
|---|---|---|
| Downgrade / rollback | monotonic version floor, never below the highest already seen | PassesVersionFloor |
| Freeze | the manifest carries signed issue and expiry times. An expired one, or one older than the last seen, is refused | JudgeFreshness |
| Mix and match | the manifest covers the entire set of files and their hashes as one signed unit | format. The stage checks the entire list |
| Path traversal (zip-slip) | each path is refused if it is absolute, contains .., a drive root, UNC, an NTFS stream (:), or a reserved device name | IsSafeRelativePath, in the manifest and in the package |
| Endless data | the download aborts with eSizeExceeded on the first byte past the signed size | TickDownload |
| Decompression bomb | the inflate stream has a ceiling (≈1024 × the artifact, never more than 16 GiB), and anything past the useful size would never have the right hash | CStagingJob |
| Delta against the wrong source | the patch carries the source hash. An installation that does not match gives eDeltaSourceMismatch and the client falls back to the full artifact | ApplyPatch |
---
The download
params.pDownload = &meuTransporte; // IDownloadTransport: Open(url, offset) / Read / Close
params.pHasher = &sha256; // Glue::CSha256UpdateHasher
std::strcpy( params.aStagingDir, "..." ); // on the same volume as the installation
upd.BeginDownload( info ); // does not block
while( upd.Tick() == EStatus::ePending ) { /* the integrator's loop */ }- It does not block. Each
Tickreads at mostuBytesPerTick(1 MiB by default). TheIDownloadTransport::Readreturns what has already arrived, without waiting. - It resumes. A
<hash>.partfrom a previous run has its hash recomputed (also in pieces, inTick) and the request continues from that byte. A server that does not resume mid-file (eRangeUnsupported) makes it start over from zero. - Mirrors. A URL that fails
uRetriesPerUrltimes moves on to the next one. All of them down giveseTransportError. - Bandwidth limit.
uMaxBytesPerSecond, measured by theIClock. - Memory. The buffer is 64 KB and lives inside the object. A 4 GiB artifact is downloaded and checked with zero allocations in the
Tickcalls (measured inFourGiB. 256 MiB in the sanitizer trees, which are slow). TheCUpdatertakes about 105 KB.
---
Applying, the journal and power loss
BeginApply( strategy ) builds the stage (in Tick) and then:
| Strategy | What it does | Status |
|---|---|---|
eRenameReplace | swaps immediately, with a journal: the old version goes to the backups, the new one comes in by rename | ✅ |
eOnNextLaunch | only builds the stage. The next launch calls ApplyStaged before loading the rest | ✅ |
eExternalHelper | builds the stage. A helper (etl-update apply-staged --wait-pid N) waits for the app to close and applies | ✅ |
eOnReboot | MoveFileEx delayed until reboot (Windows) | ❌ eNotImplemented: it writes to HKLM, requires administrator rights, and this machine does not have that available to test |
eCheckOnly | nothing to apply. The integrator delivers | ✅ eOk immediately |
An artifact of type ePackage (msi, deb, pkg) belongs to the integrator's installer: BeginApply returns eNotImplemented. The eFull and eDelta artifacts are applied.
The journal (<installation>/.etl-update/journal, text, written by .tmp + fsync + rename + fsync of the folder) goes through the states S (staged), P (applying), C (applied, awaiting confirmation), R (rolling back) and K (confirmed, backups being removed). The backups of the old version stay in .etl-update/backup/.
At startup, before loading the rest, the app calls RecoverInstall: a P or R interrupted midway is undone (or finished), and the startup sees eClean, eStaged or ePendingConfirmation.
Power loss was injected at every operation that touches the disk (PowerLossTests, with a file system that "powers off" at operation k and loses whatever was not synced). A full apply has 42 operations. In 41 of them the installation returns to the complete old version, in the remaining one it is already at the complete new version, and in none is it mixed or corrupted. With a removed file (see below), 45 operations: 44 old, 1 new, none mixed (the removed file is present in the old version and absent in the new one). After each failure, a new apply runs to completion.
Removed files. On confirmation, the release's list is kept in .etl-update/installed (the record of what the updater installed). On the next apply, a path that was in the record and is no longer in the new list is removed through the backup path: it goes to .etl-update/backup, enters the journal (drop), and a rollback puts it back. It is only deleted for good on confirmation. Without a record (the first update of an installation made by an installer) nothing is removed: the updater only deletes what it installed itself. The user's files, which are not in any list, always stay.
Health. NotifyLaunch counts launches without ConfirmHealthy. Past uMaxUnconfirmedLaunches (3), it rolls back to the old version on its own. ConfirmHealthy writes K first and only then deletes the backups. RollbackInstall rolls back manually before confirmation.
---
Large artifacts: the list in the package
The manifest has a fixed size in memory: it carries at most 16 files per artifact, with paths of up to 63 bytes. A larger artifact (manifest schema 2) carries, instead of the list, the hash and the count of a list (uListCount, aListHash), and the list travels as the first entry of the package (.etl-files, EPackageEntryKind::eFileList, format ETLFL1 in filelist.hpp). The stage computes its hash while reading it, checks it against what the manifest signed, and only then uses it as the signed list. Up to 65,536 files and 255-byte paths.
The list is canonical (sorted, no duplicates: the same list gives the same bytes) and the reader refuses anything else. Tested end to end with 40 files with long paths, and each corruption refused without touching the installation: the list is not the signed one (eHashMismatch), the count does not match, the package does not carry it, one extra file, one missing file. A schema 3 manifest (newer than this client) is a clean refusal (eSchemaTooNew).
---
Deltas
Format ETLUDLT1, in the style of bsdiff: the new size, and three raw deflate blocks (the controls, the differences and the extra). The suffix sort is Larsson-Sadakane, and the recursion goes only into the smaller partition (the stack stays at O(log n)). Files of up to 512 MiB.
In a package, a patch entry carries the source hash. The stage checks the installed file before applying the patch and checks the result against the signed list. If the manifest also carries the full artifact, a source that does not match switches the download to it (eDeltaSourceMismatch, and the state goes back to eUpdateAvailable).
---
The publisher: etl-update
Separate target (ETHEREAL_UPDATER_TOOL), in C++, for the publisher's CI:
| Command | Does |
|---|---|
keygen <prefix> | Ed25519 pair: <prefix>.key (mode 0600) and <prefix>.pub |
pack <folder> <output> [--deflate] [--list] | the ETLUPKG1 package of a folder. With more than 16 files or a path of 64 bytes or more (or --list), the list goes in the package |
delta <old> <new> <output> [--deflate] [--list] | a package of patches. A file only becomes a patch when the patch is smaller |
manifest <spec> <output> --key <f.key> --keyid N | reads a text specification, signs it, and checks again what it wrote. files = <folder> uses the same rule as pack (embedded list or in the package). list = <folder> forces the list into the package, like --list |
verify <manifest> --pub <f.pub> --keyid N | checks and displays |
apply-staged --install <p> --staging <p> [--wait-pid N] | the helper for the eExternalHelper strategy |
---
The client API
Everything is driven by Tick. The integrator owns the thread, the cadence and the lifetime, which makes the module usable the same way in a game loop, a service loop, a GUI loop and a CLI.
CUpdater upd;
upd.Init( params ); // verifier, clock, transport; download/hash/folders for applying
upd.BeginCheck(); upd.Tick(); // -> eUpdateAvailable / eNoUpdate / error
SUpdateInfo info; upd.GetAvailable( &info );
upd.BeginDownload( info ); // Tick until it stops returning ePending
upd.BeginApply( EApplyStrategy::eRenameReplace ); // Tick until ePendingRestarteUrgency is always advisory: the module never forces anything. Even Mandatory arrives as a state the integrator decides on. A library that reboots someone's machine because a manifest said so is a lawsuit.
---
The C layer: client only
ethereal/c/updater/updater.h. The opaque handle, BeginCheck, Tick, State, the accessors, BeginDownload, DownloadedBytes, ArtifactPath, BeginApply, Cancel. The startup functions (ETLC_UpdRecover, NotifyLaunch, ConfirmHealthy, Rollback, ApplyStaged). And the pure functions (version, safe path, rollout bucket). The seams cross as function pointers, including the download (pOpen/pRead/pClose) and SHA-256 (pHashInit/pHashUpdate/pHashFinal), because the core does not link Crypto.
The download and apply fields were appended at the end of ETLC_UpdParams and are only read when iStructSize covers them: a binary built against the old structure keeps verifying, and the download is refused in it. The updater test suite makes the full round trip through the C layer (verification, download, apply, startup, rollback) with the C seams on top of the real Ed25519 and SHA-256. The publisher has no C layer.
---
Implementation status
Against the spec's acceptance table (§14). Measured by updater (149 checks), updater.cabi.c11/c17 (38 each, the C surface compiled as C), updater.tool (27, the publisher end to end, including a release of 302 files with one removed file) and updater.fuzz.
| Criterion | Status |
|---|---|
| Disabled build identical byte for byte | ✅ sources out of the build, behind ETHEREAL_UPDATER |
| Idle cost: zero threads/sockets/wakeups | ✅ nothing runs outside an armed Tick |
| Verification order (parse unreachable with a bad signature) | ✅ DecodeAndVerify is the only gate. Tested |
| Bad signature: payload/keyId/truncated/magic | ✅ all four refused |
| Downgrade below the floor | ✅ eDowngrade |
| Freeze: expired refused, stale refused | ✅ eExpired / eStale |
| Path traversal (hostile corpus) | ✅ IsSafeRelativePath, corpus in the test, and hostile packages |
| Rollout bucket stable and ~uniform | ✅ tested (stability + distribution) |
| Entitlement (update window) | ✅ eNotEntitled reports instead of hiding |
| Platform without an artifact | ✅ eUnsupportedPlatform |
| Deterministic packaging | ✅ the same manifest gives identical bytes |
| Memory: 4 GB package within budget | ✅ the 4 GiB download with zero allocations. ⚠️ the stage was not measured at 4 GiB (it is streamed, with fixed buffers) |
| Endless data: aborts at the signed size | ✅ eSizeExceeded |
| Resumable download, mirror failover, bandwidth limit | ✅ all three, plus a server without resume, a wrong hash, all mirrors down |
| Atomic apply: stage, journal, fsync, rename | ✅ |
| Power loss at every step (fault injection) | ✅ 42 operations (45 with a removed file), none leaves the installation mixed |
| Large artifacts (more than 16 files, long paths) | ✅ (2026-09-29) the list in the package, signed by the manifest (schema 2): up to 65,536 files, 255-byte paths |
| Files removed in a new version | ✅ (2026-09-29) through the record of what the updater installed. Reversible until confirmation |
| Self-replacement (4 strategies × 3 platforms) | ⚠️ 3 strategies on Windows and Linux. eOnReboot no. macOS no (there is no Mac here) |
| macOS bundle / package manager path | ❌ the bundle no. ePackage returns eNotImplemented (it belongs to the installer) |
| Rollback + health (rolls back after N unconfirmed launches) | ✅ |
| Deltas (bsdiff, source hash, fallback to full) | ✅ |
Publisher (etl-update, keygen/pack/delta/manifest/sign) | ✅ plus verify and apply-staged |
| Parser fuzzing | ✅ the manifest, the package, the delta and the file list (ethereal_updater_fuzz. 30,000 iterations in ctest, long campaigns by hand. It reports how many inputs each reader accepted) |
| Sanitizers ASan/UBSan/TSan | ✅ the entire test suite passes under all three |
Legend: ✅ done and tested · ⚠️ partial · ❌ not yet.
Known limits
- 65,536 files per artifact, paths of up to 255 bytes (
FILE_LIST_MAX_FILES,FILE_LIST_MAX_PATH), with the list in the package. 16 and 63 with the list embedded in the manifest. - Removed files are only removed after an update confirmed by the updater: the first update of an installation made by an installer deletes nothing (there is no record of what belongs to the updater). Folders that become empty remain.
- Streaming compression is deflate and gzip.
eZstdandeLzmagiveeNotImplemented(they are not in this library). - The stage must be on the same volume as the installation: the atomic
renamedoes not cross volumes. - Replacing a running executable on Windows (it is renamed, and the new one takes its name) was not measured with a live process. The tests swap ordinary files.
---
Non-goals
Hosting the update server, a CDN, building distro packages (deb, rpm, MSI, pkg), app store submission, OS-level patch management, plugin/content updates separate from the application, peer-to-peer distribution.