app-builder-lib 27.0.0-alpha.0 → 27.0.0-alpha.10
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/Framework.d.ts +2 -0
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js.map +1 -1
- package/dist/appInfo.d.ts +1 -1
- package/dist/appInfo.d.ts.map +1 -1
- package/dist/appInfo.js +3 -3
- package/dist/appInfo.js.map +1 -1
- package/dist/asar/asar.js +1 -1
- package/dist/asar/asar.js.map +1 -1
- package/dist/asar/asarFileChecker.d.ts +4 -2
- package/dist/asar/asarFileChecker.d.ts.map +1 -1
- package/dist/asar/asarFileChecker.js +2 -3
- package/dist/asar/asarFileChecker.js.map +1 -1
- package/dist/asar/asarUtil.js +21 -11
- package/dist/asar/asarUtil.js.map +1 -1
- package/dist/codeSign/certInfo.d.ts +14 -0
- package/dist/codeSign/certInfo.d.ts.map +1 -1
- package/dist/codeSign/certInfo.js +49 -0
- package/dist/codeSign/certInfo.js.map +1 -1
- package/dist/codeSign/mac/macCodeSign.d.ts +3 -3
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +50 -25
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/signResult.d.ts +26 -0
- package/dist/codeSign/signResult.d.ts.map +1 -0
- package/dist/codeSign/signResult.js +12 -0
- package/dist/codeSign/signResult.js.map +1 -0
- package/dist/codeSign/win/hsmSignManager.d.ts +10 -0
- package/dist/codeSign/win/hsmSignManager.d.ts.map +1 -0
- package/dist/codeSign/win/hsmSignManager.js +50 -0
- package/dist/codeSign/win/hsmSignManager.js.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts +14 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.js +82 -0
- package/dist/codeSign/win/pkcs11SignManager.js.map +1 -0
- package/dist/codeSign/win/signManager.d.ts +17 -0
- package/dist/codeSign/win/signManager.d.ts.map +1 -0
- package/dist/codeSign/win/signManager.js +19 -0
- package/dist/codeSign/win/signManager.js.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +95 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.js +507 -0
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -0
- package/dist/codeSign/win/windowsCodeSign.d.ts +2 -1
- package/dist/codeSign/win/windowsCodeSign.d.ts.map +1 -1
- package/dist/codeSign/win/windowsCodeSign.js +22 -8
- package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +11 -4
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +142 -37
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/codeSign/win/windowsSignToolManager.d.ts +1 -58
- package/dist/codeSign/win/windowsSignToolManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignToolManager.js +3 -363
- package/dist/codeSign/win/windowsSignToolManager.js.map +1 -1
- package/dist/configuration.d.ts +228 -163
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +11 -1
- package/dist/configuration.js.map +1 -1
- package/dist/core.d.ts +14 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +11 -0
- package/dist/core.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +3 -3
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +60 -61
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/electronArchSupport.d.ts +12 -0
- package/dist/electron/electronArchSupport.d.ts.map +1 -0
- package/dist/electron/electronArchSupport.js +58 -0
- package/dist/electron/electronArchSupport.js.map +1 -0
- package/dist/electron/electronVersion.d.ts.map +1 -1
- package/dist/electron/electronVersion.js +1 -11
- package/dist/electron/electronVersion.js.map +1 -1
- package/dist/electron/injectFFMPEG.js +2 -2
- package/dist/electron/injectFFMPEG.js.map +1 -1
- package/dist/electron/mac/electronMac.js +24 -35
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +24 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -0
- package/dist/electron/mac/electronMacUtils.js +42 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -0
- package/dist/electron/win/electronWin.js +2 -2
- package/dist/electron/win/electronWin.js.map +1 -1
- package/dist/fileMatcher.d.ts +42 -2
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +246 -18
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +19 -8
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +18 -7
- package/dist/indexInternal.js.map +1 -1
- package/dist/linuxPackager.d.ts.map +1 -1
- package/dist/linuxPackager.js +19 -1
- package/dist/linuxPackager.js.map +1 -1
- package/dist/macPackager.d.ts +31 -14
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +236 -147
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/index.d.ts.map +1 -1
- package/dist/node-module-collector/index.js +47 -16
- package/dist/node-module-collector/index.js.map +1 -1
- package/dist/node-module-collector/moduleManager.d.ts +11 -2
- package/dist/node-module-collector/moduleManager.d.ts.map +1 -1
- package/dist/node-module-collector/moduleManager.js +34 -14
- package/dist/node-module-collector/moduleManager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +47 -26
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +157 -142
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/packageManager.js +1 -1
- package/dist/node-module-collector/packageManager.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts +90 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +325 -25
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/types.d.ts +4 -0
- package/dist/node-module-collector/types.d.ts.map +1 -1
- package/dist/node-module-collector/types.js.map +1 -1
- package/dist/options/FuseOptionsV1.d.ts +137 -0
- package/dist/options/FuseOptionsV1.d.ts.map +1 -0
- package/dist/options/FuseOptionsV1.js +2 -0
- package/dist/options/FuseOptionsV1.js.map +1 -0
- package/dist/options/MsixOptions.d.ts +126 -0
- package/dist/options/MsixOptions.d.ts.map +1 -0
- package/dist/options/MsixOptions.js +2 -0
- package/dist/options/MsixOptions.js.map +1 -0
- package/dist/options/PlatformSpecificBuildOptions.d.ts +55 -9
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +23 -17
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/SquirrelWindowsOptions.d.ts +0 -5
- package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
- package/dist/options/SquirrelWindowsOptions.js.map +1 -1
- package/dist/options/linuxOptions.d.ts +8 -12
- package/dist/options/linuxOptions.d.ts.map +1 -1
- package/dist/options/linuxOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +113 -131
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/pkgOptions.d.ts +1 -1
- package/dist/options/pkgOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +282 -70
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js +12 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +6 -1
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +121 -40
- package/dist/packager.js.map +1 -1
- package/dist/packagerApi.d.ts +10 -1
- package/dist/packagerApi.d.ts.map +1 -1
- package/dist/packagerApi.js.map +1 -1
- package/dist/platformPackager.d.ts +49 -3
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +130 -17
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +36 -2
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +387 -23
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +110 -32
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/ArchiveTarget.d.ts +1 -0
- package/dist/targets/ArchiveTarget.d.ts.map +1 -1
- package/dist/targets/ArchiveTarget.js +6 -3
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts +33 -2
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +109 -29
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/blockmap/blockmap.d.ts +43 -3
- package/dist/targets/blockmap/blockmap.d.ts.map +1 -1
- package/dist/targets/blockmap/blockmap.js +141 -15
- package/dist/targets/blockmap/blockmap.js.map +1 -1
- package/dist/targets/blockmap/verbatimRange.d.ts +44 -0
- package/dist/targets/blockmap/verbatimRange.d.ts.map +1 -0
- package/dist/targets/blockmap/verbatimRange.js +117 -0
- package/dist/targets/blockmap/verbatimRange.js.map +1 -0
- package/dist/targets/differentialUpdateInfoBuilder.d.ts +28 -2
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +75 -6
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +13 -3
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts +14 -0
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +86 -10
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.d.ts +15 -0
- package/dist/targets/linux/LinuxTargetHelper.d.ts.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +54 -59
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts +2 -0
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +16 -15
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +5 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +14 -7
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.d.ts.map +1 -1
- package/dist/targets/linux/appimage/appLauncher.js +5 -11
- package/dist/targets/linux/appimage/appLauncher.js.map +1 -1
- package/dist/targets/linux/launcherScript.d.ts +32 -0
- package/dist/targets/linux/launcherScript.d.ts.map +1 -0
- package/dist/targets/linux/launcherScript.js +24 -0
- package/dist/targets/linux/launcherScript.js.map +1 -0
- package/dist/targets/linux/snap/SnapTarget.d.ts +1 -1
- package/dist/targets/linux/snap/SnapTarget.d.ts.map +1 -1
- package/dist/targets/linux/snap/SnapTarget.js +23 -1
- package/dist/targets/linux/snap/SnapTarget.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +30 -1
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +146 -70
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts +1 -1
- package/dist/targets/linux/snap/coreCustom.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreCustom.js +2 -2
- package/dist/targets/linux/snap/coreCustom.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts +3 -3
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +12 -12
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapCommand.d.ts +13 -0
- package/dist/targets/linux/snap/snapCommand.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapCommand.js +21 -0
- package/dist/targets/linux/snap/snapCommand.js.map +1 -0
- package/dist/targets/linux/snap/snapcraft.d.ts +190 -0
- package/dist/targets/linux/snap/snapcraft.d.ts.map +1 -0
- package/dist/targets/linux/snap/snapcraft.js +11 -0
- package/dist/targets/linux/snap/snapcraft.js.map +1 -0
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts +7 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +57 -20
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +146 -14
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +485 -91
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts +16 -0
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +31 -5
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/targetFactory.d.ts +7 -0
- package/dist/targets/targetFactory.d.ts.map +1 -1
- package/dist/targets/targetFactory.js +28 -0
- package/dist/targets/targetFactory.js.map +1 -1
- package/dist/targets/win/AppxTarget.d.ts +1 -2
- package/dist/targets/win/AppxTarget.d.ts.map +1 -1
- package/dist/targets/win/AppxTarget.js +37 -314
- package/dist/targets/win/AppxTarget.js.map +1 -1
- package/dist/targets/win/MsiTarget.d.ts.map +1 -1
- package/dist/targets/win/MsiTarget.js +13 -13
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/targets/win/MsixTarget.d.ts +22 -0
- package/dist/targets/win/MsixTarget.d.ts.map +1 -0
- package/dist/targets/win/MsixTarget.js +214 -0
- package/dist/targets/win/MsixTarget.js.map +1 -0
- package/dist/targets/win/nsis/Defines.d.ts +3 -0
- package/dist/targets/win/nsis/Defines.d.ts.map +1 -1
- package/dist/targets/win/nsis/Defines.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts +57 -3
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +252 -113
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/WebInstallerTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/WebInstallerTarget.js +23 -12
- package/dist/targets/win/nsis/WebInstallerTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +56 -48
- package/dist/targets/win/nsis/nsisOptions.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisScriptGenerator.js +4 -3
- package/dist/targets/win/nsis/nsisScriptGenerator.js.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.d.ts +17 -2
- package/dist/targets/win/nsis/nsisUtil.d.ts.map +1 -1
- package/dist/targets/win/nsis/nsisUtil.js +143 -41
- package/dist/targets/win/nsis/nsisUtil.js.map +1 -1
- package/dist/targets/win/nsis/progId.d.ts +21 -0
- package/dist/targets/win/nsis/progId.d.ts.map +1 -0
- package/dist/targets/win/nsis/progId.js +60 -0
- package/dist/targets/win/nsis/progId.js.map +1 -0
- package/dist/targets/win/winAppUtil.d.ts +115 -0
- package/dist/targets/win/winAppUtil.d.ts.map +1 -0
- package/dist/targets/win/winAppUtil.js +407 -0
- package/dist/targets/win/winAppUtil.js.map +1 -0
- package/dist/toolsets/7zip.d.ts +32 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +39 -11
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/appimage.d.ts +3 -3
- package/dist/toolsets/appimage.d.ts.map +1 -1
- package/dist/toolsets/appimage.js +9 -6
- package/dist/toolsets/appimage.js.map +1 -1
- package/dist/toolsets/custom.d.ts +2 -3
- package/dist/toolsets/custom.d.ts.map +1 -1
- package/dist/toolsets/custom.js +67 -149
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/fpm.d.ts.map +1 -1
- package/dist/toolsets/fpm.js +11 -5
- package/dist/toolsets/fpm.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +17 -3
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +17 -4
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/toolsets/nsis.d.ts +5 -0
- package/dist/toolsets/nsis.d.ts.map +1 -1
- package/dist/toolsets/nsis.js +20 -4
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/version.d.ts +12 -0
- package/dist/toolsets/version.d.ts.map +1 -0
- package/dist/toolsets/version.js +13 -0
- package/dist/toolsets/version.js.map +1 -0
- package/dist/toolsets/winCodeSign.d.ts +56 -3
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +125 -42
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +2 -1
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +31 -15
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/NodeModuleCopyHelper.js +14 -6
- package/dist/util/NodeModuleCopyHelper.js.map +1 -1
- package/dist/util/appFileCopier.d.ts +52 -0
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +221 -21
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/archCompatibility.d.ts +42 -0
- package/dist/util/archCompatibility.d.ts.map +1 -0
- package/dist/util/archCompatibility.js +202 -0
- package/dist/util/archCompatibility.js.map +1 -0
- package/dist/util/checksum.d.ts +36 -0
- package/dist/util/checksum.d.ts.map +1 -0
- package/dist/util/checksum.js +48 -0
- package/dist/util/checksum.js.map +1 -0
- package/dist/util/config/config.d.ts +1 -0
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +8 -1
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/legacyConfigGuard.d.ts +7 -0
- package/dist/util/config/legacyConfigGuard.d.ts.map +1 -0
- package/dist/util/config/legacyConfigGuard.js +187 -0
- package/dist/util/config/legacyConfigGuard.js.map +1 -0
- package/dist/util/config/legacyOptions.d.ts +75 -0
- package/dist/util/config/legacyOptions.d.ts.map +1 -0
- package/dist/util/config/legacyOptions.js +399 -0
- package/dist/util/config/legacyOptions.js.map +1 -0
- package/dist/util/config/load.d.ts +2 -2
- package/dist/util/config/load.d.ts.map +1 -1
- package/dist/util/config/load.js +3 -12
- package/dist/util/config/load.js.map +1 -1
- package/dist/util/config/schemaValidator.d.ts.map +1 -1
- package/dist/util/config/schemaValidator.js +26 -3
- package/dist/util/config/schemaValidator.js.map +1 -1
- package/dist/util/electronGet.d.ts +30 -32
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +359 -129
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts +5 -5
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +124 -16
- package/dist/util/flags.js.map +1 -1
- package/dist/util/hash.d.ts +1 -1
- package/dist/util/hash.d.ts.map +1 -1
- package/dist/util/hash.js +1 -15
- package/dist/util/hash.js.map +1 -1
- package/dist/util/installOrRebuild.d.ts +44 -0
- package/dist/util/installOrRebuild.d.ts.map +1 -0
- package/dist/util/installOrRebuild.js +276 -0
- package/dist/util/installOrRebuild.js.map +1 -0
- package/dist/util/langs.d.ts.map +1 -1
- package/dist/util/langs.js +1 -0
- package/dist/util/langs.js.map +1 -1
- package/dist/util/license.d.ts.map +1 -1
- package/dist/util/license.js +4 -1
- package/dist/util/license.js.map +1 -1
- package/dist/util/mac/macosIconComposer.d.ts +2 -1
- package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
- package/dist/util/mac/macosIconComposer.js +41 -59
- package/dist/util/mac/macosIconComposer.js.map +1 -1
- package/dist/util/mac/macosVersion.d.ts +0 -1
- package/dist/util/mac/macosVersion.d.ts.map +1 -1
- package/dist/util/mac/macosVersion.js +0 -3
- package/dist/util/mac/macosVersion.js.map +1 -1
- package/dist/util/mac/plist.d.ts +1 -1
- package/dist/util/mac/plist.d.ts.map +1 -1
- package/dist/util/mac/plist.js +6 -1
- package/dist/util/mac/plist.js.map +1 -1
- package/dist/util/nativeBinaryVerifier.d.ts +40 -0
- package/dist/util/nativeBinaryVerifier.d.ts.map +1 -0
- package/dist/util/nativeBinaryVerifier.js +381 -0
- package/dist/util/nativeBinaryVerifier.js.map +1 -0
- package/dist/util/packageMetadata.js +57 -31
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/util/repositoryInfo.js +6 -3
- package/dist/util/repositoryInfo.js.map +1 -1
- package/dist/util/resolve.js +1 -1
- package/dist/util/resolve.js.map +1 -1
- package/dist/util/streamSpawnToFile.d.ts +47 -0
- package/dist/util/streamSpawnToFile.d.ts.map +1 -0
- package/dist/util/streamSpawnToFile.js +110 -0
- package/dist/util/streamSpawnToFile.js.map +1 -0
- package/dist/util/toolsetLock.d.ts +2 -0
- package/dist/util/toolsetLock.d.ts.map +1 -1
- package/dist/util/toolsetLock.js +31 -5
- package/dist/util/toolsetLock.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +29 -3
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/vm/vm.d.ts +2 -0
- package/dist/vm/vm.d.ts.map +1 -1
- package/dist/vm/vm.js +29 -6
- package/dist/vm/vm.js.map +1 -1
- package/dist/winPackager.d.ts +6 -5
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +45 -39
- package/dist/winPackager.js.map +1 -1
- package/package.json +19 -18
- package/scheme.json +1731 -961
- package/templates/appx/appxmanifest.xml +2 -3
- package/templates/entitlements.mac.adhoc.plist +15 -0
- package/templates/entitlements.mac.plist +9 -6
- package/templates/msix/appxmanifest.xml +45 -0
- package/templates/nsis/assistedMessages.yml +17 -0
- package/templates/nsis/common.nsh +2 -2
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +96 -13
- package/templates/nsis/include/extractAppPackage.nsh +5 -2
- package/templates/nsis/include/installUtil.nsh +2 -2
- package/templates/nsis/include/installer.nsh +88 -50
- package/templates/nsis/include/webPackage.nsh +52 -27
- package/templates/nsis/installSection.nsh +29 -0
- package/templates/nsis/installer.nsi +1 -1
- package/templates/nsis/messages.yml +5 -0
- package/templates/nsis/multiUserUi.nsh +1 -1
- package/dist/codeSign/signManager.d.ts +0 -14
- package/dist/codeSign/signManager.d.ts.map +0 -1
- package/dist/codeSign/signManager.js +0 -2
- package/dist/codeSign/signManager.js.map +0 -1
- package/dist/util/yarn.d.ts +0 -23
- package/dist/util/yarn.d.ts.map +0 -1
- package/dist/util/yarn.js +0 -153
- package/dist/util/yarn.js.map +0 -1
|
@@ -1,21 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { notarize } from "@electron/notarize";
|
|
2
|
+
import { Arch, InvalidConfigurationError, log, MAX_FILE_REQUESTS, spawnAndWriteWithOutput, statOrNull, walk } from "builder-util";
|
|
3
|
+
import { open } from "fs/promises";
|
|
3
4
|
import * as path from "path";
|
|
4
|
-
import { findIdentity, reportError } from "../../codeSign/mac/macCodeSign.js";
|
|
5
|
+
import { findIdentity, Identity, reportError } from "../../codeSign/mac/macCodeSign.js";
|
|
6
|
+
import { parsePlistFile, savePlistFile } from "../../util/mac/plist.js";
|
|
5
7
|
import { getTemplatePath } from "../../util/pathManager.js";
|
|
8
|
+
import asyncPool from "tiny-async-pool";
|
|
9
|
+
const DISABLE_LIBRARY_VALIDATION = "com.apple.security.cs.disable-library-validation";
|
|
10
|
+
const APP_SANDBOX = "com.apple.security.app-sandbox";
|
|
6
11
|
export class MacTargetHelper {
|
|
7
12
|
constructor(packager) {
|
|
8
13
|
this.packager = packager;
|
|
9
14
|
}
|
|
15
|
+
/** Ad-hoc signing (`sign.identity: "-"`) produces a signature with no Team ID. */
|
|
16
|
+
static isAdHocIdentity(identity) {
|
|
17
|
+
return identity?.name === "-";
|
|
18
|
+
}
|
|
10
19
|
handleNullIdentity() {
|
|
11
20
|
if (this.packager.forceCodeSigning) {
|
|
12
21
|
throw new InvalidConfigurationError("identity explicitly is set to null, but forceCodeSigning is set to true");
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
// The meaning of `mac.sign: null` flipped in v27. In v26 `sign` was only a custom-signer hook, so
|
|
24
|
+
// null meant "no custom signer" and the app was still signed normally; now it means "do not sign".
|
|
25
|
+
// A v26 config carried over unchanged therefore ships an UNSIGNED app with no other signal.
|
|
26
|
+
log.warn({
|
|
27
|
+
reason: "identity explicitly is set to null",
|
|
28
|
+
solution: "remove `sign: null` to sign normally, or set `mac.sign.identity` — keep it only if you intend to ship an unsigned app",
|
|
29
|
+
}, '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-breaking-changes#macos-signing-macsign");
|
|
31
|
+
return "skipped:disabled";
|
|
16
32
|
}
|
|
17
|
-
async findSigningIdentity(
|
|
18
|
-
const
|
|
33
|
+
async findSigningIdentity(targetPlatform, qualifier, keychainFile, hasCustomSign, signOpts) {
|
|
34
|
+
const isMas = MacTargetHelper.isMasTarget(targetPlatform);
|
|
35
|
+
const certificateTypes = MacTargetHelper.getCertificateTypes(targetPlatform, MacTargetHelper.resolveSigningType(targetPlatform, signOpts?.type));
|
|
19
36
|
let identity = null;
|
|
20
37
|
for (const certificateType of certificateTypes) {
|
|
21
38
|
identity = await findIdentity(certificateType, qualifier, keychainFile);
|
|
@@ -24,20 +41,16 @@ export class MacTargetHelper {
|
|
|
24
41
|
}
|
|
25
42
|
}
|
|
26
43
|
if (identity == null) {
|
|
27
|
-
|
|
28
|
-
identity = await findIdentity("Mac Developer", qualifier, keychainFile);
|
|
29
|
-
if (identity != null) {
|
|
30
|
-
log.warn("Mac Developer is used to sign app — it is only for development and testing, not for production");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const noIdentity = !config.sign && identity == null;
|
|
44
|
+
const noIdentity = !hasCustomSign;
|
|
34
45
|
if (qualifier === "-") {
|
|
35
|
-
if (MacTargetHelper.isHardenedRuntimeEnabledForSigning(
|
|
36
|
-
log.warn(null,
|
|
37
|
-
"
|
|
46
|
+
if (MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime) && !(await this.isLibraryValidationDisabled(targetPlatform, signOpts))) {
|
|
47
|
+
log.warn(null, `ad-hoc signing with hardenedRuntime enabled requires the ${DISABLE_LIBRARY_VALIDATION} entitlement ` +
|
|
48
|
+
"in both the app entitlements (build/entitlements.mac.plist or mac.sign.entitlements) and the inherit entitlements " +
|
|
49
|
+
"(build/entitlements.mac.inherit.plist or mac.sign.entitlementsInherit) to prevent app launch failures due to library validation, " +
|
|
50
|
+
"but at least one of your entitlements files does not grant it. " +
|
|
51
|
+
"See https://electron.build/docs/features/code-signing for details.");
|
|
38
52
|
}
|
|
39
|
-
|
|
40
|
-
identity = new IdentityClass("-", undefined);
|
|
53
|
+
identity = new Identity("-", undefined);
|
|
41
54
|
}
|
|
42
55
|
else if (noIdentity) {
|
|
43
56
|
await reportError(isMas, certificateTypes, qualifier, keychainFile, this.packager.forceCodeSigning);
|
|
@@ -46,27 +59,193 @@ export class MacTargetHelper {
|
|
|
46
59
|
}
|
|
47
60
|
return identity;
|
|
48
61
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Resolves the app and inherit entitlements files for an ad-hoc build — same precedence as `getAppEntitlements()` and
|
|
64
|
+
* `getInheritEntitlements()` — and returns whether both grant `com.apple.security.cs.disable-library-validation`.
|
|
65
|
+
*
|
|
66
|
+
* An ad-hoc signature carries no Team ID, so every process in the bundle — the app and each helper — fails library
|
|
67
|
+
* validation when it loads the Electron framework unless its own entitlements disable it. A user-supplied inherit
|
|
68
|
+
* plist (e.g. a production `build/entitlements.mac.inherit.plist`) without the key therefore breaks the helpers even
|
|
69
|
+
* when the app entitlements grant it, which is why both files are checked.
|
|
70
|
+
*
|
|
71
|
+
* Fails open: returns false (so callers still warn) when either file cannot be read or parsed, or when no file
|
|
72
|
+
* resolves at all (`@electron/osx-sign`'s defaults never grant the key). An explicit `sign.entitlements` /
|
|
73
|
+
* `sign.entitlementsInherit` path that does not exist is a configuration error and throws, like any other missing
|
|
74
|
+
* build resource.
|
|
75
|
+
*/
|
|
76
|
+
async isLibraryValidationDisabled(targetPlatform, signOpts) {
|
|
77
|
+
const [appEntitlements, inheritEntitlements] = await Promise.all([
|
|
78
|
+
this.getAppEntitlements(targetPlatform, signOpts, true /* adHoc */),
|
|
79
|
+
this.getInheritEntitlements(targetPlatform, signOpts, true /* adHoc */),
|
|
80
|
+
]);
|
|
81
|
+
return (await this.grantsDisableLibraryValidation(appEntitlements)) && (await this.grantsDisableLibraryValidation(inheritEntitlements));
|
|
82
|
+
}
|
|
83
|
+
async grantsDisableLibraryValidation(file) {
|
|
84
|
+
return (await this.entitlementsValue(file, DISABLE_LIBRARY_VALIDATION)) === true;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The value the entitlements file assigns to `key`, or `undefined` when the key is absent or the file cannot be
|
|
88
|
+
* read or parsed. Returns the raw value rather than a boolean because callers disagree on the predicate: an
|
|
89
|
+
* opt-out we act on ourselves is required to be literally `true`, while a key we are predicting
|
|
90
|
+
* `@electron/osx-sign` will act on has to use osx-sign's own truthiness test.
|
|
91
|
+
*/
|
|
92
|
+
async entitlementsValue(file, key) {
|
|
93
|
+
if (file == null) {
|
|
94
|
+
// no user-supplied file and no bundled default — @electron/osx-sign's defaults never grant the key
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const entitlements = await parsePlistFile(file);
|
|
99
|
+
return entitlements[key];
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
log.debug({ file, key, error: e.message }, "cannot read entitlements");
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolves the entitlements file for the app bundle itself.
|
|
108
|
+
*
|
|
109
|
+
* Precedence: explicit `sign.entitlements` → `build/entitlements.{mac,mas}.plist` → a bundled default.
|
|
110
|
+
* The explicit path is resolved like every other build resource (build resources dir, then project dir) and
|
|
111
|
+
* must exist. Returns `null` when no default applies, which lets `@electron/osx-sign` fall back to its own
|
|
112
|
+
* Chromium-derived defaults (`default.mas.plist` for MAS).
|
|
113
|
+
*/
|
|
114
|
+
async getAppEntitlements(targetPlatform, signOpts, adHoc) {
|
|
115
|
+
const isMas = MacTargetHelper.isMasTarget(targetPlatform);
|
|
116
|
+
// an explicit `sign.entitlements` resolves like every other build resource (build resources dir, then project dir);
|
|
117
|
+
// `null`/empty behave like unset so the `build/entitlements.{mac,mas}.plist` convention still applies
|
|
118
|
+
const entitlements = await this.packager.getResource(signOpts?.entitlements || undefined, `entitlements.${isMas ? "mas" : "mac"}.plist`);
|
|
119
|
+
if (entitlements != null) {
|
|
120
|
+
return entitlements;
|
|
121
|
+
}
|
|
122
|
+
if (isMas) {
|
|
123
|
+
// @electron/osx-sign's default.mas.plist enables the App Sandbox, which a MAS build cannot ship without
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return getTemplatePath(adHoc ? "entitlements.mac.adhoc.plist" : "entitlements.mac.plist");
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Resolves the entitlements file for the nested binaries (helpers, frameworks, unpacked executables) that
|
|
130
|
+
* inherit the app's signature.
|
|
131
|
+
*
|
|
132
|
+
* Precedence: explicit `sign.entitlementsInherit` → `build/entitlements.{mac,mas}.inherit.plist` → `null`,
|
|
133
|
+
* which hands the file to `@electron/osx-sign`'s per-file defaults, modelled on Chromium's own entitlements
|
|
134
|
+
* (the explicit path is resolved like every other build resource — build resources dir, then project dir — and must exist):
|
|
135
|
+
* - renderer and GPU helpers: `allow-jit` only
|
|
136
|
+
* - plugin helper: `allow-jit`, `allow-unsigned-executable-memory`, `disable-library-validation`
|
|
137
|
+
* - everything else (frameworks, `.node` modules, unpacked executables): `default.darwin.plist`, i.e. `allow-jit`
|
|
138
|
+
* plus Chromium's `device.*` / `personal-information.*` entitlements
|
|
139
|
+
* Nested binaries therefore do not inherit the app's entitlements, and apart from the plugin helper none of these
|
|
140
|
+
* defaults grant `disable-library-validation` or `allow-unsigned-executable-memory`.
|
|
141
|
+
*/
|
|
142
|
+
async getInheritEntitlements(targetPlatform, signOpts, adHoc) {
|
|
143
|
+
const isMas = MacTargetHelper.isMasTarget(targetPlatform);
|
|
144
|
+
// an explicit `sign.entitlementsInherit` resolves like every other build resource (build resources dir, then project dir);
|
|
145
|
+
// `null`/empty behave like unset so the `build/entitlements.{mac,mas}.inherit.plist` convention still applies
|
|
146
|
+
const entitlements = await this.packager.getResource(signOpts?.entitlementsInherit || undefined, `entitlements.${isMas ? "mas" : "mac"}.inherit.plist`);
|
|
147
|
+
if (entitlements != null) {
|
|
148
|
+
return entitlements;
|
|
149
|
+
}
|
|
150
|
+
// an ad-hoc signature has no Team ID, so every process in the bundle — not just the main one — needs
|
|
151
|
+
// library validation disabled or it cannot load the Electron framework
|
|
152
|
+
return adHoc && !isMas ? getTemplatePath("entitlements.mac.adhoc.plist") : null;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Picks the string handed to `@electron/osx-sign` as `identity`. Two consumers inside osx-sign want different
|
|
156
|
+
* forms of the same certificate, which is why this line has flipped twice before:
|
|
157
|
+
*
|
|
158
|
+
* - `codesign --sign <identity>` needs a *unique* reference. A common name can match several valid certificates
|
|
159
|
+
* (the same name issued twice with different expiry dates), and `codesign` then fails with
|
|
160
|
+
* `... : ambiguous (matches "X" and "X" ...)` — `--keychain` does not disambiguate it. Only the SHA-1 hash is
|
|
161
|
+
* unique. https://github.com/electron-userland/electron-builder/issues/10237
|
|
162
|
+
* - osx-sign's entitlements automation scrapes the Team ID out of the identity *name* with `/^.+\((.+?)\)$/` to
|
|
163
|
+
* fill in `ElectronTeamID`, and throws `Could not automatically determine ElectronTeamID from identity` when
|
|
164
|
+
* that fails. A bare hash has no `(TEAMID)` suffix.
|
|
165
|
+
* https://github.com/electron-userland/electron-builder/issues/7995
|
|
166
|
+
*
|
|
167
|
+
* So we pass the hash and, when that automation is going to run, hand it the Team ID through the one channel it
|
|
168
|
+
* already prefers over the identity name: `ElectronTeamID` in the app's `Info.plist`. Writing that key is exactly
|
|
169
|
+
* what osx-sign would have done itself, from the same source. It reaches the regex only when the App Sandbox is
|
|
170
|
+
* enabled (see `isSandboxed`), no `provisioningProfile` is configured, and `Info.plist` carries no
|
|
171
|
+
* `ElectronTeamID` — so those cases skip the write and pass the hash straight through.
|
|
172
|
+
*
|
|
173
|
+
* Falls back to the name whenever the hash cannot be made to work (no hash at all, ad-hoc, a self-signed name
|
|
174
|
+
* with no `(TEAMID)`, an unreadable `Info.plist`), which leaves the previous behavior — and the previous error
|
|
175
|
+
* message — untouched for those cases.
|
|
176
|
+
*
|
|
177
|
+
* All of this is osx-sign-specific, so a custom signer (`sign` as a function or module path) gets the bare hash
|
|
178
|
+
* and an untouched `Info.plist`: `@electron/osx-sign` never runs, so there is no automation to feed.
|
|
179
|
+
*/
|
|
180
|
+
async resolveSignIdentity(appPath, identity, signOpts, targetPlatform, hasCustomSign = false) {
|
|
181
|
+
// ad-hoc ("-") and any name-only identity have nothing to disambiguate with
|
|
182
|
+
if (!identity.hash || MacTargetHelper.isAdHocIdentity(identity)) {
|
|
183
|
+
return identity.name;
|
|
184
|
+
}
|
|
185
|
+
// a custom signer replaces @electron/osx-sign entirely. Hand over the unique hash — the form `codesign`
|
|
186
|
+
// needs — and mutate nothing on its behalf. This must stay above every branch below, so a delegated signer
|
|
187
|
+
// never lands in one of their `identity.name` fallbacks.
|
|
188
|
+
if (hasCustomSign) {
|
|
189
|
+
return identity.hash;
|
|
190
|
+
}
|
|
191
|
+
// osx-sign's entitlements automation is off, or it takes the Team ID from the profile instead of the identity
|
|
192
|
+
if (signOpts?.preAutoEntitlements === false || signOpts?.provisioningProfile) {
|
|
193
|
+
return identity.hash;
|
|
194
|
+
}
|
|
195
|
+
if (!(await this.isSandboxed(appPath, signOpts, targetPlatform))) {
|
|
196
|
+
return identity.hash;
|
|
197
|
+
}
|
|
198
|
+
const infoPlistFile = path.join(appPath, "Contents", "Info.plist");
|
|
199
|
+
try {
|
|
200
|
+
const info = await parsePlistFile(infoPlistFile);
|
|
201
|
+
if (info.ElectronTeamID) {
|
|
202
|
+
// osx-sign prefers this over parsing the identity, so the hash never reaches its regex
|
|
203
|
+
return identity.hash;
|
|
204
|
+
}
|
|
205
|
+
// the same pattern osx-sign uses, so we never derive a Team ID it would have rejected
|
|
206
|
+
const teamId = /^.+\((.+?)\)\s*$/.exec(identity.name)?.[1];
|
|
207
|
+
if (teamId == null) {
|
|
208
|
+
log.debug({ identityName: identity.name }, "cannot parse Team ID from identity name, signing with the identity name");
|
|
209
|
+
return identity.name;
|
|
54
210
|
}
|
|
211
|
+
await savePlistFile(infoPlistFile, { ...info, ElectronTeamID: teamId });
|
|
212
|
+
log.debug({ file: log.filePath(infoPlistFile), teamId }, "ElectronTeamID set from the signing identity name");
|
|
213
|
+
return identity.hash;
|
|
55
214
|
}
|
|
56
|
-
|
|
57
|
-
|
|
215
|
+
catch (e) {
|
|
216
|
+
log.debug({ file: log.filePath(infoPlistFile), error: e.message }, "cannot read or update Info.plist, signing with the identity name");
|
|
217
|
+
return identity.name;
|
|
58
218
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Whether `@electron/osx-sign`'s entitlements automation can reach the `ElectronTeamID`-from-identity-name step
|
|
222
|
+
* that a bare hash cannot satisfy.
|
|
223
|
+
*
|
|
224
|
+
* osx-sign gates the automation on `!filePath.includes('.app/')` and runs it with that path's own entitlements.
|
|
225
|
+
* The app bundle itself always qualifies, under the app entitlements. Two further cases qualify under the
|
|
226
|
+
* inherit entitlements, and only then is that file worth reading: a `sign.binaries` entry (signed alongside the
|
|
227
|
+
* bundle rather than within it), and — when the signed bundle is not named `*.app`, which `--prepackaged`
|
|
228
|
+
* allows — every file inside it, since none of their paths contain `.app/` either.
|
|
229
|
+
*
|
|
230
|
+
* A `null` file means osx-sign falls back to its own default, and only the MAS defaults enable the App Sandbox.
|
|
231
|
+
* Truthiness, not `=== true`, because that is the test osx-sign itself applies.
|
|
232
|
+
*/
|
|
233
|
+
async isSandboxed(appPath, signOpts, targetPlatform) {
|
|
234
|
+
const isMas = MacTargetHelper.isMasTarget(targetPlatform);
|
|
235
|
+
const grants = async (file) => (file == null ? isMas : !!(await this.entitlementsValue(file, APP_SANDBOX)));
|
|
236
|
+
if (await grants(await this.getAppEntitlements(targetPlatform, signOpts, false))) {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
if (!signOpts?.binaries?.length && path.basename(appPath).endsWith(".app")) {
|
|
240
|
+
// nothing but the bundle itself is signed outside a `.app/` path, so the inherit entitlements never apply
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
return await grants(await this.getInheritEntitlements(targetPlatform, signOpts, false));
|
|
244
|
+
}
|
|
245
|
+
async buildSignOptions(appPath, identity, config, keychainFile, arch, targetPlatform, hasCustomSign = false) {
|
|
246
|
+
const isMas = MacTargetHelper.isMasTarget(targetPlatform);
|
|
247
|
+
const type = MacTargetHelper.resolveSigningType(targetPlatform, config?.type);
|
|
248
|
+
let binaries = config?.binaries || undefined;
|
|
70
249
|
if (binaries) {
|
|
71
250
|
// Accept absolute paths for external binaries, else resolve relative paths from the artifact's app Contents path.
|
|
72
251
|
binaries = (await Promise.all(binaries.flatMap(async (destination) => {
|
|
@@ -80,6 +259,25 @@ export class MacTargetHelper {
|
|
|
80
259
|
}))).flat();
|
|
81
260
|
log.info({ binaries, arch: arch == null ? null : Arch[arch] }, "signing additional user-defined binaries for arch");
|
|
82
261
|
}
|
|
262
|
+
let filter = config?.ignore;
|
|
263
|
+
if (Array.isArray(filter)) {
|
|
264
|
+
if (filter.length == 0) {
|
|
265
|
+
filter = undefined;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
else if (typeof filter === "string") {
|
|
269
|
+
filter = filter.length === 0 ? undefined : [filter];
|
|
270
|
+
}
|
|
271
|
+
const filterRe = typeof filter === "function"
|
|
272
|
+
? null
|
|
273
|
+
: filter?.map(it => {
|
|
274
|
+
try {
|
|
275
|
+
return new RegExp(it);
|
|
276
|
+
}
|
|
277
|
+
catch (e) {
|
|
278
|
+
throw new InvalidConfigurationError(`Invalid regex filter pattern: ${it}. ${e.message}`);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
83
281
|
return {
|
|
84
282
|
identityValidation: false,
|
|
85
283
|
// https://github.com/electron-userland/electron-builder/issues/1699
|
|
@@ -92,6 +290,9 @@ export class MacTargetHelper {
|
|
|
92
290
|
}
|
|
93
291
|
}
|
|
94
292
|
}
|
|
293
|
+
if (typeof filter === "function" && filter(file)) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
95
296
|
return (file.endsWith(".kext") ||
|
|
96
297
|
file.startsWith("/Contents/PlugIns", appPath.length) ||
|
|
97
298
|
file.includes("/node_modules/puppeteer/.local-chromium") ||
|
|
@@ -102,7 +303,7 @@ export class MacTargetHelper {
|
|
|
102
303
|
https://github.com/electron-userland/electron-builder/issues/5383
|
|
103
304
|
*/
|
|
104
305
|
},
|
|
105
|
-
identity: identity ?
|
|
306
|
+
identity: identity ? await this.resolveSignIdentity(appPath, identity, config, targetPlatform, hasCustomSign) : undefined,
|
|
106
307
|
type,
|
|
107
308
|
platform: isMas ? "mas" : "darwin",
|
|
108
309
|
version: this.packager.config.electronVersion || undefined,
|
|
@@ -110,17 +311,109 @@ export class MacTargetHelper {
|
|
|
110
311
|
keychain: keychainFile || undefined,
|
|
111
312
|
binaries,
|
|
112
313
|
// https://github.com/electron-userland/electron-builder/issues/1480
|
|
113
|
-
strictVerify: config
|
|
114
|
-
preAutoEntitlements: config
|
|
115
|
-
optionsForFile: await this.getOptionsForFile(appPath,
|
|
116
|
-
provisioningProfile: config
|
|
314
|
+
strictVerify: config?.strictVerify,
|
|
315
|
+
preAutoEntitlements: config?.preAutoEntitlements,
|
|
316
|
+
optionsForFile: await this.getOptionsForFile(appPath, targetPlatform, config, identity),
|
|
317
|
+
provisioningProfile: config?.provisioningProfile || undefined,
|
|
117
318
|
};
|
|
118
319
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Post-sign diagnostic replacing the blanket `com.apple.security.cs.disable-library-validation` default.
|
|
322
|
+
*
|
|
323
|
+
* Walks the Mach-O libraries and bundles (`MH_DYLIB` / `MH_BUNDLE`) under `Contents/Resources/app.asar.unpacked` and
|
|
324
|
+
* `Contents/PlugIns` and reports the ones whose signature does not carry the Team ID `codesign` reports for the
|
|
325
|
+
* freshly signed app bundle — typically excluded via `sign.ignore`, or fetched at build time already signed by a
|
|
326
|
+
* third party. Only loadable code is checked because library validation applies to what a process loads;
|
|
327
|
+
* executables (`MH_EXECUTE`, e.g. a bundled ffmpeg) are spawned rather than loaded, so a foreign signature on them is
|
|
328
|
+
* not a launch failure and reporting them would be a false positive. `Contents/PlugIns` is covered because
|
|
329
|
+
* `buildSignOptions` never re-signs it, so a bundle there keeps whatever signature it shipped with. Under the
|
|
330
|
+
* hardened runtime those fail library validation when loaded, which is precisely the failure the old default hid
|
|
331
|
+
* from every user instead of only the affected ones.
|
|
332
|
+
*
|
|
333
|
+
* The opt-out is read from the app entitlements (not the inherit ones) because library validation is enforced by
|
|
334
|
+
* the loading process under its own entitlements — the main process, governed by the app plist, is the usual loader
|
|
335
|
+
* of these modules, while the inherit plist only governs loads performed by helper processes.
|
|
336
|
+
*
|
|
337
|
+
* Best-effort: never fails the build, and skips the scan when the app bundle itself has no Team ID (e.g. a
|
|
338
|
+
* self-signed certificate).
|
|
339
|
+
*/
|
|
340
|
+
async warnAboutForeignSignedBinaries(appPath, identity, targetPlatform, signOpts) {
|
|
341
|
+
if (MacTargetHelper.isMasTarget(targetPlatform) ||
|
|
342
|
+
MacTargetHelper.isAdHocIdentity(identity) ||
|
|
343
|
+
!MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, signOpts?.hardenedRuntime)) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (await this.grantsDisableLibraryValidation(await this.getAppEntitlements(targetPlatform, signOpts, false))) {
|
|
347
|
+
// the app already opted out of library validation
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
// `Contents/PlugIns` is scanned too: `buildSignOptions` unconditionally excludes it from re-signing, so anything
|
|
351
|
+
// there keeps whatever third-party signature it shipped with — exactly what fails library validation
|
|
352
|
+
const candidateDirs = [path.join(appPath, "Contents", "Resources", "app.asar.unpacked"), path.join(appPath, "Contents", "PlugIns")];
|
|
353
|
+
try {
|
|
354
|
+
const dirs = [];
|
|
355
|
+
for (const dir of candidateDirs) {
|
|
356
|
+
if ((await statOrNull(dir)) != null) {
|
|
357
|
+
dirs.push(dir);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (dirs.length === 0) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
// the Team ID is read from the signed bundle rather than parsed out of the identity's common name: not every
|
|
364
|
+
// identity carries a "(TEAMID)" suffix, and a self-signed one can carry it without codesign ever recording it
|
|
365
|
+
const teamId = await this.readSigningTeamId(appPath);
|
|
366
|
+
if (teamId == null) {
|
|
367
|
+
// no Team ID to compare against (unsigned, or signed without one)
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
let files = [];
|
|
371
|
+
for (const dir of dirs) {
|
|
372
|
+
files = files.concat(await walk(dir));
|
|
373
|
+
}
|
|
374
|
+
// bounded concurrency: each check spawns `codesign -d`; results are sorted afterwards so the warning is deterministic
|
|
375
|
+
const checked = await asyncPool(MAX_FILE_REQUESTS, files, async (file) => {
|
|
376
|
+
// only dylibs and bundles get loaded into a process; executables are spawned and never face library validation
|
|
377
|
+
if (!isLoadableMachOFileType(await readMachOFileType(file))) {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
return (await this.readSigningTeamId(file)) === teamId ? null : path.relative(appPath, file);
|
|
381
|
+
});
|
|
382
|
+
const foreign = checked.filter((it) => it != null).sort();
|
|
383
|
+
if (foreign.length > 0) {
|
|
384
|
+
log.warn({ files: foreign.join(", "), teamId }, `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. ` +
|
|
385
|
+
`Sign them with the same identity, or grant ${DISABLE_LIBRARY_VALIDATION} in build/entitlements.mac.plist ` +
|
|
386
|
+
`(and in build/entitlements.mac.inherit.plist if a helper process such as a utilityProcess or a nodeIntegration renderer loads them)`);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
catch (e) {
|
|
390
|
+
log.debug({ error: e.message }, "cannot inspect app.asar.unpacked and Contents/PlugIns for foreign-signed binaries");
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* The `TeamIdentifier` of a file's existing code signature as reported by `codesign -d`, or `null` when there is none:
|
|
395
|
+
* `codesign` fails (e.g. the file is unsigned), the field is absent, or it is the literal `not set` that ad-hoc and
|
|
396
|
+
* self-signed signatures report.
|
|
397
|
+
*
|
|
398
|
+
* @internal An instance method rather than a module-level function so tests can stub the `codesign` invocation, which
|
|
399
|
+
* only exists on macOS.
|
|
400
|
+
*/
|
|
401
|
+
async readSigningTeamId(file) {
|
|
402
|
+
try {
|
|
403
|
+
// `codesign -d` reports on stderr, so stdout alone (as `exec` returns) is not enough
|
|
404
|
+
const { stderr } = await spawnAndWriteWithOutput("/usr/bin/codesign", ["-d", "--verbose=4", file], "");
|
|
405
|
+
return parseSigningTeamId(stderr);
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
// unsigned binaries make `codesign -d` exit non-zero
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
async createMasInstaller(appPath, outDir, masOptions, keychainFile, targetPlatform, arch, identityQualifier) {
|
|
413
|
+
const certType = MacTargetHelper.isMasDevelopment(targetPlatform) ? "Mac Developer" : "3rd Party Mac Developer Installer";
|
|
414
|
+
const masInstallerIdentity = await findIdentity(certType, identityQualifier, keychainFile);
|
|
122
415
|
if (masInstallerIdentity == null) {
|
|
123
|
-
throw new InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/code-signing`);
|
|
416
|
+
throw new InvalidConfigurationError(`Cannot find valid "${certType}" identity to sign MAS installer, please see https://electron.build/docs/features/code-signing`);
|
|
124
417
|
}
|
|
125
418
|
MacTargetHelper.assertSafePathForCommandUsage(outDir, "output directory");
|
|
126
419
|
// mas uploaded to AppStore, so, use "-" instead of space for name
|
|
@@ -137,74 +430,75 @@ export class MacTargetHelper {
|
|
|
137
430
|
packager: this.packager,
|
|
138
431
|
});
|
|
139
432
|
}
|
|
140
|
-
async getOptionsForFile(appPath,
|
|
141
|
-
const
|
|
142
|
-
const
|
|
433
|
+
async getOptionsForFile(appPath, targetPlatform, customSignOptions, identity) {
|
|
434
|
+
const isMas = MacTargetHelper.isMasTarget(targetPlatform);
|
|
435
|
+
const adHoc = MacTargetHelper.isAdHocIdentity(identity);
|
|
436
|
+
const appEntitlements = await this.getAppEntitlements(targetPlatform, customSignOptions, adHoc);
|
|
437
|
+
const inheritEntitlements = await this.getInheritEntitlements(targetPlatform, customSignOptions, adHoc);
|
|
143
438
|
const getEntitlements = (filePath) => {
|
|
144
439
|
if (filePath === appPath) {
|
|
145
|
-
|
|
146
|
-
return customSignOptions.entitlements;
|
|
147
|
-
}
|
|
148
|
-
const p = `entitlements.${entitlementsSuffix}.plist`;
|
|
149
|
-
if (resourceList.includes(p)) {
|
|
150
|
-
return path.join(this.packager.buildResourcesDir, p);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
return getTemplatePath("entitlements.mac.plist");
|
|
154
|
-
}
|
|
440
|
+
return appEntitlements;
|
|
155
441
|
}
|
|
156
442
|
if (filePath.includes("Library/LoginItems")) {
|
|
157
|
-
return customSignOptions
|
|
158
|
-
}
|
|
159
|
-
if (customSignOptions.entitlementsInherit) {
|
|
160
|
-
return customSignOptions.entitlementsInherit;
|
|
161
|
-
}
|
|
162
|
-
const p = `entitlements.${entitlementsSuffix}.inherit.plist`;
|
|
163
|
-
if (resourceList.includes(p)) {
|
|
164
|
-
return path.join(this.packager.buildResourcesDir, p);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
return getTemplatePath("entitlements.mac.plist");
|
|
443
|
+
return customSignOptions?.entitlementsLoginHelper;
|
|
168
444
|
}
|
|
445
|
+
// `null` leaves the file to @electron/osx-sign's per-file defaults, which are tighter than one blanket plist
|
|
446
|
+
return inheritEntitlements;
|
|
169
447
|
};
|
|
170
|
-
const requirements = isMas ||
|
|
171
|
-
// harden by default for mac builds. Only harden mas builds if explicitly true (backward compatibility)
|
|
172
|
-
const hardenedRuntime = isMas ? customSignOptions.hardenedRuntime === true : customSignOptions.hardenedRuntime !== false;
|
|
448
|
+
const requirements = isMas || customSignOptions?.requirements == null ? undefined : await this.packager.getResource(customSignOptions.requirements);
|
|
173
449
|
return (filePath) => {
|
|
174
450
|
const entitlements = getEntitlements(filePath);
|
|
175
451
|
return {
|
|
176
452
|
entitlements: entitlements || undefined,
|
|
177
|
-
hardenedRuntime: hardenedRuntime ?? undefined,
|
|
178
|
-
timestamp: customSignOptions
|
|
453
|
+
hardenedRuntime: MacTargetHelper.isHardenedRuntimeEnabledForSigning(targetPlatform, customSignOptions?.hardenedRuntime) ?? undefined,
|
|
454
|
+
timestamp: customSignOptions?.timestamp || undefined,
|
|
179
455
|
requirements: requirements || undefined,
|
|
180
|
-
additionalArguments: customSignOptions
|
|
456
|
+
additionalArguments: customSignOptions?.additionalArguments || undefined,
|
|
181
457
|
};
|
|
182
458
|
};
|
|
183
459
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
460
|
+
/**
|
|
461
|
+
* The effective signing type: an explicit `sign.type` wins, otherwise derived from the build flavor
|
|
462
|
+
* (`mas-dev` → `development`, otherwise `distribution`).
|
|
463
|
+
*/
|
|
464
|
+
static resolveSigningType(targetPlatform, configType) {
|
|
465
|
+
return configType ?? (MacTargetHelper.isMasDevelopment(targetPlatform) ? "development" : "distribution");
|
|
466
|
+
}
|
|
467
|
+
static getCertificateTypes(targetPlatform, type) {
|
|
468
|
+
if (type === "development") {
|
|
469
|
+
return ["Mac Developer", "Apple Development"];
|
|
187
470
|
}
|
|
188
|
-
return
|
|
471
|
+
return MacTargetHelper.isMasTarget(targetPlatform) ? ["Apple Distribution", "3rd Party Mac Developer Application"] : ["Developer ID Application"];
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* The MAS `.pkg` installer is only built for distribution signing — a development-signed build
|
|
475
|
+
* (`mas-dev`, or an explicit `sign.type: "development"` on a `mas` build) is installed directly.
|
|
476
|
+
*/
|
|
477
|
+
static shouldCreateMasInstaller(targetPlatform, configType) {
|
|
478
|
+
return MacTargetHelper.isMasTarget(targetPlatform) && MacTargetHelper.resolveSigningType(targetPlatform, configType) !== "development";
|
|
189
479
|
}
|
|
190
480
|
static isMasTarget(targetName) {
|
|
191
481
|
return targetName === "mas" || targetName === "mas-dev";
|
|
192
482
|
}
|
|
483
|
+
static isMasDevelopment(targetName) {
|
|
484
|
+
return targetName === "mas-dev";
|
|
485
|
+
}
|
|
193
486
|
static getPlatformTypeFromTarget(targetName) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
if (targetName === "mas-dev") {
|
|
487
|
+
// must check for mas-dev first
|
|
488
|
+
if (MacTargetHelper.isMasDevelopment(targetName)) {
|
|
198
489
|
return "mas-dev";
|
|
199
490
|
}
|
|
491
|
+
if (MacTargetHelper.isMasTarget(targetName)) {
|
|
492
|
+
return "mas";
|
|
493
|
+
}
|
|
200
494
|
return "mac";
|
|
201
495
|
}
|
|
202
496
|
/**
|
|
203
497
|
* Returns true when hardened runtime will be active for signing.
|
|
204
498
|
* For non-MAS builds it defaults to on; for MAS it defaults to off.
|
|
205
499
|
*/
|
|
206
|
-
static isHardenedRuntimeEnabledForSigning(
|
|
207
|
-
return
|
|
500
|
+
static isHardenedRuntimeEnabledForSigning(targetPlatform, hardenedRuntime) {
|
|
501
|
+
return MacTargetHelper.isMasTarget(targetPlatform) ? hardenedRuntime === true : hardenedRuntime !== false;
|
|
208
502
|
}
|
|
209
503
|
static assertSafePathForCommandUsage(pathValue, description) {
|
|
210
504
|
if (/[\0\r\n"'`$;&|<>]/.test(pathValue)) {
|
|
@@ -212,7 +506,6 @@ export class MacTargetHelper {
|
|
|
212
506
|
}
|
|
213
507
|
}
|
|
214
508
|
static getNotarizeOptions(appPath) {
|
|
215
|
-
const tool = "notarytool";
|
|
216
509
|
const teamId = process.env.APPLE_TEAM_ID;
|
|
217
510
|
const appleId = process.env.APPLE_ID;
|
|
218
511
|
const appleIdPassword = process.env.APPLE_APP_SPECIFIC_PASSWORD;
|
|
@@ -226,7 +519,7 @@ export class MacTargetHelper {
|
|
|
226
519
|
if (!teamId) {
|
|
227
520
|
throw new InvalidConfigurationError(`APPLE_TEAM_ID env var needs to be set`);
|
|
228
521
|
}
|
|
229
|
-
return {
|
|
522
|
+
return { appPath, appleId, appleIdPassword, teamId };
|
|
230
523
|
}
|
|
231
524
|
const appleApiKey = process.env.APPLE_API_KEY;
|
|
232
525
|
const appleApiKeyId = process.env.APPLE_API_KEY_ID;
|
|
@@ -235,7 +528,7 @@ export class MacTargetHelper {
|
|
|
235
528
|
if (!appleApiKey || !appleApiKeyId || !appleApiIssuer) {
|
|
236
529
|
throw new InvalidConfigurationError(`Env vars APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER need to be set`);
|
|
237
530
|
}
|
|
238
|
-
return {
|
|
531
|
+
return { appPath, appleApiKey, appleApiKeyId, appleApiIssuer };
|
|
239
532
|
}
|
|
240
533
|
const keychain = process.env.APPLE_KEYCHAIN;
|
|
241
534
|
const keychainProfile = process.env.APPLE_KEYCHAIN_PROFILE;
|
|
@@ -244,7 +537,7 @@ export class MacTargetHelper {
|
|
|
244
537
|
if (keychain) {
|
|
245
538
|
args = { ...args, keychain };
|
|
246
539
|
}
|
|
247
|
-
return {
|
|
540
|
+
return { appPath, ...args };
|
|
248
541
|
}
|
|
249
542
|
return undefined;
|
|
250
543
|
}
|
|
@@ -259,9 +552,110 @@ export class MacTargetHelper {
|
|
|
259
552
|
log.warn({ reason: "`notarize` options were unable to be generated" }, "skipped macOS notarization");
|
|
260
553
|
return;
|
|
261
554
|
}
|
|
262
|
-
const { notarize } = await dynamicImport("@electron/notarize");
|
|
263
555
|
await notarize(options);
|
|
264
556
|
log.info(null, "notarization successful");
|
|
265
557
|
}
|
|
266
558
|
}
|
|
559
|
+
/** Big-endian fat/universal magic — the same bytes open a Java class file, so `nfat_arch` has to disambiguate. */
|
|
560
|
+
const FAT_MAGIC = 0xcafebabe;
|
|
561
|
+
/** 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. */
|
|
562
|
+
const FAT_MAX_ARCH_COUNT = 30;
|
|
563
|
+
/** 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. */
|
|
564
|
+
const THIN_MAGIC_BE = new Set([0xfeedface, 0xfeedfacf]);
|
|
565
|
+
const THIN_MAGIC_LE = new Set([0xcefaedfe, 0xcffaedfe]);
|
|
566
|
+
/** `mach_header.filetype` follows `magic`, `cputype` and `cpusubtype` in both the 32- and 64-bit header. */
|
|
567
|
+
const MACH_HEADER_FILETYPE_OFFSET = 12;
|
|
568
|
+
const MACH_HEADER_MIN_LENGTH = 16;
|
|
569
|
+
/** The first `fat_arch` (`cputype`, `cpusubtype`, `offset`, `size`, `align` — five big-endian uint32s) follows the 8-byte fat header. */
|
|
570
|
+
const FAT_ARCH_OFFSET = 8;
|
|
571
|
+
const FAT_ARCH_LENGTH = 20;
|
|
572
|
+
const FAT_ARCH_SLICE_OFFSET_FIELD = FAT_ARCH_OFFSET + 8;
|
|
573
|
+
const HEAD_READ_LENGTH = 4096;
|
|
574
|
+
/** The `mach_header.filetype` values the foreign-signature scan tells apart (see `<mach-o/loader.h>`). */
|
|
575
|
+
export const MachOFileType = {
|
|
576
|
+
/** Executable — spawned as its own process, never loaded into another one. */
|
|
577
|
+
MH_EXECUTE: 2,
|
|
578
|
+
/** Dynamically bound shared library (`.dylib`). */
|
|
579
|
+
MH_DYLIB: 6,
|
|
580
|
+
/** Dynamically bound bundle (`.node` native addons, plug-ins). */
|
|
581
|
+
MH_BUNDLE: 8,
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* The `filetype` field of a Mach-O header, or `null` when the file is not Mach-O, too short, or unreadable. Endianness
|
|
585
|
+
* follows the magic. A fat/universal binary reports the filetype of its first slice (all slices share one filetype);
|
|
586
|
+
* the fat magic `0xcafebabe` is shared with Java class files, so `nfat_arch` must also be a plausible slice count.
|
|
587
|
+
*
|
|
588
|
+
* @internal Exported for tests only.
|
|
589
|
+
*/
|
|
590
|
+
export async function readMachOFileType(file) {
|
|
591
|
+
let handle = null;
|
|
592
|
+
try {
|
|
593
|
+
handle = await open(file, "r");
|
|
594
|
+
const head = Buffer.alloc(HEAD_READ_LENGTH);
|
|
595
|
+
const { bytesRead } = await handle.read(head, 0, HEAD_READ_LENGTH, 0);
|
|
596
|
+
if (bytesRead < 4) {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
if (head.readUInt32BE(0) !== FAT_MAGIC) {
|
|
600
|
+
return readThinMachOFileType(head.subarray(0, bytesRead));
|
|
601
|
+
}
|
|
602
|
+
if (bytesRead < FAT_ARCH_OFFSET + FAT_ARCH_LENGTH) {
|
|
603
|
+
return null;
|
|
604
|
+
}
|
|
605
|
+
const archCount = head.readUInt32BE(4);
|
|
606
|
+
if (archCount === 0 || archCount >= FAT_MAX_ARCH_COUNT) {
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
const sliceOffset = head.readUInt32BE(FAT_ARCH_SLICE_OFFSET_FIELD);
|
|
610
|
+
const sliceHeader = Buffer.alloc(MACH_HEADER_MIN_LENGTH);
|
|
611
|
+
const slice = await handle.read(sliceHeader, 0, MACH_HEADER_MIN_LENGTH, sliceOffset);
|
|
612
|
+
return readThinMachOFileType(sliceHeader.subarray(0, slice.bytesRead));
|
|
613
|
+
}
|
|
614
|
+
catch {
|
|
615
|
+
return null;
|
|
616
|
+
}
|
|
617
|
+
finally {
|
|
618
|
+
await handle?.close();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
function readThinMachOFileType(header) {
|
|
622
|
+
if (header.length < MACH_HEADER_MIN_LENGTH) {
|
|
623
|
+
return null;
|
|
624
|
+
}
|
|
625
|
+
const magic = header.readUInt32BE(0);
|
|
626
|
+
if (THIN_MAGIC_BE.has(magic)) {
|
|
627
|
+
return header.readUInt32BE(MACH_HEADER_FILETYPE_OFFSET);
|
|
628
|
+
}
|
|
629
|
+
if (THIN_MAGIC_LE.has(magic)) {
|
|
630
|
+
return header.readUInt32LE(MACH_HEADER_FILETYPE_OFFSET);
|
|
631
|
+
}
|
|
632
|
+
return null;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Whether a Mach-O filetype is loaded into a process — a dylib or a bundle — and is therefore subject to library
|
|
636
|
+
* validation. Executables are spawned, not loaded, so they are not.
|
|
637
|
+
*
|
|
638
|
+
* @internal Exported for tests only.
|
|
639
|
+
*/
|
|
640
|
+
export function isLoadableMachOFileType(type) {
|
|
641
|
+
return type === MachOFileType.MH_DYLIB || type === MachOFileType.MH_BUNDLE;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Whether the file starts with a Mach-O header (thin or fat), regardless of filetype.
|
|
645
|
+
*
|
|
646
|
+
* @internal Exported for tests only.
|
|
647
|
+
*/
|
|
648
|
+
export async function isMachOFile(file) {
|
|
649
|
+
return (await readMachOFileType(file)) != null;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Extracts the `TeamIdentifier` from `codesign -d --verbose=4` output, or `null` when the field is absent or the
|
|
653
|
+
* literal `not set` that ad-hoc and self-signed signatures report.
|
|
654
|
+
*
|
|
655
|
+
* @internal Exported for tests only.
|
|
656
|
+
*/
|
|
657
|
+
export function parseSigningTeamId(codesignOutput) {
|
|
658
|
+
const teamId = /^TeamIdentifier=(.+)$/m.exec(codesignOutput)?.[1].trim();
|
|
659
|
+
return teamId == null || teamId === "not set" ? null : teamId;
|
|
660
|
+
}
|
|
267
661
|
//# sourceMappingURL=MacTargetHelper.js.map
|