Skip to content

Desktop updater: simpler signing gate and .sig check before download (#3705 follow-up) - #3720

Open
holmesworcester wants to merge 3 commits into
developfrom
chore/updater-simplify
Open

holmesworcester wants to merge 3 commits into
developfrom
chore/updater-simplify

Conversation

@holmesworcester

Copy link
Copy Markdown
Collaborator

Follow-up to #3705 (desktop update signature verification, squash 0efc96d). It makes the changes an Opus review of #3705 asked for: a simpler update-signing gate that no longer depends on electron-builder internals, and a .sig checked before the installer is downloaded. Security is not weaker. Every #3705 guarantee is kept and still tested: elevation refusal, installing from a verified private copy, downgrade/prerelease refusal, sign-before-upload, no reuse of a cache from an earlier launch, and a signed statement that binds version, file name and sha512.

Build-side gate (packages/desktop/scripts)

  • Removed: isBuilderCli / explicitlyUnpublished, which canonicalised argv[1] and re-parsed argv with electron-builder's internal yargs. An electron-builder upgrade that moved those internals would have broken every keyless local/PR build.
  • When a key is present it is always used: Windows/Linux artifacts are signed in artifactBuildCompleted, before upload, and verified. A key that is not pinned in update-signing-keys.json still stops the build.
  • When the key is required: only if the build is told to sign, or could publish:
    • QUIET_REQUIRE_UPDATE_SIGNING=1, which is now set on the Linux and Windows release steps in desktop-build.yml. Any other non-empty value is an error.
    • S3 publishing credentials are reachable. That covers any AWS credential variable, including the legacy AWS_ACCESS_KEY/AWS_SECRET_KEY and the AWS_PROFILE/AWS_*_FILE overrides, and ~/.aws/credentials or ~/.aws/config in the default location. electron-builder reads that location whatever the override says.
    • Why: a publish that nobody flagged (implicit tag publish, a new workflow, a developer's -p always) is still refused without a key. Only the environment is read. This part came out of the Codex review, rounds 1 and 2.
  • Unchanged: verifyUpdateSignatures.cjs still runs after the release builds.
  • JS-API callers no longer null the hooks: affects mobile-notification-e2e.yml and the two e2e READMEs.

Signature checked before download (src/main/updaterSecurity.ts)

  • Before download: the app fetches <file>.sig and verifies it against the feed's announced version, file name and sha512 before downloading the installer. Before this change, every hardened client re-downloaded the ~150 MB installer every 15 minutes and on every launch whenever a feed had a bad or missing .sig. Now that costs one ≤4 KB request.
  • After download: electron-updater's sha512 check ties the file to the signed hash. The finished file is also re-hashed against the signed sha512, so this does not depend on every download route (full, differential) doing that check upstream.
  • Unchanged: the install-time private copy, re-hash and re-verify.
  • New comment: on the spawnLog wrapper, explaining what it does on Linux (nothing; it is the Windows installer start).

Docs and nits

Tests

  • Desktop jest: 140 suites, 900 passed. updaterSecurity.test.ts: 118/118.
  • Node script tests: 51/51. Also packaged-appimage against a real built AppImage.
  • New: refused before download. For a missing, malformed, wrong-key, replayed or wrong-bytes .sig, the installer is never requested over three consecutive checks; only the .sig is. The control fetches the .sig before the installer.
  • New: other routes. Re-hash binding when a download route skips electron-updater's own sha512 check. Differentially delivered bytes that differ from the signed, announced file.
  • New: gate. Key used whenever present. Wrong key refused. Keyless builds allowed whatever the CI or event labels. Credentials require the key. The flag accepts only 1 or unset.
  • New: matches the real publisher. A differential test checks the gate against the locked S3 publisher's own credential lookup (electron-publish resolveAwsCredentials plus aws4's fallback).
  • New: workflow test. Every workflow step that runs electron-builder with a publish flag or AWS credentials, as run: or as an action's with: command:, must set the flag, have the key, and be followed by verifyUpdateSignatures.
  • Mutation-checked: each of these fails tests:
    • verifying the .sig after the download (16 failures)
    • removing the re-hash
    • dropping the legacy credential names
    • honouring the credential-file override
    • a release step without the flag, including action form and implicit publish
  • Local feed loop (update-loop.test.cjs, real NsisUpdater/AppImageUpdater, feed served by another process): it now also asserts whether the installer was fetched. Linux: pass. Windows 11 VM (Node 20.20.1): 10/10. The installer is never fetched for tampered, wrong-signer, unsigned, garbage, replayed or prerelease cases, and is fetched for the control and the feed-hash mismatch.
  • Real electron-builder runs (Linux AppImage):
    • keyless --publish never: builds, no .sig
    • JS-API dir build with no hook-nulling: builds
    • refused before packaging, no artifact: flag set with no key; unpinned key; QUIET_REQUIRE_UPDATE_SIGNING=true; -p always with dummy AWS_ACCESS_KEY_ID or legacy AWS_ACCESS_KEY and no key
    • keyed (throwaway key pinned temporarily, flag set): signed, and verifyUpdateSignatures passed. The same .sig is correctly rejected against the real pinned keys.
  • Review: Codex (gpt-daybreak-blue-latest) took three rounds: CHANGES REQUESTED, CHANGES REQUESTED, then ACCEPT with no findings.
  • Not run: the local-QSS e2e suites and the Tor smoke. This PR only touches the desktop updater and build scripts.

Residual

🤖 Generated with Claude Code

holmesworcester and others added 3 commits October 27, 2026 10:24
… downloading (#3705 follow-up)

Build side: sign whenever QUIET_UPDATE_SIGNING_KEY is set (a key the app does not
accept still stops the build), and require a key only when
QUIET_REQUIRE_UPDATE_SIGNING=1, which the Linux and Windows release jobs set.
This replaces the argv/yargs detection of `--publish never`, which depended on
electron-builder internals, and JS-API callers no longer need to null the hooks.
A test checks that every publishing Windows/Linux step in desktop-build.yml sets
the requirement and is followed by verifyUpdateSignatures.

Runtime: fetch and verify the .sig against the feed's announced version, file name
and sha512 before downloading the installer, so a bad or missing signature is
refused without a ~150 MB download on every check. The finished file is re-hashed
against the signed sha512 (covering every download route), and the install-time
copy, re-hash and re-verify are unchanged.

Docs: update-signing.md, the JS-API build commands, a one-sentence CHANGELOG
entry; buildEnv.cjs renamed to buildEnv.test-helper.cjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…als are present

Codex review: with only the opt-in flag, a build with publishing credentials but
no flag (implicit tag publish, a new workflow, a developer's -p always) would
upload unsigned installers. Treat AWS credentials in the environment or in the
AWS credential/config files as requiring the key, still without reading any
electron-builder internals, and check every workflow step that can publish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lisher

Codex review round 2: electron-builder's S3 signer also accepts the legacy
AWS_ACCESS_KEY/AWS_SECRET_KEY, and electron-publish reads ~/.aws/credentials from
the default location whatever AWS_SHARED_CREDENTIALS_FILE says. Detect both, test
the detector against the locked publisher's own credential lookup, and check
workflow steps that hand electron-builder to an action as with: command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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