Skip to content

Lesson 8 of 9 · 27m

Auto-Update Without Creating a Malware Loader

Update feeds, signatures, staged rollout, rollback, and user consent — how to ship fixes quickly without making the updater your biggest exploit primitive.

Your updater is the most powerful feature in the application: it downloads executable code and replaces the program users trust. That makes it both your fastest incident-response tool and your most valuable attack surface. Build it with the same seriousness as payment processing.

Use the platform mechanisms deliberately

Electron's autoUpdater supports Squirrel-based flows on macOS and Windows; Linux distribution often belongs in package repositories or AppImage-specific mechanisms. electron-updater wraps much of the operational detail:

const { autoUpdater } = require("electron-updater");

autoUpdater.autoDownload = false;
autoUpdater.on("update-available", async (info) => {
  const accepted = await promptUserForUpdate(info.version);
  if (accepted) autoUpdater.downloadUpdate();
});
autoUpdater.on("update-downloaded", () => {
  notifyReadyToInstall();
});

Automatic download and immediate restart are convenient until the app is a document editor, meeting client, or forensic tool. Decide what user consent means for your product. Interrupting active work is not a security feature.

HTTPS is necessary and insufficient

TLS protects transport, but a compromised update server can still publish malicious artifacts. The update chain should verify package signatures using keys independent of the web server. macOS uses Developer ID/notarization as part of platform trust; Windows packages must be Authenticode signed. For custom update systems, use a signing design where release keys are offline or tightly controlled and metadata expiry/versioning prevents rollback attacks.

Versioning is a security invariant

Never accept an update whose version is older or equal unless rollback is explicitly designed. Record minimum supported versions and migration constraints. A compromised server offering 1.0.0 to every client should fail validation even if transport is perfect. Keep update metadata small, signed, timestamped, and cache-aware.

Staged rollout beats prayer

internal -> 1% -> 10% -> 50% -> 100%

At every ring, watch crash rate, startup failure, update failure, and support signals. Desktop apps run on heterogeneous machines; GPU drivers, endpoint protection, corporate proxies, and missing permissions produce failure modes your test laptop never will. Rollout automation needs a kill switch you can operate while tired.

Failure behavior matters

Partial downloads must resume or restart cleanly. Corrupt artifacts must be deleted, not retried in a hot loop. Update checks should back off with jitter. If installation fails, the app must remain in its previous working state — never half-copied. Log enough detail to diagnose failures without uploading user file paths or sensitive document names to analytics.

Field notes

  • Test behind a proxy, captive portal, flaky network, sleeping laptop, and low disk space.
  • Never update while an external removable drive hosts the running binary; desktop users do strange things.
  • Keep release notes factual and versioned; update prompts are trust-building UI.
  • Practice rollback before you need it. A broken updater with no rollback path is a company-level incident.

Was this lesson helpful?

Sign in to rate