app-builder-lib 27.0.0-alpha.6 → 27.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +6 -4
- 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/signManager.d.ts +2 -1
- package/dist/codeSign/win/signManager.d.ts.map +1 -1
- package/dist/codeSign/win/signManager.js.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +25 -1
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +74 -3
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- 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 +16 -7
- package/dist/codeSign/win/windowsCodeSign.js.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +2 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +2 -2
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +56 -8
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/core.d.ts +5 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/fileMatcher.d.ts +15 -0
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +42 -2
- package/dist/fileMatcher.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +2 -1
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +2 -1
- package/dist/indexInternal.js.map +1 -1
- package/dist/macPackager.d.ts +16 -8
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +59 -32
- package/dist/macPackager.js.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts +11 -1
- package/dist/node-module-collector/nodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/nodeModulesCollector.js +28 -5
- package/dist/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.d.ts.map +1 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js +3 -1
- package/dist/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +2 -2
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SnapOptions.d.ts +8 -4
- package/dist/options/SnapOptions.d.ts.map +1 -1
- package/dist/options/SnapOptions.js.map +1 -1
- package/dist/options/linuxOptions.d.ts +8 -2
- package/dist/options/linuxOptions.d.ts.map +1 -1
- package/dist/options/linuxOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +18 -8
- 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 +8 -7
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +6 -3
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +2 -1
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +5 -3
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.js +37 -0
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +9 -5
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.d.ts.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +4 -1
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts +7 -0
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +29 -2
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.d.ts +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +3 -3
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts +27 -0
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +92 -57
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +16 -4
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +23 -14
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.js +1 -1
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/win/MsiTarget.js +2 -2
- package/dist/targets/win/MsiTarget.js.map +1 -1
- package/dist/toolsets/7zip.d.ts +32 -0
- package/dist/toolsets/7zip.d.ts.map +1 -1
- package/dist/toolsets/7zip.js +39 -13
- package/dist/toolsets/7zip.js.map +1 -1
- package/dist/toolsets/custom.js +4 -2
- package/dist/toolsets/custom.js.map +1 -1
- package/dist/toolsets/icons.d.ts.map +1 -1
- package/dist/toolsets/icons.js +4 -1
- package/dist/toolsets/icons.js.map +1 -1
- package/dist/toolsets/linuxToolsMac.d.ts.map +1 -1
- package/dist/toolsets/linuxToolsMac.js +15 -5
- package/dist/toolsets/linuxToolsMac.js.map +1 -1
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +63 -2
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/electronGet.d.ts +16 -0
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +153 -10
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/installOrRebuild.d.ts +6 -0
- package/dist/util/installOrRebuild.d.ts.map +1 -1
- package/dist/util/installOrRebuild.js +47 -0
- package/dist/util/installOrRebuild.js.map +1 -1
- package/dist/util/packageMetadata.js +46 -21
- 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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/winPackager.d.ts +4 -3
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +22 -16
- package/dist/winPackager.js.map +1 -1
- package/package.json +10 -10
- package/scheme.json +63 -35
- package/templates/nsis/common.nsh +2 -2
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +68 -4
- package/templates/nsis/include/extractAppPackage.nsh +1 -1
- package/templates/nsis/include/installUtil.nsh +2 -2
- package/templates/nsis/include/installer.nsh +1 -1
- package/templates/nsis/installer.nsi +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macCodeSign.d.ts","sourceRoot":"","sources":["../../../src/codeSign/mac/macCodeSign.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EAAyG,MAAM,EAAkB,MAAM,cAAc,CAAA;AAC5J,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAW9C,eAAO,MAAM,wBAAwB,UAAyI,CAAA;AAE9K,MAAM,MAAM,QAAQ,GAChB,0BAA0B,GAC1B,wBAAwB,GACxB,qCAAqC,GACrC,mCAAmC,GACnC,eAAe,GACf,mBAAmB,G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gB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAe9H"}
|
|
@@ -42,7 +42,7 @@ export async function reportError(isMas, certificateTypes, qualifier, keychainFi
|
|
|
42
42
|
if (isAutoDiscoveryCodeSignIdentity()) {
|
|
43
43
|
logFields.reason += `cannot find valid "${certificateTypes.join(", ")}" identity${isMas ? "" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`}`;
|
|
44
44
|
}
|
|
45
|
-
logFields.reason += ", see https://electron.build/code-signing";
|
|
45
|
+
logFields.reason += ", see https://electron.build/docs/features/code-signing";
|
|
46
46
|
if (!isAutoDiscoveryCodeSignIdentity()) {
|
|
47
47
|
logFields.CSC_IDENTITY_AUTO_DISCOVERY = false;
|
|
48
48
|
}
|
|
@@ -143,15 +143,17 @@ export async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink
|
|
|
143
143
|
if (cscIKeyPassword != null) {
|
|
144
144
|
cscPasswords.push(cscIKeyPassword);
|
|
145
145
|
}
|
|
146
|
-
return await importCerts(keychainFile, certPaths, cscPasswords);
|
|
146
|
+
return await importCerts(keychainFile, certPaths, cscPasswords, keychainPassword);
|
|
147
147
|
}
|
|
148
|
-
async function importCerts(keychainFile, paths, keyPasswords) {
|
|
148
|
+
async function importCerts(keychainFile, paths, keyPasswords, keychainPassword) {
|
|
149
149
|
for (let i = 0; i < paths.length; i++) {
|
|
150
150
|
const password = keyPasswords[i] ?? "";
|
|
151
151
|
await exec("/usr/bin/security", ["import", paths[i], "-k", keychainFile, "-T", "/usr/bin/codesign", "-T", "/usr/bin/productbuild", "-P", password]);
|
|
152
152
|
// https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p
|
|
153
153
|
// https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996
|
|
154
|
-
|
|
154
|
+
// `-k` expects the keychain's own unlock password (as used by create-keychain/unlock-keychain above),
|
|
155
|
+
// not the imported item's password used by `security import -P`.
|
|
156
|
+
await exec("/usr/bin/security", ["set-key-partition-list", "-S", "apple-tool:,apple:", "-s", "-k", keychainPassword, keychainFile]);
|
|
155
157
|
}
|
|
156
158
|
return {
|
|
157
159
|
keychainFile,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macCodeSign.js","sourceRoot":"","sources":["../../../src/codeSign/mac/macCodeSign.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAU,yBAAyB,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAU,cAAc,EAAE,MAAM,cAAc,CAAA;AAE5J,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAA;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAA;AAEzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,2BAA2B,EAAE,yBAAyB,EAAE,sCAAsC,EAAE,oCAAoC,CAAC,CAAA;AAe9K,MAAM,UAAU,aAAa,CAAC,WAAW,GAAG,IAAI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G,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAA;IACnD,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AACjC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAkB,EAAE,SAAyB,EAAE,QAAwB;IAClG,IAAI,QAAQ,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;IAChD,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,IAAI,+BAA+B,EAAE,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC1B,KAAK,MAAM,MAAM,IAAI,wBAAwB,EAAE,CAAC;YAC9C,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC/B,CAAC;QACD,OAAO,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,MAAc;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,yBAAyB,CAAC,yBAAyB,MAAM,kFAAkF,CAAC,CAAA;IACxJ,CAAC;AACH,CAAC","sourcesContent":["import type { SignOptions } from \"@electron/osx-sign\"\nimport { sign as _sign } from \"@electron/osx-sign\"\nimport { copyFile, exec, Fields, InvalidConfigurationError, isEmptyOrSpaces, isPullRequest, log, Logger, retry, TmpDir, unlinkIfExists } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { createHash, randomBytes } from \"crypto\"\nimport { rename } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { tmpdir } from \"os\"\nimport * as path from \"path\"\nimport { getTempName } from \"temp-file\"\nimport { isAutoDiscoveryCodeSignIdentity, isCscForPullRequest, isTravis } from \"../../util/flags.js\"\nimport { importCertificate } from \"../codesign.js\"\nimport { cacheDirectoryOverrideAllowed } from \"../../util/electronGet.js\"\n\nexport const appleCertificatePrefixes = [\"Developer ID Application:\", \"Developer ID Installer:\", \"3rd Party Mac Developer Application:\", \"3rd Party Mac Developer Installer:\"]\n\nexport type CertType =\n | \"Developer ID Application\"\n | \"Developer ID Installer\"\n | \"3rd Party Mac Developer Application\"\n | \"3rd Party Mac Developer Installer\"\n | \"Mac Developer\"\n | \"Apple Development\"\n | \"Apple Distribution\"\n\nexport interface CodeSigningInfo {\n keychainFile?: string | null\n}\n\nexport function isSignAllowed(isPrintWarn = true): boolean {\n if (process.platform !== \"darwin\") {\n if (isPrintWarn) {\n log.warn({ reason: \"supported only on macOS\" }, \"skipped macOS application code signing\")\n }\n return false\n }\n\n if (isPullRequest()) {\n const buildForPrWarning =\n \"There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)\" +\n \"\\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.\"\n\n if (isCscForPullRequest()) {\n if (isPrintWarn) {\n log.warn(buildForPrWarning)\n }\n } else {\n if (isPrintWarn) {\n // https://github.com/electron-userland/electron-builder/issues/1524\n log.warn(\n \"Current build is a part of pull request, code signing will be skipped.\" + \"\\nSet env CSC_FOR_PULL_REQUEST to true to force code signing.\" + `\\n${buildForPrWarning}`\n )\n }\n return false\n }\n }\n\n return true\n}\n\nexport async function reportError(isMas: boolean, certificateTypes: CertType[], qualifier: string | Nullish, keychainFile: string | Nullish, isForceCodeSigning: boolean) {\n const logFields: Fields = {}\n if (qualifier == null) {\n logFields.reason = \"\"\n if (isAutoDiscoveryCodeSignIdentity()) {\n logFields.reason += `cannot find valid \"${certificateTypes.join(\", \")}\" identity${\n isMas ? \"\" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`\n }`\n }\n logFields.reason += \", see https://electron.build/code-signing\"\n if (!isAutoDiscoveryCodeSignIdentity()) {\n logFields.CSC_IDENTITY_AUTO_DISCOVERY = false\n }\n } else {\n logFields.reason = \"Identity name is specified, but no valid identity with this name in the keychain\"\n logFields.identity = qualifier\n }\n\n const args = [\"find-identity\"]\n if (keychainFile != null) {\n args.push(keychainFile)\n }\n\n if (qualifier != null || isAutoDiscoveryCodeSignIdentity()) {\n logFields.allIdentities = (await exec(\"/usr/bin/security\", args))\n .trim()\n .split(\"\\n\")\n .filter(it => !(it.includes(\"Policy: X.509 Basic\") || it.includes(\"Matching identities\")))\n .join(\"\\n\")\n }\n\n const skipMessage = \"skipped macOS application code signing\"\n if (isMas || isForceCodeSigning) {\n throw new Error(Logger.createMessage(skipMessage, logFields, \"error\", it => it))\n } else {\n log.warn(logFields, skipMessage)\n }\n}\n\n// \"Note that filename will not be searched to resolve the signing identity's certificate chain unless it is also on the user's keychain search list.\"\n// but \"security list-keychains\" doesn't support add - we should 1) get current list 2) set new list - it is very bad http://stackoverflow.com/questions/10538942/add-a-keychain-to-search-list\n// \"overly complicated and introduces a race condition.\"\n// https://github.com/electron-userland/electron-builder/issues/398\nconst bundledCertKeychainAdded = new Lazy<void>(async () => {\n // copy to temp and then atomic rename to final path\n const cacheDir = await cacheDirectoryOverrideAllowed.value\n const tmpKeychainPath = path.join(cacheDir, getTempName(\"electron-builder-root-certs\"))\n const keychainPath = path.join(cacheDir, \"electron-builder-root-certs.keychain\")\n const results = await Promise.all<any>([\n listUserKeychains(),\n copyFile(path.join(import.meta.dirname, \"..\", \"..\", \"..\", \"certs\", \"root_certs.keychain\"), tmpKeychainPath).then(() => rename(tmpKeychainPath, keychainPath)),\n ])\n const list = results[0]\n if (!list.includes(keychainPath)) {\n await exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\", \"-s\", keychainPath].concat(list))\n }\n})\n\nfunction listUserKeychains(): Promise<Array<string>> {\n return exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\"]).then(it =>\n it\n .split(\"\\n\")\n .map(it => {\n const r = it.trim()\n return r.substring(1, r.length - 1)\n })\n .filter(it => it.length > 0)\n )\n}\n\nexport interface CreateKeychainOptions {\n tmpDir: TmpDir\n cscLink: string\n cscKeyPassword: string\n cscILink?: string | null\n cscIKeyPassword?: string | null\n currentDir: string\n}\n\nexport function removeKeychain(keychainFile: string, printWarn = true): Promise<any> {\n return exec(\"/usr/bin/security\", [\"delete-keychain\", keychainFile]).catch((e: any) => {\n if (printWarn) {\n log.warn({ file: keychainFile, error: e.stack || e }, \"cannot delete keychain\")\n }\n return unlinkIfExists(keychainFile)\n })\n}\n\nexport async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }: CreateKeychainOptions): Promise<CodeSigningInfo> {\n // travis has correct AppleWWDRCA cert\n if (!isTravis()) {\n await bundledCertKeychainAdded.value\n }\n\n // https://github.com/electron-userland/electron-builder/issues/3685\n // use constant file\n const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || tmpdir(), `${createHash(\"sha256\").update(currentDir).update(\"app-builder\").digest(\"hex\")}.keychain`)\n // noinspection JSUnusedLocalSymbols\n\n await removeKeychain(keychainFile, false).catch(_ => {\n /* ignore*/\n })\n\n const certLinks = [cscLink]\n if (cscILink != null) {\n certLinks.push(cscILink)\n }\n\n const certPaths = new Array(certLinks.length)\n const keychainPassword = randomBytes(32).toString(\"base64\")\n const securityCommands = [\n [\"create-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"unlock-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"set-keychain-settings\", keychainFile],\n ]\n\n // https://stackoverflow.com/questions/42484678/codesign-keychain-gets-ignored\n // https://github.com/electron-userland/electron-builder/issues/1457\n const list = await listUserKeychains()\n if (!list.includes(keychainFile)) {\n securityCommands.push([\"list-keychains\", \"-d\", \"user\", \"-s\", keychainFile].concat(list))\n }\n\n // Import all certs in parallel, then run security commands sequentially.\n await Promise.all(certLinks.map((link, i) => importCertificate(link, tmpDir, currentDir).then(it => (certPaths[i] = it))))\n for (const cmd of securityCommands) {\n await exec(\"/usr/bin/security\", cmd)\n }\n const cscPasswords: Array<string> = [cscKeyPassword]\n if (cscIKeyPassword != null) {\n cscPasswords.push(cscIKeyPassword)\n }\n return await importCerts(keychainFile, certPaths, cscPasswords)\n}\n\nasync function importCerts(keychainFile: string, paths: Array<string>, keyPasswords: Array<string>): Promise<CodeSigningInfo> {\n for (let i = 0; i < paths.length; i++) {\n const password = keyPasswords[i] ?? \"\"\n await exec(\"/usr/bin/security\", [\"import\", paths[i], \"-k\", keychainFile, \"-T\", \"/usr/bin/codesign\", \"-T\", \"/usr/bin/productbuild\", \"-P\", password])\n\n // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p\n // https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996\n await exec(\"/usr/bin/security\", [\"set-key-partition-list\", \"-S\", \"apple-tool:,apple:\", \"-s\", \"-k\", password, keychainFile])\n }\n\n return {\n keychainFile,\n }\n}\n\nexport async function sign(opts: SignOptions): Promise<void> {\n return retry(() => _sign(opts), {\n retries: 3,\n interval: 5000,\n backoff: 5000,\n })\n}\n\nexport let findIdentityRawResult: Promise<Array<string>> | null = null\n\n// Discovery of untrusted self-signed identities is OFF in production, and there is intentionally NO env var\n// or build-config option to enable it: an untrusted identity must never be silently accepted in a real\n// build. This in-process flag exists solely as a seam for electron-builder's own signing tests, which\n// provision an ephemeral self-signed cert and flip it via setAllowUntrustedSelfSignedIdentityForTesting().\nlet allowUntrustedSelfSignedIdentity = false\n\n/** @internal Test-only. Enables discovery of untrusted self-signed code-signing identities. Never use in production. */\nexport function setAllowUntrustedSelfSignedIdentityForTesting(value: boolean): void {\n allowUntrustedSelfSignedIdentity = value\n}\n\nasync function getValidIdentities(keychain?: string | null): Promise<Array<string>> {\n function addKeychain(args: Array<string>) {\n if (keychain != null) {\n args.push(keychain)\n }\n return args\n }\n\n let result = findIdentityRawResult\n if (result == null || keychain != null) {\n // https://github.com/electron-userland/electron-builder/issues/481\n // https://github.com/electron-userland/electron-builder/issues/535\n const commands = [\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\"])).then(it =>\n it\n .trim()\n .split(\"\\n\")\n .filter(it => {\n for (const prefix of appleCertificatePrefixes) {\n if (it.includes(prefix)) {\n return true\n }\n }\n return false\n })\n ),\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\", \"-p\", \"codesigning\"])).then(it => it.trim().split(\"\\n\")),\n ]\n\n // Test-only seam: also accept untrusted self-signed identities. `find-identity` without `-v` lists them;\n // trusted identities discovered above still take precedence (they appear first and dupes are de-duped).\n if (allowUntrustedSelfSignedIdentity) {\n commands.push(exec(\"/usr/bin/security\", addKeychain([\"find-identity\"])).then(it => it.trim().split(\"\\n\")))\n }\n\n result = Promise.all<Array<string>>(commands).then(it => {\n const array = it\n .flat()\n .filter(\n it =>\n !it.includes(\"(Missing required extension)\") &&\n !it.includes(\"identities found\") &&\n !it.includes(\"Policy: X.509 Basic\") &&\n !it.includes(\"Matching identities\") &&\n !it.includes(\"Valid identities only\") &&\n !it.includes(\"iPhone \") &&\n !it.includes(\"com.apple.idms.appleid.prd.\")\n )\n // remove 1)\n .map(it => it.substring(it.indexOf(\")\") + 1).trim())\n return Array.from(new Set(array))\n })\n\n if (keychain == null) {\n findIdentityRawResult = result\n }\n }\n return result\n}\n\nasync function _findIdentity(type: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n // https://github.com/electron-userland/electron-builder/issues/484\n //noinspection SpellCheckingInspection\n const lines = await getValidIdentities(keychain)\n const namePrefix = `${type}:`\n for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(namePrefix)) {\n return parseIdentity(line)\n }\n }\n\n if (type === \"Developer ID Application\") {\n // find non-Apple certificate\n // https://github.com/electron-userland/electron-builder/issues/458\n l: for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(\"Mac Developer:\")) {\n continue\n }\n\n for (const prefix of appleCertificatePrefixes) {\n if (line.includes(prefix)) {\n continue l\n }\n }\n\n return parseIdentity(line)\n }\n }\n return null\n}\n\n// @electron/osx-sign v2 no longer exposes its `Identity` class via the package's public exports, so we own this lightweight equivalent.\nexport class Identity {\n constructor(\n readonly name: string,\n readonly hash?: string\n ) {}\n}\n\nfunction parseIdentity(line: string): Identity {\n const firstQuoteIndex = line.indexOf('\"')\n const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('\"'))\n const hash = line.substring(0, firstQuoteIndex - 1)\n return new Identity(name, hash)\n}\n\nexport function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n let identity = qualifier || process.env.CSC_NAME\n if (isEmptyOrSpaces(identity)) {\n if (isAutoDiscoveryCodeSignIdentity()) {\n return _findIdentity(certType, null, keychain)\n } else {\n return Promise.resolve(null)\n }\n } else {\n identity = identity.trim()\n for (const prefix of appleCertificatePrefixes) {\n checkPrefix(identity, prefix)\n }\n return _findIdentity(certType, identity, keychain)\n }\n}\n\nfunction checkPrefix(name: string, prefix: string) {\n if (name.startsWith(prefix)) {\n throw new InvalidConfigurationError(`Please remove prefix \"${prefix}\" from the specified name — appropriate certificate will be chosen automatically`)\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"macCodeSign.js","sourceRoot":"","sources":["../../../src/codeSign/mac/macCodeSign.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,oBAAoB,CAA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Ae,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,IAAI,+BAA+B,EAAE,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;QAChD,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,CAAC;IACH,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC1B,KAAK,MAAM,MAAM,IAAI,wBAAwB,EAAE,CAAC;YAC9C,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC/B,CAAC;QACD,OAAO,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,MAAc;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,yBAAyB,CAAC,yBAAyB,MAAM,kFAAkF,CAAC,CAAA;IACxJ,CAAC;AACH,CAAC","sourcesContent":["import type { SignOptions } from \"@electron/osx-sign\"\nimport { sign as _sign } from \"@electron/osx-sign\"\nimport { copyFile, exec, Fields, InvalidConfigurationError, isEmptyOrSpaces, isPullRequest, log, Logger, retry, TmpDir, unlinkIfExists } from \"builder-util\"\nimport { Nullish } from \"builder-util-runtime\"\nimport { createHash, randomBytes } from \"crypto\"\nimport { rename } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport { tmpdir } from \"os\"\nimport * as path from \"path\"\nimport { getTempName } from \"temp-file\"\nimport { isAutoDiscoveryCodeSignIdentity, isCscForPullRequest, isTravis } from \"../../util/flags.js\"\nimport { importCertificate } from \"../codesign.js\"\nimport { cacheDirectoryOverrideAllowed } from \"../../util/electronGet.js\"\n\nexport const appleCertificatePrefixes = [\"Developer ID Application:\", \"Developer ID Installer:\", \"3rd Party Mac Developer Application:\", \"3rd Party Mac Developer Installer:\"]\n\nexport type CertType =\n | \"Developer ID Application\"\n | \"Developer ID Installer\"\n | \"3rd Party Mac Developer Application\"\n | \"3rd Party Mac Developer Installer\"\n | \"Mac Developer\"\n | \"Apple Development\"\n | \"Apple Distribution\"\n\nexport interface CodeSigningInfo {\n keychainFile?: string | null\n}\n\nexport function isSignAllowed(isPrintWarn = true): boolean {\n if (process.platform !== \"darwin\") {\n if (isPrintWarn) {\n log.warn({ reason: \"supported only on macOS\" }, \"skipped macOS application code signing\")\n }\n return false\n }\n\n if (isPullRequest()) {\n const buildForPrWarning =\n \"There are serious security concerns with CSC_FOR_PULL_REQUEST=true (see the CircleCI documentation (https://circleci.com/docs/1.0/fork-pr-builds/) for details)\" +\n \"\\nIf you have SSH keys, sensitive env vars or AWS credentials stored in your project settings and untrusted forks can make pull requests against your repo, then this option isn't for you.\"\n\n if (isCscForPullRequest()) {\n if (isPrintWarn) {\n log.warn(buildForPrWarning)\n }\n } else {\n if (isPrintWarn) {\n // https://github.com/electron-userland/electron-builder/issues/1524\n log.warn(\n \"Current build is a part of pull request, code signing will be skipped.\" + \"\\nSet env CSC_FOR_PULL_REQUEST to true to force code signing.\" + `\\n${buildForPrWarning}`\n )\n }\n return false\n }\n }\n\n return true\n}\n\nexport async function reportError(isMas: boolean, certificateTypes: CertType[], qualifier: string | Nullish, keychainFile: string | Nullish, isForceCodeSigning: boolean) {\n const logFields: Fields = {}\n if (qualifier == null) {\n logFields.reason = \"\"\n if (isAutoDiscoveryCodeSignIdentity()) {\n logFields.reason += `cannot find valid \"${certificateTypes.join(\", \")}\" identity${\n isMas ? \"\" : ` or custom non-Apple code signing certificate, it could cause some undefined behaviour, e.g. macOS localized description not visible`\n }`\n }\n logFields.reason += \", see https://electron.build/docs/features/code-signing\"\n if (!isAutoDiscoveryCodeSignIdentity()) {\n logFields.CSC_IDENTITY_AUTO_DISCOVERY = false\n }\n } else {\n logFields.reason = \"Identity name is specified, but no valid identity with this name in the keychain\"\n logFields.identity = qualifier\n }\n\n const args = [\"find-identity\"]\n if (keychainFile != null) {\n args.push(keychainFile)\n }\n\n if (qualifier != null || isAutoDiscoveryCodeSignIdentity()) {\n logFields.allIdentities = (await exec(\"/usr/bin/security\", args))\n .trim()\n .split(\"\\n\")\n .filter(it => !(it.includes(\"Policy: X.509 Basic\") || it.includes(\"Matching identities\")))\n .join(\"\\n\")\n }\n\n const skipMessage = \"skipped macOS application code signing\"\n if (isMas || isForceCodeSigning) {\n throw new Error(Logger.createMessage(skipMessage, logFields, \"error\", it => it))\n } else {\n log.warn(logFields, skipMessage)\n }\n}\n\n// \"Note that filename will not be searched to resolve the signing identity's certificate chain unless it is also on the user's keychain search list.\"\n// but \"security list-keychains\" doesn't support add - we should 1) get current list 2) set new list - it is very bad http://stackoverflow.com/questions/10538942/add-a-keychain-to-search-list\n// \"overly complicated and introduces a race condition.\"\n// https://github.com/electron-userland/electron-builder/issues/398\nconst bundledCertKeychainAdded = new Lazy<void>(async () => {\n // copy to temp and then atomic rename to final path\n const cacheDir = await cacheDirectoryOverrideAllowed.value\n const tmpKeychainPath = path.join(cacheDir, getTempName(\"electron-builder-root-certs\"))\n const keychainPath = path.join(cacheDir, \"electron-builder-root-certs.keychain\")\n const results = await Promise.all<any>([\n listUserKeychains(),\n copyFile(path.join(import.meta.dirname, \"..\", \"..\", \"..\", \"certs\", \"root_certs.keychain\"), tmpKeychainPath).then(() => rename(tmpKeychainPath, keychainPath)),\n ])\n const list = results[0]\n if (!list.includes(keychainPath)) {\n await exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\", \"-s\", keychainPath].concat(list))\n }\n})\n\nfunction listUserKeychains(): Promise<Array<string>> {\n return exec(\"/usr/bin/security\", [\"list-keychains\", \"-d\", \"user\"]).then(it =>\n it\n .split(\"\\n\")\n .map(it => {\n const r = it.trim()\n return r.substring(1, r.length - 1)\n })\n .filter(it => it.length > 0)\n )\n}\n\nexport interface CreateKeychainOptions {\n tmpDir: TmpDir\n cscLink: string\n cscKeyPassword: string\n cscILink?: string | null\n cscIKeyPassword?: string | null\n currentDir: string\n}\n\nexport function removeKeychain(keychainFile: string, printWarn = true): Promise<any> {\n return exec(\"/usr/bin/security\", [\"delete-keychain\", keychainFile]).catch((e: any) => {\n if (printWarn) {\n log.warn({ file: keychainFile, error: e.stack || e }, \"cannot delete keychain\")\n }\n return unlinkIfExists(keychainFile)\n })\n}\n\nexport async function createKeychain({ tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword, currentDir }: CreateKeychainOptions): Promise<CodeSigningInfo> {\n // travis has correct AppleWWDRCA cert\n if (!isTravis()) {\n await bundledCertKeychainAdded.value\n }\n\n // https://github.com/electron-userland/electron-builder/issues/3685\n // use constant file\n const keychainFile = path.join(process.env.APP_BUILDER_TMP_DIR || tmpdir(), `${createHash(\"sha256\").update(currentDir).update(\"app-builder\").digest(\"hex\")}.keychain`)\n // noinspection JSUnusedLocalSymbols\n\n await removeKeychain(keychainFile, false).catch(_ => {\n /* ignore*/\n })\n\n const certLinks = [cscLink]\n if (cscILink != null) {\n certLinks.push(cscILink)\n }\n\n const certPaths = new Array(certLinks.length)\n const keychainPassword = randomBytes(32).toString(\"base64\")\n const securityCommands = [\n [\"create-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"unlock-keychain\", \"-p\", keychainPassword, keychainFile],\n [\"set-keychain-settings\", keychainFile],\n ]\n\n // https://stackoverflow.com/questions/42484678/codesign-keychain-gets-ignored\n // https://github.com/electron-userland/electron-builder/issues/1457\n const list = await listUserKeychains()\n if (!list.includes(keychainFile)) {\n securityCommands.push([\"list-keychains\", \"-d\", \"user\", \"-s\", keychainFile].concat(list))\n }\n\n // Import all certs in parallel, then run security commands sequentially.\n await Promise.all(certLinks.map((link, i) => importCertificate(link, tmpDir, currentDir).then(it => (certPaths[i] = it))))\n for (const cmd of securityCommands) {\n await exec(\"/usr/bin/security\", cmd)\n }\n const cscPasswords: Array<string> = [cscKeyPassword]\n if (cscIKeyPassword != null) {\n cscPasswords.push(cscIKeyPassword)\n }\n return await importCerts(keychainFile, certPaths, cscPasswords, keychainPassword)\n}\n\nasync function importCerts(keychainFile: string, paths: Array<string>, keyPasswords: Array<string>, keychainPassword: string): Promise<CodeSigningInfo> {\n for (let i = 0; i < paths.length; i++) {\n const password = keyPasswords[i] ?? \"\"\n await exec(\"/usr/bin/security\", [\"import\", paths[i], \"-k\", keychainFile, \"-T\", \"/usr/bin/codesign\", \"-T\", \"/usr/bin/productbuild\", \"-P\", password])\n\n // https://stackoverflow.com/questions/39868578/security-codesign-in-sierra-keychain-ignores-access-control-settings-and-ui-p\n // https://github.com/electron-userland/electron-packager/issues/701#issuecomment-322315996\n // `-k` expects the keychain's own unlock password (as used by create-keychain/unlock-keychain above),\n // not the imported item's password used by `security import -P`.\n await exec(\"/usr/bin/security\", [\"set-key-partition-list\", \"-S\", \"apple-tool:,apple:\", \"-s\", \"-k\", keychainPassword, keychainFile])\n }\n\n return {\n keychainFile,\n }\n}\n\nexport async function sign(opts: SignOptions): Promise<void> {\n return retry(() => _sign(opts), {\n retries: 3,\n interval: 5000,\n backoff: 5000,\n })\n}\n\nexport let findIdentityRawResult: Promise<Array<string>> | null = null\n\n// Discovery of untrusted self-signed identities is OFF in production, and there is intentionally NO env var\n// or build-config option to enable it: an untrusted identity must never be silently accepted in a real\n// build. This in-process flag exists solely as a seam for electron-builder's own signing tests, which\n// provision an ephemeral self-signed cert and flip it via setAllowUntrustedSelfSignedIdentityForTesting().\nlet allowUntrustedSelfSignedIdentity = false\n\n/** @internal Test-only. Enables discovery of untrusted self-signed code-signing identities. Never use in production. */\nexport function setAllowUntrustedSelfSignedIdentityForTesting(value: boolean): void {\n allowUntrustedSelfSignedIdentity = value\n}\n\nasync function getValidIdentities(keychain?: string | null): Promise<Array<string>> {\n function addKeychain(args: Array<string>) {\n if (keychain != null) {\n args.push(keychain)\n }\n return args\n }\n\n let result = findIdentityRawResult\n if (result == null || keychain != null) {\n // https://github.com/electron-userland/electron-builder/issues/481\n // https://github.com/electron-userland/electron-builder/issues/535\n const commands = [\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\"])).then(it =>\n it\n .trim()\n .split(\"\\n\")\n .filter(it => {\n for (const prefix of appleCertificatePrefixes) {\n if (it.includes(prefix)) {\n return true\n }\n }\n return false\n })\n ),\n exec(\"/usr/bin/security\", addKeychain([\"find-identity\", \"-v\", \"-p\", \"codesigning\"])).then(it => it.trim().split(\"\\n\")),\n ]\n\n // Test-only seam: also accept untrusted self-signed identities. `find-identity` without `-v` lists them;\n // trusted identities discovered above still take precedence (they appear first and dupes are de-duped).\n if (allowUntrustedSelfSignedIdentity) {\n commands.push(exec(\"/usr/bin/security\", addKeychain([\"find-identity\"])).then(it => it.trim().split(\"\\n\")))\n }\n\n result = Promise.all<Array<string>>(commands).then(it => {\n const array = it\n .flat()\n .filter(\n it =>\n !it.includes(\"(Missing required extension)\") &&\n !it.includes(\"identities found\") &&\n !it.includes(\"Policy: X.509 Basic\") &&\n !it.includes(\"Matching identities\") &&\n !it.includes(\"Valid identities only\") &&\n !it.includes(\"iPhone \") &&\n !it.includes(\"com.apple.idms.appleid.prd.\")\n )\n // remove 1)\n .map(it => it.substring(it.indexOf(\")\") + 1).trim())\n return Array.from(new Set(array))\n })\n\n if (keychain == null) {\n findIdentityRawResult = result\n }\n }\n return result\n}\n\nasync function _findIdentity(type: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n // https://github.com/electron-userland/electron-builder/issues/484\n //noinspection SpellCheckingInspection\n const lines = await getValidIdentities(keychain)\n const namePrefix = `${type}:`\n for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(namePrefix)) {\n return parseIdentity(line)\n }\n }\n\n if (type === \"Developer ID Application\") {\n // find non-Apple certificate\n // https://github.com/electron-userland/electron-builder/issues/458\n l: for (const line of lines) {\n if (qualifier != null && !line.includes(qualifier)) {\n continue\n }\n\n if (line.includes(\"Mac Developer:\")) {\n continue\n }\n\n for (const prefix of appleCertificatePrefixes) {\n if (line.includes(prefix)) {\n continue l\n }\n }\n\n return parseIdentity(line)\n }\n }\n return null\n}\n\n// @electron/osx-sign v2 no longer exposes its `Identity` class via the package's public exports, so we own this lightweight equivalent.\nexport class Identity {\n constructor(\n readonly name: string,\n readonly hash?: string\n ) {}\n}\n\nfunction parseIdentity(line: string): Identity {\n const firstQuoteIndex = line.indexOf('\"')\n const name = line.substring(firstQuoteIndex + 1, line.lastIndexOf('\"'))\n const hash = line.substring(0, firstQuoteIndex - 1)\n return new Identity(name, hash)\n}\n\nexport function findIdentity(certType: CertType, qualifier?: string | null, keychain?: string | null): Promise<Identity | null> {\n let identity = qualifier || process.env.CSC_NAME\n if (isEmptyOrSpaces(identity)) {\n if (isAutoDiscoveryCodeSignIdentity()) {\n return _findIdentity(certType, null, keychain)\n } else {\n return Promise.resolve(null)\n }\n } else {\n identity = identity.trim()\n for (const prefix of appleCertificatePrefixes) {\n checkPrefix(identity, prefix)\n }\n return _findIdentity(certType, identity, keychain)\n }\n}\n\nfunction checkPrefix(name: string, prefix: string) {\n if (name.startsWith(prefix)) {\n throw new InvalidConfigurationError(`Please remove prefix \"${prefix}\" from the specified name — appropriate certificate will be chosen automatically`)\n }\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subset of {@link SigningResult} a sign manager's single sign attempt can produce
|
|
3
|
+
* (e.g. Windows `SignManager.signFile`). Failures are always thrown, never returned:
|
|
4
|
+
* - `signed` — the configured signing tooling signed the file/app itself
|
|
5
|
+
* - `signed:custom` — a custom `sign` hook did the signing
|
|
6
|
+
* - `skipped:no-certificate` — nothing to sign with (no certificate configured / no signing identity found, and no custom `sign` hook)
|
|
7
|
+
*/
|
|
8
|
+
export type SignFileResult = "signed" | "signed:custom" | "skipped:no-certificate";
|
|
9
|
+
/**
|
|
10
|
+
* Result of a signing operation, unified across the platform packagers' signing logic
|
|
11
|
+
* ({@link SignFileResult} extended with the skip reasons that are decided before any signing
|
|
12
|
+
* tooling is invoked). Failures are always thrown, never returned:
|
|
13
|
+
* - `skipped:filtered` — the file does not match the signing filters (e.g. the Windows `signExts` filter)
|
|
14
|
+
* - `skipped:disabled` — signing is explicitly disabled (`win.sign: false`/`null`, or macOS `sign`/`sign.identity` set to `null`)
|
|
15
|
+
* - `skipped:unsupported` — signing is not possible in this build environment (e.g. macOS signing on a non-mac host,
|
|
16
|
+
* or the pull-request CI guard) or is not implemented by this platform packager (the base `PlatformPackager.signApp`, e.g. Linux)
|
|
17
|
+
*/
|
|
18
|
+
export type SigningResult = SignFileResult | "skipped:filtered" | "skipped:disabled" | "skipped:unsupported";
|
|
19
|
+
export declare function isSignResultSigned(result: SigningResult): result is "signed" | "signed:custom";
|
|
20
|
+
/**
|
|
21
|
+
* Folds per-file sign results into the single result `signApp` reports: any signed result wins
|
|
22
|
+
* (the `afterSign` hook must fire when at least one file was actually signed); otherwise the first
|
|
23
|
+
* skip reason is returned. An empty set means no file matched the signing filters at all.
|
|
24
|
+
*/
|
|
25
|
+
export declare function combineSignResults(results: Array<SigningResult>): SigningResult;
|
|
26
|
+
//# sourceMappingURL=signResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signResult.d.ts","sourceRoot":"","sources":["../../src/codeSign/signResult.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,eAAe,GAAG,wBAAwB,CAAA;AAElF;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,qBAAqB,CAAA;AAE5G,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,IAAI,QAAQ,GAAG,eAAe,CAE9F;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,aAAa,CAE/E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function isSignResultSigned(result) {
|
|
2
|
+
return result === "signed" || result === "signed:custom";
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Folds per-file sign results into the single result `signApp` reports: any signed result wins
|
|
6
|
+
* (the `afterSign` hook must fire when at least one file was actually signed); otherwise the first
|
|
7
|
+
* skip reason is returned. An empty set means no file matched the signing filters at all.
|
|
8
|
+
*/
|
|
9
|
+
export function combineSignResults(results) {
|
|
10
|
+
return results.find(isSignResultSigned) ?? results[0] ?? "skipped:filtered";
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=signResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signResult.js","sourceRoot":"","sources":["../../src/codeSign/signResult.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,kBAAkB,CAAC,MAAqB;IACtD,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,eAAe,CAAA;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA6B;IAC9D,OAAO,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAA;AAC7E,CAAC","sourcesContent":["/**\n * The subset of {@link SigningResult} a sign manager's single sign attempt can produce\n * (e.g. Windows `SignManager.signFile`). Failures are always thrown, never returned:\n * - `signed` — the configured signing tooling signed the file/app itself\n * - `signed:custom` — a custom `sign` hook did the signing\n * - `skipped:no-certificate` — nothing to sign with (no certificate configured / no signing identity found, and no custom `sign` hook)\n */\nexport type SignFileResult = \"signed\" | \"signed:custom\" | \"skipped:no-certificate\"\n\n/**\n * Result of a signing operation, unified across the platform packagers' signing logic\n * ({@link SignFileResult} extended with the skip reasons that are decided before any signing\n * tooling is invoked). Failures are always thrown, never returned:\n * - `skipped:filtered` — the file does not match the signing filters (e.g. the Windows `signExts` filter)\n * - `skipped:disabled` — signing is explicitly disabled (`win.sign: false`/`null`, or macOS `sign`/`sign.identity` set to `null`)\n * - `skipped:unsupported` — signing is not possible in this build environment (e.g. macOS signing on a non-mac host,\n * or the pull-request CI guard) or is not implemented by this platform packager (the base `PlatformPackager.signApp`, e.g. Linux)\n */\nexport type SigningResult = SignFileResult | \"skipped:filtered\" | \"skipped:disabled\" | \"skipped:unsupported\"\n\nexport function isSignResultSigned(result: SigningResult): result is \"signed\" | \"signed:custom\" {\n return result === \"signed\" || result === \"signed:custom\"\n}\n\n/**\n * Folds per-file sign results into the single result `signApp` reports: any signed result wins\n * (the `afterSign` hook must fire when at least one file was actually signed); otherwise the first\n * skip reason is returned. An empty set means no file matched the signing filters at all.\n */\nexport function combineSignResults(results: Array<SigningResult>): SigningResult {\n return results.find(isSignResultSigned) ?? results[0] ?? \"skipped:filtered\"\n}\n"]}
|
|
@@ -5,12 +5,13 @@ import { WindowsConfiguration } from "../../options/winOptions.js";
|
|
|
5
5
|
import type { WinPackager } from "../../winPackager.js";
|
|
6
6
|
import { CertificateFromStoreInfo, FileCodeSigningInfo } from "./signtoolBaseSignManager.js";
|
|
7
7
|
import { WindowsSignOptions } from "./windowsCodeSign.js";
|
|
8
|
+
import { SignFileResult } from "../signResult.js";
|
|
8
9
|
export interface SignManager {
|
|
9
10
|
readonly computedPublisherName: Lazy<Array<string> | null>;
|
|
10
11
|
readonly cscInfo: MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>;
|
|
11
12
|
computePublisherName(target: Target, publisherName: string | null): Promise<string>;
|
|
12
13
|
initialize(): Promise<void>;
|
|
13
|
-
signFile(options: WindowsSignOptions): Promise<
|
|
14
|
+
signFile(options: WindowsSignOptions): Promise<SignFileResult>;
|
|
14
15
|
}
|
|
15
16
|
export declare function createSignManager(packager: WinPackager): SignManager;
|
|
16
17
|
//# sourceMappingURL=signManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signManager.d.ts","sourceRoot":"","sources":["../../../src/codeSign/win/signManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAsC,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACtG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAuB,MAAM,8BAA8B,CAAA;AAEjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"signManager.d.ts","sourceRoot":"","sources":["../../../src/codeSign/win/signManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAsC,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AACtG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAuB,MAAM,8BAA8B,CAAA;AAEjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;IAC1D,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,oBAAoB,EAAE,mBAAmB,GAAG,wBAAwB,GAAG,IAAI,CAAC,CAAA;IACvG,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnF,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;CAC/D;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,GAAG,WAAW,CAYpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signManager.js","sourceRoot":"","sources":["../../../src/codeSign/win/signManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kCAAkC,EAAwB,MAAM,6BAA6B,CAAA;AAEtG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAiD,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AACjH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"signManager.js","sourceRoot":"","sources":["../../../src/codeSign/win/signManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kCAAkC,EAAwB,MAAM,6BAA6B,CAAA;AAEtG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAiD,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AACjH,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAYtE,MAAM,UAAU,iBAAiB,CAAC,QAAqB;IACrD,QAAQ,kCAAkC,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC;QAC3E,KAAK,OAAO;YACV,OAAO,IAAI,uBAAuB,CAAC,QAAQ,CAAC,CAAA;QAC9C,KAAK,KAAK;YACR,OAAO,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAA;QACrC,KAAK,QAAQ;YACX,OAAO,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAAA;QACxC,KAAK,UAAU,CAAC;QAChB;YACE,OAAO,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAA;IAC5C,CAAC;AACH,CAAC","sourcesContent":["import { MemoLazy } from \"builder-util-runtime\"\nimport { Lazy } from \"lazy-val\"\nimport { Target } from \"../../core.js\"\nimport { resolveWindowsSigningConfiguration, WindowsConfiguration } from \"../../options/winOptions.js\"\nimport type { WinPackager } from \"../../winPackager.js\"\nimport { HsmSignManager } from \"./hsmSignManager.js\"\nimport { Pkcs11SignManager } from \"./pkcs11SignManager.js\"\nimport { CertificateFromStoreInfo, FileCodeSigningInfo, SigntoolSignManager } from \"./signtoolBaseSignManager.js\"\nimport { WindowsSignAzureManager } from \"./windowsSignAzureManager.js\"\nimport { WindowsSignOptions } from \"./windowsCodeSign.js\"\nimport { SignFileResult } from \"../signResult.js\"\n\nexport interface SignManager {\n readonly computedPublisherName: Lazy<Array<string> | null>\n readonly cscInfo: MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>\n computePublisherName(target: Target, publisherName: string | null): Promise<string>\n initialize(): Promise<void>\n signFile(options: WindowsSignOptions): Promise<SignFileResult>\n}\n\nexport function createSignManager(packager: WinPackager): SignManager {\n switch (resolveWindowsSigningConfiguration(packager.platformOptions)?.type) {\n case \"azure\":\n return new WindowsSignAzureManager(packager)\n case \"hsm\":\n return new HsmSignManager(packager)\n case \"pkcs11\":\n return new Pkcs11SignManager(packager)\n case \"signtool\":\n default:\n return new SigntoolSignManager(packager)\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { VmManager } from "../../vm/vm.js";
|
|
|
7
7
|
import type { WinPackager } from "../../winPackager.js";
|
|
8
8
|
import type { SignManager } from "./signManager.js";
|
|
9
9
|
import { WindowsSignOptions } from "./windowsCodeSign.js";
|
|
10
|
+
import { SignFileResult } from "../signResult.js";
|
|
10
11
|
export type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise<any>;
|
|
11
12
|
export interface WindowsSignToolOptions extends WindowsSignOptions {
|
|
12
13
|
readonly name: string;
|
|
@@ -37,12 +38,35 @@ export interface CertificateFromStoreInfo {
|
|
|
37
38
|
}
|
|
38
39
|
/** Extracts the non-Azure signing config from WindowsConfiguration, or null for Azure/unset/disabled. */
|
|
39
40
|
export declare function getSigntoolFamilyConfig(config: WindowsConfiguration): WindowsSigntoolFamilyConfig | null;
|
|
41
|
+
/**
|
|
42
|
+
* Matches configured publisher names against a certificate subject using the same semantics as
|
|
43
|
+
* electron-updater's update signature verifier (windowsExecutableCodeSignatureVerifier): a name that
|
|
44
|
+
* parses as a Distinguished Name (DN) must match every RDN it specifies against the certificate
|
|
45
|
+
* subject (extra subject RDNs are ignored); otherwise it is compared strictly against the
|
|
46
|
+
* certificate's Common Name (CN). Passes when ANY configured name matches — multiple names are
|
|
47
|
+
* supported for certificate rotation.
|
|
48
|
+
*/
|
|
49
|
+
export declare function publisherNameMatchesCertificate(publisherNames: Array<string>, certInfo: CertificateInfo): boolean;
|
|
40
50
|
export declare abstract class SigntoolBaseSignManager implements SignManager {
|
|
41
51
|
protected readonly packager: WinPackager;
|
|
42
52
|
protected readonly platformSpecificBuildOptions: WindowsConfiguration;
|
|
43
53
|
constructor(packager: WinPackager);
|
|
44
54
|
readonly computedPublisherName: Lazy<string[] | null>;
|
|
45
55
|
readonly lazyCertInfo: MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>;
|
|
56
|
+
private readonly explicitPublisherNameValidation;
|
|
57
|
+
/**
|
|
58
|
+
* When `publisherName` is explicitly configured and the subject of the local code signing
|
|
59
|
+
* certificate is known, fail the build if none of the configured names match the certificate.
|
|
60
|
+
* This catches signing with the wrong certificate at build time — otherwise the mismatch only
|
|
61
|
+
* surfaces at update time, when electron-updater rejects every update signed with that
|
|
62
|
+
* certificate.
|
|
63
|
+
*
|
|
64
|
+
* The check is intentionally skipped whenever the actual signing certificate's subject is not
|
|
65
|
+
* genuinely known: custom `sign` hooks, PKCS#11 without an extractable certificate file,
|
|
66
|
+
* x509 certificate files without a CN, or any error while reading certificate info.
|
|
67
|
+
* An explicit `publisherName: null` remains a pure opt-out (nothing to validate).
|
|
68
|
+
*/
|
|
69
|
+
protected validateExplicitPublisherName(): Promise<void>;
|
|
46
70
|
readonly cscInfo: MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>;
|
|
47
71
|
initialize(): Promise<void>;
|
|
48
72
|
computePublisherName(target: Target, publisherName: string | null): Promise<string>;
|
|
@@ -51,7 +75,7 @@ export declare abstract class SigntoolBaseSignManager implements SignManager {
|
|
|
51
75
|
* Override in subclasses with different null-cert behaviour (HSM throws, PKCS#11 proceeds).
|
|
52
76
|
*/
|
|
53
77
|
protected handleNullCscInfo(customSign: CustomWindowsSign | string | null | undefined): boolean;
|
|
54
|
-
signFile(options: WindowsSignOptions): Promise<
|
|
78
|
+
signFile(options: WindowsSignOptions): Promise<SignFileResult>;
|
|
55
79
|
getCertInfo(file: string, password: string): Promise<CertificateInfo>;
|
|
56
80
|
computeSignToolArgs(options: WindowsSignTaskConfiguration, isWin: boolean, vm?: VmManager): Array<string>;
|
|
57
81
|
protected isLegacyToolset(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signtoolBaseSignManager.d.ts","sourceRoot":"","sources":["../../../src/codeSign/win/signtoolBaseSignManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAW,MAAM,sBAAsB,CAAA;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAEL,oBAAoB,EAEpB,2BAA2B,EAE5B,MAAM,6BAA6B,CAAA;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,IAAI;IAyB/H,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAKvC,2BAA2B,CAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsC5G,WAAW,CAAC,KAAK,UAA+B,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIpE,MAAM,CAAC,aAAa,EAAE,kCAAkC,EAAE,QAAQ,EAAE,WAAW;CA2CtF;AAED,qBAAa,mBAAoB,SAAQ,uBAAuB;IAC9D,SAAS,CAAC,sBAAsB,CAAC,OAAO,EAAE,4BAA4B,EAAE,EAAE,EAAE,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;IA6CrG,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,4BAA4B,EAAE,EAAE,EAAE,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;CAgCvG"}
|
|
@@ -21,6 +21,24 @@ export function getSigntoolFamilyConfig(config) {
|
|
|
21
21
|
}
|
|
22
22
|
return s;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Matches configured publisher names against a certificate subject using the same semantics as
|
|
26
|
+
* electron-updater's update signature verifier (windowsExecutableCodeSignatureVerifier): a name that
|
|
27
|
+
* parses as a Distinguished Name (DN) must match every RDN it specifies against the certificate
|
|
28
|
+
* subject (extra subject RDNs are ignored); otherwise it is compared strictly against the
|
|
29
|
+
* certificate's Common Name (CN). Passes when ANY configured name matches — multiple names are
|
|
30
|
+
* supported for certificate rotation.
|
|
31
|
+
*/
|
|
32
|
+
export function publisherNameMatchesCertificate(publisherNames, certInfo) {
|
|
33
|
+
const subject = parseDn(certInfo.bloodyMicrosoftSubjectDn);
|
|
34
|
+
return publisherNames.some(name => {
|
|
35
|
+
const dn = parseDn(name);
|
|
36
|
+
if (dn.size) {
|
|
37
|
+
return Array.from(dn.keys()).every(key => dn.get(key) === subject.get(key));
|
|
38
|
+
}
|
|
39
|
+
return name === certInfo.commonName;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
24
42
|
export class SigntoolBaseSignManager {
|
|
25
43
|
constructor(packager) {
|
|
26
44
|
this.packager = packager;
|
|
@@ -31,6 +49,7 @@ export class SigntoolBaseSignManager {
|
|
|
31
49
|
return null;
|
|
32
50
|
}
|
|
33
51
|
else if (publisherName != null) {
|
|
52
|
+
await this.explicitPublisherNameValidation.value;
|
|
34
53
|
return asArray(publisherName);
|
|
35
54
|
}
|
|
36
55
|
const certInfo = await this.lazyCertInfo.value;
|
|
@@ -60,6 +79,8 @@ export class SigntoolBaseSignManager {
|
|
|
60
79
|
// Returns null when the CN is absent — caller must set publisherName explicitly.
|
|
61
80
|
return await readCertInfoFromX509(cscFile);
|
|
62
81
|
});
|
|
82
|
+
// Memoized so the check runs once per build even though signFile is invoked once per file.
|
|
83
|
+
this.explicitPublisherNameValidation = new Lazy(() => this.validateExplicitPublisherName());
|
|
63
84
|
this.cscInfo = new MemoLazy(() => this.platformSpecificBuildOptions, platformSpecificBuildOptions => {
|
|
64
85
|
const signing = getSigntoolFamilyConfig(platformSpecificBuildOptions);
|
|
65
86
|
// signtool is the implicit default when win.sign is unset, so an absent config still
|
|
@@ -115,6 +136,53 @@ export class SigntoolBaseSignManager {
|
|
|
115
136
|
});
|
|
116
137
|
this.platformSpecificBuildOptions = packager.platformOptions;
|
|
117
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* When `publisherName` is explicitly configured and the subject of the local code signing
|
|
141
|
+
* certificate is known, fail the build if none of the configured names match the certificate.
|
|
142
|
+
* This catches signing with the wrong certificate at build time — otherwise the mismatch only
|
|
143
|
+
* surfaces at update time, when electron-updater rejects every update signed with that
|
|
144
|
+
* certificate.
|
|
145
|
+
*
|
|
146
|
+
* The check is intentionally skipped whenever the actual signing certificate's subject is not
|
|
147
|
+
* genuinely known: custom `sign` hooks, PKCS#11 without an extractable certificate file,
|
|
148
|
+
* x509 certificate files without a CN, or any error while reading certificate info.
|
|
149
|
+
* An explicit `publisherName: null` remains a pure opt-out (nothing to validate).
|
|
150
|
+
*/
|
|
151
|
+
async validateExplicitPublisherName() {
|
|
152
|
+
const signing = getSigntoolFamilyConfig(this.platformSpecificBuildOptions);
|
|
153
|
+
const publisherName = signing?.publisherName;
|
|
154
|
+
if (publisherName == null) {
|
|
155
|
+
// not configured (auto-derive) or explicit `null` opt-out — nothing to validate
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (signing?.sign != null) {
|
|
159
|
+
// custom sign hook: electron-builder does not know which certificate the hook actually signs with
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const publisherNames = asArray(publisherName);
|
|
163
|
+
if (publisherNames.length === 0) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
let certInfo;
|
|
167
|
+
try {
|
|
168
|
+
certInfo = await this.lazyCertInfo.value;
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
// this check must only fire when the signing certificate's subject is genuinely known
|
|
172
|
+
log.debug({ error: e.message || e }, "skipping publisherName validation against the signing certificate (cannot read certificate info)");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (certInfo == null) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (!publisherNameMatchesCertificate(publisherNames, certInfo)) {
|
|
179
|
+
throw new InvalidConfigurationError(`The configured publisherName does not match the subject of the code signing certificate. ` +
|
|
180
|
+
`This usually means the build is signing with the wrong certificate (for example, a code signing certificate for another platform or team leaked into WIN_CSC_LINK/CSC_LINK in CI) — electron-updater would reject every update signed with it.\n` +
|
|
181
|
+
` Configured publisherName: ${publisherNames.join(" | ")}\n` +
|
|
182
|
+
` Certificate subject: ${certInfo.bloodyMicrosoftSubjectDn}\n` +
|
|
183
|
+
`Fix win.publisherName (or sign with the intended certificate). To opt out of update signature verification entirely, set publisherName to null.`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
118
186
|
initialize() {
|
|
119
187
|
return Promise.resolve();
|
|
120
188
|
}
|
|
@@ -179,10 +247,13 @@ export class SigntoolBaseSignManager {
|
|
|
179
247
|
};
|
|
180
248
|
}
|
|
181
249
|
log.info(logInfo, "signing");
|
|
250
|
+
// validate an explicitly configured publisherName against the signing certificate before the
|
|
251
|
+
// first file is signed, so a wrong-certificate build fails even when no publish config exists
|
|
252
|
+
await this.explicitPublisherNameValidation.value;
|
|
182
253
|
}
|
|
183
254
|
else if (this.handleNullCscInfo(customSign)) {
|
|
184
|
-
|
|
185
|
-
return
|
|
255
|
+
// the canonical "signing skipped" message is logged once in signWindows, which receives this reason
|
|
256
|
+
return "skipped:no-certificate";
|
|
186
257
|
}
|
|
187
258
|
const executor = customSign || ((config, packager) => this.doSign(config, packager));
|
|
188
259
|
let isNest = false;
|
|
@@ -197,7 +268,7 @@ export class SigntoolBaseSignManager {
|
|
|
197
268
|
await rename(taskConfiguration.resultOutputPath, options.path);
|
|
198
269
|
}
|
|
199
270
|
}
|
|
200
|
-
return
|
|
271
|
+
return customSign ? "signed:custom" : "signed";
|
|
201
272
|
}
|
|
202
273
|
async getCertInfo(file, password) {
|
|
203
274
|
const errorMessagePrefix = "Cannot extract publisher name from code signing certificate. As workaround, set win.publisherName. Error: ";
|