app-builder-lib 27.0.0-alpha.13 → 27.0.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/hsmSignManager.js +3 -2
- package/dist/codeSign/win/hsmSignManager.js.map +1 -1
- package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -1
- package/dist/codeSign/win/pkcs11SignManager.js +2 -1
- package/dist/codeSign/win/pkcs11SignManager.js.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +15 -5
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/configuration.d.ts +78 -20
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/indexInternal.d.ts +5 -3
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +4 -3
- package/dist/indexInternal.js.map +1 -1
- package/dist/options/FileAssociation.d.ts +1 -1
- package/dist/options/FileAssociation.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +4 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +13 -3
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +9 -6
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +2 -2
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +22 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +115 -66
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +10 -8
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +5 -0
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +102 -24
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/manifestUploadCheck.d.ts +12 -0
- package/dist/publish/manifestUploadCheck.d.ts.map +1 -1
- package/dist/publish/manifestUploadCheck.js +84 -12
- package/dist/publish/manifestUploadCheck.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +12 -7
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/publish/updateManifestVerifier.d.ts +54 -0
- package/dist/publish/updateManifestVerifier.d.ts.map +1 -1
- package/dist/publish/updateManifestVerifier.js +121 -1
- package/dist/publish/updateManifestVerifier.js.map +1 -1
- package/dist/publish/updaterSettingsCheck.d.ts +8 -0
- package/dist/publish/updaterSettingsCheck.d.ts.map +1 -0
- package/dist/publish/updaterSettingsCheck.js +136 -0
- package/dist/publish/updaterSettingsCheck.js.map +1 -0
- package/dist/targets/ArchiveTarget.js +1 -1
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +4 -3
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/blockmap/blockmap.d.ts +30 -0
- package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
- package/dist/targets/blockmap/blockmap.js +99 -31
- package/dist/targets/blockmap/blockmap.js.map +1 -1
- package/dist/targets/blockmap/blockmapV3.d.ts +36 -0
- package/dist/targets/blockmap/blockmapV3.d.ts.map +1 -0
- package/dist/targets/blockmap/blockmapV3.js +41 -0
- package/dist/targets/blockmap/blockmapV3.js.map +1 -0
- package/dist/targets/blockmap/verbatimRange.d.ts +6 -0
- package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -1
- package/dist/targets/blockmap/verbatimRange.js +11 -0
- package/dist/targets/blockmap/verbatimRange.js.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.d.ts +92 -4
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +266 -10
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +1 -1
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +23 -31
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +6 -14
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.d.ts +4 -3
- package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.js +10 -6
- package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +8 -0
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +42 -9
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +13 -9
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +22 -3
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +70 -29
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/MsiTarget.d.ts +7 -0
- package/dist/targets/win/MsiTarget.d.ts.map +1 -1
- package/dist/targets/win/MsiTarget.js +140 -21
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/targets/win/nsis/Defines.d.ts +1 -0
- package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
- package/dist/targets/win/nsis/Defines.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts +3 -0
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +33 -12
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisLicense.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisLicense.js +8 -5
- package/dist/targets/win/nsis/nsisLicense.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +31 -3
- package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts +6 -0
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js +16 -5
- package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +11 -29
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/toolsets/7zip.d.ts +10 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +12 -1
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -0
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +4 -1
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/archive.d.ts +13 -0
- package/dist/toolsets/archive.d.ts.map +1 -0
- package/dist/toolsets/archive.js +55 -0
- package/dist/toolsets/archive.js.map +1 -0
- package/dist/toolsets/custom.d.ts.map +1 -1
- package/dist/toolsets/custom.js +19 -2
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/fpm.d.ts +23 -0
- package/dist/toolsets/fpm.d.ts.map +1 -1
- package/dist/toolsets/fpm.js +52 -19
- package/dist/toolsets/fpm.js.map +1 -1
- package/dist/toolsets/nsis.d.ts +23 -4
- package/dist/toolsets/nsis.d.ts.map +1 -1
- package/dist/toolsets/nsis.js +49 -14
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/winCodeSign.d.ts +20 -1
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +32 -5
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wix.d.ts +44 -0
- package/dist/toolsets/wix.d.ts.map +1 -0
- package/dist/toolsets/wix.js +91 -0
- package/dist/toolsets/wix.js.map +1 -0
- package/dist/util/buildOutputVerifier.d.ts +2 -1
- package/dist/util/buildOutputVerifier.d.ts.map +1 -1
- package/dist/util/buildOutputVerifier.js +41 -63
- package/dist/util/buildOutputVerifier.js.map +1 -1
- package/dist/util/bundledTool.d.ts +8 -0
- package/dist/util/bundledTool.d.ts.map +1 -1
- package/dist/util/bundledTool.js +34 -0
- package/dist/util/bundledTool.js.map +1 -1
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +107 -10
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/electronUpdaterCompatibility.d.ts +64 -0
- package/dist/util/electronUpdaterCompatibility.d.ts.map +1 -0
- package/dist/util/electronUpdaterCompatibility.js +82 -0
- package/dist/util/electronUpdaterCompatibility.js.map +1 -0
- package/dist/util/flags.d.ts +5 -0
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +8 -2
- package/dist/util/flags.js.map +1 -1
- package/dist/util/mac/macosVersion.d.ts +0 -1
- package/dist/util/mac/macosVersion.d.ts.map +1 -1
- package/dist/util/mac/macosVersion.js +0 -21
- package/dist/util/mac/macosVersion.js.map +1 -1
- package/dist/util/packageMetadata.d.ts +14 -1
- package/dist/util/packageMetadata.d.ts.map +1 -1
- package/dist/util/packageMetadata.js +115 -51
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/util/removedEnvVars.js +1 -1
- package/dist/util/removedEnvVars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +8 -8
- package/scheme.json +182 -49
- package/templates/msi/template.xml +5 -5
- package/templates/msiWrapped/template.xml +1 -1
- package/templates/nsis/assistedInstaller.nsh +37 -1
- package/templates/nsis/common.nsh +142 -1
- package/templates/nsis/include/installUtil.nsh +12 -0
- package/templates/nsis/include/installer.nsh +12 -0
- package/templates/nsis/installSection.nsh +3 -0
- package/templates/nsis/installer.nsi +25 -13
- package/templates/nsis/multiUser.nsh +50 -10
- package/templates/nsis/portable.nsi +1 -1
- package/templates/nsis/uninstaller.nsh +6 -0
- package/dist/toolsets/linuxToolsMac.d.ts +0 -8
- package/dist/toolsets/linuxToolsMac.d.ts.map +0 -1
- package/dist/toolsets/linuxToolsMac.js +0 -44
- package/dist/toolsets/linuxToolsMac.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Arch, asArray, AsyncTaskManager, derivePublicKeyPem, exists, InvalidConfigurationError, isEmptyOrSpaces, isPullRequest, log, prepareFixedNameWrite, safeStringifyJson, serializeToYaml, } from "builder-util";
|
|
2
|
-
import { computeUpdateManifestKeyId, getS3LikeProviderBaseUrl, githubTagPrefix, githubUrl, normalizePublicKeyList, } from "builder-util-runtime";
|
|
2
|
+
import { computeUpdateManifestKeyId, getS3LikeProviderBaseUrl, githubTagPrefix, githubUrl, isLoopbackHostname, isValidMaxUpdateInfoSize, normalizePublicKeyList, } from "builder-util-runtime";
|
|
3
3
|
import _debug from "debug";
|
|
4
4
|
import { BitbucketPublisher, getCiTag, GitHubPublisher, GitlabPublisher, KeygenPublisher, R2Publisher, S3Publisher, SnapStorePublisher, SpacesPublisher, } from "electron-publish";
|
|
5
5
|
import { MultiProgress } from "electron-publish/internal";
|
|
@@ -10,6 +10,7 @@ import * as path from "path";
|
|
|
10
10
|
import { Platform } from "../core.js";
|
|
11
11
|
import { missingUpdatePublisherNameError, validatePublisherNameFormat } from "../codeSign/win/publisherName.js";
|
|
12
12
|
import { createUpdateInfoTasks, writeUpdateInfoFiles } from "./updateInfoBuilder.js";
|
|
13
|
+
import { findUpdaterSettingsMentions, warnAboutUpdaterSettings } from "./updaterSettingsCheck.js";
|
|
13
14
|
import { resolveModule } from "../util/resolve.js";
|
|
14
15
|
import { parseUrl } from "../util/pathManager.js";
|
|
15
16
|
import { isPublishForPullRequest } from "../util/flags.js";
|
|
@@ -25,10 +26,11 @@ function checkOptions(publishPolicy) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
|
-
* electron-updater
|
|
29
|
-
*
|
|
30
|
-
* 401/403 at update time, inside a shipped app, with nothing at build time saying why —
|
|
31
|
-
* but cannot be relied on to have been run. Only the query parameter names are logged,
|
|
29
|
+
* electron-updater adds the query string of a generic feed url (typically a token) only to requests on the feed's origin, and sends
|
|
30
|
+
* another origin only the request headers the app's `autoUpdater.crossOriginHeaders` keeps. An app whose latest*.yml points downloads at
|
|
31
|
+
* another origin that relies on that query gets 401/403 at update time, inside a shipped app, with nothing at build time saying why —
|
|
32
|
+
* `migrate-schema` prints a similar advisory, but cannot be relied on to have been run. Only the query parameter names are logged,
|
|
33
|
+
* never the url or the values.
|
|
32
34
|
*
|
|
33
35
|
* @internal exported for tests
|
|
34
36
|
*/
|
|
@@ -42,12 +44,61 @@ export function warnAboutGenericFeedQuery(publishConfig) {
|
|
|
42
44
|
const queryParameters = [...new Set(new URLSearchParams(url.slice(queryStart + 1).split("#")[0]).keys())];
|
|
43
45
|
log.once(`generic-feed-query:${url.slice(0, queryStart)}`).warn({
|
|
44
46
|
queryParameters: queryParameters.length === 0 ? "(none)" : queryParameters.join(", "),
|
|
45
|
-
solution: "serve the update files from the feed origin (relative files[].url, the default)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
47
|
+
solution: "serve the update files from the feed origin (relative files[].url, the default), use pre-signed URLs, or send the credential as a request header " +
|
|
48
|
+
"(requestHeaders / addAuthHeader) that the app's autoUpdater.crossOriginHeaders keeps for the origin that needs it",
|
|
49
|
+
}, "the generic publish url has a query string. electron-updater adds the feed url's query string only to requests on the feed's origin (scheme, host and port), " +
|
|
50
|
+
"such as the channel file and the relative download URLs electron-builder writes: a URL on another origin, such as an absolute download url in latest*.yml, " +
|
|
51
|
+
"keeps its own query string and is requested without the feed's. The request headers from requestHeaders / addAuthHeader go to every request on the feed's origin, " +
|
|
52
|
+
"and to a request or redirect to another origin only the ones the app's autoUpdater.crossOriginHeaders keeps for it. " +
|
|
49
53
|
"See https://www.electron.build/docs/migration/v27-runtime-changes#update-credentials-stay-on-the-feeds-origin");
|
|
50
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* electron-updater rejects an update request over plain http to a host that is not loopback (`ERR_UPDATER_INSECURE_FEED`) unless
|
|
57
|
+
* the app sets `allowInsecureFeed`: a feed in app-update.yml that uses http (a generic or custom `url`, a github `protocol: "http"`,
|
|
58
|
+
* an s3 `endpoint`) fails every update check of the shipped app. The build succeeds (the app may opt in); only the feed origin
|
|
59
|
+
* is logged, never its path, query or user info.
|
|
60
|
+
*
|
|
61
|
+
* @internal exported for tests
|
|
62
|
+
*/
|
|
63
|
+
export function warnAboutInsecureFeed(publishConfig) {
|
|
64
|
+
let url;
|
|
65
|
+
if (publishConfig.provider === "generic" || publishConfig.provider === "custom") {
|
|
66
|
+
url = publishConfig.url;
|
|
67
|
+
}
|
|
68
|
+
else if (publishConfig.provider === "github") {
|
|
69
|
+
// electron-updater requests the release feed and the GitHub API with this protocol
|
|
70
|
+
const options = publishConfig;
|
|
71
|
+
url = options.protocol === "http" ? githubUrl(options) : null;
|
|
72
|
+
}
|
|
73
|
+
else if (publishConfig.provider === "s3") {
|
|
74
|
+
// electron-updater reads the bucket through the endpoint, unless accelerate selects the (https) accelerated endpoint
|
|
75
|
+
const options = publishConfig;
|
|
76
|
+
url = options.accelerate === true ? null : options.endpoint;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (typeof url !== "string") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
let feed;
|
|
85
|
+
try {
|
|
86
|
+
feed = new URL(url);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (feed.protocol !== "http:" || isLoopbackHostname(feed.hostname)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const origin = `${feed.protocol}//${feed.host}`;
|
|
95
|
+
// once per feed origin per process — app-update.yml is written for every pack
|
|
96
|
+
log
|
|
97
|
+
.once(`insecure-feed:${origin}`)
|
|
98
|
+
.warn({ feed: origin, solution: "serve the updates over https; for a test server, set autoUpdater.allowInsecureFeed = !app.isPackaged in the app (dev runs only)" }, "the update feed written to app-update.yml uses plain http. electron-updater rejects every update request over http to a host " +
|
|
99
|
+
"that is not loopback (localhost, 127.0.0.0/8, ::1) with ERR_UPDATER_INSECURE_FEED, unless the app sets autoUpdater.allowInsecureFeed (meant for dev runs: autoUpdater.allowInsecureFeed = !app.isPackaged). " +
|
|
100
|
+
"See https://www.electron.build/docs/migration/v27-runtime-changes#update-requests-require-https");
|
|
101
|
+
}
|
|
51
102
|
/**
|
|
52
103
|
* v26 published implicitly when it detected a CI tag; v27 requires an explicit `--publish` policy.
|
|
53
104
|
* Without a signal, a tagged release pipeline goes green and uploads nothing — the build looks
|
|
@@ -81,6 +132,11 @@ export class PublishManager {
|
|
|
81
132
|
this.isPublish = false;
|
|
82
133
|
this.progress = process.stdout.isTTY ? new MultiProgress() : null;
|
|
83
134
|
this.updateFileWriteTask = [];
|
|
135
|
+
/**
|
|
136
|
+
* The scan of the first packed app of each platform of this build that ships app-update.yml and needs one, not one per arch: the archs
|
|
137
|
+
* of a platform ship the same app code, but platforms may not (platform-level `files`). The warnings themselves are once per process.
|
|
138
|
+
*/
|
|
139
|
+
this.updaterSettingsScans = new Map();
|
|
84
140
|
checkOptions(publishOptions.publish);
|
|
85
141
|
this.taskManager = new AsyncTaskManager(cancellationToken);
|
|
86
142
|
const forcePublishForPr = isPublishForPullRequest();
|
|
@@ -120,13 +176,22 @@ export class PublishManager {
|
|
|
120
176
|
// otherwise) only applies when a target emits a manifest - the same per-target resolution as the build-start
|
|
121
177
|
// preflight. A snap-, flatpak- or mas-only pack has none (Linux and mas are not filtered above), nor has an
|
|
122
178
|
// installer whose target-level `publish` is `null` or waived.
|
|
123
|
-
const { publishConfigs, emitsManifest } = await resolvePackAppUpdatePublishConfigs(packager, event.targets, event.arch, this.isPublish);
|
|
179
|
+
const { publishConfigs, emitsManifest, manifestTargetNames } = await resolvePackAppUpdatePublishConfigs(packager, event.targets, event.arch, this.isPublish);
|
|
124
180
|
if (emitsManifest) {
|
|
125
181
|
await packager.requireUpdateSigningKeys(this.isPublish);
|
|
126
182
|
}
|
|
127
183
|
const publishConfig = await createAppUpdateConfiguration(packager, publishConfigs, this.isPublish, false);
|
|
128
184
|
if (publishConfig != null) {
|
|
129
|
-
|
|
185
|
+
const resourcesDir = packager.getResourcesDir(event.appOutDir);
|
|
186
|
+
await writeAppUpdateYaml(resourcesDir, publishConfig, event.appOutDir);
|
|
187
|
+
await warnAboutUpdaterSettings(this.packager, manifestTargetNames.includes("rpm"), () => {
|
|
188
|
+
let scan = this.updaterSettingsScans.get(packager.platform);
|
|
189
|
+
if (scan == null) {
|
|
190
|
+
scan = findUpdaterSettingsMentions(resourcesDir);
|
|
191
|
+
this.updaterSettingsScans.set(packager.platform, scan);
|
|
192
|
+
}
|
|
193
|
+
return scan;
|
|
194
|
+
});
|
|
130
195
|
}
|
|
131
196
|
});
|
|
132
197
|
packager.onArtifactCreated(async (event) => {
|
|
@@ -242,8 +307,8 @@ export class PublishManager {
|
|
|
242
307
|
}
|
|
243
308
|
}
|
|
244
309
|
getOrCreatePublisher(publishConfig, appInfo) {
|
|
245
|
-
// to not include token into cache key
|
|
246
|
-
const providerCacheKey = safeStringifyJson(publishConfig);
|
|
310
|
+
// to not include token into cache key; every sensitive value is fingerprinted, so configs that differ in one get different keys
|
|
311
|
+
const providerCacheKey = safeStringifyJson(publishConfig, undefined, Number.POSITIVE_INFINITY);
|
|
247
312
|
let publisher = this.nameToPublisher.get(providerCacheKey);
|
|
248
313
|
if (publisher == null) {
|
|
249
314
|
publisher = createPublisher(this, appInfo.version, publishConfig, this.publishOptions, this.packager).then(it => {
|
|
@@ -317,7 +382,8 @@ export async function getPackAppUpdatePublishConfiguration(packager, targets, ar
|
|
|
317
382
|
* - with none (a snap-only pack, or `nsis.publish: null`), it comes from the platform/root settings, as before -
|
|
318
383
|
* including the GitHub fallback from repository info when no level configures `publish` at all.
|
|
319
384
|
*
|
|
320
|
-
* `emitsManifest` tells whether any target of the pack emits one, i.e. whether the signing requirement applies
|
|
385
|
+
* `emitsManifest` tells whether any target of the pack emits one, i.e. whether the signing requirement applies, and `manifestTargetNames`
|
|
386
|
+
* which targets do.
|
|
321
387
|
*/
|
|
322
388
|
async function resolvePackAppUpdatePublishConfigs(packager, targets, arch, isPublish) {
|
|
323
389
|
const writers = [];
|
|
@@ -328,16 +394,16 @@ async function resolvePackAppUpdatePublishConfigs(packager, targets, arch, isPub
|
|
|
328
394
|
}
|
|
329
395
|
}
|
|
330
396
|
if (writers.length === 0) {
|
|
331
|
-
return { publishConfigs: await getPlatformUpdateInfoPublishConfigs(packager, arch, isPublish), emitsManifest: false };
|
|
397
|
+
return { publishConfigs: await getPlatformUpdateInfoPublishConfigs(packager, arch, isPublish), emitsManifest: false, manifestTargetNames: [] };
|
|
332
398
|
}
|
|
333
399
|
const embedded = appUpdateFeedIdentity(writers[0].publishConfigs[0]);
|
|
334
400
|
if (writers.some(it => appUpdateFeedIdentity(it.publishConfigs[0]) !== embedded)) {
|
|
335
401
|
reportConflictingAppUpdateFeeds(packager, writers, arch, isPublish);
|
|
336
402
|
// not publishing: no app-update.yml, the same package the error would have prevented - picking one of the feeds
|
|
337
403
|
// would silently ship installs that poll a feed without their manifest
|
|
338
|
-
return { publishConfigs: null, emitsManifest: true };
|
|
404
|
+
return { publishConfigs: null, emitsManifest: true, manifestTargetNames: writers.map(it => it.target.name) };
|
|
339
405
|
}
|
|
340
|
-
return { publishConfigs: writers[0].publishConfigs, emitsManifest: true };
|
|
406
|
+
return { publishConfigs: writers[0].publishConfigs, emitsManifest: true, manifestTargetNames: writers.map(it => it.target.name) };
|
|
341
407
|
}
|
|
342
408
|
/**
|
|
343
409
|
* Targets of one pack resolve different app-update.yml feeds: an InvalidConfigurationError when publishing, otherwise
|
|
@@ -403,6 +469,12 @@ async function createAppUpdateConfiguration(packager, publishConfigs, isPublish,
|
|
|
403
469
|
updaterCacheDirName: packager.appInfo.updaterCacheDirName,
|
|
404
470
|
};
|
|
405
471
|
warnAboutGenericFeedQuery(publishConfig);
|
|
472
|
+
warnAboutInsecureFeed(publishConfig);
|
|
473
|
+
// electron-updater fails every update check of an installed app whose app-update.yml has an invalid limit
|
|
474
|
+
const maxUpdateInfoSize = publishConfig.maxUpdateInfoSize;
|
|
475
|
+
if (maxUpdateInfoSize != null && !isValidMaxUpdateInfoSize(maxUpdateInfoSize)) {
|
|
476
|
+
throw new InvalidConfigurationError(`publish.maxUpdateInfoSize must be a positive integer (bytes) or 0 for no limit, but got: ${typeof maxUpdateInfoSize === "string" ? JSON.stringify(maxUpdateInfoSize) : typeof maxUpdateInfoSize === "number" ? maxUpdateInfoSize : typeof maxUpdateInfoSize}`);
|
|
477
|
+
}
|
|
406
478
|
// like updateManifestPublicKey: the opt-out marker is only ever assigned below, from win.verifyUpdateCodeSignature
|
|
407
479
|
if (publishConfig.verifyUpdateCodeSignature !== undefined) {
|
|
408
480
|
throw new InvalidConfigurationError("publish.verifyUpdateCodeSignature is managed by electron-builder and must not be set; configure win.verifyUpdateCodeSignature instead");
|
|
@@ -474,6 +546,14 @@ async function applyUpdateCodeSignatureVerification(winPackager, publishConfig)
|
|
|
474
546
|
* ever reported, never key material.
|
|
475
547
|
*/
|
|
476
548
|
function checkSigningKeysTrusted(packager, signingKeys, explicitKeys, fail) {
|
|
549
|
+
checkUpdateSigningKeysTrusted(packager.platform.name, packager.updateManifestOptions, signingKeys, explicitKeys, fail);
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* {@link checkSigningKeysTrusted} for a platform's resolved `updateManifest` options (`<platform>.updateManifest ?? updateManifest`)
|
|
553
|
+
* rather than a packager, so a step outside the build (the `sign-update-manifest` CLI) refuses exactly what the build refuses.
|
|
554
|
+
* @internal
|
|
555
|
+
*/
|
|
556
|
+
export function checkUpdateSigningKeysTrusted(platformName, updateManifestConfig, signingKeys, explicitKeys, fail) {
|
|
477
557
|
if (signingKeys.length === 0 || explicitKeys.length === 0) {
|
|
478
558
|
return;
|
|
479
559
|
}
|
|
@@ -482,10 +562,9 @@ function checkSigningKeysTrusted(packager, signingKeys, explicitKeys, fail) {
|
|
|
482
562
|
if (signingIds.some(id => trustedIds.includes(id))) {
|
|
483
563
|
return;
|
|
484
564
|
}
|
|
485
|
-
const updateManifestConfig = packager.updateManifestOptions;
|
|
486
565
|
const allowed = updateManifestConfig !== false && updateManifestConfig?.allowSigningKeyOutsideTrustList === true;
|
|
487
566
|
if (fail && !allowed) {
|
|
488
|
-
throw new InvalidConfigurationError(`none of the update-manifest signing keys (key id(s) ${signingIds.join(", ")}) is in updateManifest.publicKey (key id(s) ${trustedIds.join(", ")}) for ${
|
|
567
|
+
throw new InvalidConfigurationError(`none of the update-manifest signing keys (key id(s) ${signingIds.join(", ")}) is in updateManifest.publicKey (key id(s) ${trustedIds.join(", ")}) for ${platformName}. ` +
|
|
489
568
|
"The app built here embeds only the listed keys, so its installs will reject manifests signed with the signing key(s) above: every later release would have to be signed by a key in updateManifest.publicKey. " +
|
|
490
569
|
"Add the signing key's public key to updateManifest.publicKey, or sign with a key that is listed. " +
|
|
491
570
|
"For a deliberate cutover release that hands installs over to a listed key, set updateManifest.allowSigningKeyOutsideTrustList: true. " +
|
|
@@ -493,7 +572,7 @@ function checkSigningKeysTrusted(packager, signingKeys, explicitKeys, fail) {
|
|
|
493
572
|
}
|
|
494
573
|
log
|
|
495
574
|
.once("update-manifest-signing-key-outside-trust-list")
|
|
496
|
-
.warn({ platform:
|
|
575
|
+
.warn({ platform: platformName, signingKeyIds: signingIds, trustedKeyIds: trustedIds }, "none of the update-manifest signing keys is in updateManifest.publicKey: installs of this release will not be able to verify manifests signed with the current key(s). " +
|
|
497
576
|
(allowed
|
|
498
577
|
? "Allowed by updateManifest.allowSigningKeyOutsideTrustList for a deliberate cutover release; every later release must be signed by a key in updateManifest.publicKey."
|
|
499
578
|
: "Publishing a manifest signed with these keys fails: add the current public key to updateManifest.publicKey, or set updateManifest.allowSigningKeyOutsideTrustList: true for a deliberate cutover release. " +
|
|
@@ -503,8 +582,9 @@ const SIGNING_KEY_OUTSIDE_TRUST_LIST_DOCS = "https://www.electron.build/docs/mig
|
|
|
503
582
|
/**
|
|
504
583
|
* Normalizes the configured `updateManifest.publicKey` (string, multi-PEM string, or array) into distinct,
|
|
505
584
|
* validated Ed25519 public keys, preserving order. Duplicates and non-Ed25519 keys are configuration errors.
|
|
585
|
+
* @internal
|
|
506
586
|
*/
|
|
507
|
-
function normalizeExplicitPublicKeys(value) {
|
|
587
|
+
export function normalizeExplicitPublicKeys(value) {
|
|
508
588
|
const keys = normalizePublicKeyList(value);
|
|
509
589
|
const seen = new Map();
|
|
510
590
|
keys.forEach((key, index) => {
|
|
@@ -584,10 +664,8 @@ async function resolveReleaseBody(packager) {
|
|
|
584
664
|
}
|
|
585
665
|
}
|
|
586
666
|
export async function createPublisher(context, version, publishConfig, options, packager) {
|
|
587
|
-
if (debug.enabled) {
|
|
588
|
-
debug(`Create publisher: ${safeStringifyJson(publishConfig)}`);
|
|
589
|
-
}
|
|
590
667
|
const provider = publishConfig.provider;
|
|
668
|
+
debug(`Create publisher: ${provider}`);
|
|
591
669
|
switch (provider) {
|
|
592
670
|
case "github": {
|
|
593
671
|
const releaseBody = await resolveReleaseBody(packager);
|