app-builder-lib 27.0.0-alpha.11 → 27.0.0-alpha.13
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/asar/asarUtil.js +1 -1
- package/dist/asar/asarUtil.js.map +1 -1
- package/dist/codeSign/certInfo.d.ts +4 -1
- package/dist/codeSign/certInfo.d.ts.map +1 -1
- package/dist/codeSign/certInfo.js +5 -3
- package/dist/codeSign/certInfo.js.map +1 -1
- package/dist/codeSign/forceCodeSigning.d.ts +22 -0
- package/dist/codeSign/forceCodeSigning.d.ts.map +1 -0
- package/dist/codeSign/forceCodeSigning.js +18 -0
- package/dist/codeSign/forceCodeSigning.js.map +1 -0
- package/dist/codeSign/mac/macCodeSign.d.ts +13 -1
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +29 -2
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/mac/macSignatureVerifier.d.ts +23 -0
- package/dist/codeSign/mac/macSignatureVerifier.d.ts.map +1 -0
- package/dist/codeSign/mac/macSignatureVerifier.js +96 -0
- package/dist/codeSign/mac/macSignatureVerifier.js.map +1 -0
- package/dist/codeSign/win/authenticodeSignature.d.ts +83 -0
- package/dist/codeSign/win/authenticodeSignature.d.ts.map +1 -0
- package/dist/codeSign/win/authenticodeSignature.js +289 -0
- package/dist/codeSign/win/authenticodeSignature.js.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -1
- package/dist/codeSign/win/pkcs11SignManager.js +4 -3
- package/dist/codeSign/win/pkcs11SignManager.js.map +1 -1
- package/dist/codeSign/win/publisherName.d.ts +31 -0
- package/dist/codeSign/win/publisherName.d.ts.map +1 -0
- package/dist/codeSign/win/publisherName.js +78 -0
- package/dist/codeSign/win/publisherName.js.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +27 -9
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +80 -49
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/verifyUpdatePublisher.d.ts +25 -0
- package/dist/codeSign/win/verifyUpdatePublisher.d.ts.map +1 -0
- package/dist/codeSign/win/verifyUpdatePublisher.js +101 -0
- package/dist/codeSign/win/verifyUpdatePublisher.js.map +1 -0
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +24 -6
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +56 -12
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +15 -0
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +33 -2
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/mac/asarIntegrityDigest.d.ts +10 -0
- package/dist/electron/mac/asarIntegrityDigest.d.ts.map +1 -0
- package/dist/electron/mac/asarIntegrityDigest.js +122 -0
- package/dist/electron/mac/asarIntegrityDigest.js.map +1 -0
- package/dist/electron/mac/electronMac.js +1 -28
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +9 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -1
- package/dist/electron/mac/electronMacUtils.js +37 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -1
- package/dist/fileMatcher.d.ts +34 -11
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +125 -36
- package/dist/fileMatcher.js.map +1 -1
- package/dist/forge-maker.d.ts +64 -0
- package/dist/forge-maker.d.ts.map +1 -1
- package/dist/forge-maker.js +104 -2
- package/dist/forge-maker.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +9 -3
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +8 -3
- package/dist/indexInternal.js.map +1 -1
- package/dist/linuxPackager.js +1 -1
- package/dist/linuxPackager.js.map +1 -1
- package/dist/macPackager.d.ts +32 -0
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +215 -13
- package/dist/macPackager.js.map +1 -1
- package/dist/options/FuseOptionsV1.d.ts +4 -0
- package/dist/options/FuseOptionsV1.d.ts.map +1 -1
- package/dist/options/FuseOptionsV1.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +93 -21
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SquirrelWindowsOptions.d.ts +3 -0
- package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
- package/dist/options/SquirrelWindowsOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +22 -3
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +68 -19
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js +20 -0
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +3 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +11 -2
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +18 -7
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +56 -15
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +4 -0
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +106 -28
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/manifestUploadCheck.d.ts +10 -0
- package/dist/publish/manifestUploadCheck.d.ts.map +1 -0
- package/dist/publish/manifestUploadCheck.js +75 -0
- package/dist/publish/manifestUploadCheck.js.map +1 -0
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +51 -17
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/publish/updateManifestVerifier.d.ts +22 -0
- package/dist/publish/updateManifestVerifier.d.ts.map +1 -0
- package/dist/publish/updateManifestVerifier.js +65 -0
- package/dist/publish/updateManifestVerifier.js.map +1 -0
- package/dist/targets/ArchiveTarget.d.ts.map +1 -1
- package/dist/targets/ArchiveTarget.js +6 -2
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts +6 -0
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +15 -5
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +4 -0
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +5 -5
- 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 +12 -17
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +6 -1
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +9 -9
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/flatpakBundle.d.ts.map +1 -1
- package/dist/targets/linux/flatpakBundle.js +25 -20
- package/dist/targets/linux/flatpakBundle.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +2 -9
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +22 -6
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapPlugs.d.ts +2 -2
- package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapPlugs.js +1 -1
- package/dist/targets/linux/snap/snapPlugs.js.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +19 -17
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +21 -3
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +140 -13
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +8 -5
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +15 -3
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/toolsets/nsis.js +1 -1
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/winCodeSign.d.ts +14 -1
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +14 -1
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +3 -0
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +14 -5
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +15 -11
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/buildOutputVerifier.d.ts +40 -0
- package/dist/util/buildOutputVerifier.d.ts.map +1 -0
- package/dist/util/buildOutputVerifier.js +420 -0
- package/dist/util/buildOutputVerifier.js.map +1 -0
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +9 -1
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/fileOptions.d.ts +22 -0
- package/dist/util/config/fileOptions.d.ts.map +1 -1
- package/dist/util/config/fileOptions.js +92 -2
- package/dist/util/config/fileOptions.js.map +1 -1
- package/dist/util/config/legacyConfigGuard.d.ts.map +1 -1
- package/dist/util/config/legacyConfigGuard.js +2 -2
- package/dist/util/config/legacyConfigGuard.js.map +1 -1
- package/dist/util/config/legacyOptions.d.ts +9 -2
- package/dist/util/config/legacyOptions.d.ts.map +1 -1
- package/dist/util/config/legacyOptions.js +20 -2
- package/dist/util/config/legacyOptions.js.map +1 -1
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +3 -1
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +3 -9
- package/dist/util/flags.js.map +1 -1
- package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
- package/dist/util/mac/macosIconComposer.js +6 -5
- package/dist/util/mac/macosIconComposer.js.map +1 -1
- package/dist/util/macroExpander.js +1 -1
- package/dist/util/macroExpander.js.map +1 -1
- package/dist/util/nativeBinaryVerifier.d.ts.map +1 -1
- package/dist/util/nativeBinaryVerifier.js +3 -1
- package/dist/util/nativeBinaryVerifier.js.map +1 -1
- package/dist/util/packageMetadata.js +1 -1
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/util/removedEnvVars.d.ts +2 -0
- package/dist/util/removedEnvVars.d.ts.map +1 -1
- package/dist/util/removedEnvVars.js +15 -1
- package/dist/util/removedEnvVars.js.map +1 -1
- package/dist/util/streamSpawnToFile.d.ts +3 -1
- package/dist/util/streamSpawnToFile.d.ts.map +1 -1
- package/dist/util/streamSpawnToFile.js +6 -2
- package/dist/util/streamSpawnToFile.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/dist/vm/ParallelsVm.d.ts +10 -0
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +22 -8
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/vm/PwshVm.d.ts +0 -1
- package/dist/vm/PwshVm.d.ts.map +1 -1
- package/dist/vm/PwshVm.js +10 -15
- package/dist/vm/PwshVm.js.map +1 -1
- package/dist/vm/WineVm.d.ts.map +1 -1
- package/dist/vm/WineVm.js +4 -4
- package/dist/vm/WineVm.js.map +1 -1
- package/dist/vm/vm.d.ts +9 -3
- package/dist/vm/vm.d.ts.map +1 -1
- package/dist/vm/vm.js +40 -32
- package/dist/vm/vm.js.map +1 -1
- package/dist/winPackager.d.ts +16 -1
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +77 -19
- package/dist/winPackager.js.map +1 -1
- package/package.json +12 -10
- package/scheme.json +662 -50
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +14 -9
- package/templates/nsis/installSection.nsh +5 -0
- package/dist/vm/MonoVm.d.ts +0 -9
- package/dist/vm/MonoVm.d.ts.map +0 -1
- package/dist/vm/MonoVm.js +0 -16
- package/dist/vm/MonoVm.js.map +0 -1
|
@@ -8,10 +8,12 @@ import _fsExtra from "fs-extra";
|
|
|
8
8
|
const { outputFile } = _fsExtra;
|
|
9
9
|
import * as path from "path";
|
|
10
10
|
import { Platform } from "../core.js";
|
|
11
|
+
import { missingUpdatePublisherNameError, validatePublisherNameFormat } from "../codeSign/win/publisherName.js";
|
|
11
12
|
import { createUpdateInfoTasks, writeUpdateInfoFiles } from "./updateInfoBuilder.js";
|
|
12
13
|
import { resolveModule } from "../util/resolve.js";
|
|
13
14
|
import { parseUrl } from "../util/pathManager.js";
|
|
14
15
|
import { isPublishForPullRequest } from "../util/flags.js";
|
|
16
|
+
import { BUILD_CHANGES_URL } from "../util/config/legacyOptions.js";
|
|
15
17
|
const publishForPrWarning = "There are serious security concerns with PUBLISH_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/guides/integration/oss/#pass-secrets-to-builds-from-forked-pull-requests) for details)" +
|
|
16
18
|
"\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.";
|
|
17
19
|
const debug = _debug("electron-builder:publish");
|
|
@@ -44,7 +46,7 @@ export function warnAboutGenericFeedQuery(publishConfig) {
|
|
|
44
46
|
}, "the generic publish url has a query string. electron-updater 7 (electron-builder v27) adds it, and sends the credential headers from requestHeaders / addAuthHeader, " +
|
|
45
47
|
"only to downloads on the feed's origin (scheme, host and port): a download url in latest*.yml on another origin is requested without them. " +
|
|
46
48
|
"Nothing changes for the relative URLs electron-builder writes. " +
|
|
47
|
-
"See https://www.electron.build/docs/migration/v27-
|
|
49
|
+
"See https://www.electron.build/docs/migration/v27-runtime-changes#update-credentials-stay-on-the-feeds-origin");
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
* v26 published implicitly when it detected a CI tag; v27 requires an explicit `--publish` policy.
|
|
@@ -68,7 +70,7 @@ function warnIfImplicitPublishExpected(packager) {
|
|
|
68
70
|
}
|
|
69
71
|
log.warn({ tag, solution: "pass --publish <always|onTag|onTagOrDraft|never>, or set the `publish` policy in your build configuration" }, "a publish configuration and a CI tag are present, but no publish policy was given — nothing will be uploaded. " +
|
|
70
72
|
"electron-builder v27 removed implicit publishing (v26 auto-published when it detected a CI tag). " +
|
|
71
|
-
"See https://www.electron.build/docs/migration/v27-
|
|
73
|
+
"See https://www.electron.build/docs/migration/v27-build-changes#implicit-publish-removed");
|
|
72
74
|
}
|
|
73
75
|
export class PublishManager {
|
|
74
76
|
constructor(packager, publishOptions, cancellationToken = packager.cancellationToken) {
|
|
@@ -148,19 +150,27 @@ export class PublishManager {
|
|
|
148
150
|
* none, `publishAutoUpdate: false` on every provider waives it - which stays in place for targets that do not
|
|
149
151
|
* declare `writesUpdateInfo`. Each planned platform x arch is one pack, so targets of a pack that disagree about the
|
|
150
152
|
* app-update.yml feed fail here too, before anything is packed (also for a prepackaged app, which has no afterPack).
|
|
153
|
+
*
|
|
154
|
+
* A build that does not publish (no publish policy, `never`, or a pull-request build) is checked only for the
|
|
155
|
+
* platforms with `forceCodeSigning`, which requires signed manifests either way (see requireUpdateSigningKeys).
|
|
151
156
|
*/
|
|
152
157
|
async requireSigningKeysForPlannedTargets(plan) {
|
|
153
|
-
if (!this.isPublish) {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
158
|
for (const { packager, arch, targets } of plan) {
|
|
159
|
+
if (!this.isPublish && !packager.forceCodeSigning) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
157
162
|
// resolving publish configs is async: a build cancelled meanwhile stops instead of failing on a missing key
|
|
158
163
|
if (this.cancellationToken.cancelled) {
|
|
159
164
|
return;
|
|
160
165
|
}
|
|
161
|
-
const { emitsManifest } = await resolvePackAppUpdatePublishConfigs(packager, targets, arch,
|
|
166
|
+
const { emitsManifest } = await resolvePackAppUpdatePublishConfigs(packager, targets, arch, this.isPublish);
|
|
162
167
|
if (emitsManifest && !this.cancellationToken.cancelled) {
|
|
163
|
-
|
|
168
|
+
// requireUpdateSigningKeys enforces forceCodeSigning itself
|
|
169
|
+
const signingKeys = await packager.requireUpdateSigningKeys(this.isPublish);
|
|
170
|
+
const updateManifestConfig = packager.updateManifestOptions;
|
|
171
|
+
if (updateManifestConfig !== false) {
|
|
172
|
+
checkSigningKeysTrusted(packager, signingKeys, normalizeExplicitPublicKeys(updateManifestConfig?.publicKey), true);
|
|
173
|
+
}
|
|
164
174
|
}
|
|
165
175
|
}
|
|
166
176
|
}
|
|
@@ -339,25 +349,28 @@ function reportConflictingAppUpdateFeeds(packager, writers, arch, isPublish) {
|
|
|
339
349
|
const problem = `targets ${targets} are built from the same ${packager.platform.name} ${Arch[arch]} app, which holds a single app-update.yml, ` +
|
|
340
350
|
`but their publish settings resolve to different auto-update feeds (${feeds}; the first provider of each that receives the manifest is embedded)`;
|
|
341
351
|
const solution = `configure \`publish\` once at the platform level (\`${packager.platform.buildConfigurationKey}.publish\`) and remove the target-level overrides, or point their first providers at the same feed`;
|
|
352
|
+
const docs = `${BUILD_CHANGES_URL}#app-updateyml-feed-follows-the-update-writing-targets`;
|
|
342
353
|
if (isPublish) {
|
|
343
|
-
throw new InvalidConfigurationError(`${problem}. To fix it, ${solution}
|
|
354
|
+
throw new InvalidConfigurationError(`${problem}. To fix it, ${solution}. See ${docs}`);
|
|
344
355
|
}
|
|
345
356
|
// scoped to the platform packager (one per platform and build): afterPack and the targets writing app-update.yml themselves
|
|
346
357
|
// resolve the same pack, and every arch usually repeats the same conflict - report each one once
|
|
347
358
|
log
|
|
348
359
|
.once(`conflicting-app-update-feeds:${feeds}`, packager)
|
|
349
|
-
.warn({ solution }, `${problem}. No app-update.yml is written, so installed apps get neither an update feed nor the update-manifest public key. ` +
|
|
360
|
+
.warn({ solution, docs }, `${problem}. No app-update.yml is written, so installed apps get neither an update feed nor the update-manifest public key. ` +
|
|
350
361
|
"Publishing this configuration fails with an InvalidConfigurationError.");
|
|
351
362
|
}
|
|
352
363
|
// Options that only the publisher reads (the upload itself), never electron-updater, so they cannot make two otherwise
|
|
353
|
-
// identical first providers different feeds.
|
|
354
|
-
//
|
|
364
|
+
// identical first providers different feeds. Build-time-only options (credential sources, see
|
|
365
|
+
// BUILD_TIME_ONLY_PUBLISH_OPTIONS) are never embedded and are left out as well. Everything else is compared - including
|
|
366
|
+
// fields of custom providers and options such as `requestHeaders`, `token` or `private` that change how or whether the
|
|
367
|
+
// updater can read the feed.
|
|
355
368
|
const PUBLISH_ONLY_OPTIONS = new Set(["publishAutoUpdate", "timeout"]);
|
|
356
369
|
const S3_PUBLISH_ONLY_OPTIONS = new Set(["acl", "storageClass", "encryption"]);
|
|
357
370
|
/**
|
|
358
371
|
* What makes two first providers the same app-update.yml feed: the provider and every option that decides where, or
|
|
359
|
-
* how, electron-updater reads the manifest (url, bucket, region, path, owner, repo, channel, ...). Publish-only
|
|
360
|
-
* and unset (nullish) values are left out, and key order does not matter - so `publishAutoUpdate: true` against an
|
|
372
|
+
* how, electron-updater reads the manifest (url, bucket, region, path, owner, repo, channel, ...). Publish-only and
|
|
373
|
+
* build-time-only options and unset (nullish) values are left out, and key order does not matter - so `publishAutoUpdate: true` against an
|
|
361
374
|
* absent flag is the same feed, a different url or bucket is not.
|
|
362
375
|
*/
|
|
363
376
|
function appUpdateFeedIdentity(config) {
|
|
@@ -365,7 +378,7 @@ function appUpdateFeedIdentity(config) {
|
|
|
365
378
|
return "null";
|
|
366
379
|
}
|
|
367
380
|
const isS3Like = config.provider === "s3" || config.provider === "spaces" || config.provider === "r2";
|
|
368
|
-
const identity = Object.fromEntries(Object.entries(config).filter(([key, value]) => value != null && !PUBLISH_ONLY_OPTIONS.has(key) && !(isS3Like && S3_PUBLISH_ONLY_OPTIONS.has(key))));
|
|
381
|
+
const identity = Object.fromEntries(Object.entries(stripBuildTimeOnlyPublishOptions(config)).filter(([key, value]) => value != null && !PUBLISH_ONLY_OPTIONS.has(key) && !(isS3Like && S3_PUBLISH_ONLY_OPTIONS.has(key))));
|
|
369
382
|
// key order does not make two configs different feeds
|
|
370
383
|
return JSON.stringify(identity, (_key, value) => value != null && typeof value === "object" && !Array.isArray(value)
|
|
371
384
|
? Object.fromEntries(Object.keys(value)
|
|
@@ -386,16 +399,16 @@ async function createAppUpdateConfiguration(packager, publishConfigs, isPublish,
|
|
|
386
399
|
return null;
|
|
387
400
|
}
|
|
388
401
|
const publishConfig = {
|
|
389
|
-
...publishConfigs[0],
|
|
402
|
+
...stripBuildTimeOnlyPublishOptions(publishConfigs[0]),
|
|
390
403
|
updaterCacheDirName: packager.appInfo.updaterCacheDirName,
|
|
391
404
|
};
|
|
392
405
|
warnAboutGenericFeedQuery(publishConfig);
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
406
|
+
// like updateManifestPublicKey: the opt-out marker is only ever assigned below, from win.verifyUpdateCodeSignature
|
|
407
|
+
if (publishConfig.verifyUpdateCodeSignature !== undefined) {
|
|
408
|
+
throw new InvalidConfigurationError("publish.verifyUpdateCodeSignature is managed by electron-builder and must not be set; configure win.verifyUpdateCodeSignature instead");
|
|
409
|
+
}
|
|
410
|
+
if (packager.platform === Platform.WINDOWS) {
|
|
411
|
+
await applyUpdateCodeSignatureVerification(packager, publishConfig);
|
|
399
412
|
}
|
|
400
413
|
// Embed the update-manifest trust list so the updater can verify signed manifests. An explicit
|
|
401
414
|
// `publicKey` list wins as-is; otherwise the public half of every configured signing key is derived
|
|
@@ -423,15 +436,70 @@ async function createAppUpdateConfiguration(packager, publishConfigs, isPublish,
|
|
|
423
436
|
if (trustedKeys.length > 0) {
|
|
424
437
|
publishConfig.updateManifestPublicKey = trustedKeys.length === 1 ? trustedKeys[0] : trustedKeys;
|
|
425
438
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
439
|
+
checkSigningKeysTrusted(packager, signingKeys, explicitKeys, isPublish && requireSigning);
|
|
440
|
+
return publishConfig;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* The Windows publisher electron-updater verifies the Authenticode signature of NSIS updates against, written into a fresh copy of the
|
|
444
|
+
* first provider's config. electron-updater 7 rejects an update when `app-update.yml` has no publisherName, so:
|
|
445
|
+
*
|
|
446
|
+
* - `win.verifyUpdateCodeSignature: false` writes the explicit opt-out marker (`verifyUpdateCodeSignature: false`) and no publisherName,
|
|
447
|
+
* not even a publish-level one;
|
|
448
|
+
* - otherwise a publish-level publisherName (validated as a distinguished name) or the one of the signing configuration (explicit, or
|
|
449
|
+
* `CN=<common name>` of the certificate) is written, and without any the build fails ({@link missingUpdatePublisherNameError}).
|
|
450
|
+
*/
|
|
451
|
+
async function applyUpdateCodeSignatureVerification(winPackager, publishConfig) {
|
|
452
|
+
if (!winPackager.isForceCodeSigningVerification) {
|
|
453
|
+
delete publishConfig.publisherName;
|
|
454
|
+
publishConfig.verifyUpdateCodeSignature = false;
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (publishConfig.publisherName != null) {
|
|
458
|
+
validatePublisherNameFormat(publishConfig.publisherName, "publish.publisherName");
|
|
459
|
+
if (asArray(publishConfig.publisherName).length > 0) {
|
|
460
|
+
return;
|
|
431
461
|
}
|
|
432
462
|
}
|
|
433
|
-
|
|
463
|
+
const publisherName = await (await winPackager.signingManager.value).computedPublisherName.value;
|
|
464
|
+
if (publisherName == null || publisherName.length === 0) {
|
|
465
|
+
throw missingUpdatePublisherNameError(winPackager.platformOptions);
|
|
466
|
+
}
|
|
467
|
+
publishConfig.publisherName = publisherName;
|
|
434
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* An explicit `updateManifest.publicKey` list that holds none of the signing keys ships an app that rejects manifests
|
|
471
|
+
* signed with those keys, so every later release has to be signed by a listed key. That is a mistake unless it is a
|
|
472
|
+
* deliberate cutover release: with `fail` (a publishing build whose manifest is signed) it is an error unless
|
|
473
|
+
* `updateManifest.allowSigningKeyOutsideTrustList` is set; otherwise it only warns, once per process. Only key ids are
|
|
474
|
+
* ever reported, never key material.
|
|
475
|
+
*/
|
|
476
|
+
function checkSigningKeysTrusted(packager, signingKeys, explicitKeys, fail) {
|
|
477
|
+
if (signingKeys.length === 0 || explicitKeys.length === 0) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const trustedIds = explicitKeys.map(computeUpdateManifestKeyId);
|
|
481
|
+
const signingIds = signingKeys.map(computeUpdateManifestKeyId);
|
|
482
|
+
if (signingIds.some(id => trustedIds.includes(id))) {
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const updateManifestConfig = packager.updateManifestOptions;
|
|
486
|
+
const allowed = updateManifestConfig !== false && updateManifestConfig?.allowSigningKeyOutsideTrustList === true;
|
|
487
|
+
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 ${packager.platform.name}. ` +
|
|
489
|
+
"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
|
+
"Add the signing key's public key to updateManifest.publicKey, or sign with a key that is listed. " +
|
|
491
|
+
"For a deliberate cutover release that hands installs over to a listed key, set updateManifest.allowSigningKeyOutsideTrustList: true. " +
|
|
492
|
+
`See ${SIGNING_KEY_OUTSIDE_TRUST_LIST_DOCS}`);
|
|
493
|
+
}
|
|
494
|
+
log
|
|
495
|
+
.once("update-manifest-signing-key-outside-trust-list")
|
|
496
|
+
.warn({ platform: packager.platform.name, 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
|
+
(allowed
|
|
498
|
+
? "Allowed by updateManifest.allowSigningKeyOutsideTrustList for a deliberate cutover release; every later release must be signed by a key in updateManifest.publicKey."
|
|
499
|
+
: "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. " +
|
|
500
|
+
`See ${SIGNING_KEY_OUTSIDE_TRUST_LIST_DOCS}`));
|
|
501
|
+
}
|
|
502
|
+
const SIGNING_KEY_OUTSIDE_TRUST_LIST_DOCS = "https://www.electron.build/docs/migration/v27-build-changes#signing-key-must-be-in-updatemanifestpublickey";
|
|
435
503
|
/**
|
|
436
504
|
* Normalizes the configured `updateManifest.publicKey` (string, multi-PEM string, or array) into distinct,
|
|
437
505
|
* validated Ed25519 public keys, preserving order. Duplicates and non-Ed25519 keys are configuration errors.
|
|
@@ -455,6 +523,16 @@ function normalizeExplicitPublicKeys(value) {
|
|
|
455
523
|
});
|
|
456
524
|
return keys;
|
|
457
525
|
}
|
|
526
|
+
// Publish options that only configure the build machine (credential sources, local file paths). They must never be
|
|
527
|
+
// embedded in app-update.yml, which ships inside every installed app.
|
|
528
|
+
const BUILD_TIME_ONLY_PUBLISH_OPTIONS = ["awsCredentials"];
|
|
529
|
+
export function stripBuildTimeOnlyPublishOptions(publishConfig) {
|
|
530
|
+
const result = { ...publishConfig };
|
|
531
|
+
for (const key of BUILD_TIME_ONLY_PUBLISH_OPTIONS) {
|
|
532
|
+
delete result[key];
|
|
533
|
+
}
|
|
534
|
+
return result;
|
|
535
|
+
}
|
|
458
536
|
/**
|
|
459
537
|
* Writes `app-update.yml` into the resources directory. Untrusted files (extraResources, the app directory) were copied there before,
|
|
460
538
|
* so the write is confined to `containmentRoot` by real path and replaces, rather than follows, a symlink already at the file name.
|
|
@@ -462,7 +540,7 @@ function normalizeExplicitPublicKeys(value) {
|
|
|
462
540
|
export async function writeAppUpdateYaml(resourcesDir, publishConfig, containmentRoot = resourcesDir) {
|
|
463
541
|
const file = path.join(resourcesDir, "app-update.yml");
|
|
464
542
|
await prepareFixedNameWrite(containmentRoot, file, "auto-update configuration");
|
|
465
|
-
await outputFile(file, serializeToYaml(publishConfig));
|
|
543
|
+
await outputFile(file, serializeToYaml(stripBuildTimeOnlyPublishOptions(publishConfig)));
|
|
466
544
|
}
|
|
467
545
|
export async function getPublishConfigsForUpdateInfo(packager, publishConfigs, arch) {
|
|
468
546
|
if (publishConfigs === null) {
|