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
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { notarize } from "@electron/notarize";
|
|
2
|
-
import { Arch, InvalidConfigurationError, log, MAX_FILE_REQUESTS, spawnAndWriteWithOutput, statOrNull, walk } from "builder-util";
|
|
3
|
-
import {
|
|
2
|
+
import { Arch, decodeStrictBase64, Executables, InvalidConfigurationError, log, MAX_FILE_REQUESTS, spawnAndWriteWithOutput, statOrNull, walk } from "builder-util";
|
|
3
|
+
import { createPrivateKey } from "crypto";
|
|
4
|
+
import { open, rm, writeFile } from "fs/promises";
|
|
4
5
|
import * as path from "path";
|
|
5
|
-
import {
|
|
6
|
+
import { forceCodeSigningError, VERIFICATION_FAILED_ERROR_CODE } from "../../codeSign/forceCodeSigning.js";
|
|
7
|
+
import { findIdentity, Identity, isSignAllowed, reportError } from "../../codeSign/mac/macCodeSign.js";
|
|
8
|
+
import { checkInstallerPackageSignature, validateStapledTicket } from "../../codeSign/mac/macSignatureVerifier.js";
|
|
6
9
|
import { parsePlistFile, savePlistFile } from "../../util/mac/plist.js";
|
|
10
|
+
import { BUILD_CHANGES_URL } from "../../util/config/legacyOptions.js";
|
|
7
11
|
import { getTemplatePath } from "../../util/pathManager.js";
|
|
8
12
|
import asyncPool from "tiny-async-pool";
|
|
9
13
|
const DISABLE_LIBRARY_VALIDATION = "com.apple.security.cs.disable-library-validation";
|
|
10
14
|
const APP_SANDBOX = "com.apple.security.app-sandbox";
|
|
15
|
+
/** How to produce a base64 `APPLE_API_KEY`; ends each of its format errors, which never include the value. */
|
|
16
|
+
const APPLE_API_KEY_HINT = "Set APPLE_API_KEY to the path of the AuthKey_<KEY_ID>.p8 file, or to the file's contents base64-encoded on one line: `base64 < AuthKey_<KEY_ID>.p8 | tr -d '\\n'` " +
|
|
17
|
+
"(macOS, Linux) or `[Convert]::ToBase64String([IO.File]::ReadAllBytes((Resolve-Path AuthKey_<KEY_ID>.p8)))` (PowerShell). " +
|
|
18
|
+
"See https://www.electron.build/docs/features/code-signing/notarization";
|
|
11
19
|
export class MacTargetHelper {
|
|
12
20
|
constructor(packager) {
|
|
13
21
|
this.packager = packager;
|
|
@@ -16,8 +24,8 @@ export class MacTargetHelper {
|
|
|
16
24
|
static isAdHocIdentity(identity) {
|
|
17
25
|
return identity?.name === "-";
|
|
18
26
|
}
|
|
19
|
-
handleNullIdentity() {
|
|
20
|
-
if (this.packager.
|
|
27
|
+
handleNullIdentity(targetPlatform) {
|
|
28
|
+
if (this.packager.forceCodeSigningFor(targetPlatform)) {
|
|
21
29
|
throw new InvalidConfigurationError("identity explicitly is set to null, but forceCodeSigning is set to true");
|
|
22
30
|
}
|
|
23
31
|
// The meaning of `mac.sign: null` flipped in v27. In v26 `sign` was only a custom-signer hook, so
|
|
@@ -27,7 +35,7 @@ export class MacTargetHelper {
|
|
|
27
35
|
reason: "identity explicitly is set to null",
|
|
28
36
|
solution: "remove `sign: null` to sign normally, or set `mac.sign.identity` — keep it only if you intend to ship an unsigned app",
|
|
29
37
|
}, 'skipped macOS code signing. Note this changed in v27: `mac.sign: null` now means "do not sign", whereas in v26 it only meant "no custom signer" and the app was still signed. ' +
|
|
30
|
-
"See https://www.electron.build/docs/migration/v27-
|
|
38
|
+
"See https://www.electron.build/docs/migration/v27-config-changes#macos-signing-macsign");
|
|
31
39
|
return "skipped:disabled";
|
|
32
40
|
}
|
|
33
41
|
async findSigningIdentity(targetPlatform, qualifier, keychainFile, hasCustomSign, signOpts) {
|
|
@@ -53,7 +61,7 @@ export class MacTargetHelper {
|
|
|
53
61
|
identity = new Identity("-", undefined);
|
|
54
62
|
}
|
|
55
63
|
else if (noIdentity) {
|
|
56
|
-
await reportError(isMas, certificateTypes, qualifier, keychainFile, this.packager.
|
|
64
|
+
await reportError(isMas, certificateTypes, qualifier, keychainFile, this.packager.forceCodeSigningFor(targetPlatform));
|
|
57
65
|
return null;
|
|
58
66
|
}
|
|
59
67
|
}
|
|
@@ -202,8 +210,8 @@ export class MacTargetHelper {
|
|
|
202
210
|
// osx-sign prefers this over parsing the identity, so the hash never reaches its regex
|
|
203
211
|
return identity.hash;
|
|
204
212
|
}
|
|
205
|
-
//
|
|
206
|
-
const teamId =
|
|
213
|
+
// what osx-sign's pattern takes, so we never derive a Team ID it would have rejected
|
|
214
|
+
const teamId = parseIdentityTeamId(identity.name);
|
|
207
215
|
if (teamId == null) {
|
|
208
216
|
log.debug({ identityName: identity.name }, "cannot parse Team ID from identity name, signing with the identity name");
|
|
209
217
|
return identity.name;
|
|
@@ -242,7 +250,9 @@ export class MacTargetHelper {
|
|
|
242
250
|
}
|
|
243
251
|
return await grants(await this.getInheritEntitlements(targetPlatform, signOpts, false));
|
|
244
252
|
}
|
|
245
|
-
async buildSignOptions(appPath,
|
|
253
|
+
async buildSignOptions(appPath,
|
|
254
|
+
// null only for a custom signer without a keychain identity, which is called without one (see MacPackager.sign)
|
|
255
|
+
identity, config, keychainFile, arch, targetPlatform, hasCustomSign = false) {
|
|
246
256
|
const isMas = MacTargetHelper.isMasTarget(targetPlatform);
|
|
247
257
|
const type = MacTargetHelper.resolveSigningType(targetPlatform, config?.type);
|
|
248
258
|
let binaries = config?.binaries || undefined;
|
|
@@ -399,9 +409,11 @@ export class MacTargetHelper {
|
|
|
399
409
|
* only exists on macOS.
|
|
400
410
|
*/
|
|
401
411
|
async readSigningTeamId(file) {
|
|
412
|
+
// resolved outside the try: a codesign that cannot be located is a configuration error, not an unsigned file
|
|
413
|
+
const codesign = Executables.resolve("codesign");
|
|
402
414
|
try {
|
|
403
415
|
// `codesign -d` reports on stderr, so stdout alone (as `exec` returns) is not enough
|
|
404
|
-
const { stderr } = await spawnAndWriteWithOutput(
|
|
416
|
+
const { stderr } = await spawnAndWriteWithOutput(codesign, ["-d", "--verbose=4", file], "");
|
|
405
417
|
return parseSigningTeamId(stderr);
|
|
406
418
|
}
|
|
407
419
|
catch {
|
|
@@ -422,6 +434,7 @@ export class MacTargetHelper {
|
|
|
422
434
|
MacTargetHelper.assertSafePathForCommandUsage(artifactName, "artifact name");
|
|
423
435
|
const artifactPath = path.resolve(outDir, artifactName);
|
|
424
436
|
await this.packager.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile);
|
|
437
|
+
await this.verifyInstallerPackage(artifactPath, targetPlatform);
|
|
425
438
|
await this.packager.emitArtifactBuildCompleted({
|
|
426
439
|
file: artifactPath,
|
|
427
440
|
target: null,
|
|
@@ -541,19 +554,113 @@ export class MacTargetHelper {
|
|
|
541
554
|
}
|
|
542
555
|
return undefined;
|
|
543
556
|
}
|
|
557
|
+
/** The error for a forceCodeSigning build that would skip notarization because no notarization credentials are set. */
|
|
558
|
+
static missingNotarizationCredentialsError() {
|
|
559
|
+
return forceCodeSigningError("forceCodeSigning is enabled, but no notarization credentials are set, so the macOS app would not be notarized. " +
|
|
560
|
+
"Set APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER (recommended for CI), or APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD and APPLE_TEAM_ID, or APPLE_KEYCHAIN_PROFILE (with APPLE_KEYCHAIN); " +
|
|
561
|
+
"they must be set when the build starts. To skip notarization - for an ad-hoc or development-signed app, or one you notarize yourself, e.g. in an afterSign hook - set mac.notarize: false (the build then warns).");
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Whether `mac.notarize: true` requires notarization here: where the app can be signed, on a macOS host outside a pull-request
|
|
565
|
+
* build (isSignAllowed). Elsewhere a missing credential set only warns, as when `notarize` is unset. The build-start check and
|
|
566
|
+
* every notarization use this rule.
|
|
567
|
+
*/
|
|
568
|
+
static isNotarizationRequired(notarize) {
|
|
569
|
+
return notarize === true && isSignAllowed(false);
|
|
570
|
+
}
|
|
571
|
+
/** The error for `mac.notarize: true`, which requires notarization, when no notarization credentials are set. */
|
|
572
|
+
static notarizeTrueWithoutCredentialsError() {
|
|
573
|
+
return new InvalidConfigurationError("mac.notarize is true, which requires notarization, but no notarization credentials are set. " +
|
|
574
|
+
"Set APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER (recommended for CI), or APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD and APPLE_TEAM_ID, or APPLE_KEYCHAIN_PROFILE (with APPLE_KEYCHAIN); " +
|
|
575
|
+
"they must be set when the build starts. Leave mac.notarize unset to notarize only when credentials are set (and skip it with a warning otherwise), or set it to false to never notarize. " +
|
|
576
|
+
`See ${BUILD_CHANGES_URL}#mac-notarize-true-requires-credentials`);
|
|
577
|
+
}
|
|
578
|
+
/** Under forceCodeSigning, checks the signature of an installer package electron-builder signed (`pkgutil --check-signature`). */
|
|
579
|
+
async verifyInstallerPackage(pkg, targetPlatform = "mac") {
|
|
580
|
+
if (!this.packager.forceCodeSigningFor(targetPlatform)) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
const problem = await checkInstallerPackageSignature(pkg);
|
|
584
|
+
if (problem != null) {
|
|
585
|
+
throw forceCodeSigningError(`forceCodeSigning is enabled, but the installer package ${log.filePath(pkg)} is not validly signed (${problem}).`, VERIFICATION_FAILED_ERROR_CODE);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
544
588
|
async notarizeIfProvided(appPath) {
|
|
545
589
|
const notarizeOptions = this.packager.platformOptions.notarize;
|
|
590
|
+
const forceCodeSigning = this.packager.forceCodeSigning;
|
|
546
591
|
if (notarizeOptions === false) {
|
|
547
|
-
|
|
592
|
+
if (forceCodeSigning) {
|
|
593
|
+
// an explicit opt-out is honored under forceCodeSigning - the app may be notarized in an afterSign hook - but not silently
|
|
594
|
+
log
|
|
595
|
+
.once("notarize-false-with-force-code-signing", this.packager)
|
|
596
|
+
.warn({ reason: "`notarize` options were set explicitly `false`" }, "skipped macOS notarization although forceCodeSigning is enabled");
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
log.info({ reason: "`notarize` options were set explicitly `false`" }, "skipped macOS notarization");
|
|
600
|
+
}
|
|
548
601
|
return;
|
|
549
602
|
}
|
|
550
603
|
const options = MacTargetHelper.getNotarizeOptions(appPath);
|
|
551
604
|
if (!options) {
|
|
605
|
+
if (MacTargetHelper.isNotarizationRequired(notarizeOptions)) {
|
|
606
|
+
throw MacTargetHelper.notarizeTrueWithoutCredentialsError();
|
|
607
|
+
}
|
|
608
|
+
if (forceCodeSigning) {
|
|
609
|
+
throw MacTargetHelper.missingNotarizationCredentialsError();
|
|
610
|
+
}
|
|
552
611
|
log.warn({ reason: "`notarize` options were unable to be generated" }, "skipped macOS notarization");
|
|
553
612
|
return;
|
|
554
613
|
}
|
|
555
|
-
|
|
614
|
+
const apiKey = "appleApiKey" in options ? MacTargetHelper.decodeAppleApiKey(options.appleApiKey) : null;
|
|
615
|
+
// notarytool by absolute path, so that it never runs through an xcrun looked up on PATH: the credentials are in its arguments
|
|
616
|
+
const notarytoolPath = await Executables.notarytool();
|
|
617
|
+
if (apiKey == null) {
|
|
618
|
+
await notarize({ ...options, notarytoolPath });
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
// notarytool only reads the API key from a file: a fresh 0600 file in the build's temp dir, deleted as soon as notarytool is done
|
|
622
|
+
const keyFile = await this.packager.tempDirManager.getTempFile({ prefix: "notarize-api-key", suffix: ".p8" });
|
|
623
|
+
try {
|
|
624
|
+
await writeFile(keyFile, apiKey, { mode: 0o600, flag: "wx" });
|
|
625
|
+
await notarize({ ...options, appleApiKey: keyFile, notarytoolPath });
|
|
626
|
+
}
|
|
627
|
+
finally {
|
|
628
|
+
await rm(keyFile, { force: true }).catch((e) => log.warn({ error: e.message }, "cannot delete the temporary App Store Connect API key file"));
|
|
629
|
+
}
|
|
630
|
+
}
|
|
556
631
|
log.info(null, "notarization successful");
|
|
632
|
+
// @electron/notarize staples the ticket but never validates it
|
|
633
|
+
if (forceCodeSigning) {
|
|
634
|
+
const problem = await validateStapledTicket(appPath);
|
|
635
|
+
if (problem != null) {
|
|
636
|
+
throw forceCodeSigningError(`forceCodeSigning is enabled, but ${log.filePath(appPath)} was notarized and stapler validate rejects its stapled ticket (${problem}).`, VERIFICATION_FAILED_ERROR_CODE);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* `APPLE_API_KEY` is the path of the App Store Connect API key file (`AuthKey_<KEY_ID>.p8`), passed to notarytool as is, or the file's
|
|
642
|
+
* contents base64-encoded, so that a masked CI variable can hold it. Returns the decoded key, or null for a path. No path contains a
|
|
643
|
+
* `-----BEGIN` line or decodes to one, so a path is never mistaken for a key.
|
|
644
|
+
*/
|
|
645
|
+
static decodeAppleApiKey(value) {
|
|
646
|
+
if (value.includes("-----BEGIN")) {
|
|
647
|
+
throw new InvalidConfigurationError(`APPLE_API_KEY holds PEM text, but it must be a path or base64-encoded (the value is not shown). ${APPLE_API_KEY_HINT}`);
|
|
648
|
+
}
|
|
649
|
+
const decoded = decodeStrictBase64(value);
|
|
650
|
+
if (decoded != null && decoded.toString("utf8").includes("-----BEGIN")) {
|
|
651
|
+
try {
|
|
652
|
+
createPrivateKey({ key: decoded, format: "pem" });
|
|
653
|
+
}
|
|
654
|
+
catch (e) {
|
|
655
|
+
throw new InvalidConfigurationError(`APPLE_API_KEY decodes to PEM text that is not a valid private key (the value is not shown): ${e.message}. Check that it is the whole AuthKey_<KEY_ID>.p8 file and was not cut off. ${APPLE_API_KEY_HINT}`);
|
|
656
|
+
}
|
|
657
|
+
return decoded;
|
|
658
|
+
}
|
|
659
|
+
// "LS0tLS1CRUdJTi" is the base64 of "-----BEGIN": a damaged encoded key, which notarytool would print in its error if it were passed on as a path
|
|
660
|
+
if (value.includes("LS0tLS1CRUdJTi")) {
|
|
661
|
+
throw new InvalidConfigurationError(`APPLE_API_KEY looks like a base64-encoded key but is not valid standard base64 (the value is not shown): check for surrounding quotes, URL-safe \`-\` or \`_\` characters, or a truncated value. ${APPLE_API_KEY_HINT}`);
|
|
662
|
+
}
|
|
663
|
+
return null;
|
|
557
664
|
}
|
|
558
665
|
}
|
|
559
666
|
/** Big-endian fat/universal magic — the same bytes open a Java class file, so `nfat_arch` has to disambiguate. */
|
|
@@ -648,6 +755,26 @@ export function isLoadableMachOFileType(type) {
|
|
|
648
755
|
export async function isMachOFile(file) {
|
|
649
756
|
return (await readMachOFileType(file)) != null;
|
|
650
757
|
}
|
|
758
|
+
const LINE_TERMINATOR = /[\n\r\u2028\u2029]/;
|
|
759
|
+
/**
|
|
760
|
+
* The Team ID of a signing identity name such as `Developer ID Application: Foo Inc (ABCDE12345)`, or `null`: what
|
|
761
|
+
* @electron/osx-sign's `/^.+\((.+?)\)\s*$/` captures - the text between the last `(` that leaves it non-empty and a closing `)`
|
|
762
|
+
* followed only by whitespace, with at least one character before the `(` and no line break before the trailing whitespace.
|
|
763
|
+
* Parsed without that regular expression, which backtracks polynomially on names with many `(` (the name comes from the
|
|
764
|
+
* keychain or the configuration).
|
|
765
|
+
*
|
|
766
|
+
* @internal Exported for tests only.
|
|
767
|
+
*/
|
|
768
|
+
export function parseIdentityTeamId(name) {
|
|
769
|
+
// \s and trimEnd remove the same characters
|
|
770
|
+
const trimmed = name.trimEnd();
|
|
771
|
+
if (!trimmed.endsWith(")") || LINE_TERMINATOR.test(trimmed)) {
|
|
772
|
+
return null;
|
|
773
|
+
}
|
|
774
|
+
// the last "(" with at least one character between it and the closing ")"
|
|
775
|
+
const open = trimmed.lastIndexOf("(", trimmed.length - 3);
|
|
776
|
+
return open < 1 ? null : trimmed.substring(open + 1, trimmed.length - 1);
|
|
777
|
+
}
|
|
651
778
|
/**
|
|
652
779
|
* Extracts the `TeamIdentifier` from `codesign -d --verbose=4` output, or `null` when the field is absent or the
|
|
653
780
|
* literal `not set` that ad-hoc and self-signed signatures report.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MacTargetHelper.js","sourceRoot":"","sources":["../../../src/targets/mac/MacTargetHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA4D,MAAM,oBAAoB,CAAA;AAEvG,OAAO,EAAE,IAAI,EAAE,yBAAyB,EAAE,GAAG,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEjI,OAAO,EAAE,IAAI,EAAmB,MAAM,aAAa,CAAA;AACnD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAY,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAIjG,OAAO,EAAE,cAAc,EAAE,aAAa,EAA2B,MAAM,yBAAyB,CAAA;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,SAAS,MAAM,iBAAiB,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AAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY;IAC5C,OAAO,CAAC,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAA;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,cAAsB;IACvD,MAAM,MAAM,GAAG,wBAAwB,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;IACxE,OAAO,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;AAC/D,CAAC","sourcesContent":["import { notarize, type NotarizeOptions, type NotaryToolKeychainCredentials } from \"@electron/notarize\"\nimport type { PerFileSignOptions, SigningDistributionType, SignOptions } from \"@electron/osx-sign\"\nimport { Arch, InvalidConfigurationError, log, MAX_FILE_REQUESTS, spawnAndWriteWithOutput, statOrNull, walk } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { open, type FileHandle } from \"fs/promises\"\nimport * as path from \"path\"\nimport { CertType, findIdentity, Identity, reportError } from \"../../codeSign/mac/macCodeSign.js\"\nimport { SigningResult } from \"../../codeSign/signResult.js\"\nimport type { MacPackager } from \"../../macPackager.js\"\nimport { ElectronSignOptions, MasConfiguration } from \"../../options/macOptions.js\"\nimport { parsePlistFile, savePlistFile, PlistObject, PlistValue } from \"../../util/mac/plist.js\"\nimport { getTemplatePath } from \"../../util/pathManager.js\"\nimport asyncPool from \"tiny-async-pool\"\n\nexport type MasPlatformType = \"mas\" | \"mas-dev\"\nexport type PlatformType = MasPlatformType | \"mac\"\n\nconst DISABLE_LIBRARY_VALIDATION = \"com.apple.security.cs.disable-library-validation\"\nconst APP_SANDBOX = \"com.apple.security.app-sandbox\"\n\nexport class MacTargetHelper {\n constructor(private packager: MacPackager) {}\n\n /** Ad-hoc signing (`sign.identity: \"-\"`) produces a signature with no Team ID. */\n static isAdHocIdentity(identity: Identity | Nullish): boolean {\n return identity?.name === \"-\"\n }\n\n handleNullIdentity(): SigningResult {\n if (this.packager.forceCodeSigning) {\n throw new InvalidConfigurationError(\"identity explicitly is set to null, but forceCodeSigning is set to true\")\n }\n // The meaning of `mac.sign: null` flipped in v27. In v26 `sign` was only a custom-signer hook, so\n // null meant \"no custom signer\" and the app was still signed normally; now it means \"do not sign\".\n // A v26 config carried over unchanged therefore ships an UNSIGNED app with no other signal.\n log.warn(\n {\n reason: \"identity explicitly is set to null\",\n solution: \"remove `sign: null` to sign normally, or set `mac.sign.identity` — keep it only if you intend to ship an unsigned app\",\n },\n 'skipped macOS code signing. Note this changed in v27: `mac.sign: null` now means \"do not sign\", whereas in v26 it only meant \"no custom signer\" and the app was still signed. ' +\n \"See https://www.electron.build/docs/migration/v27-breaking-changes#macos-signing-macsign\"\n )\n return \"skipped:disabled\"\n }\n\n async findSigningIdentity(\n targetPlatform: PlatformType,\n qualifier: string | undefined,\n keychainFile: string | Nullish,\n hasCustomSign: boolean,\n signOpts: ElectronSignOptions | null | undefined\n ): Promise<Identity | null> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const certificateTypes = MacTargetHelper.getCertificateTypes(targetPlatform, MacTargetHelper.resolveSigningType(targetPlatform, signOpts?.type))\n\n let identity: Identity | null = null\n for (const certificateType of certificateTypes) {\n identity = await findIdentity(certificateType, qualifier, keychainFile)\n if (identity != null) {\n break\n }\n }\n\n if (identity == null) {\n const noIdentity = !hasCustomSign\n if (qualifier === \"-\") {\n if (MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime) && !(await this.isLibraryValidationDisabled(targetPlatform, signOpts))) {\n log.warn(\n null,\n `ad-hoc signing with hardenedRuntime enabled requires the ${DISABLE_LIBRARY_VALIDATION} entitlement ` +\n \"in both the app entitlements (build/entitlements.mac.plist or mac.sign.entitlements) and the inherit entitlements \" +\n \"(build/entitlements.mac.inherit.plist or mac.sign.entitlementsInherit) to prevent app launch failures due to library validation, \" +\n \"but at least one of your entitlements files does not grant it. \" +\n \"See https://electron.build/docs/features/code-signing for details.\"\n )\n }\n identity = new Identity(\"-\", undefined)\n } else if (noIdentity) {\n await reportError(isMas, certificateTypes, qualifier, keychainFile, this.packager.forceCodeSigning)\n return null\n }\n }\n\n return identity\n }\n\n /**\n * Resolves the app and inherit entitlements files for an ad-hoc build — same precedence as `getAppEntitlements()` and\n * `getInheritEntitlements()` — and returns whether both grant `com.apple.security.cs.disable-library-validation`.\n *\n * An ad-hoc signature carries no Team ID, so every process in the bundle — the app and each helper — fails library\n * validation when it loads the Electron framework unless its own entitlements disable it. A user-supplied inherit\n * plist (e.g. a production `build/entitlements.mac.inherit.plist`) without the key therefore breaks the helpers even\n * when the app entitlements grant it, which is why both files are checked.\n *\n * Fails open: returns false (so callers still warn) when either file cannot be read or parsed, or when no file\n * resolves at all (`@electron/osx-sign`'s defaults never grant the key). An explicit `sign.entitlements` /\n * `sign.entitlementsInherit` path that does not exist is a configuration error and throws, like any other missing\n * build resource.\n */\n async isLibraryValidationDisabled(targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish): Promise<boolean> {\n const [appEntitlements, inheritEntitlements] = await Promise.all([\n this.getAppEntitlements(targetPlatform, signOpts, true /* adHoc */),\n this.getInheritEntitlements(targetPlatform, signOpts, true /* adHoc */),\n ])\n return (await this.grantsDisableLibraryValidation(appEntitlements)) && (await this.grantsDisableLibraryValidation(inheritEntitlements))\n }\n\n private async grantsDisableLibraryValidation(file: string | null): Promise<boolean> {\n return (await this.entitlementsValue(file, DISABLE_LIBRARY_VALIDATION)) === true\n }\n\n /**\n * The value the entitlements file assigns to `key`, or `undefined` when the key is absent or the file cannot be\n * read or parsed. Returns the raw value rather than a boolean because callers disagree on the predicate: an\n * opt-out we act on ourselves is required to be literally `true`, while a key we are predicting\n * `@electron/osx-sign` will act on has to use osx-sign's own truthiness test.\n */\n private async entitlementsValue(file: string | null, key: string): Promise<PlistValue | undefined> {\n if (file == null) {\n // no user-supplied file and no bundled default — @electron/osx-sign's defaults never grant the key\n return undefined\n }\n try {\n const entitlements = await parsePlistFile<PlistObject>(file)\n return entitlements[key]\n } catch (e: any) {\n log.debug({ file, key, error: e.message }, \"cannot read entitlements\")\n return undefined\n }\n }\n\n /**\n * Resolves the entitlements file for the app bundle itself.\n *\n * Precedence: explicit `sign.entitlements` → `build/entitlements.{mac,mas}.plist` → a bundled default.\n * The explicit path is resolved like every other build resource (build resources dir, then project dir) and\n * must exist. Returns `null` when no default applies, which lets `@electron/osx-sign` fall back to its own\n * Chromium-derived defaults (`default.mas.plist` for MAS).\n */\n async getAppEntitlements(targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish, adHoc: boolean): Promise<string | null> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n // an explicit `sign.entitlements` resolves like every other build resource (build resources dir, then project dir);\n // `null`/empty behave like unset so the `build/entitlements.{mac,mas}.plist` convention still applies\n const entitlements = await this.packager.getResource(signOpts?.entitlements || undefined, `entitlements.${isMas ? \"mas\" : \"mac\"}.plist`)\n if (entitlements != null) {\n return entitlements\n }\n if (isMas) {\n // @electron/osx-sign's default.mas.plist enables the App Sandbox, which a MAS build cannot ship without\n return null\n }\n return getTemplatePath(adHoc ? \"entitlements.mac.adhoc.plist\" : \"entitlements.mac.plist\")\n }\n\n /**\n * Resolves the entitlements file for the nested binaries (helpers, frameworks, unpacked executables) that\n * inherit the app's signature.\n *\n * Precedence: explicit `sign.entitlementsInherit` → `build/entitlements.{mac,mas}.inherit.plist` → `null`,\n * which hands the file to `@electron/osx-sign`'s per-file defaults, modelled on Chromium's own entitlements\n * (the explicit path is resolved like every other build resource — build resources dir, then project dir — and must exist):\n * - renderer and GPU helpers: `allow-jit` only\n * - plugin helper: `allow-jit`, `allow-unsigned-executable-memory`, `disable-library-validation`\n * - everything else (frameworks, `.node` modules, unpacked executables): `default.darwin.plist`, i.e. `allow-jit`\n * plus Chromium's `device.*` / `personal-information.*` entitlements\n * Nested binaries therefore do not inherit the app's entitlements, and apart from the plugin helper none of these\n * defaults grant `disable-library-validation` or `allow-unsigned-executable-memory`.\n */\n async getInheritEntitlements(targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish, adHoc: boolean): Promise<string | null> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n // an explicit `sign.entitlementsInherit` resolves like every other build resource (build resources dir, then project dir);\n // `null`/empty behave like unset so the `build/entitlements.{mac,mas}.inherit.plist` convention still applies\n const entitlements = await this.packager.getResource(signOpts?.entitlementsInherit || undefined, `entitlements.${isMas ? \"mas\" : \"mac\"}.inherit.plist`)\n if (entitlements != null) {\n return entitlements\n }\n // an ad-hoc signature has no Team ID, so every process in the bundle — not just the main one — needs\n // library validation disabled or it cannot load the Electron framework\n return adHoc && !isMas ? getTemplatePath(\"entitlements.mac.adhoc.plist\") : null\n }\n\n /**\n * Picks the string handed to `@electron/osx-sign` as `identity`. Two consumers inside osx-sign want different\n * forms of the same certificate, which is why this line has flipped twice before:\n *\n * - `codesign --sign <identity>` needs a *unique* reference. A common name can match several valid certificates\n * (the same name issued twice with different expiry dates), and `codesign` then fails with\n * `... : ambiguous (matches \"X\" and \"X\" ...)` — `--keychain` does not disambiguate it. Only the SHA-1 hash is\n * unique. https://github.com/electron-userland/electron-builder/issues/10237\n * - osx-sign's entitlements automation scrapes the Team ID out of the identity *name* with `/^.+\\((.+?)\\)$/` to\n * fill in `ElectronTeamID`, and throws `Could not automatically determine ElectronTeamID from identity` when\n * that fails. A bare hash has no `(TEAMID)` suffix.\n * https://github.com/electron-userland/electron-builder/issues/7995\n *\n * So we pass the hash and, when that automation is going to run, hand it the Team ID through the one channel it\n * already prefers over the identity name: `ElectronTeamID` in the app's `Info.plist`. Writing that key is exactly\n * what osx-sign would have done itself, from the same source. It reaches the regex only when the App Sandbox is\n * enabled (see `isSandboxed`), no `provisioningProfile` is configured, and `Info.plist` carries no\n * `ElectronTeamID` — so those cases skip the write and pass the hash straight through.\n *\n * Falls back to the name whenever the hash cannot be made to work (no hash at all, ad-hoc, a self-signed name\n * with no `(TEAMID)`, an unreadable `Info.plist`), which leaves the previous behavior — and the previous error\n * message — untouched for those cases.\n *\n * All of this is osx-sign-specific, so a custom signer (`sign` as a function or module path) gets the bare hash\n * and an untouched `Info.plist`: `@electron/osx-sign` never runs, so there is no automation to feed.\n */\n async resolveSignIdentity(appPath: string, identity: Identity, signOpts: ElectronSignOptions | Nullish, targetPlatform: PlatformType, hasCustomSign = false): Promise<string> {\n // ad-hoc (\"-\") and any name-only identity have nothing to disambiguate with\n if (!identity.hash || MacTargetHelper.isAdHocIdentity(identity)) {\n return identity.name\n }\n\n // a custom signer replaces @electron/osx-sign entirely. Hand over the unique hash — the form `codesign`\n // needs — and mutate nothing on its behalf. This must stay above every branch below, so a delegated signer\n // never lands in one of their `identity.name` fallbacks.\n if (hasCustomSign) {\n return identity.hash\n }\n\n // osx-sign's entitlements automation is off, or it takes the Team ID from the profile instead of the identity\n if (signOpts?.preAutoEntitlements === false || signOpts?.provisioningProfile) {\n return identity.hash\n }\n\n if (!(await this.isSandboxed(appPath, signOpts, targetPlatform))) {\n return identity.hash\n }\n\n const infoPlistFile = path.join(appPath, \"Contents\", \"Info.plist\")\n try {\n const info = await parsePlistFile<PlistObject>(infoPlistFile)\n if (info.ElectronTeamID) {\n // osx-sign prefers this over parsing the identity, so the hash never reaches its regex\n return identity.hash\n }\n\n // the same pattern osx-sign uses, so we never derive a Team ID it would have rejected\n const teamId = /^.+\\((.+?)\\)\\s*$/.exec(identity.name)?.[1]\n if (teamId == null) {\n log.debug({ identityName: identity.name }, \"cannot parse Team ID from identity name, signing with the identity name\")\n return identity.name\n }\n\n await savePlistFile(infoPlistFile, { ...info, ElectronTeamID: teamId })\n log.debug({ file: log.filePath(infoPlistFile), teamId }, \"ElectronTeamID set from the signing identity name\")\n return identity.hash\n } catch (e: any) {\n log.debug({ file: log.filePath(infoPlistFile), error: e.message }, \"cannot read or update Info.plist, signing with the identity name\")\n return identity.name\n }\n }\n\n /**\n * Whether `@electron/osx-sign`'s entitlements automation can reach the `ElectronTeamID`-from-identity-name step\n * that a bare hash cannot satisfy.\n *\n * osx-sign gates the automation on `!filePath.includes('.app/')` and runs it with that path's own entitlements.\n * The app bundle itself always qualifies, under the app entitlements. Two further cases qualify under the\n * inherit entitlements, and only then is that file worth reading: a `sign.binaries` entry (signed alongside the\n * bundle rather than within it), and — when the signed bundle is not named `*.app`, which `--prepackaged`\n * allows — every file inside it, since none of their paths contain `.app/` either.\n *\n * A `null` file means osx-sign falls back to its own default, and only the MAS defaults enable the App Sandbox.\n * Truthiness, not `=== true`, because that is the test osx-sign itself applies.\n */\n private async isSandboxed(appPath: string, signOpts: ElectronSignOptions | Nullish, targetPlatform: PlatformType): Promise<boolean> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const grants = async (file: string | null) => (file == null ? isMas : !!(await this.entitlementsValue(file, APP_SANDBOX)))\n\n if (await grants(await this.getAppEntitlements(targetPlatform, signOpts, false))) {\n return true\n }\n if (!signOpts?.binaries?.length && path.basename(appPath).endsWith(\".app\")) {\n // nothing but the bundle itself is signed outside a `.app/` path, so the inherit entitlements never apply\n return false\n }\n return await grants(await this.getInheritEntitlements(targetPlatform, signOpts, false))\n }\n\n async buildSignOptions(\n appPath: string,\n identity: Identity,\n config: ElectronSignOptions | null | undefined,\n keychainFile: string | Nullish,\n arch: Arch,\n targetPlatform: PlatformType,\n hasCustomSign = false\n ): Promise<SignOptions> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const type = MacTargetHelper.resolveSigningType(targetPlatform, config?.type)\n\n let binaries = config?.binaries || undefined\n if (binaries) {\n // Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path.\n binaries = (\n await Promise.all(\n binaries.flatMap(async destination => {\n const expandedDestination = this.packager.expandArch(destination, arch)\n return await Promise.all(\n expandedDestination.map(async d => {\n if (await statOrNull(d)) {\n return d\n }\n return path.resolve(appPath, d)\n })\n )\n })\n )\n ).flat()\n log.info({ binaries, arch: arch == null ? null : Arch[arch] }, \"signing additional user-defined binaries for arch\")\n }\n\n let filter = config?.ignore\n if (Array.isArray(filter)) {\n if (filter.length == 0) {\n filter = undefined\n }\n } else if (typeof filter === \"string\") {\n filter = filter.length === 0 ? undefined : [filter]\n }\n\n const filterRe =\n typeof filter === \"function\"\n ? null\n : filter?.map(it => {\n try {\n return new RegExp(it)\n } catch (e: any) {\n throw new InvalidConfigurationError(`Invalid regex filter pattern: ${it}. ${e.message}`)\n }\n })\n\n return {\n identityValidation: false,\n // https://github.com/electron-userland/electron-builder/issues/1699\n // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.\n ignore: (file: string) => {\n if (filterRe != null) {\n for (const regExp of filterRe) {\n if (regExp.test(file)) {\n return true\n }\n }\n }\n if (typeof filter === \"function\" && filter(file)) {\n return true\n }\n return (\n file.endsWith(\".kext\") ||\n file.startsWith(\"/Contents/PlugIns\", appPath.length) ||\n file.includes(\"/node_modules/puppeteer/.local-chromium\") ||\n file.includes(\"/node_modules/playwright-firefox/.local-browsers\") ||\n file.includes(\"/node_modules/playwright/.local-browsers\")\n )\n\n /* Those are browser automating modules, browser (chromium, nightly) cannot be signed\n https://github.com/electron-userland/electron-builder/issues/2010\n https://github.com/electron-userland/electron-builder/issues/5383\n */\n },\n identity: identity ? await this.resolveSignIdentity(appPath, identity, config, targetPlatform, hasCustomSign) : undefined,\n type,\n platform: isMas ? \"mas\" : \"darwin\",\n version: this.packager.config.electronVersion || undefined,\n app: appPath,\n keychain: keychainFile || undefined,\n binaries,\n // https://github.com/electron-userland/electron-builder/issues/1480\n strictVerify: config?.strictVerify,\n preAutoEntitlements: config?.preAutoEntitlements,\n optionsForFile: await this.getOptionsForFile(appPath, targetPlatform, config, identity),\n provisioningProfile: config?.provisioningProfile || undefined,\n }\n }\n\n /**\n * Post-sign diagnostic replacing the blanket `com.apple.security.cs.disable-library-validation` default.\n *\n * Walks the Mach-O libraries and bundles (`MH_DYLIB` / `MH_BUNDLE`) under `Contents/Resources/app.asar.unpacked` and\n * `Contents/PlugIns` and reports the ones whose signature does not carry the Team ID `codesign` reports for the\n * freshly signed app bundle — typically excluded via `sign.ignore`, or fetched at build time already signed by a\n * third party. Only loadable code is checked because library validation applies to what a process loads;\n * executables (`MH_EXECUTE`, e.g. a bundled ffmpeg) are spawned rather than loaded, so a foreign signature on them is\n * not a launch failure and reporting them would be a false positive. `Contents/PlugIns` is covered because\n * `buildSignOptions` never re-signs it, so a bundle there keeps whatever signature it shipped with. Under the\n * hardened runtime those fail library validation when loaded, which is precisely the failure the old default hid\n * from every user instead of only the affected ones.\n *\n * The opt-out is read from the app entitlements (not the inherit ones) because library validation is enforced by\n * the loading process under its own entitlements — the main process, governed by the app plist, is the usual loader\n * of these modules, while the inherit plist only governs loads performed by helper processes.\n *\n * Best-effort: never fails the build, and skips the scan when the app bundle itself has no Team ID (e.g. a\n * self-signed certificate).\n */\n async warnAboutForeignSignedBinaries(appPath: string, identity: Identity | Nullish, targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish): Promise<void> {\n if (\n MacTargetHelper.isMasTarget(targetPlatform) ||\n MacTargetHelper.isAdHocIdentity(identity) ||\n !MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime)\n ) {\n return\n }\n if (await this.grantsDisableLibraryValidation(await this.getAppEntitlements(targetPlatform, signOpts, false))) {\n // the app already opted out of library validation\n return\n }\n\n // `Contents/PlugIns` is scanned too: `buildSignOptions` unconditionally excludes it from re-signing, so anything\n // there keeps whatever third-party signature it shipped with — exactly what fails library validation\n const candidateDirs = [path.join(appPath, \"Contents\", \"Resources\", \"app.asar.unpacked\"), path.join(appPath, \"Contents\", \"PlugIns\")]\n try {\n const dirs: string[] = []\n for (const dir of candidateDirs) {\n if ((await statOrNull(dir)) != null) {\n dirs.push(dir)\n }\n }\n if (dirs.length === 0) {\n return\n }\n // the Team ID is read from the signed bundle rather than parsed out of the identity's common name: not every\n // identity carries a \"(TEAMID)\" suffix, and a self-signed one can carry it without codesign ever recording it\n const teamId = await this.readSigningTeamId(appPath)\n if (teamId == null) {\n // no Team ID to compare against (unsigned, or signed without one)\n return\n }\n let files: string[] = []\n for (const dir of dirs) {\n files = files.concat(await walk(dir))\n }\n // bounded concurrency: each check spawns `codesign -d`; results are sorted afterwards so the warning is deterministic\n const checked = await asyncPool<string, string | null>(MAX_FILE_REQUESTS, files, async file => {\n // only dylibs and bundles get loaded into a process; executables are spawned and never face library validation\n if (!isLoadableMachOFileType(await readMachOFileType(file))) {\n return null\n }\n return (await this.readSigningTeamId(file)) === teamId ? null : path.relative(appPath, file)\n })\n const foreign = checked.filter((it): it is string => it != null).sort()\n if (foreign.length > 0) {\n log.warn(\n { files: foreign.join(\", \"), teamId },\n `libraries in app.asar.unpacked or Contents/PlugIns are unsigned or signed by another team — under the hardened runtime they will fail library validation when loaded. ` +\n `Sign them with the same identity, or grant ${DISABLE_LIBRARY_VALIDATION} in build/entitlements.mac.plist ` +\n `(and in build/entitlements.mac.inherit.plist if a helper process such as a utilityProcess or a nodeIntegration renderer loads them)`\n )\n }\n } catch (e: any) {\n log.debug({ error: e.message }, \"cannot inspect app.asar.unpacked and Contents/PlugIns for foreign-signed binaries\")\n }\n }\n\n /**\n * The `TeamIdentifier` of a file's existing code signature as reported by `codesign -d`, or `null` when there is none:\n * `codesign` fails (e.g. the file is unsigned), the field is absent, or it is the literal `not set` that ad-hoc and\n * self-signed signatures report.\n *\n * @internal An instance method rather than a module-level function so tests can stub the `codesign` invocation, which\n * only exists on macOS.\n */\n async readSigningTeamId(file: string): Promise<string | null> {\n try {\n // `codesign -d` reports on stderr, so stdout alone (as `exec` returns) is not enough\n const { stderr } = await spawnAndWriteWithOutput(\"/usr/bin/codesign\", [\"-d\", \"--verbose=4\", file], \"\")\n return parseSigningTeamId(stderr)\n } catch {\n // unsigned binaries make `codesign -d` exit non-zero\n return null\n }\n }\n\n async createMasInstaller(\n appPath: string,\n outDir: string,\n masOptions: MasConfiguration,\n keychainFile: string | Nullish,\n targetPlatform: PlatformType,\n arch: Arch,\n identityQualifier?: string | null\n ): Promise<void> {\n const certType = MacTargetHelper.isMasDevelopment(targetPlatform) ? \"Mac Developer\" : \"3rd Party Mac Developer Installer\"\n const masInstallerIdentity = await findIdentity(certType, identityQualifier, keychainFile)\n\n if (masInstallerIdentity == null) {\n throw new InvalidConfigurationError(`Cannot find valid \"${certType}\" identity to sign MAS installer, please see https://electron.build/docs/features/code-signing`)\n }\n\n MacTargetHelper.assertSafePathForCommandUsage(outDir, \"output directory\")\n\n // mas uploaded to AppStore, so, use \"-\" instead of space for name\n // path.basename prevents path traversal if a crafted artifactName contains \"../../\"\n const artifactName = path.basename(this.packager.expandArtifactNamePattern(masOptions, \"pkg\", arch))\n MacTargetHelper.assertSafePathForCommandUsage(artifactName, \"artifact name\")\n const artifactPath = path.resolve(outDir, artifactName)\n await this.packager.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile)\n await this.packager.emitArtifactBuildCompleted({\n file: artifactPath,\n target: null,\n arch: Arch.x64,\n safeArtifactName: this.packager.computeSafeArtifactName(artifactName, \"pkg\", arch, true, this.packager.platformOptions.defaultArch),\n packager: this.packager,\n })\n }\n\n async getOptionsForFile(\n appPath: string,\n targetPlatform: PlatformType,\n customSignOptions: ElectronSignOptions | Nullish,\n identity: Identity | Nullish\n ): Promise<(filePath: string) => PerFileSignOptions> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const adHoc = MacTargetHelper.isAdHocIdentity(identity)\n const appEntitlements = await this.getAppEntitlements(targetPlatform, customSignOptions, adHoc)\n const inheritEntitlements = await this.getInheritEntitlements(targetPlatform, customSignOptions, adHoc)\n\n const getEntitlements = (filePath: string) => {\n if (filePath === appPath) {\n return appEntitlements\n }\n\n if (filePath.includes(\"Library/LoginItems\")) {\n return customSignOptions?.entitlementsLoginHelper\n }\n\n // `null` leaves the file to @electron/osx-sign's per-file defaults, which are tighter than one blanket plist\n return inheritEntitlements\n }\n\n const requirements = isMas || customSignOptions?.requirements == null ? undefined : await this.packager.getResource(customSignOptions.requirements)\n\n return (filePath: string): PerFileSignOptions => {\n const entitlements = getEntitlements(filePath)\n return {\n entitlements: entitlements || undefined,\n hardenedRuntime: MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, customSignOptions?.hardenedRuntime) ?? undefined,\n timestamp: customSignOptions?.timestamp || undefined,\n requirements: requirements || undefined,\n additionalArguments: customSignOptions?.additionalArguments || undefined,\n }\n }\n }\n\n /**\n * The effective signing type: an explicit `sign.type` wins, otherwise derived from the build flavor\n * (`mas-dev` → `development`, otherwise `distribution`).\n */\n static resolveSigningType(targetPlatform: PlatformType, configType: SigningDistributionType | Nullish): SigningDistributionType {\n return configType ?? (MacTargetHelper.isMasDevelopment(targetPlatform) ? \"development\" : \"distribution\")\n }\n\n static getCertificateTypes(targetPlatform: PlatformType, type: SigningDistributionType): CertType[] {\n if (type === \"development\") {\n return [\"Mac Developer\", \"Apple Development\"]\n }\n return MacTargetHelper.isMasTarget(targetPlatform) ? [\"Apple Distribution\", \"3rd Party Mac Developer Application\"] : [\"Developer ID Application\"]\n }\n\n /**\n * The MAS `.pkg` installer is only built for distribution signing — a development-signed build\n * (`mas-dev`, or an explicit `sign.type: \"development\"` on a `mas` build) is installed directly.\n */\n static shouldCreateMasInstaller(targetPlatform: PlatformType, configType: SigningDistributionType | Nullish): targetPlatform is MasPlatformType {\n return MacTargetHelper.isMasTarget(targetPlatform) && MacTargetHelper.resolveSigningType(targetPlatform, configType) !== \"development\"\n }\n\n static isMasTarget(targetName: string): boolean {\n return targetName === \"mas\" || targetName === \"mas-dev\"\n }\n\n static isMasDevelopment(targetName: string): boolean {\n return targetName === \"mas-dev\"\n }\n\n static getPlatformTypeFromTarget(targetName: string): PlatformType {\n // must check for mas-dev first\n if (MacTargetHelper.isMasDevelopment(targetName)) {\n return \"mas-dev\"\n }\n if (MacTargetHelper.isMasTarget(targetName)) {\n return \"mas\"\n }\n return \"mac\"\n }\n\n /**\n * Returns true when hardened runtime will be active for signing.\n * For non-MAS builds it defaults to on; for MAS it defaults to off.\n */\n static isHardenedRuntimeEnabledForSigning(targetPlatform: PlatformType, hardenedRuntime: boolean | null | undefined): boolean {\n return MacTargetHelper.isMasTarget(targetPlatform) ? hardenedRuntime === true : hardenedRuntime !== false\n }\n\n static assertSafePathForCommandUsage(pathValue: string, description: string): void {\n if (/[\\0\\r\\n\"'`$;&|<>]/.test(pathValue)) {\n throw new InvalidConfigurationError(`Invalid ${description}: contains unsupported shell-special characters`)\n }\n }\n\n static getNotarizeOptions(appPath: string): NotarizeOptions | undefined {\n const teamId = process.env.APPLE_TEAM_ID\n const appleId = process.env.APPLE_ID\n const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD\n\n if (appleId || appleIdPassword) {\n if (!appleId) {\n throw new InvalidConfigurationError(`APPLE_ID env var needs to be set`)\n }\n if (!appleIdPassword) {\n throw new InvalidConfigurationError(`APPLE_APP_SPECIFIC_PASSWORD env var needs to be set`)\n }\n if (!teamId) {\n throw new InvalidConfigurationError(`APPLE_TEAM_ID env var needs to be set`)\n }\n return { appPath, appleId, appleIdPassword, teamId }\n }\n\n const appleApiKey = process.env.APPLE_API_KEY\n const appleApiKeyId = process.env.APPLE_API_KEY_ID\n const appleApiIssuer = process.env.APPLE_API_ISSUER\n if (appleApiKey || appleApiKeyId || appleApiIssuer) {\n if (!appleApiKey || !appleApiKeyId || !appleApiIssuer) {\n throw new InvalidConfigurationError(`Env vars APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER need to be set`)\n }\n return { appPath, appleApiKey, appleApiKeyId, appleApiIssuer }\n }\n\n const keychain = process.env.APPLE_KEYCHAIN\n const keychainProfile = process.env.APPLE_KEYCHAIN_PROFILE\n if (keychainProfile) {\n let args: NotaryToolKeychainCredentials = { keychainProfile }\n if (keychain) {\n args = { ...args, keychain }\n }\n return { appPath, ...args }\n }\n\n return undefined\n }\n\n async notarizeIfProvided(appPath: string): Promise<void> {\n const notarizeOptions = this.packager.platformOptions.notarize\n if (notarizeOptions === false) {\n log.info({ reason: \"`notarize` options were set explicitly `false`\" }, \"skipped macOS notarization\")\n return\n }\n const options = MacTargetHelper.getNotarizeOptions(appPath)\n if (!options) {\n log.warn({ reason: \"`notarize` options were unable to be generated\" }, \"skipped macOS notarization\")\n return\n }\n await notarize(options)\n log.info(null, \"notarization successful\")\n }\n}\n\n/** Big-endian fat/universal magic — the same bytes open a Java class file, so `nfat_arch` has to disambiguate. */\nconst FAT_MAGIC = 0xcafebabe\n/** libmagic's heuristic: a fat header has fewer than 30 slices, whereas a Java class file's `major_version` (in the same bytes) is at least 45. */\nconst FAT_MAX_ARCH_COUNT = 30\n/** Thin magics as read big-endian: the file is big-endian when the bytes spell the magic out, little-endian when they are byte-swapped. */\nconst THIN_MAGIC_BE = new Set([0xfeedface, 0xfeedfacf])\nconst THIN_MAGIC_LE = new Set([0xcefaedfe, 0xcffaedfe])\n/** `mach_header.filetype` follows `magic`, `cputype` and `cpusubtype` in both the 32- and 64-bit header. */\nconst MACH_HEADER_FILETYPE_OFFSET = 12\nconst MACH_HEADER_MIN_LENGTH = 16\n/** The first `fat_arch` (`cputype`, `cpusubtype`, `offset`, `size`, `align` — five big-endian uint32s) follows the 8-byte fat header. */\nconst FAT_ARCH_OFFSET = 8\nconst FAT_ARCH_LENGTH = 20\nconst FAT_ARCH_SLICE_OFFSET_FIELD = FAT_ARCH_OFFSET + 8\nconst HEAD_READ_LENGTH = 4096\n\n/** The `mach_header.filetype` values the foreign-signature scan tells apart (see `<mach-o/loader.h>`). */\nexport const MachOFileType = {\n /** Executable — spawned as its own process, never loaded into another one. */\n MH_EXECUTE: 2,\n /** Dynamically bound shared library (`.dylib`). */\n MH_DYLIB: 6,\n /** Dynamically bound bundle (`.node` native addons, plug-ins). */\n MH_BUNDLE: 8,\n} as const\n\n/**\n * The `filetype` field of a Mach-O header, or `null` when the file is not Mach-O, too short, or unreadable. Endianness\n * follows the magic. A fat/universal binary reports the filetype of its first slice (all slices share one filetype);\n * the fat magic `0xcafebabe` is shared with Java class files, so `nfat_arch` must also be a plausible slice count.\n *\n * @internal Exported for tests only.\n */\nexport async function readMachOFileType(file: string): Promise<number | null> {\n let handle: FileHandle | null = null\n try {\n handle = await open(file, \"r\")\n const head = Buffer.alloc(HEAD_READ_LENGTH)\n const { bytesRead } = await handle.read(head, 0, HEAD_READ_LENGTH, 0)\n if (bytesRead < 4) {\n return null\n }\n if (head.readUInt32BE(0) !== FAT_MAGIC) {\n return readThinMachOFileType(head.subarray(0, bytesRead))\n }\n if (bytesRead < FAT_ARCH_OFFSET + FAT_ARCH_LENGTH) {\n return null\n }\n const archCount = head.readUInt32BE(4)\n if (archCount === 0 || archCount >= FAT_MAX_ARCH_COUNT) {\n return null\n }\n const sliceOffset = head.readUInt32BE(FAT_ARCH_SLICE_OFFSET_FIELD)\n const sliceHeader = Buffer.alloc(MACH_HEADER_MIN_LENGTH)\n const slice = await handle.read(sliceHeader, 0, MACH_HEADER_MIN_LENGTH, sliceOffset)\n return readThinMachOFileType(sliceHeader.subarray(0, slice.bytesRead))\n } catch {\n return null\n } finally {\n await handle?.close()\n }\n}\n\nfunction readThinMachOFileType(header: Buffer): number | null {\n if (header.length < MACH_HEADER_MIN_LENGTH) {\n return null\n }\n const magic = header.readUInt32BE(0)\n if (THIN_MAGIC_BE.has(magic)) {\n return header.readUInt32BE(MACH_HEADER_FILETYPE_OFFSET)\n }\n if (THIN_MAGIC_LE.has(magic)) {\n return header.readUInt32LE(MACH_HEADER_FILETYPE_OFFSET)\n }\n return null\n}\n\n/**\n * Whether a Mach-O filetype is loaded into a process — a dylib or a bundle — and is therefore subject to library\n * validation. Executables are spawned, not loaded, so they are not.\n *\n * @internal Exported for tests only.\n */\nexport function isLoadableMachOFileType(type: number | null): boolean {\n return type === MachOFileType.MH_DYLIB || type === MachOFileType.MH_BUNDLE\n}\n\n/**\n * Whether the file starts with a Mach-O header (thin or fat), regardless of filetype.\n *\n * @internal Exported for tests only.\n */\nexport async function isMachOFile(file: string): Promise<boolean> {\n return (await readMachOFileType(file)) != null\n}\n\n/**\n * Extracts the `TeamIdentifier` from `codesign -d --verbose=4` output, or `null` when the field is absent or the\n * literal `not set` that ad-hoc and self-signed signatures report.\n *\n * @internal Exported for tests only.\n */\nexport function parseSigningTeamId(codesignOutput: string): string | null {\n const teamId = /^TeamIdentifier=(.+)$/m.exec(codesignOutput)?.[1].trim()\n return teamId == null || teamId === \"not set\" ? null : teamId\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MacTargetHelper.js","sourceRoot":"","sources":["../../../src/targets/mac/MacTargetHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA4D,MAAM,oBAAoB,CAAA;AAEvG,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,yBAAyB,EAAE,GAAG,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAElK,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAA;AAC1G,OAAO,EAAY,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAChH,OAAO,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAA;AAIlH,OAAO,EAAE,cAAc,EAAE,aAAa,EAA2B,MAAM,yBAAyB,CAAA;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,e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type { PerFileSignOptions, SigningDistributionType, SignOptions } from \"@electron/osx-sign\"\nimport { Arch, decodeStrictBase64, Executables, InvalidConfigurationError, log, MAX_FILE_REQUESTS, spawnAndWriteWithOutput, statOrNull, walk } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { createPrivateKey } from \"crypto\"\nimport { open, rm, writeFile, type FileHandle } from \"fs/promises\"\nimport * as path from \"path\"\nimport { forceCodeSigningError, VERIFICATION_FAILED_ERROR_CODE } from \"../../codeSign/forceCodeSigning.js\"\nimport { CertType, findIdentity, Identity, isSignAllowed, reportError } from \"../../codeSign/mac/macCodeSign.js\"\nimport { checkInstallerPackageSignature, validateStapledTicket } from \"../../codeSign/mac/macSignatureVerifier.js\"\nimport { SigningResult } from \"../../codeSign/signResult.js\"\nimport type { MacPackager } from \"../../macPackager.js\"\nimport { ElectronSignOptions, MasConfiguration } from \"../../options/macOptions.js\"\nimport { parsePlistFile, savePlistFile, PlistObject, PlistValue } from \"../../util/mac/plist.js\"\nimport { BUILD_CHANGES_URL } from \"../../util/config/legacyOptions.js\"\nimport { getTemplatePath } from \"../../util/pathManager.js\"\nimport asyncPool from \"tiny-async-pool\"\n\nexport type MasPlatformType = \"mas\" | \"mas-dev\"\nexport type PlatformType = MasPlatformType | \"mac\"\n\nconst DISABLE_LIBRARY_VALIDATION = \"com.apple.security.cs.disable-library-validation\"\nconst APP_SANDBOX = \"com.apple.security.app-sandbox\"\n\n/** How to produce a base64 `APPLE_API_KEY`; ends each of its format errors, which never include the value. */\nconst APPLE_API_KEY_HINT =\n \"Set APPLE_API_KEY to the path of the AuthKey_<KEY_ID>.p8 file, or to the file's contents base64-encoded on one line: `base64 < AuthKey_<KEY_ID>.p8 | tr -d '\\\\n'` \" +\n \"(macOS, Linux) or `[Convert]::ToBase64String([IO.File]::ReadAllBytes((Resolve-Path AuthKey_<KEY_ID>.p8)))` (PowerShell). \" +\n \"See https://www.electron.build/docs/features/code-signing/notarization\"\n\nexport class MacTargetHelper {\n constructor(private packager: MacPackager) {}\n\n /** Ad-hoc signing (`sign.identity: \"-\"`) produces a signature with no Team ID. */\n static isAdHocIdentity(identity: Identity | Nullish): boolean {\n return identity?.name === \"-\"\n }\n\n handleNullIdentity(targetPlatform: PlatformType): SigningResult {\n if (this.packager.forceCodeSigningFor(targetPlatform)) {\n throw new InvalidConfigurationError(\"identity explicitly is set to null, but forceCodeSigning is set to true\")\n }\n // The meaning of `mac.sign: null` flipped in v27. In v26 `sign` was only a custom-signer hook, so\n // null meant \"no custom signer\" and the app was still signed normally; now it means \"do not sign\".\n // A v26 config carried over unchanged therefore ships an UNSIGNED app with no other signal.\n log.warn(\n {\n reason: \"identity explicitly is set to null\",\n solution: \"remove `sign: null` to sign normally, or set `mac.sign.identity` — keep it only if you intend to ship an unsigned app\",\n },\n 'skipped macOS code signing. Note this changed in v27: `mac.sign: null` now means \"do not sign\", whereas in v26 it only meant \"no custom signer\" and the app was still signed. ' +\n \"See https://www.electron.build/docs/migration/v27-config-changes#macos-signing-macsign\"\n )\n return \"skipped:disabled\"\n }\n\n async findSigningIdentity(\n targetPlatform: PlatformType,\n qualifier: string | undefined,\n keychainFile: string | Nullish,\n hasCustomSign: boolean,\n signOpts: ElectronSignOptions | null | undefined\n ): Promise<Identity | null> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const certificateTypes = MacTargetHelper.getCertificateTypes(targetPlatform, MacTargetHelper.resolveSigningType(targetPlatform, signOpts?.type))\n\n let identity: Identity | null = null\n for (const certificateType of certificateTypes) {\n identity = await findIdentity(certificateType, qualifier, keychainFile)\n if (identity != null) {\n break\n }\n }\n\n if (identity == null) {\n const noIdentity = !hasCustomSign\n if (qualifier === \"-\") {\n if (MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime) && !(await this.isLibraryValidationDisabled(targetPlatform, signOpts))) {\n log.warn(\n null,\n `ad-hoc signing with hardenedRuntime enabled requires the ${DISABLE_LIBRARY_VALIDATION} entitlement ` +\n \"in both the app entitlements (build/entitlements.mac.plist or mac.sign.entitlements) and the inherit entitlements \" +\n \"(build/entitlements.mac.inherit.plist or mac.sign.entitlementsInherit) to prevent app launch failures due to library validation, \" +\n \"but at least one of your entitlements files does not grant it. \" +\n \"See https://electron.build/docs/features/code-signing for details.\"\n )\n }\n identity = new Identity(\"-\", undefined)\n } else if (noIdentity) {\n await reportError(isMas, certificateTypes, qualifier, keychainFile, this.packager.forceCodeSigningFor(targetPlatform))\n return null\n }\n }\n\n return identity\n }\n\n /**\n * Resolves the app and inherit entitlements files for an ad-hoc build — same precedence as `getAppEntitlements()` and\n * `getInheritEntitlements()` — and returns whether both grant `com.apple.security.cs.disable-library-validation`.\n *\n * An ad-hoc signature carries no Team ID, so every process in the bundle — the app and each helper — fails library\n * validation when it loads the Electron framework unless its own entitlements disable it. A user-supplied inherit\n * plist (e.g. a production `build/entitlements.mac.inherit.plist`) without the key therefore breaks the helpers even\n * when the app entitlements grant it, which is why both files are checked.\n *\n * Fails open: returns false (so callers still warn) when either file cannot be read or parsed, or when no file\n * resolves at all (`@electron/osx-sign`'s defaults never grant the key). An explicit `sign.entitlements` /\n * `sign.entitlementsInherit` path that does not exist is a configuration error and throws, like any other missing\n * build resource.\n */\n async isLibraryValidationDisabled(targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish): Promise<boolean> {\n const [appEntitlements, inheritEntitlements] = await Promise.all([\n this.getAppEntitlements(targetPlatform, signOpts, true /* adHoc */),\n this.getInheritEntitlements(targetPlatform, signOpts, true /* adHoc */),\n ])\n return (await this.grantsDisableLibraryValidation(appEntitlements)) && (await this.grantsDisableLibraryValidation(inheritEntitlements))\n }\n\n private async grantsDisableLibraryValidation(file: string | null): Promise<boolean> {\n return (await this.entitlementsValue(file, DISABLE_LIBRARY_VALIDATION)) === true\n }\n\n /**\n * The value the entitlements file assigns to `key`, or `undefined` when the key is absent or the file cannot be\n * read or parsed. Returns the raw value rather than a boolean because callers disagree on the predicate: an\n * opt-out we act on ourselves is required to be literally `true`, while a key we are predicting\n * `@electron/osx-sign` will act on has to use osx-sign's own truthiness test.\n */\n private async entitlementsValue(file: string | null, key: string): Promise<PlistValue | undefined> {\n if (file == null) {\n // no user-supplied file and no bundled default — @electron/osx-sign's defaults never grant the key\n return undefined\n }\n try {\n const entitlements = await parsePlistFile<PlistObject>(file)\n return entitlements[key]\n } catch (e: any) {\n log.debug({ file, key, error: e.message }, \"cannot read entitlements\")\n return undefined\n }\n }\n\n /**\n * Resolves the entitlements file for the app bundle itself.\n *\n * Precedence: explicit `sign.entitlements` → `build/entitlements.{mac,mas}.plist` → a bundled default.\n * The explicit path is resolved like every other build resource (build resources dir, then project dir) and\n * must exist. Returns `null` when no default applies, which lets `@electron/osx-sign` fall back to its own\n * Chromium-derived defaults (`default.mas.plist` for MAS).\n */\n async getAppEntitlements(targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish, adHoc: boolean): Promise<string | null> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n // an explicit `sign.entitlements` resolves like every other build resource (build resources dir, then project dir);\n // `null`/empty behave like unset so the `build/entitlements.{mac,mas}.plist` convention still applies\n const entitlements = await this.packager.getResource(signOpts?.entitlements || undefined, `entitlements.${isMas ? \"mas\" : \"mac\"}.plist`)\n if (entitlements != null) {\n return entitlements\n }\n if (isMas) {\n // @electron/osx-sign's default.mas.plist enables the App Sandbox, which a MAS build cannot ship without\n return null\n }\n return getTemplatePath(adHoc ? \"entitlements.mac.adhoc.plist\" : \"entitlements.mac.plist\")\n }\n\n /**\n * Resolves the entitlements file for the nested binaries (helpers, frameworks, unpacked executables) that\n * inherit the app's signature.\n *\n * Precedence: explicit `sign.entitlementsInherit` → `build/entitlements.{mac,mas}.inherit.plist` → `null`,\n * which hands the file to `@electron/osx-sign`'s per-file defaults, modelled on Chromium's own entitlements\n * (the explicit path is resolved like every other build resource — build resources dir, then project dir — and must exist):\n * - renderer and GPU helpers: `allow-jit` only\n * - plugin helper: `allow-jit`, `allow-unsigned-executable-memory`, `disable-library-validation`\n * - everything else (frameworks, `.node` modules, unpacked executables): `default.darwin.plist`, i.e. `allow-jit`\n * plus Chromium's `device.*` / `personal-information.*` entitlements\n * Nested binaries therefore do not inherit the app's entitlements, and apart from the plugin helper none of these\n * defaults grant `disable-library-validation` or `allow-unsigned-executable-memory`.\n */\n async getInheritEntitlements(targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish, adHoc: boolean): Promise<string | null> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n // an explicit `sign.entitlementsInherit` resolves like every other build resource (build resources dir, then project dir);\n // `null`/empty behave like unset so the `build/entitlements.{mac,mas}.inherit.plist` convention still applies\n const entitlements = await this.packager.getResource(signOpts?.entitlementsInherit || undefined, `entitlements.${isMas ? \"mas\" : \"mac\"}.inherit.plist`)\n if (entitlements != null) {\n return entitlements\n }\n // an ad-hoc signature has no Team ID, so every process in the bundle — not just the main one — needs\n // library validation disabled or it cannot load the Electron framework\n return adHoc && !isMas ? getTemplatePath(\"entitlements.mac.adhoc.plist\") : null\n }\n\n /**\n * Picks the string handed to `@electron/osx-sign` as `identity`. Two consumers inside osx-sign want different\n * forms of the same certificate, which is why this line has flipped twice before:\n *\n * - `codesign --sign <identity>` needs a *unique* reference. A common name can match several valid certificates\n * (the same name issued twice with different expiry dates), and `codesign` then fails with\n * `... : ambiguous (matches \"X\" and \"X\" ...)` — `--keychain` does not disambiguate it. Only the SHA-1 hash is\n * unique. https://github.com/electron-userland/electron-builder/issues/10237\n * - osx-sign's entitlements automation scrapes the Team ID out of the identity *name* with `/^.+\\((.+?)\\)$/` to\n * fill in `ElectronTeamID`, and throws `Could not automatically determine ElectronTeamID from identity` when\n * that fails. A bare hash has no `(TEAMID)` suffix.\n * https://github.com/electron-userland/electron-builder/issues/7995\n *\n * So we pass the hash and, when that automation is going to run, hand it the Team ID through the one channel it\n * already prefers over the identity name: `ElectronTeamID` in the app's `Info.plist`. Writing that key is exactly\n * what osx-sign would have done itself, from the same source. It reaches the regex only when the App Sandbox is\n * enabled (see `isSandboxed`), no `provisioningProfile` is configured, and `Info.plist` carries no\n * `ElectronTeamID` — so those cases skip the write and pass the hash straight through.\n *\n * Falls back to the name whenever the hash cannot be made to work (no hash at all, ad-hoc, a self-signed name\n * with no `(TEAMID)`, an unreadable `Info.plist`), which leaves the previous behavior — and the previous error\n * message — untouched for those cases.\n *\n * All of this is osx-sign-specific, so a custom signer (`sign` as a function or module path) gets the bare hash\n * and an untouched `Info.plist`: `@electron/osx-sign` never runs, so there is no automation to feed.\n */\n async resolveSignIdentity(appPath: string, identity: Identity, signOpts: ElectronSignOptions | Nullish, targetPlatform: PlatformType, hasCustomSign = false): Promise<string> {\n // ad-hoc (\"-\") and any name-only identity have nothing to disambiguate with\n if (!identity.hash || MacTargetHelper.isAdHocIdentity(identity)) {\n return identity.name\n }\n\n // a custom signer replaces @electron/osx-sign entirely. Hand over the unique hash — the form `codesign`\n // needs — and mutate nothing on its behalf. This must stay above every branch below, so a delegated signer\n // never lands in one of their `identity.name` fallbacks.\n if (hasCustomSign) {\n return identity.hash\n }\n\n // osx-sign's entitlements automation is off, or it takes the Team ID from the profile instead of the identity\n if (signOpts?.preAutoEntitlements === false || signOpts?.provisioningProfile) {\n return identity.hash\n }\n\n if (!(await this.isSandboxed(appPath, signOpts, targetPlatform))) {\n return identity.hash\n }\n\n const infoPlistFile = path.join(appPath, \"Contents\", \"Info.plist\")\n try {\n const info = await parsePlistFile<PlistObject>(infoPlistFile)\n if (info.ElectronTeamID) {\n // osx-sign prefers this over parsing the identity, so the hash never reaches its regex\n return identity.hash\n }\n\n // what osx-sign's pattern takes, so we never derive a Team ID it would have rejected\n const teamId = parseIdentityTeamId(identity.name)\n if (teamId == null) {\n log.debug({ identityName: identity.name }, \"cannot parse Team ID from identity name, signing with the identity name\")\n return identity.name\n }\n\n await savePlistFile(infoPlistFile, { ...info, ElectronTeamID: teamId })\n log.debug({ file: log.filePath(infoPlistFile), teamId }, \"ElectronTeamID set from the signing identity name\")\n return identity.hash\n } catch (e: any) {\n log.debug({ file: log.filePath(infoPlistFile), error: e.message }, \"cannot read or update Info.plist, signing with the identity name\")\n return identity.name\n }\n }\n\n /**\n * Whether `@electron/osx-sign`'s entitlements automation can reach the `ElectronTeamID`-from-identity-name step\n * that a bare hash cannot satisfy.\n *\n * osx-sign gates the automation on `!filePath.includes('.app/')` and runs it with that path's own entitlements.\n * The app bundle itself always qualifies, under the app entitlements. Two further cases qualify under the\n * inherit entitlements, and only then is that file worth reading: a `sign.binaries` entry (signed alongside the\n * bundle rather than within it), and — when the signed bundle is not named `*.app`, which `--prepackaged`\n * allows — every file inside it, since none of their paths contain `.app/` either.\n *\n * A `null` file means osx-sign falls back to its own default, and only the MAS defaults enable the App Sandbox.\n * Truthiness, not `=== true`, because that is the test osx-sign itself applies.\n */\n private async isSandboxed(appPath: string, signOpts: ElectronSignOptions | Nullish, targetPlatform: PlatformType): Promise<boolean> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const grants = async (file: string | null) => (file == null ? isMas : !!(await this.entitlementsValue(file, APP_SANDBOX)))\n\n if (await grants(await this.getAppEntitlements(targetPlatform, signOpts, false))) {\n return true\n }\n if (!signOpts?.binaries?.length && path.basename(appPath).endsWith(\".app\")) {\n // nothing but the bundle itself is signed outside a `.app/` path, so the inherit entitlements never apply\n return false\n }\n return await grants(await this.getInheritEntitlements(targetPlatform, signOpts, false))\n }\n\n async buildSignOptions(\n appPath: string,\n // null only for a custom signer without a keychain identity, which is called without one (see MacPackager.sign)\n identity: Identity | null,\n config: ElectronSignOptions | null | undefined,\n keychainFile: string | Nullish,\n arch: Arch,\n targetPlatform: PlatformType,\n hasCustomSign = false\n ): Promise<SignOptions> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const type = MacTargetHelper.resolveSigningType(targetPlatform, config?.type)\n\n let binaries = config?.binaries || undefined\n if (binaries) {\n // Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path.\n binaries = (\n await Promise.all(\n binaries.flatMap(async destination => {\n const expandedDestination = this.packager.expandArch(destination, arch)\n return await Promise.all(\n expandedDestination.map(async d => {\n if (await statOrNull(d)) {\n return d\n }\n return path.resolve(appPath, d)\n })\n )\n })\n )\n ).flat()\n log.info({ binaries, arch: arch == null ? null : Arch[arch] }, \"signing additional user-defined binaries for arch\")\n }\n\n let filter = config?.ignore\n if (Array.isArray(filter)) {\n if (filter.length == 0) {\n filter = undefined\n }\n } else if (typeof filter === \"string\") {\n filter = filter.length === 0 ? undefined : [filter]\n }\n\n const filterRe =\n typeof filter === \"function\"\n ? null\n : filter?.map(it => {\n try {\n return new RegExp(it)\n } catch (e: any) {\n throw new InvalidConfigurationError(`Invalid regex filter pattern: ${it}. ${e.message}`)\n }\n })\n\n return {\n identityValidation: false,\n // https://github.com/electron-userland/electron-builder/issues/1699\n // kext are signed by the chipset manufacturers. You need a special certificate (only available on request) from Apple to be able to sign kext.\n ignore: (file: string) => {\n if (filterRe != null) {\n for (const regExp of filterRe) {\n if (regExp.test(file)) {\n return true\n }\n }\n }\n if (typeof filter === \"function\" && filter(file)) {\n return true\n }\n return (\n file.endsWith(\".kext\") ||\n file.startsWith(\"/Contents/PlugIns\", appPath.length) ||\n file.includes(\"/node_modules/puppeteer/.local-chromium\") ||\n file.includes(\"/node_modules/playwright-firefox/.local-browsers\") ||\n file.includes(\"/node_modules/playwright/.local-browsers\")\n )\n\n /* Those are browser automating modules, browser (chromium, nightly) cannot be signed\n https://github.com/electron-userland/electron-builder/issues/2010\n https://github.com/electron-userland/electron-builder/issues/5383\n */\n },\n identity: identity ? await this.resolveSignIdentity(appPath, identity, config, targetPlatform, hasCustomSign) : undefined,\n type,\n platform: isMas ? \"mas\" : \"darwin\",\n version: this.packager.config.electronVersion || undefined,\n app: appPath,\n keychain: keychainFile || undefined,\n binaries,\n // https://github.com/electron-userland/electron-builder/issues/1480\n strictVerify: config?.strictVerify,\n preAutoEntitlements: config?.preAutoEntitlements,\n optionsForFile: await this.getOptionsForFile(appPath, targetPlatform, config, identity),\n provisioningProfile: config?.provisioningProfile || undefined,\n }\n }\n\n /**\n * Post-sign diagnostic replacing the blanket `com.apple.security.cs.disable-library-validation` default.\n *\n * Walks the Mach-O libraries and bundles (`MH_DYLIB` / `MH_BUNDLE`) under `Contents/Resources/app.asar.unpacked` and\n * `Contents/PlugIns` and reports the ones whose signature does not carry the Team ID `codesign` reports for the\n * freshly signed app bundle — typically excluded via `sign.ignore`, or fetched at build time already signed by a\n * third party. Only loadable code is checked because library validation applies to what a process loads;\n * executables (`MH_EXECUTE`, e.g. a bundled ffmpeg) are spawned rather than loaded, so a foreign signature on them is\n * not a launch failure and reporting them would be a false positive. `Contents/PlugIns` is covered because\n * `buildSignOptions` never re-signs it, so a bundle there keeps whatever signature it shipped with. Under the\n * hardened runtime those fail library validation when loaded, which is precisely the failure the old default hid\n * from every user instead of only the affected ones.\n *\n * The opt-out is read from the app entitlements (not the inherit ones) because library validation is enforced by\n * the loading process under its own entitlements — the main process, governed by the app plist, is the usual loader\n * of these modules, while the inherit plist only governs loads performed by helper processes.\n *\n * Best-effort: never fails the build, and skips the scan when the app bundle itself has no Team ID (e.g. a\n * self-signed certificate).\n */\n async warnAboutForeignSignedBinaries(appPath: string, identity: Identity | Nullish, targetPlatform: PlatformType, signOpts: ElectronSignOptions | Nullish): Promise<void> {\n if (\n MacTargetHelper.isMasTarget(targetPlatform) ||\n MacTargetHelper.isAdHocIdentity(identity) ||\n !MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime)\n ) {\n return\n }\n if (await this.grantsDisableLibraryValidation(await this.getAppEntitlements(targetPlatform, signOpts, false))) {\n // the app already opted out of library validation\n return\n }\n\n // `Contents/PlugIns` is scanned too: `buildSignOptions` unconditionally excludes it from re-signing, so anything\n // there keeps whatever third-party signature it shipped with — exactly what fails library validation\n const candidateDirs = [path.join(appPath, \"Contents\", \"Resources\", \"app.asar.unpacked\"), path.join(appPath, \"Contents\", \"PlugIns\")]\n try {\n const dirs: string[] = []\n for (const dir of candidateDirs) {\n if ((await statOrNull(dir)) != null) {\n dirs.push(dir)\n }\n }\n if (dirs.length === 0) {\n return\n }\n // the Team ID is read from the signed bundle rather than parsed out of the identity's common name: not every\n // identity carries a \"(TEAMID)\" suffix, and a self-signed one can carry it without codesign ever recording it\n const teamId = await this.readSigningTeamId(appPath)\n if (teamId == null) {\n // no Team ID to compare against (unsigned, or signed without one)\n return\n }\n let files: string[] = []\n for (const dir of dirs) {\n files = files.concat(await walk(dir))\n }\n // bounded concurrency: each check spawns `codesign -d`; results are sorted afterwards so the warning is deterministic\n const checked = await asyncPool<string, string | null>(MAX_FILE_REQUESTS, files, async file => {\n // only dylibs and bundles get loaded into a process; executables are spawned and never face library validation\n if (!isLoadableMachOFileType(await readMachOFileType(file))) {\n return null\n }\n return (await this.readSigningTeamId(file)) === teamId ? null : path.relative(appPath, file)\n })\n const foreign = checked.filter((it): it is string => it != null).sort()\n if (foreign.length > 0) {\n log.warn(\n { files: foreign.join(\", \"), teamId },\n `libraries in app.asar.unpacked or Contents/PlugIns are unsigned or signed by another team — under the hardened runtime they will fail library validation when loaded. ` +\n `Sign them with the same identity, or grant ${DISABLE_LIBRARY_VALIDATION} in build/entitlements.mac.plist ` +\n `(and in build/entitlements.mac.inherit.plist if a helper process such as a utilityProcess or a nodeIntegration renderer loads them)`\n )\n }\n } catch (e: any) {\n log.debug({ error: e.message }, \"cannot inspect app.asar.unpacked and Contents/PlugIns for foreign-signed binaries\")\n }\n }\n\n /**\n * The `TeamIdentifier` of a file's existing code signature as reported by `codesign -d`, or `null` when there is none:\n * `codesign` fails (e.g. the file is unsigned), the field is absent, or it is the literal `not set` that ad-hoc and\n * self-signed signatures report.\n *\n * @internal An instance method rather than a module-level function so tests can stub the `codesign` invocation, which\n * only exists on macOS.\n */\n async readSigningTeamId(file: string): Promise<string | null> {\n // resolved outside the try: a codesign that cannot be located is a configuration error, not an unsigned file\n const codesign = Executables.resolve(\"codesign\")\n try {\n // `codesign -d` reports on stderr, so stdout alone (as `exec` returns) is not enough\n const { stderr } = await spawnAndWriteWithOutput(codesign, [\"-d\", \"--verbose=4\", file], \"\")\n return parseSigningTeamId(stderr)\n } catch {\n // unsigned binaries make `codesign -d` exit non-zero\n return null\n }\n }\n\n async createMasInstaller(\n appPath: string,\n outDir: string,\n masOptions: MasConfiguration,\n keychainFile: string | Nullish,\n targetPlatform: PlatformType,\n arch: Arch,\n identityQualifier?: string | null\n ): Promise<void> {\n const certType = MacTargetHelper.isMasDevelopment(targetPlatform) ? \"Mac Developer\" : \"3rd Party Mac Developer Installer\"\n const masInstallerIdentity = await findIdentity(certType, identityQualifier, keychainFile)\n\n if (masInstallerIdentity == null) {\n throw new InvalidConfigurationError(`Cannot find valid \"${certType}\" identity to sign MAS installer, please see https://electron.build/docs/features/code-signing`)\n }\n\n MacTargetHelper.assertSafePathForCommandUsage(outDir, \"output directory\")\n\n // mas uploaded to AppStore, so, use \"-\" instead of space for name\n // path.basename prevents path traversal if a crafted artifactName contains \"../../\"\n const artifactName = path.basename(this.packager.expandArtifactNamePattern(masOptions, \"pkg\", arch))\n MacTargetHelper.assertSafePathForCommandUsage(artifactName, \"artifact name\")\n const artifactPath = path.resolve(outDir, artifactName)\n await this.packager.doFlat(appPath, artifactPath, masInstallerIdentity, keychainFile)\n await this.verifyInstallerPackage(artifactPath, targetPlatform)\n await this.packager.emitArtifactBuildCompleted({\n file: artifactPath,\n target: null,\n arch: Arch.x64,\n safeArtifactName: this.packager.computeSafeArtifactName(artifactName, \"pkg\", arch, true, this.packager.platformOptions.defaultArch),\n packager: this.packager,\n })\n }\n\n async getOptionsForFile(\n appPath: string,\n targetPlatform: PlatformType,\n customSignOptions: ElectronSignOptions | Nullish,\n identity: Identity | Nullish\n ): Promise<(filePath: string) => PerFileSignOptions> {\n const isMas = MacTargetHelper.isMasTarget(targetPlatform)\n const adHoc = MacTargetHelper.isAdHocIdentity(identity)\n const appEntitlements = await this.getAppEntitlements(targetPlatform, customSignOptions, adHoc)\n const inheritEntitlements = await this.getInheritEntitlements(targetPlatform, customSignOptions, adHoc)\n\n const getEntitlements = (filePath: string) => {\n if (filePath === appPath) {\n return appEntitlements\n }\n\n if (filePath.includes(\"Library/LoginItems\")) {\n return customSignOptions?.entitlementsLoginHelper\n }\n\n // `null` leaves the file to @electron/osx-sign's per-file defaults, which are tighter than one blanket plist\n return inheritEntitlements\n }\n\n const requirements = isMas || customSignOptions?.requirements == null ? undefined : await this.packager.getResource(customSignOptions.requirements)\n\n return (filePath: string): PerFileSignOptions => {\n const entitlements = getEntitlements(filePath)\n return {\n entitlements: entitlements || undefined,\n hardenedRuntime: MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, customSignOptions?.hardenedRuntime) ?? undefined,\n timestamp: customSignOptions?.timestamp || undefined,\n requirements: requirements || undefined,\n additionalArguments: customSignOptions?.additionalArguments || undefined,\n }\n }\n }\n\n /**\n * The effective signing type: an explicit `sign.type` wins, otherwise derived from the build flavor\n * (`mas-dev` → `development`, otherwise `distribution`).\n */\n static resolveSigningType(targetPlatform: PlatformType, configType: SigningDistributionType | Nullish): SigningDistributionType {\n return configType ?? (MacTargetHelper.isMasDevelopment(targetPlatform) ? \"development\" : \"distribution\")\n }\n\n static getCertificateTypes(targetPlatform: PlatformType, type: SigningDistributionType): CertType[] {\n if (type === \"development\") {\n return [\"Mac Developer\", \"Apple Development\"]\n }\n return MacTargetHelper.isMasTarget(targetPlatform) ? [\"Apple Distribution\", \"3rd Party Mac Developer Application\"] : [\"Developer ID Application\"]\n }\n\n /**\n * The MAS `.pkg` installer is only built for distribution signing — a development-signed build\n * (`mas-dev`, or an explicit `sign.type: \"development\"` on a `mas` build) is installed directly.\n */\n static shouldCreateMasInstaller(targetPlatform: PlatformType, configType: SigningDistributionType | Nullish): targetPlatform is MasPlatformType {\n return MacTargetHelper.isMasTarget(targetPlatform) && MacTargetHelper.resolveSigningType(targetPlatform, configType) !== \"development\"\n }\n\n static isMasTarget(targetName: string): boolean {\n return targetName === \"mas\" || targetName === \"mas-dev\"\n }\n\n static isMasDevelopment(targetName: string): boolean {\n return targetName === \"mas-dev\"\n }\n\n static getPlatformTypeFromTarget(targetName: string): PlatformType {\n // must check for mas-dev first\n if (MacTargetHelper.isMasDevelopment(targetName)) {\n return \"mas-dev\"\n }\n if (MacTargetHelper.isMasTarget(targetName)) {\n return \"mas\"\n }\n return \"mac\"\n }\n\n /**\n * Returns true when hardened runtime will be active for signing.\n * For non-MAS builds it defaults to on; for MAS it defaults to off.\n */\n static isHardenedRuntimeEnabledForSigning(targetPlatform: PlatformType, hardenedRuntime: boolean | null | undefined): boolean {\n return MacTargetHelper.isMasTarget(targetPlatform) ? hardenedRuntime === true : hardenedRuntime !== false\n }\n\n static assertSafePathForCommandUsage(pathValue: string, description: string): void {\n if (/[\\0\\r\\n\"'`$;&|<>]/.test(pathValue)) {\n throw new InvalidConfigurationError(`Invalid ${description}: contains unsupported shell-special characters`)\n }\n }\n\n static getNotarizeOptions(appPath: string): NotarizeOptions | undefined {\n const teamId = process.env.APPLE_TEAM_ID\n const appleId = process.env.APPLE_ID\n const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD\n\n if (appleId || appleIdPassword) {\n if (!appleId) {\n throw new InvalidConfigurationError(`APPLE_ID env var needs to be set`)\n }\n if (!appleIdPassword) {\n throw new InvalidConfigurationError(`APPLE_APP_SPECIFIC_PASSWORD env var needs to be set`)\n }\n if (!teamId) {\n throw new InvalidConfigurationError(`APPLE_TEAM_ID env var needs to be set`)\n }\n return { appPath, appleId, appleIdPassword, teamId }\n }\n\n const appleApiKey = process.env.APPLE_API_KEY\n const appleApiKeyId = process.env.APPLE_API_KEY_ID\n const appleApiIssuer = process.env.APPLE_API_ISSUER\n if (appleApiKey || appleApiKeyId || appleApiIssuer) {\n if (!appleApiKey || !appleApiKeyId || !appleApiIssuer) {\n throw new InvalidConfigurationError(`Env vars APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER need to be set`)\n }\n return { appPath, appleApiKey, appleApiKeyId, appleApiIssuer }\n }\n\n const keychain = process.env.APPLE_KEYCHAIN\n const keychainProfile = process.env.APPLE_KEYCHAIN_PROFILE\n if (keychainProfile) {\n let args: NotaryToolKeychainCredentials = { keychainProfile }\n if (keychain) {\n args = { ...args, keychain }\n }\n return { appPath, ...args }\n }\n\n return undefined\n }\n\n /** The error for a forceCodeSigning build that would skip notarization because no notarization credentials are set. */\n static missingNotarizationCredentialsError(): InvalidConfigurationError {\n return forceCodeSigningError(\n \"forceCodeSigning is enabled, but no notarization credentials are set, so the macOS app would not be notarized. \" +\n \"Set APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER (recommended for CI), or APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD and APPLE_TEAM_ID, or APPLE_KEYCHAIN_PROFILE (with APPLE_KEYCHAIN); \" +\n \"they must be set when the build starts. To skip notarization - for an ad-hoc or development-signed app, or one you notarize yourself, e.g. in an afterSign hook - set mac.notarize: false (the build then warns).\"\n )\n }\n\n /**\n * Whether `mac.notarize: true` requires notarization here: where the app can be signed, on a macOS host outside a pull-request\n * build (isSignAllowed). Elsewhere a missing credential set only warns, as when `notarize` is unset. The build-start check and\n * every notarization use this rule.\n */\n static isNotarizationRequired(notarize: boolean | Nullish): boolean {\n return notarize === true && isSignAllowed(false)\n }\n\n /** The error for `mac.notarize: true`, which requires notarization, when no notarization credentials are set. */\n static notarizeTrueWithoutCredentialsError(): InvalidConfigurationError {\n return new InvalidConfigurationError(\n \"mac.notarize is true, which requires notarization, but no notarization credentials are set. \" +\n \"Set APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER (recommended for CI), or APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD and APPLE_TEAM_ID, or APPLE_KEYCHAIN_PROFILE (with APPLE_KEYCHAIN); \" +\n \"they must be set when the build starts. Leave mac.notarize unset to notarize only when credentials are set (and skip it with a warning otherwise), or set it to false to never notarize. \" +\n `See ${BUILD_CHANGES_URL}#mac-notarize-true-requires-credentials`\n )\n }\n\n /** Under forceCodeSigning, checks the signature of an installer package electron-builder signed (`pkgutil --check-signature`). */\n async verifyInstallerPackage(pkg: string, targetPlatform: PlatformType = \"mac\"): Promise<void> {\n if (!this.packager.forceCodeSigningFor(targetPlatform)) {\n return\n }\n const problem = await checkInstallerPackageSignature(pkg)\n if (problem != null) {\n throw forceCodeSigningError(`forceCodeSigning is enabled, but the installer package ${log.filePath(pkg)} is not validly signed (${problem}).`, VERIFICATION_FAILED_ERROR_CODE)\n }\n }\n\n async notarizeIfProvided(appPath: string): Promise<void> {\n const notarizeOptions = this.packager.platformOptions.notarize\n const forceCodeSigning = this.packager.forceCodeSigning\n if (notarizeOptions === false) {\n if (forceCodeSigning) {\n // an explicit opt-out is honored under forceCodeSigning - the app may be notarized in an afterSign hook - but not silently\n log\n .once(\"notarize-false-with-force-code-signing\", this.packager)\n .warn({ reason: \"`notarize` options were set explicitly `false`\" }, \"skipped macOS notarization although forceCodeSigning is enabled\")\n } else {\n log.info({ reason: \"`notarize` options were set explicitly `false`\" }, \"skipped macOS notarization\")\n }\n return\n }\n const options = MacTargetHelper.getNotarizeOptions(appPath)\n if (!options) {\n if (MacTargetHelper.isNotarizationRequired(notarizeOptions)) {\n throw MacTargetHelper.notarizeTrueWithoutCredentialsError()\n }\n if (forceCodeSigning) {\n throw MacTargetHelper.missingNotarizationCredentialsError()\n }\n log.warn({ reason: \"`notarize` options were unable to be generated\" }, \"skipped macOS notarization\")\n return\n }\n const apiKey = \"appleApiKey\" in options ? MacTargetHelper.decodeAppleApiKey(options.appleApiKey) : null\n // notarytool by absolute path, so that it never runs through an xcrun looked up on PATH: the credentials are in its arguments\n const notarytoolPath = await Executables.notarytool()\n if (apiKey == null) {\n await notarize({ ...options, notarytoolPath })\n } else {\n // notarytool only reads the API key from a file: a fresh 0600 file in the build's temp dir, deleted as soon as notarytool is done\n const keyFile = await this.packager.tempDirManager.getTempFile({ prefix: \"notarize-api-key\", suffix: \".p8\" })\n try {\n await writeFile(keyFile, apiKey, { mode: 0o600, flag: \"wx\" })\n await notarize({ ...options, appleApiKey: keyFile, notarytoolPath })\n } finally {\n await rm(keyFile, { force: true }).catch((e: any) => log.warn({ error: e.message }, \"cannot delete the temporary App Store Connect API key file\"))\n }\n }\n log.info(null, \"notarization successful\")\n\n // @electron/notarize staples the ticket but never validates it\n if (forceCodeSigning) {\n const problem = await validateStapledTicket(appPath)\n if (problem != null) {\n throw forceCodeSigningError(\n `forceCodeSigning is enabled, but ${log.filePath(appPath)} was notarized and stapler validate rejects its stapled ticket (${problem}).`,\n VERIFICATION_FAILED_ERROR_CODE\n )\n }\n }\n }\n\n /**\n * `APPLE_API_KEY` is the path of the App Store Connect API key file (`AuthKey_<KEY_ID>.p8`), passed to notarytool as is, or the file's\n * contents base64-encoded, so that a masked CI variable can hold it. Returns the decoded key, or null for a path. No path contains a\n * `-----BEGIN` line or decodes to one, so a path is never mistaken for a key.\n */\n static decodeAppleApiKey(value: string): Buffer | null {\n if (value.includes(\"-----BEGIN\")) {\n throw new InvalidConfigurationError(`APPLE_API_KEY holds PEM text, but it must be a path or base64-encoded (the value is not shown). ${APPLE_API_KEY_HINT}`)\n }\n const decoded = decodeStrictBase64(value)\n if (decoded != null && decoded.toString(\"utf8\").includes(\"-----BEGIN\")) {\n try {\n createPrivateKey({ key: decoded, format: \"pem\" })\n } catch (e: any) {\n throw new InvalidConfigurationError(\n `APPLE_API_KEY decodes to PEM text that is not a valid private key (the value is not shown): ${e.message}. Check that it is the whole AuthKey_<KEY_ID>.p8 file and was not cut off. ${APPLE_API_KEY_HINT}`\n )\n }\n return decoded\n }\n // \"LS0tLS1CRUdJTi\" is the base64 of \"-----BEGIN\": a damaged encoded key, which notarytool would print in its error if it were passed on as a path\n if (value.includes(\"LS0tLS1CRUdJTi\")) {\n throw new InvalidConfigurationError(\n `APPLE_API_KEY looks like a base64-encoded key but is not valid standard base64 (the value is not shown): check for surrounding quotes, URL-safe \\`-\\` or \\`_\\` characters, or a truncated value. ${APPLE_API_KEY_HINT}`\n )\n }\n return null\n }\n}\n\n/** Big-endian fat/universal magic — the same bytes open a Java class file, so `nfat_arch` has to disambiguate. */\nconst FAT_MAGIC = 0xcafebabe\n/** libmagic's heuristic: a fat header has fewer than 30 slices, whereas a Java class file's `major_version` (in the same bytes) is at least 45. */\nconst FAT_MAX_ARCH_COUNT = 30\n/** Thin magics as read big-endian: the file is big-endian when the bytes spell the magic out, little-endian when they are byte-swapped. */\nconst THIN_MAGIC_BE = new Set([0xfeedface, 0xfeedfacf])\nconst THIN_MAGIC_LE = new Set([0xcefaedfe, 0xcffaedfe])\n/** `mach_header.filetype` follows `magic`, `cputype` and `cpusubtype` in both the 32- and 64-bit header. */\nconst MACH_HEADER_FILETYPE_OFFSET = 12\nconst MACH_HEADER_MIN_LENGTH = 16\n/** The first `fat_arch` (`cputype`, `cpusubtype`, `offset`, `size`, `align` — five big-endian uint32s) follows the 8-byte fat header. */\nconst FAT_ARCH_OFFSET = 8\nconst FAT_ARCH_LENGTH = 20\nconst FAT_ARCH_SLICE_OFFSET_FIELD = FAT_ARCH_OFFSET + 8\nconst HEAD_READ_LENGTH = 4096\n\n/** The `mach_header.filetype` values the foreign-signature scan tells apart (see `<mach-o/loader.h>`). */\nexport const MachOFileType = {\n /** Executable — spawned as its own process, never loaded into another one. */\n MH_EXECUTE: 2,\n /** Dynamically bound shared library (`.dylib`). */\n MH_DYLIB: 6,\n /** Dynamically bound bundle (`.node` native addons, plug-ins). */\n MH_BUNDLE: 8,\n} as const\n\n/**\n * The `filetype` field of a Mach-O header, or `null` when the file is not Mach-O, too short, or unreadable. Endianness\n * follows the magic. A fat/universal binary reports the filetype of its first slice (all slices share one filetype);\n * the fat magic `0xcafebabe` is shared with Java class files, so `nfat_arch` must also be a plausible slice count.\n *\n * @internal Exported for tests only.\n */\nexport async function readMachOFileType(file: string): Promise<number | null> {\n let handle: FileHandle | null = null\n try {\n handle = await open(file, \"r\")\n const head = Buffer.alloc(HEAD_READ_LENGTH)\n const { bytesRead } = await handle.read(head, 0, HEAD_READ_LENGTH, 0)\n if (bytesRead < 4) {\n return null\n }\n if (head.readUInt32BE(0) !== FAT_MAGIC) {\n return readThinMachOFileType(head.subarray(0, bytesRead))\n }\n if (bytesRead < FAT_ARCH_OFFSET + FAT_ARCH_LENGTH) {\n return null\n }\n const archCount = head.readUInt32BE(4)\n if (archCount === 0 || archCount >= FAT_MAX_ARCH_COUNT) {\n return null\n }\n const sliceOffset = head.readUInt32BE(FAT_ARCH_SLICE_OFFSET_FIELD)\n const sliceHeader = Buffer.alloc(MACH_HEADER_MIN_LENGTH)\n const slice = await handle.read(sliceHeader, 0, MACH_HEADER_MIN_LENGTH, sliceOffset)\n return readThinMachOFileType(sliceHeader.subarray(0, slice.bytesRead))\n } catch {\n return null\n } finally {\n await handle?.close()\n }\n}\n\nfunction readThinMachOFileType(header: Buffer): number | null {\n if (header.length < MACH_HEADER_MIN_LENGTH) {\n return null\n }\n const magic = header.readUInt32BE(0)\n if (THIN_MAGIC_BE.has(magic)) {\n return header.readUInt32BE(MACH_HEADER_FILETYPE_OFFSET)\n }\n if (THIN_MAGIC_LE.has(magic)) {\n return header.readUInt32LE(MACH_HEADER_FILETYPE_OFFSET)\n }\n return null\n}\n\n/**\n * Whether a Mach-O filetype is loaded into a process — a dylib or a bundle — and is therefore subject to library\n * validation. Executables are spawned, not loaded, so they are not.\n *\n * @internal Exported for tests only.\n */\nexport function isLoadableMachOFileType(type: number | null): boolean {\n return type === MachOFileType.MH_DYLIB || type === MachOFileType.MH_BUNDLE\n}\n\n/**\n * Whether the file starts with a Mach-O header (thin or fat), regardless of filetype.\n *\n * @internal Exported for tests only.\n */\nexport async function isMachOFile(file: string): Promise<boolean> {\n return (await readMachOFileType(file)) != null\n}\n\nconst LINE_TERMINATOR = /[\\n\\r\\u2028\\u2029]/\n\n/**\n * The Team ID of a signing identity name such as `Developer ID Application: Foo Inc (ABCDE12345)`, or `null`: what\n * @electron/osx-sign's `/^.+\\((.+?)\\)\\s*$/` captures - the text between the last `(` that leaves it non-empty and a closing `)`\n * followed only by whitespace, with at least one character before the `(` and no line break before the trailing whitespace.\n * Parsed without that regular expression, which backtracks polynomially on names with many `(` (the name comes from the\n * keychain or the configuration).\n *\n * @internal Exported for tests only.\n */\nexport function parseIdentityTeamId(name: string): string | null {\n // \\s and trimEnd remove the same characters\n const trimmed = name.trimEnd()\n if (!trimmed.endsWith(\")\") || LINE_TERMINATOR.test(trimmed)) {\n return null\n }\n // the last \"(\" with at least one character between it and the closing \")\"\n const open = trimmed.lastIndexOf(\"(\", trimmed.length - 3)\n return open < 1 ? null : trimmed.substring(open + 1, trimmed.length - 1)\n}\n\n/**\n * Extracts the `TeamIdentifier` from `codesign -d --verbose=4` output, or `null` when the field is absent or the\n * literal `not set` that ad-hoc and self-signed signatures report.\n *\n * @internal Exported for tests only.\n */\nexport function parseSigningTeamId(codesignOutput: string): string | null {\n const teamId = /^TeamIdentifier=(.+)$/m.exec(codesignOutput)?.[1].trim()\n return teamId == null || teamId === \"not set\" ? null : teamId\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pkg.d.ts","sourceRoot":"","sources":["../../../src/targets/mac/pkg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"pkg.d.ts","sourceRoot":"","sources":["../../../src/targets/mac/pkg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA6C,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAc,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAM1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AA+BxD,qBAAa,SAAU,SAAQ,MAAM;IAIjC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM;IAJzB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;gBAGT,QAAQ,EAAE,WAAW,EAC7B,MAAM,EAAE,MAAM;IAanB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC;IA4DtD,OAAO,CAAC,gBAAgB;YAuBV,kCAAkC;YAsFlC,qBAAqB;CAgEpC;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAS5G;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS/F;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAK9G;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,eAAe,GAAG,sBAAsB,CAAC,GAAG,MAAM,CAOjI"}
|
package/dist/targets/mac/pkg.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arch, debug, exec, statOrNull, use } from "builder-util";
|
|
1
|
+
import { Arch, debug, exec, Executables, statOrNull, use } from "builder-util";
|
|
2
2
|
import { deepAssign } from "builder-util-runtime";
|
|
3
3
|
import { readdirSync } from "fs";
|
|
4
4
|
import { readFile, unlink, writeFile } from "fs/promises";
|
|
@@ -73,10 +73,12 @@ export class PkgTarget extends Target {
|
|
|
73
73
|
}
|
|
74
74
|
args.push(artifactPath);
|
|
75
75
|
use(options.productbuild, it => args.push(...it));
|
|
76
|
-
await exec("productbuild", args, {
|
|
76
|
+
await exec(Executables.resolve("productbuild"), args, {
|
|
77
77
|
cwd: appOutDir,
|
|
78
78
|
});
|
|
79
79
|
await Promise.all([unlink(innerPackageFile), unlink(distInfoFile)]);
|
|
80
|
+
// under forceCodeSigning, identity is never null here (see above)
|
|
81
|
+
await packager.helper.verifyInstallerPackage(artifactPath);
|
|
80
82
|
await packager.helper.notarizeIfProvided(artifactPath);
|
|
81
83
|
await packager.emitArtifactBuildCompleted({
|
|
82
84
|
file: artifactPath,
|
|
@@ -133,7 +135,7 @@ export class PkgTarget extends Target {
|
|
|
133
135
|
});
|
|
134
136
|
}
|
|
135
137
|
args.push(distInfoFile);
|
|
136
|
-
await exec("productbuild", args, {
|
|
138
|
+
await exec(Executables.resolve("productbuild"), args, {
|
|
137
139
|
cwd: this.outDir,
|
|
138
140
|
});
|
|
139
141
|
let distInfo = await readFile(distInfoFile, "utf-8");
|
|
@@ -179,12 +181,13 @@ export class PkgTarget extends Target {
|
|
|
179
181
|
}
|
|
180
182
|
debug(distInfo);
|
|
181
183
|
await writeFile(distInfoFile, distInfo);
|
|
184
|
+
await this.packager.emitPkgDistributionCreated(distInfoFile);
|
|
182
185
|
}
|
|
183
186
|
async buildComponentPackage(appPath, propertyListOutputFile, packageOutputFile) {
|
|
184
187
|
const options = this.options;
|
|
185
188
|
const rootPath = path.dirname(appPath);
|
|
186
189
|
// first produce a component plist template
|
|
187
|
-
await exec("pkgbuild", ["--analyze", "--root", rootPath, propertyListOutputFile]);
|
|
190
|
+
await exec(Executables.resolve("pkgbuild"), ["--analyze", "--root", rootPath, propertyListOutputFile]);
|
|
188
191
|
// process the template plist
|
|
189
192
|
const plistInfo = (await parsePlistFile(propertyListOutputFile)).filter((it) => it.RootRelativeBundlePath !== "Electron.dSYM");
|
|
190
193
|
let packageInfo = {};
|
|
@@ -230,7 +233,7 @@ export class PkgTarget extends Target {
|
|
|
230
233
|
await savePlistFile(propertyListOutputFile, plistInfo);
|
|
231
234
|
}
|
|
232
235
|
args.push(packageOutputFile);
|
|
233
|
-
await exec("pkgbuild", args);
|
|
236
|
+
await exec(Executables.resolve("pkgbuild"), args);
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
239
|
export function prepareProductBuildArgs(identity, keychain) {
|