Repository navigation
electron-updater@7.0.0-alpha.15
Pre-release
Pre-release
Immutable
release. Only release title and notes can be modified.
Major Changes
- Feat(updater)!: a missing NSIS update installer (
ENOENT) fails the install withERR_UPDATER_INSTALLER_START_FAILED; electron-updater neither starts it elevated nor opens it with the shell.quitAndInstall()and the install on launch wait for the installer to start and keep the app running when the start is refused or fails.elevate.exe(forisAdminRightsRequiredand the retry afterEACCESorUNKNOWN, e.g. AppLocker or WDAC rules that let only administrators run the installer) runs only when the current user cannot modify it, its folder or the install folder of the app; elsewhere the installer is started directly, which installs in an app that runs with administrator rights and fails withERR_UPDATER_INSTALLER_ELEVATION_REFUSEDin any other, so an update cannot switch an app installed per user to a per-machine build unless the app runs with administrator rights: install per-machine apps into a folder only administrators can write, e.g. withnsis.perMachine: true#10660f0dc4dd - Fix(updater)!: on Linux, run the elevation helper (
pkexec,gksudo,kdesudo,beesu, elsesudo) and the package manager only from/usr/sbin,/usr/bin,/sbinand/bin, by absolute path, never a copy elsewhere in the app'sPATH(a helper found only elsewhere is skipped with a warning; a package manager, orsudoas the last helper, found in none of them fails withERR_UPDATER_ELEVATION_COMMAND_NOT_FOUND); undergksudo,kdesudoorbeesu, run the package manager in a clean environment (env -i, aPATHof those directories), so the app's environment variables, proxy settings included, do not reach it; and warn once per updater whenpkexecis used althoughgksudoorkdesudois installed in those directories too. See https://www.electron.build/docs/migration/v27-runtime-changes#linux-update-elevation#106641e02ba7 - Feat(updater)!: the app chooses the request headers sent to another origin with the required
autoUpdater.crossOriginHeadersproperty:(headerNames: string[], hop: { from: URL; to: URL }) => string[](theCrossOriginHeadersCallbackandCrossOriginHoptypes),nullby default. electron-updater calls it for each request and redirect to another origin than the update feed (Provider.feedBaseUrl; private GitHub's feed is the GitHub API): a redirect, a download or channel file on another origin, a blockmap or differential range request and their redirects, a private GitHub release asset or GitLab release link on another origin, and a provider's own request there. It gets the lowercase names of the request headers about to be sent, never their values, and returns the names of the ones to send (case-insensitive); the feed's origin gets every header without it. A header it leaves out stays on the original origin:AuthorizationfromaddAuthHeader, a custom header fromrequestHeaders, a provider's token (private GitHub, GitLab), a provider's other request headers andx-user-staging-id. The headers electron-updater builds for each request itself are sent whatever it returns: its defaultUser-Agent,Cache-Control, theAcceptit or the provider sets, andRange; an app's ownUser-AgentfromrequestHeadersgoes to another origin only when it keepsuser-agent.autoUpdater.crossOriginHeaders = () => []sends none of the app's headers to another origin. Without a function,checkForUpdates(),checkForUpdatesAndNotify()anddownloadUpdate()emiterrorand reject withERR_UPDATER_CROSS_ORIGIN_HEADERS_NOT_CONFIGURED, whose message names the property and links the migration guide, and so does each request to another origin, such as one of the install at launch of an update marked for the next launch: set it before the app isready. An unpackaged app withoutforceDevUpdateConfig, which skips the check, gets the same error fromcheckForUpdates()andcheckForUpdatesAndNotify(), so a missing callback shows up in development. A throw, or a result that is not an array of strings, fails that request, unsent, withERR_UPDATER_INVALID_CROSS_ORIGIN_HEADERS. builder-util-runtime:HttpExecutortakes aCrossOriginHeaderPolicy((headers, hop) => headers) for its redirects as its constructor argument, by default electron-builder's, which sends only the headers that carry no credential (Accept,Content-Type,Range,User-Agentand the like);HttpExecutor.crossOriginHeaders(headers, ownHeaders, hop, policy)applies one, andApiRequestOptions.ownHeadersandDownloadOptions.ownHeadersname the headers a request builds itself, which a hop to another origin sends whatever the policy keeps. electron-updater'sProviderRuntimeOptionshas a requiredcrossOriginHeaderPolicy, set by electron-updater, so code that constructs a built-in provider passes on the runtime options it was given. The first time a request to an origin goes without some of the app's or a provider's headers, electron-updater logs a warning, once per origin, naming those headers and both origins (never a value), with a link to the migration guide. AHostheader is never sent to another origin. A provider constructed with runtime options without acrossOriginHeaderPolicyfunction throwsERR_UPDATER_CROSS_ORIGIN_HEADER_POLICY_MISSING. See https://www.electron.build/docs/migration/v27-runtime-changes#cross-origin-headers#10563d699bdf—electron-updater,builder-util-runtime· updated in#10665 - Feat(runtime)!: an
HttpExecutorwithout a cross-origin header policy of its own, such as builder-util'shttpExecutor, sends a redirect to another origin only the headers that carry no credential (Accept,Accept-Encoding,Accept-Language,Cache-Control,Content-Encoding,Content-Language,Content-Length,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Pragma,Range,User-Agent); every other header, a custom credential header such asX-Api-Tokentoo, stays on its origin. builder-util'sNodeHttpExecutorwarns once per process, at the first redirect that leaves out headers other than the well-known credential headers (Authorization,Cookie,PRIVATE-TOKEN,X-Api-Keyand the like), naming them and both origins (never a value). electron-updater keeps its own policy (autoUpdater.crossOriginHeaders). https://www.electron.build/docs/migration/v27-developer-changes#builder-util-runtime-default-cross-origin-headers#1066512bafb3—builder-util-runtime
Minor Changes
- Feat: add the optional
blockMapSha512field toUpdateFileInfo. It is not covered by the manifest signature.decodeBlockMapV3andcheckBlockMapV3Headerreject an empty map (no blocks, or a 0-byte file), a region that is empty or extends past the file, and blocks that do not cover the file#10496d0d4046—builder-util-runtime - Feat: reject block maps that cannot be planned on. An update of unknown, zero or invalid size is downloaded in full without fetching any block map. A block map (v2 or v3, separate or embedded) that is empty, describes a 0-byte file, does not end at the update's size or plans no data is rejected with one log line (
ERR_UPDATER_INVALID_BLOCKMAP) and the update is downloaded in full. When the update manifest has ablockMapSha512for a file, the new block map (downloaded whole, or assembled from Range requests) is checked against it before it is decoded, used or cached, and a mismatch error quotes the manifest value;blockMapSha512is base64 only#10496d0d4046 - Feat(updater): when no
loginlistener takes theurlargument, a server's authentication challenge from another origin than the update feed (Provider.feedBaseUrlof the last update check or of the update being downloaded, orpreviousBlockmapBaseUrlOverride) still reacheslogin, and logs a warning once per updater that the handler cannot tell which origin it is answering. electron-updater 8, the next major version, will cancel such a challenge; take(authInfo, callback, url)and answer only whennew URL(url).originis the origin your credentials are meant for. See https://www.electron.build/docs/features/auto-update#event-login#1066626cae9e
Patch Changes
- Fix(updater): an update pending for the next launch is installed only when the cached file is the installer the target picks from the update info fetched on that launch (new protected
BaseUpdater.findUpdateFile, which picks the first file unless a target overrides it; an updater subclass that downloads another file overrides it to return that file, and otherwise logs a warning and does not install the pending update), and is started with that update info'sisAdminRightsRequired, as a cached update that an update check reuses is. A pending cache that marks the update per-machine makes the automatic install at launch skip it without a request, and a deb, rpm, pacman or AppImage download whose update info has no file for the target rejects withERR_UPDATER_UPDATE_FILE_NOT_FOUND. See https://www.electron.build/docs/migration/v27-runtime-changes#downloaded-updates-are-checked-again-before-they-are-installed#106636f4d55e - Fix(updater): hash the downloaded update again right before it is installed, and verify an NSIS installer's signature again before
quitAndInstall(),installAsync()or the install on launch starts it and before an installer cached by an earlier launch is reused, and refuse to download an update file whose update info has no checksum (ERR_UPDATER_NO_CHECKSUM) with every provider, including GitLab, private GitHub and custom ones#1066147c9a1d - Fix(updater): the Linux install only elevates a bare command name found as an executable regular file in the system directories (
/usr/sbin,/usr/bin,/sbin,/bin), symlinks there followed wherever they lead#10460e15f702— updated in#10664 - Docs:
allowDowngrade,allowPrereleaseandchannelJSDoc: settingchannelturnsallowDowngradeon,allowPrereleasedoes not, and a signed update manifest does not stop a downgrade#10670caab5b2 - Fix: end the unsigned-manifest, invalid-signature and missing web-package checksum errors, the no-key warning and the warning for a full installer downloaded while
disableWebInstalleris set to false (logged once per updater instance) with a migration-doc link; the nsis-web installer's abort for an update started without--package-fileno longer prints a link#10671e9481ec - Fix(updater): with
allowPrerelease, private GitHub repositories now pick the highest release eligible for the current channel, as public GitHub repositories do, instead of the first pre-release in the API list, so a pre-release user gets a newer stable release, a beta user is not offered alpha builds, and settingchannelno longer installs an older pre-release; with a customtagNamePrefix, tags without the prefix are skipped, and releases whose tags are not versions keep the list-order pick. On both public and private GitHub, a numbered pre-release (such as1.0.1-1) is no longer treated as a channel named1, so it is offered1.0.1-2and1.0.1. The channel's own channel file (such asbeta.yml) is read when the release has it, and a release list with no eligible release, or a malformed/releases/latestresponse, fails with anERR_UPDATER_*code instead of aTypeError#10519b84d440 - Fix(updater): pick the update file for the app's arch by name instead of by its position in the update manifest; when no file names the app's arch, prefer one that names no other arch. With
nsis.buildUniversalInstaller: false, an x64 app no longer installs the ia32 or arm64 installer listed before its own, and an app built withdefaultArchno longer installs another arch's installer#10518f675d75