app-builder-lib 27.0.0-alpha.11 → 27.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asar/asarUtil.js +1 -1
- package/dist/asar/asarUtil.js.map +1 -1
- package/dist/codeSign/certInfo.d.ts +4 -1
- package/dist/codeSign/certInfo.d.ts.map +1 -1
- package/dist/codeSign/certInfo.js +5 -3
- package/dist/codeSign/certInfo.js.map +1 -1
- package/dist/codeSign/forceCodeSigning.d.ts +22 -0
- package/dist/codeSign/forceCodeSigning.d.ts.map +1 -0
- package/dist/codeSign/forceCodeSigning.js +18 -0
- package/dist/codeSign/forceCodeSigning.js.map +1 -0
- package/dist/codeSign/mac/macCodeSign.d.ts +13 -1
- package/dist/codeSign/mac/macCodeSign.d.ts.map +1 -1
- package/dist/codeSign/mac/macCodeSign.js +29 -2
- package/dist/codeSign/mac/macCodeSign.js.map +1 -1
- package/dist/codeSign/mac/macSignatureVerifier.d.ts +23 -0
- package/dist/codeSign/mac/macSignatureVerifier.d.ts.map +1 -0
- package/dist/codeSign/mac/macSignatureVerifier.js +96 -0
- package/dist/codeSign/mac/macSignatureVerifier.js.map +1 -0
- package/dist/codeSign/win/authenticodeSignature.d.ts +83 -0
- package/dist/codeSign/win/authenticodeSignature.d.ts.map +1 -0
- package/dist/codeSign/win/authenticodeSignature.js +289 -0
- package/dist/codeSign/win/authenticodeSignature.js.map +1 -0
- package/dist/codeSign/win/pkcs11SignManager.d.ts.map +1 -1
- package/dist/codeSign/win/pkcs11SignManager.js +4 -3
- package/dist/codeSign/win/pkcs11SignManager.js.map +1 -1
- package/dist/codeSign/win/publisherName.d.ts +31 -0
- package/dist/codeSign/win/publisherName.d.ts.map +1 -0
- package/dist/codeSign/win/publisherName.js +78 -0
- package/dist/codeSign/win/publisherName.js.map +1 -0
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts +27 -9
- package/dist/codeSign/win/signtoolBaseSignManager.d.ts.map +1 -1
- package/dist/codeSign/win/signtoolBaseSignManager.js +80 -49
- package/dist/codeSign/win/signtoolBaseSignManager.js.map +1 -1
- package/dist/codeSign/win/verifyUpdatePublisher.d.ts +25 -0
- package/dist/codeSign/win/verifyUpdatePublisher.d.ts.map +1 -0
- package/dist/codeSign/win/verifyUpdatePublisher.js +101 -0
- package/dist/codeSign/win/verifyUpdatePublisher.js.map +1 -0
- package/dist/codeSign/win/windowsSignAzureManager.d.ts +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.d.ts.map +1 -1
- package/dist/codeSign/win/windowsSignAzureManager.js +24 -6
- package/dist/codeSign/win/windowsSignAzureManager.js.map +1 -1
- package/dist/configuration.d.ts +56 -12
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/electron/ElectronFramework.d.ts +15 -0
- package/dist/electron/ElectronFramework.d.ts.map +1 -1
- package/dist/electron/ElectronFramework.js +33 -2
- package/dist/electron/ElectronFramework.js.map +1 -1
- package/dist/electron/mac/asarIntegrityDigest.d.ts +10 -0
- package/dist/electron/mac/asarIntegrityDigest.d.ts.map +1 -0
- package/dist/electron/mac/asarIntegrityDigest.js +122 -0
- package/dist/electron/mac/asarIntegrityDigest.js.map +1 -0
- package/dist/electron/mac/electronMac.js +1 -28
- package/dist/electron/mac/electronMac.js.map +1 -1
- package/dist/electron/mac/electronMacUtils.d.ts +9 -0
- package/dist/electron/mac/electronMacUtils.d.ts.map +1 -1
- package/dist/electron/mac/electronMacUtils.js +37 -0
- package/dist/electron/mac/electronMacUtils.js.map +1 -1
- package/dist/fileMatcher.d.ts +34 -11
- package/dist/fileMatcher.d.ts.map +1 -1
- package/dist/fileMatcher.js +125 -36
- package/dist/fileMatcher.js.map +1 -1
- package/dist/forge-maker.d.ts +64 -0
- package/dist/forge-maker.d.ts.map +1 -1
- package/dist/forge-maker.js +104 -2
- package/dist/forge-maker.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/indexInternal.d.ts +9 -3
- package/dist/indexInternal.d.ts.map +1 -1
- package/dist/indexInternal.js +8 -3
- package/dist/indexInternal.js.map +1 -1
- package/dist/linuxPackager.js +1 -1
- package/dist/linuxPackager.js.map +1 -1
- package/dist/macPackager.d.ts +32 -0
- package/dist/macPackager.d.ts.map +1 -1
- package/dist/macPackager.js +215 -13
- package/dist/macPackager.js.map +1 -1
- package/dist/options/FuseOptionsV1.d.ts +4 -0
- package/dist/options/FuseOptionsV1.d.ts.map +1 -1
- package/dist/options/FuseOptionsV1.js.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.d.ts +93 -21
- package/dist/options/PlatformSpecificBuildOptions.d.ts.map +1 -1
- package/dist/options/PlatformSpecificBuildOptions.js.map +1 -1
- package/dist/options/SquirrelWindowsOptions.d.ts +3 -0
- package/dist/options/SquirrelWindowsOptions.d.ts.map +1 -1
- package/dist/options/SquirrelWindowsOptions.js.map +1 -1
- package/dist/options/macOptions.d.ts +22 -3
- package/dist/options/macOptions.d.ts.map +1 -1
- package/dist/options/macOptions.js.map +1 -1
- package/dist/options/winOptions.d.ts +68 -19
- package/dist/options/winOptions.d.ts.map +1 -1
- package/dist/options/winOptions.js +20 -0
- package/dist/options/winOptions.js.map +1 -1
- package/dist/packager.d.ts +3 -0
- package/dist/packager.d.ts.map +1 -1
- package/dist/packager.js +11 -2
- package/dist/packager.js.map +1 -1
- package/dist/platformPackager.d.ts +18 -7
- package/dist/platformPackager.d.ts.map +1 -1
- package/dist/platformPackager.js +56 -15
- package/dist/platformPackager.js.map +1 -1
- package/dist/publish/PublishManager.d.ts +4 -0
- package/dist/publish/PublishManager.d.ts.map +1 -1
- package/dist/publish/PublishManager.js +106 -28
- package/dist/publish/PublishManager.js.map +1 -1
- package/dist/publish/manifestUploadCheck.d.ts +10 -0
- package/dist/publish/manifestUploadCheck.d.ts.map +1 -0
- package/dist/publish/manifestUploadCheck.js +75 -0
- package/dist/publish/manifestUploadCheck.js.map +1 -0
- package/dist/publish/updateInfoBuilder.d.ts.map +1 -1
- package/dist/publish/updateInfoBuilder.js +51 -17
- package/dist/publish/updateInfoBuilder.js.map +1 -1
- package/dist/publish/updateManifestVerifier.d.ts +22 -0
- package/dist/publish/updateManifestVerifier.d.ts.map +1 -0
- package/dist/publish/updateManifestVerifier.js +65 -0
- package/dist/publish/updateManifestVerifier.js.map +1 -0
- package/dist/targets/ArchiveTarget.d.ts.map +1 -1
- package/dist/targets/ArchiveTarget.js +6 -2
- package/dist/targets/ArchiveTarget.js.map +1 -1
- package/dist/targets/archive.d.ts +6 -0
- package/dist/targets/archive.d.ts.map +1 -1
- package/dist/targets/archive.js +15 -5
- package/dist/targets/archive.js.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.d.ts.map +1 -1
- package/dist/targets/differentialUpdateInfoBuilder.js +4 -0
- package/dist/targets/differentialUpdateInfoBuilder.js.map +1 -1
- package/dist/targets/linux/FlatpakTarget.js +5 -5
- package/dist/targets/linux/FlatpakTarget.js.map +1 -1
- package/dist/targets/linux/FpmTarget.d.ts.map +1 -1
- package/dist/targets/linux/FpmTarget.js +12 -17
- package/dist/targets/linux/FpmTarget.js.map +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js +1 -1
- package/dist/targets/linux/LinuxTargetHelper.js.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.d.ts.map +1 -1
- package/dist/targets/linux/appimage/AppImageTarget.js +6 -1
- package/dist/targets/linux/appimage/AppImageTarget.js.map +1 -1
- package/dist/targets/linux/appimage/appImageUtil.js +9 -9
- package/dist/targets/linux/appimage/appImageUtil.js.map +1 -1
- package/dist/targets/linux/flatpakBundle.d.ts.map +1 -1
- package/dist/targets/linux/flatpakBundle.js +25 -20
- package/dist/targets/linux/flatpakBundle.js.map +1 -1
- package/dist/targets/linux/snap/core24.d.ts.map +1 -1
- package/dist/targets/linux/snap/core24.js +2 -9
- package/dist/targets/linux/snap/core24.js.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.d.ts.map +1 -1
- package/dist/targets/linux/snap/coreLegacy.js +22 -6
- package/dist/targets/linux/snap/coreLegacy.js.map +1 -1
- package/dist/targets/linux/snap/snapPlugs.d.ts +2 -2
- package/dist/targets/linux/snap/snapPlugs.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapPlugs.js +1 -1
- package/dist/targets/linux/snap/snapPlugs.js.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.d.ts.map +1 -1
- package/dist/targets/linux/snap/snapcraftBuilder.js +19 -17
- package/dist/targets/linux/snap/snapcraftBuilder.js.map +1 -1
- package/dist/targets/mac/MacTargetHelper.d.ts +21 -3
- package/dist/targets/mac/MacTargetHelper.d.ts.map +1 -1
- package/dist/targets/mac/MacTargetHelper.js +140 -13
- package/dist/targets/mac/MacTargetHelper.js.map +1 -1
- package/dist/targets/mac/pkg.d.ts.map +1 -1
- package/dist/targets/mac/pkg.js +8 -5
- package/dist/targets/mac/pkg.js.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.d.ts.map +1 -1
- package/dist/targets/win/nsis/NsisTarget.js +15 -3
- package/dist/targets/win/nsis/NsisTarget.js.map +1 -1
- package/dist/targets/win/nsis/nsisOptions.d.ts +1 -1
- package/dist/targets/win/nsis/nsisOptions.js.map +1 -1
- package/dist/toolsets/nsis.js +1 -1
- package/dist/toolsets/nsis.js.map +1 -1
- package/dist/toolsets/winCodeSign.d.ts +14 -1
- package/dist/toolsets/winCodeSign.d.ts.map +1 -1
- package/dist/toolsets/winCodeSign.js +14 -1
- package/dist/toolsets/winCodeSign.js.map +1 -1
- package/dist/toolsets/wine.d.ts +3 -0
- package/dist/toolsets/wine.d.ts.map +1 -1
- package/dist/toolsets/wine.js +14 -5
- package/dist/toolsets/wine.js.map +1 -1
- package/dist/util/appFileCopier.d.ts.map +1 -1
- package/dist/util/appFileCopier.js +15 -11
- package/dist/util/appFileCopier.js.map +1 -1
- package/dist/util/buildOutputVerifier.d.ts +40 -0
- package/dist/util/buildOutputVerifier.d.ts.map +1 -0
- package/dist/util/buildOutputVerifier.js +420 -0
- package/dist/util/buildOutputVerifier.js.map +1 -0
- package/dist/util/config/config.d.ts.map +1 -1
- package/dist/util/config/config.js +9 -1
- package/dist/util/config/config.js.map +1 -1
- package/dist/util/config/fileOptions.d.ts +22 -0
- package/dist/util/config/fileOptions.d.ts.map +1 -1
- package/dist/util/config/fileOptions.js +92 -2
- package/dist/util/config/fileOptions.js.map +1 -1
- package/dist/util/config/legacyConfigGuard.d.ts.map +1 -1
- package/dist/util/config/legacyConfigGuard.js +2 -2
- package/dist/util/config/legacyConfigGuard.js.map +1 -1
- package/dist/util/config/legacyOptions.d.ts +9 -2
- package/dist/util/config/legacyOptions.d.ts.map +1 -1
- package/dist/util/config/legacyOptions.js +20 -2
- package/dist/util/config/legacyOptions.js.map +1 -1
- package/dist/util/electronGet.d.ts.map +1 -1
- package/dist/util/electronGet.js +3 -1
- package/dist/util/electronGet.js.map +1 -1
- package/dist/util/flags.d.ts.map +1 -1
- package/dist/util/flags.js +3 -9
- package/dist/util/flags.js.map +1 -1
- package/dist/util/mac/macosIconComposer.d.ts.map +1 -1
- package/dist/util/mac/macosIconComposer.js +6 -5
- package/dist/util/mac/macosIconComposer.js.map +1 -1
- package/dist/util/macroExpander.js +1 -1
- package/dist/util/macroExpander.js.map +1 -1
- package/dist/util/nativeBinaryVerifier.d.ts.map +1 -1
- package/dist/util/nativeBinaryVerifier.js +3 -1
- package/dist/util/nativeBinaryVerifier.js.map +1 -1
- package/dist/util/packageMetadata.js +1 -1
- package/dist/util/packageMetadata.js.map +1 -1
- package/dist/util/removedEnvVars.d.ts +2 -0
- package/dist/util/removedEnvVars.d.ts.map +1 -1
- package/dist/util/removedEnvVars.js +15 -1
- package/dist/util/removedEnvVars.js.map +1 -1
- package/dist/util/streamSpawnToFile.d.ts +3 -1
- package/dist/util/streamSpawnToFile.d.ts.map +1 -1
- package/dist/util/streamSpawnToFile.js +6 -2
- package/dist/util/streamSpawnToFile.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/vm/ParallelsVm.d.ts +10 -0
- package/dist/vm/ParallelsVm.d.ts.map +1 -1
- package/dist/vm/ParallelsVm.js +22 -8
- package/dist/vm/ParallelsVm.js.map +1 -1
- package/dist/vm/PwshVm.d.ts +0 -1
- package/dist/vm/PwshVm.d.ts.map +1 -1
- package/dist/vm/PwshVm.js +10 -15
- package/dist/vm/PwshVm.js.map +1 -1
- package/dist/vm/WineVm.d.ts.map +1 -1
- package/dist/vm/WineVm.js +4 -4
- package/dist/vm/WineVm.js.map +1 -1
- package/dist/vm/vm.d.ts +9 -3
- package/dist/vm/vm.d.ts.map +1 -1
- package/dist/vm/vm.js +40 -32
- package/dist/vm/vm.js.map +1 -1
- package/dist/winPackager.d.ts +16 -1
- package/dist/winPackager.d.ts.map +1 -1
- package/dist/winPackager.js +77 -19
- package/dist/winPackager.js.map +1 -1
- package/package.json +12 -10
- package/scheme.json +662 -50
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +14 -9
- package/templates/nsis/installSection.nsh +5 -0
- package/dist/vm/MonoVm.d.ts +0 -9
- package/dist/vm/MonoVm.d.ts.map +0 -1
- package/dist/vm/MonoVm.js +0 -16
- package/dist/vm/MonoVm.js.map +0 -1
|
@@ -29,6 +29,11 @@ export interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfi
|
|
|
29
29
|
export interface CertificateInfo {
|
|
30
30
|
readonly commonName: string;
|
|
31
31
|
readonly bloodyMicrosoftSubjectDn: string;
|
|
32
|
+
/**
|
|
33
|
+
* The subject in the format Windows reports it (`X509Certificate2.Subject`), which electron-updater matches
|
|
34
|
+
* publisherName against. Unset when `bloodyMicrosoftSubjectDn` already is in that format (certificate store).
|
|
35
|
+
*/
|
|
36
|
+
readonly windowsSubjectDn?: string;
|
|
32
37
|
}
|
|
33
38
|
export interface CertificateFromStoreInfo {
|
|
34
39
|
thumbprint: string;
|
|
@@ -38,13 +43,14 @@ export interface CertificateFromStoreInfo {
|
|
|
38
43
|
}
|
|
39
44
|
/** Extracts the non-Azure signing config from WindowsConfiguration, or null for Azure/unset/disabled. */
|
|
40
45
|
export declare function getSigntoolFamilyConfig(config: WindowsConfiguration): WindowsSigntoolFamilyConfig | null;
|
|
46
|
+
/** The certificate subject in the format Windows reports it, which electron-updater matches publisherName against. */
|
|
47
|
+
export declare function certificateWindowsSubjectDn(certInfo: CertificateInfo): string;
|
|
41
48
|
/**
|
|
42
|
-
* Matches configured publisher names against a certificate subject
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* supported for certificate rotation.
|
|
49
|
+
* Matches configured publisher names against a certificate subject with the matcher electron-updater's update
|
|
50
|
+
* signature verifier uses ({@link matchPublisherName}): a name must be a Distinguished Name (DN), and every RDN it
|
|
51
|
+
* specifies must equal the certificate subject's (extra subject RDNs are ignored). Passes when ANY
|
|
52
|
+
* configured name matches — multiple names are supported for certificate rotation. The subject is taken in the format
|
|
53
|
+
* Windows reports it (as the updater sees it).
|
|
48
54
|
*/
|
|
49
55
|
export declare function publisherNameMatchesCertificate(publisherNames: Array<string>, certInfo: CertificateInfo): boolean;
|
|
50
56
|
export declare abstract class SigntoolBaseSignManager implements SignManager {
|
|
@@ -55,8 +61,9 @@ export declare abstract class SigntoolBaseSignManager implements SignManager {
|
|
|
55
61
|
readonly lazyCertInfo: MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>;
|
|
56
62
|
private readonly explicitPublisherNameValidation;
|
|
57
63
|
/**
|
|
58
|
-
* When `publisherName` is explicitly configured
|
|
59
|
-
*
|
|
64
|
+
* When `publisherName` is explicitly configured, fail the build if an entry is not a distinguished name
|
|
65
|
+
* (electron-updater 7 never matches one), whatever the signing route. Then, when the subject of the local code
|
|
66
|
+
* signing certificate is known, fail the build if none of the configured names match the certificate.
|
|
60
67
|
* This catches signing with the wrong certificate at build time — otherwise the mismatch only
|
|
61
68
|
* surfaces at update time, when electron-updater rejects every update signed with that
|
|
62
69
|
* certificate.
|
|
@@ -64,7 +71,7 @@ export declare abstract class SigntoolBaseSignManager implements SignManager {
|
|
|
64
71
|
* The check is intentionally skipped whenever the actual signing certificate's subject is not
|
|
65
72
|
* genuinely known: custom `sign` hooks, PKCS#11 without an extractable certificate file,
|
|
66
73
|
* x509 certificate files without a CN, or any error while reading certificate info.
|
|
67
|
-
* An explicit `publisherName: null`
|
|
74
|
+
* An explicit `publisherName: null` has nothing to validate (a build that writes `app-update.yml` with it fails in PublishManager).
|
|
68
75
|
*/
|
|
69
76
|
protected validateExplicitPublisherName(): Promise<void>;
|
|
70
77
|
readonly cscInfo: MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>;
|
|
@@ -92,4 +99,15 @@ export declare class SigntoolSignManager extends SigntoolBaseSignManager {
|
|
|
92
99
|
protected computeWindowsSignArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string>;
|
|
93
100
|
protected computeOsslsigncodeArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string>;
|
|
94
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* The hash algorithms to sign `filePath` with, one signing pass each.
|
|
104
|
+
*
|
|
105
|
+
* - `.msi` holds a single signature, so it is signed once: with `sha256` unless `sha1` is the only algorithm requested.
|
|
106
|
+
* - `.appx`, `.msix` and `.msixbundle` are always `sha256`.
|
|
107
|
+
* - Everything else uses the configured list, defaulting to dual signing with `sha1` then `sha256`.
|
|
108
|
+
*
|
|
109
|
+
* Extensions are matched case-insensitively (`app.MSI` is an MSI). An empty list is a configuration error: it would
|
|
110
|
+
* run no signing pass while the file is still reported as signed.
|
|
111
|
+
*/
|
|
112
|
+
export declare function resolveSigningHashAlgorithms(filePath: string, configured: Array<"sha1" | "sha256"> | "sha1" | "sha256" | null | undefined): Array<"sha1" | "sha256">;
|
|
95
113
|
//# sourceMappingURL=signtoolBaseSignManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signtoolBaseSignManager.d.ts","sourceRoot":"","sources":["../../../src/codeSign/win/signtoolBaseSignManager.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"signtoolBaseSignManager.d.ts","sourceRoot":"","sources":["../../../src/codeSign/win/signtoolBaseSignManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,QAAQ,EAA6C,MAAM,sBAAsB,CAAA;AAE9G,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAGL,oBAAoB,EAEpB,2BAA2B,EAE5B,MAAM,6BAA6B,CAAA;AAIpC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAIpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAMjD,MAAM,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,kCAAkC,EAAE,QAAQ,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAE3H,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ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CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,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;IAuC5G,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;AAED;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,CAepK"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { asArray, InvalidConfigurationError, log, retry } from "builder-util";
|
|
2
|
-
import { MemoLazy, parseDn } from "builder-util-runtime";
|
|
2
|
+
import { matchPublisherName, MemoLazy, parseDn, POWERSHELL_ASCII_ESCAPE_FUNCTION } from "builder-util-runtime";
|
|
3
3
|
import _fsExtra from "fs-extra";
|
|
4
4
|
import { Lazy } from "lazy-val";
|
|
5
5
|
import * as path from "path";
|
|
@@ -12,6 +12,9 @@ import { withSigntoolLock } from "../../util/toolsetLock.js";
|
|
|
12
12
|
import { readCertInfo, readCertInfoFromX509 } from "../certInfo.js";
|
|
13
13
|
import { VmManager } from "../../vm/vm.js";
|
|
14
14
|
import { importCertificate } from "../codesign.js";
|
|
15
|
+
import { derivePublisherName, PUBLISHER_NAME_DN_DOCS_URL, validatePublisherNameFormat } from "./publisherName.js";
|
|
16
|
+
import { BUILD_CHANGES_URL } from "../../util/config/legacyOptions.js";
|
|
17
|
+
const PUBLISHER_NAME_DOCS = `${BUILD_CHANGES_URL}#windows-publishername-is-validated-against-the-signing-certificate`;
|
|
15
18
|
const { rename } = _fsExtra;
|
|
16
19
|
/** Extracts the non-Azure signing config from WindowsConfiguration, or null for Azure/unset/disabled. */
|
|
17
20
|
export function getSigntoolFamilyConfig(config) {
|
|
@@ -21,28 +24,30 @@ export function getSigntoolFamilyConfig(config) {
|
|
|
21
24
|
}
|
|
22
25
|
return s;
|
|
23
26
|
}
|
|
27
|
+
/** The certificate subject in the format Windows reports it, which electron-updater matches publisherName against. */
|
|
28
|
+
export function certificateWindowsSubjectDn(certInfo) {
|
|
29
|
+
return certInfo.windowsSubjectDn ?? certInfo.bloodyMicrosoftSubjectDn;
|
|
30
|
+
}
|
|
24
31
|
/**
|
|
25
|
-
* Matches configured publisher names against a certificate subject
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* supported for certificate rotation.
|
|
32
|
+
* Matches configured publisher names against a certificate subject with the matcher electron-updater's update
|
|
33
|
+
* signature verifier uses ({@link matchPublisherName}): a name must be a Distinguished Name (DN), and every RDN it
|
|
34
|
+
* specifies must equal the certificate subject's (extra subject RDNs are ignored). Passes when ANY
|
|
35
|
+
* configured name matches — multiple names are supported for certificate rotation. The subject is taken in the format
|
|
36
|
+
* Windows reports it (as the updater sees it).
|
|
31
37
|
*/
|
|
32
38
|
export function publisherNameMatchesCertificate(publisherNames, certInfo) {
|
|
33
|
-
|
|
34
|
-
return
|
|
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
|
-
});
|
|
39
|
+
// matchPublisherName takes the parsed Get-AuthenticodeSignature output, as electron-updater passes it
|
|
40
|
+
return matchPublisherName({ SignerCertificate: { Subject: certificateWindowsSubjectDn(certInfo) } }, publisherNames);
|
|
41
41
|
}
|
|
42
42
|
export class SigntoolBaseSignManager {
|
|
43
43
|
constructor(packager) {
|
|
44
44
|
this.packager = packager;
|
|
45
45
|
this.computedPublisherName = new Lazy(async () => {
|
|
46
|
+
// `win.sign: false` / `null` signs nothing, so no publisherName is derived: a build that writes app-update.yml then needs
|
|
47
|
+
// win.verifyUpdateCodeSignature: false (or a win.sign object with publisherName), see missingUpdatePublisherNameError.
|
|
48
|
+
if (isWindowsSigningDisabled(this.platformSpecificBuildOptions)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
46
51
|
const signing = getSigntoolFamilyConfig(this.platformSpecificBuildOptions);
|
|
47
52
|
const publisherName = signing?.publisherName;
|
|
48
53
|
if (publisherName === null) {
|
|
@@ -57,20 +62,24 @@ export class SigntoolBaseSignManager {
|
|
|
57
62
|
if (signing?.sign != null) {
|
|
58
63
|
throw new InvalidConfigurationError("A custom Windows signing hook (`win.sign.sign`) is configured without `win.sign.publisherName`. " +
|
|
59
64
|
"electron-builder cannot tell which certificate the hook signs with, and electron-updater verifies the signature of downloaded updates against the publisherName in app-update.yml. " +
|
|
60
|
-
'Set `win.sign.publisherName` to the subject of the certificate that your hook signs with (e.g. "CN=My Company, O=My Company, C=US"), ' +
|
|
61
|
-
"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly."
|
|
65
|
+
'Set `win.sign.publisherName` to the subject of the certificate that your hook signs with, as a distinguished name (e.g. "CN=My Company, O=My Company, C=US"), ' +
|
|
66
|
+
"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly. " +
|
|
67
|
+
`See ${PUBLISHER_NAME_DOCS}`);
|
|
62
68
|
}
|
|
63
69
|
const certInfo = await this.lazyCertInfo.value;
|
|
64
70
|
if (certInfo?.commonName) {
|
|
65
|
-
|
|
71
|
+
// `CN=<common name>`, quoted as Windows reports the signer subject (which electron-updater 7 matches against): pinning only the CN
|
|
72
|
+
// keeps updates working across a certificate renewal that changes other subject attributes. A stricter pin is an explicit publisherName.
|
|
73
|
+
return [derivePublisherName(certInfo.commonName)];
|
|
66
74
|
}
|
|
67
|
-
// Signed with a certificate without a CN: electron-updater verifies downloaded updates against the
|
|
68
|
-
//
|
|
69
|
-
if (
|
|
75
|
+
// Signed with a certificate without a CN (or whose subject cannot be read): electron-updater verifies downloaded updates against the
|
|
76
|
+
// publisherName in app-update.yml, so the build needs one.
|
|
77
|
+
if ((await this.cscInfo.value) != null) {
|
|
70
78
|
throw new InvalidConfigurationError("Windows code signing is configured, but the publisher name cannot be determined at build time (the signing certificate has no Common Name). " +
|
|
71
79
|
"electron-updater verifies the signature of downloaded updates against the publisherName in app-update.yml. " +
|
|
72
|
-
'Set `win.sign.publisherName` to the subject of the certificate that signs your app (e.g. "CN=My Company, O=My Company, C=US"), ' +
|
|
73
|
-
"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly."
|
|
80
|
+
'Set `win.sign.publisherName` to the subject of the certificate that signs your app, as a distinguished name (e.g. "CN=My Company, O=My Company, C=US"), ' +
|
|
81
|
+
"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly. " +
|
|
82
|
+
`See ${PUBLISHER_NAME_DN_DOCS_URL}`);
|
|
74
83
|
}
|
|
75
84
|
return null;
|
|
76
85
|
});
|
|
@@ -84,6 +93,7 @@ export class SigntoolBaseSignManager {
|
|
|
84
93
|
return {
|
|
85
94
|
// empty for a subject without a CN, like readCertInfo, so computedPublisherName requires an explicit publisherName
|
|
86
95
|
commonName: parseDn(bloodyMicrosoftSubjectDn).get("CN") ?? "",
|
|
96
|
+
// read from the Windows certificate store, so already in the format Windows reports (windowsSubjectDn falls back to it)
|
|
87
97
|
bloodyMicrosoftSubjectDn,
|
|
88
98
|
};
|
|
89
99
|
}
|
|
@@ -102,6 +112,11 @@ export class SigntoolBaseSignManager {
|
|
|
102
112
|
// Memoized so the check runs once per build even though signFile is invoked once per file.
|
|
103
113
|
this.explicitPublisherNameValidation = new Lazy(() => this.validateExplicitPublisherName());
|
|
104
114
|
this.cscInfo = new MemoLazy(() => this.platformSpecificBuildOptions, platformSpecificBuildOptions => {
|
|
115
|
+
// `win.sign: false` / `null` signs nothing: no certificate is read (not even from CSC_LINK / WIN_CSC_LINK), so none
|
|
116
|
+
// supplies an AppX/MSIX publisher, a publisherName for app-update.yml or a build-cache digest.
|
|
117
|
+
if (isWindowsSigningDisabled(platformSpecificBuildOptions)) {
|
|
118
|
+
return Promise.resolve(null);
|
|
119
|
+
}
|
|
105
120
|
const signing = getSigntoolFamilyConfig(platformSpecificBuildOptions);
|
|
106
121
|
// signtool is the implicit default when win.sign is unset, so an absent config still
|
|
107
122
|
// honours the WIN_CSC_LINK/cscLink fallback below (hsm/pkcs11 set signing.type explicitly).
|
|
@@ -157,8 +172,9 @@ export class SigntoolBaseSignManager {
|
|
|
157
172
|
this.platformSpecificBuildOptions = packager.platformOptions;
|
|
158
173
|
}
|
|
159
174
|
/**
|
|
160
|
-
* When `publisherName` is explicitly configured
|
|
161
|
-
*
|
|
175
|
+
* When `publisherName` is explicitly configured, fail the build if an entry is not a distinguished name
|
|
176
|
+
* (electron-updater 7 never matches one), whatever the signing route. Then, when the subject of the local code
|
|
177
|
+
* signing certificate is known, fail the build if none of the configured names match the certificate.
|
|
162
178
|
* This catches signing with the wrong certificate at build time — otherwise the mismatch only
|
|
163
179
|
* surfaces at update time, when electron-updater rejects every update signed with that
|
|
164
180
|
* certificate.
|
|
@@ -166,15 +182,16 @@ export class SigntoolBaseSignManager {
|
|
|
166
182
|
* The check is intentionally skipped whenever the actual signing certificate's subject is not
|
|
167
183
|
* genuinely known: custom `sign` hooks, PKCS#11 without an extractable certificate file,
|
|
168
184
|
* x509 certificate files without a CN, or any error while reading certificate info.
|
|
169
|
-
* An explicit `publisherName: null`
|
|
185
|
+
* An explicit `publisherName: null` has nothing to validate (a build that writes `app-update.yml` with it fails in PublishManager).
|
|
170
186
|
*/
|
|
171
187
|
async validateExplicitPublisherName() {
|
|
172
188
|
const signing = getSigntoolFamilyConfig(this.platformSpecificBuildOptions);
|
|
173
189
|
const publisherName = signing?.publisherName;
|
|
174
190
|
if (publisherName == null) {
|
|
175
|
-
// not configured (auto-derive) or explicit `null` opt-out — nothing to validate
|
|
191
|
+
// not configured (auto-derive) or explicit `null` (no opt-out any more: rejected where app-update.yml is written) — nothing to validate
|
|
176
192
|
return;
|
|
177
193
|
}
|
|
194
|
+
validatePublisherNameFormat(publisherName);
|
|
178
195
|
if (signing?.sign != null) {
|
|
179
196
|
// custom sign hook: electron-builder does not know which certificate the hook actually signs with
|
|
180
197
|
return;
|
|
@@ -199,8 +216,8 @@ export class SigntoolBaseSignManager {
|
|
|
199
216
|
throw new InvalidConfigurationError(`The configured publisherName does not match the subject of the code signing certificate. ` +
|
|
200
217
|
`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` +
|
|
201
218
|
` Configured publisherName: ${publisherNames.join(" | ")}\n` +
|
|
202
|
-
` Certificate subject: ${certInfo
|
|
203
|
-
`Fix win.sign.publisherName (or sign with the intended certificate). To opt out of update signature verification entirely, set
|
|
219
|
+
` Certificate subject: ${certificateWindowsSubjectDn(certInfo)}\n` +
|
|
220
|
+
`Fix win.sign.publisherName (or sign with the intended certificate). To opt out of update signature verification entirely, set win.verifyUpdateCodeSignature: false.`);
|
|
204
221
|
}
|
|
205
222
|
}
|
|
206
223
|
initialize() {
|
|
@@ -215,9 +232,11 @@ export class SigntoolBaseSignManager {
|
|
|
215
232
|
// When a signing cert is available, the cert's subject MUST be used so the APPX package
|
|
216
233
|
// Publisher attribute matches the certificate — any mismatch causes SignerSign to fail with
|
|
217
234
|
// ERROR_BAD_FORMAT. Only honour a user-supplied publisherName if it was explicitly configured
|
|
218
|
-
// (non-null); otherwise derive from the certificate.
|
|
235
|
+
// (non-null); otherwise derive from the certificate. The subject is written in the format Windows reports it
|
|
236
|
+
// (`, `-separated, Windows attribute names such as S): MakeAppx rejects a multi-RDN Publisher separated by a bare `,`
|
|
237
|
+
// or using the OpenSSL name ST.
|
|
219
238
|
const certInfo = await this.lazyCertInfo.value;
|
|
220
|
-
const publisher = publisherName ?? certInfo
|
|
239
|
+
const publisher = publisherName ?? (certInfo == null ? null : certificateWindowsSubjectDn(certInfo));
|
|
221
240
|
if (publisher == null) {
|
|
222
241
|
throw new Error("Internal error: cannot compute subject using certificate info");
|
|
223
242
|
}
|
|
@@ -232,20 +251,7 @@ export class SigntoolBaseSignManager {
|
|
|
232
251
|
}
|
|
233
252
|
async signFile(options) {
|
|
234
253
|
const signing = getSigntoolFamilyConfig(options.options);
|
|
235
|
-
|
|
236
|
-
// msi does not support dual-signing
|
|
237
|
-
if (options.path.endsWith(".msi")) {
|
|
238
|
-
hashes = [hashes != null && !hashes.includes("sha1") ? "sha256" : "sha1"];
|
|
239
|
-
}
|
|
240
|
-
else if (options.path.endsWith(".appx") || options.path.endsWith(".msix") || options.path.endsWith(".msixbundle")) {
|
|
241
|
-
hashes = ["sha256"];
|
|
242
|
-
}
|
|
243
|
-
else if (hashes == null) {
|
|
244
|
-
hashes = ["sha1", "sha256"];
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
hashes = Array.isArray(hashes) ? hashes : [hashes];
|
|
248
|
-
}
|
|
254
|
+
const hashes = resolveSigningHashAlgorithms(options.path, signing?.signingHashAlgorithms);
|
|
249
255
|
const name = this.packager.appInfo.productName;
|
|
250
256
|
const site = await this.packager.appInfo.computePackageUrl();
|
|
251
257
|
const customSign = await resolveFunction(this.packager.appInfo.type, signing?.sign, "sign", await this.packager.getWorkspaceRoot());
|
|
@@ -267,14 +273,14 @@ export class SigntoolBaseSignManager {
|
|
|
267
273
|
};
|
|
268
274
|
}
|
|
269
275
|
log.info(logInfo, "signing");
|
|
270
|
-
// validate an explicitly configured publisherName against the signing certificate before the
|
|
271
|
-
// first file is signed, so a wrong-certificate build fails even when no publish config exists
|
|
272
|
-
await this.explicitPublisherNameValidation.value;
|
|
273
276
|
}
|
|
274
277
|
else if (this.handleNullCscInfo(customSign)) {
|
|
275
278
|
// the canonical "signing skipped" message is logged once in signWindows, which receives this reason
|
|
276
279
|
return "skipped:no-certificate";
|
|
277
280
|
}
|
|
281
|
+
// validate an explicitly configured publisherName (its format on every signing route, and against the signing certificate when
|
|
282
|
+
// known) before the first file is signed, so a wrong-certificate build fails even when no publish config exists
|
|
283
|
+
await this.explicitPublisherNameValidation.value;
|
|
278
284
|
const executor = customSign || ((config, packager) => this.doSign(config, packager));
|
|
279
285
|
let isNest = false;
|
|
280
286
|
for (const hash of hashes) {
|
|
@@ -368,11 +374,12 @@ export class SigntoolBaseSignManager {
|
|
|
368
374
|
const certificateSubjectName = signing?.certificateSubjectName;
|
|
369
375
|
const certificateSha1 = signing?.certificateSha1?.toUpperCase();
|
|
370
376
|
const ps = await vm.powershellCommand.value;
|
|
377
|
+
// the non-ASCII characters of a subject are escaped, so they read back losslessly whatever the console code page
|
|
371
378
|
const rawResult = await vm.exec(ps, [
|
|
372
379
|
"-NoProfile",
|
|
373
380
|
"-NonInteractive",
|
|
374
381
|
"-Command",
|
|
375
|
-
|
|
382
|
+
`${POWERSHELL_ASCII_ESCAPE_FUNCTION}; $json = Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress; if ($json) { ConvertTo-AsciiEscaped $json }`,
|
|
376
383
|
]);
|
|
377
384
|
const certList = rawResult.length === 0 ? [] : asArray(JSON.parse(rawResult));
|
|
378
385
|
for (const certInfo of certList) {
|
|
@@ -504,4 +511,28 @@ export class SigntoolSignManager extends SigntoolBaseSignManager {
|
|
|
504
511
|
return args;
|
|
505
512
|
}
|
|
506
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* The hash algorithms to sign `filePath` with, one signing pass each.
|
|
516
|
+
*
|
|
517
|
+
* - `.msi` holds a single signature, so it is signed once: with `sha256` unless `sha1` is the only algorithm requested.
|
|
518
|
+
* - `.appx`, `.msix` and `.msixbundle` are always `sha256`.
|
|
519
|
+
* - Everything else uses the configured list, defaulting to dual signing with `sha1` then `sha256`.
|
|
520
|
+
*
|
|
521
|
+
* Extensions are matched case-insensitively (`app.MSI` is an MSI). An empty list is a configuration error: it would
|
|
522
|
+
* run no signing pass while the file is still reported as signed.
|
|
523
|
+
*/
|
|
524
|
+
export function resolveSigningHashAlgorithms(filePath, configured) {
|
|
525
|
+
const requested = configured == null ? null : asArray(configured);
|
|
526
|
+
if (requested != null && requested.length === 0) {
|
|
527
|
+
throw new InvalidConfigurationError(`win.sign.signingHashAlgorithms is an empty list, so no signing pass would run. List at least one of "sha1" or "sha256", remove the option to use the default ["sha1", "sha256"], or set win.sign to false to disable Windows signing.`);
|
|
528
|
+
}
|
|
529
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
530
|
+
if (ext === ".msi") {
|
|
531
|
+
return [requested != null && !requested.includes("sha256") ? "sha1" : "sha256"];
|
|
532
|
+
}
|
|
533
|
+
if (ext === ".appx" || ext === ".msix" || ext === ".msixbundle") {
|
|
534
|
+
return ["sha256"];
|
|
535
|
+
}
|
|
536
|
+
return requested ?? ["sha1", "sha256"];
|
|
537
|
+
}
|
|
507
538
|
//# sourceMappingURL=signtoolBaseSignManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signt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,wBAAwB,KAAK,MAAM,EAAE,CAAC;YACpD,MAAM,YAAY,GAAG,OAAO,EAAE,eAAe,IAAI,+BAA+B,CAAA;YAChF,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;QAC/B,CAAC;QAED,mBAAmB;QACnB,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAA;QAEjD,iBAAiB;QACjB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAA;QAE3C,mEAAmE;QACnE,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAA;QAEnD,gBAAgB;QAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAA;QAC1C,IAAI,UAAU,EAAE,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAC7B,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF","sourcesContent":["import { asArray, InvalidConfigurationError, log, retry } from \"builder-util\"\nimport { MemoLazy, parseDn } from \"builder-util-runtime\"\nimport _fsExtra from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../../core.js\"\nimport {\n isWindowsSigningDisabled,\n resolveWindowsSigningConfiguration,\n WindowsConfiguration,\n WindowsHsmSigningConfig,\n WindowsSigntoolFamilyConfig,\n WindowsSigntoolSigningConfig,\n} from \"../../options/winOptions.js\"\nimport AppXTarget from \"../../targets/win/AppxTarget.js\"\nimport MsixTarget from \"../../targets/win/MsixTarget.js\"\nimport { getSignToolPath } from \"../../toolsets/winCodeSign.js\"\nimport { ToolInfo } from \"../../util/bundledTool.js\"\nimport { resolveFunction } from \"../../util/resolve.js\"\nimport { withSigntoolLock } from \"../../util/toolsetLock.js\"\nimport { readCertInfo, readCertInfoFromX509 } from \"../certInfo.js\"\nimport { VmManager } from \"../../vm/vm.js\"\nimport type { WinPackager } from \"../../winPackager.js\"\nimport { importCertificate } from \"../codesign.js\"\nimport type { SignManager } from \"./signManager.js\"\nimport { WindowsSignOptions } from \"./windowsCodeSign.js\"\nimport { SignFileResult } from \"../signResult.js\"\nconst { rename } = _fsExtra\n\nexport type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise<any>\n\nexport interface WindowsSignToolOptions extends WindowsSignOptions {\n readonly name: string\n readonly site: string | null\n}\n\nexport interface FileCodeSigningInfo {\n readonly file: string\n readonly password: string | null\n}\n\nexport interface WindowsSignTaskConfiguration extends WindowsSignToolOptions {\n readonly cscInfo: FileCodeSigningInfo | CertificateFromStoreInfo | null\n\n // set if output path differs from input (e.g. osslsigncode cannot sign file in-place)\n resultOutputPath?: string\n\n hash: string\n isNest: boolean\n}\n\nexport interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfiguration {\n computeSignToolArgs(isWin: boolean): Array<string>\n}\n\nexport interface CertificateInfo {\n readonly commonName: string\n readonly bloodyMicrosoftSubjectDn: string\n}\n\nexport interface CertificateFromStoreInfo {\n thumbprint: string\n subject: string\n store: string\n isLocalMachineStore: boolean\n}\n\ninterface CertInfo {\n Subject: string\n Thumbprint: string\n PSParentPath: string\n}\n\n/** Extracts the non-Azure signing config from WindowsConfiguration, or null for Azure/unset/disabled. */\nexport function getSigntoolFamilyConfig(config: WindowsConfiguration): WindowsSigntoolFamilyConfig | null {\n const s = resolveWindowsSigningConfiguration(config)\n if (s == null || s.type === \"azure\") {\n return null\n }\n return s\n}\n\n/**\n * Matches configured publisher names against a certificate subject using the same semantics as\n * electron-updater's update signature verifier (windowsExecutableCodeSignatureVerifier): a name that\n * parses as a Distinguished Name (DN) must match every RDN it specifies against the certificate\n * subject (extra subject RDNs are ignored); otherwise it is compared strictly against the\n * certificate's Common Name (CN). Passes when ANY configured name matches — multiple names are\n * supported for certificate rotation.\n */\nexport function publisherNameMatchesCertificate(publisherNames: Array<string>, certInfo: CertificateInfo): boolean {\n const subject = parseDn(certInfo.bloodyMicrosoftSubjectDn)\n return publisherNames.some(name => {\n const dn = parseDn(name)\n if (dn.size) {\n return Array.from(dn.keys()).every(key => dn.get(key) === subject.get(key))\n }\n return name === certInfo.commonName\n })\n}\n\nexport abstract class SigntoolBaseSignManager implements SignManager {\n protected readonly platformSpecificBuildOptions: WindowsConfiguration\n\n constructor(protected readonly packager: WinPackager) {\n this.platformSpecificBuildOptions = packager.platformOptions\n }\n\n readonly computedPublisherName = new Lazy<Array<string> | null>(async () => {\n const signing = getSigntoolFamilyConfig(this.platformSpecificBuildOptions)\n const publisherName = signing?.publisherName\n if (publisherName === null) {\n return null\n } else if (publisherName != null) {\n await this.explicitPublisherNameValidation.value\n return asArray(publisherName)\n }\n\n // A custom `sign` hook signs with a certificate electron-builder doesn't see (not even one named in the config is known to be the one\n // the hook uses), so the publisher name that electron-updater trusts must be configured explicitly.\n if (signing?.sign != null) {\n throw new InvalidConfigurationError(\n \"A custom Windows signing hook (`win.sign.sign`) is configured without `win.sign.publisherName`. \" +\n \"electron-builder cannot tell which certificate the hook signs with, and electron-updater verifies the signature of downloaded updates against the publisherName in app-update.yml. \" +\n 'Set `win.sign.publisherName` to the subject of the certificate that your hook signs with (e.g. \"CN=My Company, O=My Company, C=US\"), ' +\n \"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly.\"\n )\n }\n\n const certInfo = await this.lazyCertInfo.value\n if (certInfo?.commonName) {\n return [certInfo.commonName]\n }\n // Signed with a certificate without a CN: electron-updater verifies downloaded updates against the publisherName in app-update.yml, so\n // the build needs one. Not for `win.sign: false`: nothing is signed.\n if (!isWindowsSigningDisabled(this.platformSpecificBuildOptions) && (await this.cscInfo.value) != null) {\n throw new InvalidConfigurationError(\n \"Windows code signing is configured, but the publisher name cannot be determined at build time (the signing certificate has no Common Name). \" +\n \"electron-updater verifies the signature of downloaded updates against the publisherName in app-update.yml. \" +\n 'Set `win.sign.publisherName` to the subject of the certificate that signs your app (e.g. \"CN=My Company, O=My Company, C=US\"), ' +\n \"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly.\"\n )\n }\n return null\n })\n\n readonly lazyCertInfo = new MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>(\n () => this.cscInfo,\n async csc => {\n const cscInfo = await csc.value\n if (cscInfo == null) {\n return null\n }\n\n if (\"subject\" in cscInfo) {\n const bloodyMicrosoftSubjectDn = cscInfo.subject\n return {\n // empty for a subject without a CN, like readCertInfo, so computedPublisherName requires an explicit publisherName\n commonName: parseDn(bloodyMicrosoftSubjectDn).get(\"CN\") ?? \"\",\n bloodyMicrosoftSubjectDn,\n }\n }\n\n const cscFile = cscInfo.file\n if (cscFile == null) {\n return null\n }\n\n const certExt = path.extname(cscFile).toLowerCase()\n if (certExt === \".p12\" || certExt === \".pfx\") {\n return await this.getCertInfo(cscFile, cscInfo.password || \"\")\n }\n // Non-PKCS12 files (.crt, .cer): parse as plain X.509.\n // Returns null when the CN is absent — caller must set publisherName explicitly.\n return await readCertInfoFromX509(cscFile)\n }\n )\n\n // Memoized so the check runs once per build even though signFile is invoked once per file.\n private readonly explicitPublisherNameValidation = new Lazy<void>(() => this.validateExplicitPublisherName())\n\n /**\n * When `publisherName` is explicitly configured and the subject of the local code signing\n * certificate is known, fail the build if none of the configured names match the certificate.\n * This catches signing with the wrong certificate at build time — otherwise the mismatch only\n * surfaces at update time, when electron-updater rejects every update signed with that\n * certificate.\n *\n * The check is intentionally skipped whenever the actual signing certificate's subject is not\n * genuinely known: custom `sign` hooks, PKCS#11 without an extractable certificate file,\n * x509 certificate files without a CN, or any error while reading certificate info.\n * An explicit `publisherName: null` remains a pure opt-out (nothing to validate).\n */\n protected async validateExplicitPublisherName(): Promise<void> {\n const signing = getSigntoolFamilyConfig(this.platformSpecificBuildOptions)\n const publisherName = signing?.publisherName\n if (publisherName == null) {\n // not configured (auto-derive) or explicit `null` opt-out — nothing to validate\n return\n }\n if (signing?.sign != null) {\n // custom sign hook: electron-builder does not know which certificate the hook actually signs with\n return\n }\n const publisherNames = asArray(publisherName)\n if (publisherNames.length === 0) {\n return\n }\n\n let certInfo: CertificateInfo | null\n try {\n certInfo = await this.lazyCertInfo.value\n } catch (e: any) {\n // this check must only fire when the signing certificate's subject is genuinely known\n log.debug({ error: e.message || e }, \"skipping publisherName validation against the signing certificate (cannot read certificate info)\")\n return\n }\n if (certInfo == null) {\n return\n }\n\n if (!publisherNameMatchesCertificate(publisherNames, certInfo)) {\n throw new InvalidConfigurationError(\n `The configured publisherName does not match the subject of the code signing certificate. ` +\n `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` +\n ` Configured publisherName: ${publisherNames.join(\" | \")}\\n` +\n ` Certificate subject: ${certInfo.bloodyMicrosoftSubjectDn}\\n` +\n `Fix win.sign.publisherName (or sign with the intended certificate). To opt out of update signature verification entirely, set publisherName to null.`\n )\n }\n }\n\n readonly cscInfo = new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(\n () => this.platformSpecificBuildOptions,\n platformSpecificBuildOptions => {\n const signing = getSigntoolFamilyConfig(platformSpecificBuildOptions)\n // signtool is the implicit default when win.sign is unset, so an absent config still\n // honours the WIN_CSC_LINK/cscLink fallback below (hsm/pkcs11 set signing.type explicitly).\n const isSigntool = signing == null || signing.type === \"signtool\"\n\n // signtool + hsm: store-based cert takes priority\n const subjectName = (signing as WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | null)?.certificateSubjectName\n const shaType = (signing as WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | null)?.certificateSha1\n if (subjectName != null || shaType != null) {\n return this.packager.vm.value\n .then(vm => this.getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))\n .catch((e: any) => {\n // https://github.com/electron-userland/electron-builder/pull/2397\n if (signing?.sign == null) {\n throw e\n } else {\n log.debug({ error: e }, \"getCertificateFromStoreInfo error\")\n return null\n }\n })\n }\n\n const certificateFile = signing?.certificateFile\n if (certificateFile != null) {\n // Only signtool mode uses a password (HSM private key lives in the HSM, not the cert file)\n const certificatePassword = isSigntool ? this.packager.getCscPassword() : null\n return Promise.resolve({\n file: certificateFile,\n password: certificatePassword == null ? null : certificatePassword.trim(),\n })\n }\n\n // WIN_CSC_LINK env var fallback: only for signtool mode (including the implicit default)\n if (isSigntool) {\n const cscLink = this.packager.getCscLink(\"WIN_CSC_LINK\")\n if (cscLink == null || cscLink === \"\") {\n return Promise.resolve(null)\n }\n\n return importCertificate(cscLink, this.packager.tempDirManager, this.packager.projectDir)\n .catch((e: any) => {\n if (e instanceof InvalidConfigurationError) {\n throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)\n } else {\n throw e\n }\n })\n .then(p => ({\n file: p,\n password: this.packager.getCscPassword(),\n }))\n }\n\n return Promise.resolve(null)\n }\n )\n\n initialize(): Promise<void> {\n return Promise.resolve()\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n async computePublisherName(target: Target, publisherName: string | null) {\n if ((target instanceof AppXTarget || target instanceof MsixTarget) && (await this.cscInfo.value) == null) {\n log.info({ reason: \"Windows Store only build\" }, \"AppX/MSIX package is not signed\")\n return publisherName ?? \"CN=ms\"\n }\n\n // When a signing cert is available, the cert's subject MUST be used so the APPX package\n // Publisher attribute matches the certificate — any mismatch causes SignerSign to fail with\n // ERROR_BAD_FORMAT. Only honour a user-supplied publisherName if it was explicitly configured\n // (non-null); otherwise derive from the certificate.\n const certInfo = await this.lazyCertInfo.value\n const publisher = publisherName ?? certInfo?.bloodyMicrosoftSubjectDn ?? null\n if (publisher == null) {\n throw new Error(\"Internal error: cannot compute subject using certificate info\")\n }\n return publisher\n }\n\n /**\n * Called when cscInfo is null. Returns true to skip signing, false to proceed, or throws.\n * Override in subclasses with different null-cert behaviour (HSM throws, PKCS#11 proceeds).\n */\n protected handleNullCscInfo(customSign: CustomWindowsSign | string | null | undefined): boolean {\n return !customSign // default: skip when no cert and no custom sign hook\n }\n\n async signFile(options: WindowsSignOptions): Promise<SignFileResult> {\n const signing = getSigntoolFamilyConfig(options.options)\n let hashes = signing?.signingHashAlgorithms\n // msi does not support dual-signing\n if (options.path.endsWith(\".msi\")) {\n hashes = [hashes != null && !hashes.includes(\"sha1\") ? \"sha256\" : \"sha1\"]\n } else if (options.path.endsWith(\".appx\") || options.path.endsWith(\".msix\") || options.path.endsWith(\".msixbundle\")) {\n hashes = [\"sha256\"]\n } else if (hashes == null) {\n hashes = [\"sha1\", \"sha256\"]\n } else {\n hashes = Array.isArray(hashes) ? hashes : [hashes]\n }\n\n const name = this.packager.appInfo.productName\n const site = await this.packager.appInfo.computePackageUrl()\n\n const customSign = await resolveFunction(this.packager.appInfo.type, signing?.sign, \"sign\", await this.packager.getWorkspaceRoot())\n\n const cscInfo = await this.cscInfo.value\n\n if (cscInfo) {\n let logInfo: any = {\n file: log.filePath(options.path),\n }\n if (\"file\" in cscInfo) {\n logInfo = { ...logInfo, certificateFile: cscInfo.file }\n } else {\n logInfo = {\n ...logInfo,\n subject: cscInfo.subject,\n thumbprint: cscInfo.thumbprint,\n store: cscInfo.store,\n user: cscInfo.isLocalMachineStore ? \"local machine\" : \"current user\",\n }\n }\n log.info(logInfo, \"signing\")\n // validate an explicitly configured publisherName against the signing certificate before the\n // first file is signed, so a wrong-certificate build fails even when no publish config exists\n await this.explicitPublisherNameValidation.value\n } else if (this.handleNullCscInfo(customSign)) {\n // the canonical \"signing skipped\" message is logged once in signWindows, which receives this reason\n return \"skipped:no-certificate\"\n }\n\n const executor = customSign || ((config: CustomWindowsSignTaskConfiguration, packager: WinPackager) => this.doSign(config, packager))\n let isNest = false\n for (const hash of hashes) {\n const taskConfiguration: WindowsSignTaskConfiguration = { ...options, name, site, cscInfo, hash, isNest }\n await Promise.resolve(\n executor(\n {\n ...taskConfiguration,\n computeSignToolArgs: isWin => this.computeSignToolArgs(taskConfiguration, isWin),\n },\n this.packager\n )\n )\n isNest = true\n if (taskConfiguration.resultOutputPath != null) {\n await rename(taskConfiguration.resultOutputPath, options.path)\n }\n }\n\n return customSign ? \"signed:custom\" : \"signed\"\n }\n\n async getCertInfo(file: string, password: string): Promise<CertificateInfo> {\n const errorMessagePrefix = \"Cannot extract publisher name from code signing certificate. As workaround, set win.sign.publisherName. Error: \"\n try {\n return await readCertInfo(file, password)\n } catch (e: any) {\n throw new InvalidConfigurationError(`${errorMessagePrefix}${e.message || e}`)\n }\n }\n\n // on windows be aware of http://stackoverflow.com/a/32640183/1910191\n computeSignToolArgs(options: WindowsSignTaskConfiguration, isWin: boolean, vm: VmManager = new VmManager()): Array<string> {\n return isWin ? this.computeWindowsSignArgs(options, vm) : this.computeOsslsigncodeArgs(options, vm)\n }\n\n protected isLegacyToolset(): boolean {\n const v = this.packager.config.toolsets?.winCodeSign\n // Only an explicit \"0.0.0\" pin is legacy; unset / null / \"latest\" / custom now resolve to a modern bundle.\n return v === \"0.0.0\"\n }\n\n protected abstract computeWindowsSignArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string>\n protected abstract computeOsslsigncodeArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string>\n\n // allowX509: set to true by HsmSignManager to permit .crt/.cer (public chain only, key is in HSM).\n protected addCertificateArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean, allowX509 = false): void {\n if (options.cscInfo == null) {\n throw new Error(\"No code signing certificate configured. Provide certificateFile, certificateSha1, or certificateSubjectName.\")\n }\n const certificateFile = (options.cscInfo as FileCodeSigningInfo).file\n\n if (certificateFile == null) {\n // Certificate from store (Windows only)\n if (!isWin) {\n throw new Error(\"certificateSha1/certificateSubjectName supported only on Windows\")\n }\n\n const cscInfo = options.cscInfo as CertificateFromStoreInfo\n args.push(\"/sha1\", cscInfo.thumbprint)\n args.push(\"/s\", cscInfo.store)\n if (cscInfo.isLocalMachineStore) {\n args.push(\"/sm\")\n }\n } else {\n const certExtension = path.extname(certificateFile).toLowerCase()\n\n if (certExtension === \".p12\" || certExtension === \".pfx\") {\n args.push(isWin ? \"/f\" : \"-pkcs12\", vm.toVmFile(certificateFile))\n } else if (isWin && allowX509 && (certExtension === \".crt\" || certExtension === \".cer\")) {\n args.push(\"/f\", vm.toVmFile(certificateFile))\n } else {\n throw new InvalidConfigurationError(`Please specify pkcs12 (.p12/.pfx) file, ${certificateFile} is not correct`)\n }\n }\n }\n\n protected addCommonSigningArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean): void {\n if (options.name) {\n args.push(isWin ? \"/d\" : \"-n\", options.name)\n }\n\n if (options.site) {\n args.push(isWin ? \"/du\" : \"-i\", options.site)\n }\n\n if (options.isNest) {\n args.push(isWin ? \"/as\" : \"-nest\")\n }\n\n const password = (options.cscInfo as FileCodeSigningInfo)?.password\n if (password) {\n args.push(isWin ? \"/p\" : \"-pass\", password)\n }\n\n const signing = getSigntoolFamilyConfig(options.options)\n const additionalCert = signing?.additionalCertificateFile\n if (additionalCert) {\n args.push(isWin ? \"/ac\" : \"-ac\", vm.toVmFile(additionalCert))\n }\n }\n\n getOutputPath(inputPath: string, hash: string) {\n const extension = path.extname(inputPath)\n return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`)\n }\n\n async getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise<CertificateFromStoreInfo> {\n const signing = getSigntoolFamilyConfig(options) as WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | null\n const certificateSubjectName = signing?.certificateSubjectName\n const certificateSha1 = signing?.certificateSha1?.toUpperCase()\n\n const ps = await vm.powershellCommand.value\n const rawResult = await vm.exec(ps, [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n \"Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress\",\n ])\n const certList = rawResult.length === 0 ? [] : asArray<CertInfo>(JSON.parse(rawResult))\n for (const certInfo of certList) {\n if (\n (certificateSubjectName != null && !certInfo.Subject.includes(certificateSubjectName)) ||\n (certificateSha1 != null && certInfo.Thumbprint.toUpperCase() !== certificateSha1)\n ) {\n continue\n }\n\n const parentPath = certInfo.PSParentPath\n const store = parentPath.substring(parentPath.lastIndexOf(\"\\\\\") + 1)\n log.debug({ store, PSParentPath: parentPath }, \"auto-detect certificate store\")\n // https://github.com/electron-userland/electron-builder/issues/1717\n const isLocalMachineStore = parentPath.includes(\"Certificate::LocalMachine\")\n log.debug(null, \"auto-detect using of LocalMachine store\")\n return {\n thumbprint: certInfo.Thumbprint,\n subject: certInfo.Subject,\n store,\n isLocalMachineStore,\n }\n }\n\n throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`)\n }\n\n async getToolPath(isWin = process.platform === \"win32\"): Promise<ToolInfo> {\n return getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin, this.packager.buildResourcesDir)\n }\n\n async doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {\n // https://github.com/electron-userland/electron-builder/pull/1944\n const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000\n let args: Array<string>\n let vm: VmManager\n // cscInfo can be null (e.g. PKCS#11 with no cert file); guard before using `in`.\n // CertificateFromStoreInfo (no `file` property) requires a Windows VM for cert-store lookup.\n const cscInfo = configuration.cscInfo\n const useVmIfNotOnWin = configuration.path.endsWith(\".appx\") || (cscInfo != null && !(\"file\" in cscInfo))\n const isWin = process.platform === \"win32\" || useVmIfNotOnWin\n const toolInfo = await getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin, this.packager.buildResourcesDir)\n const tool = toolInfo.path\n if (useVmIfNotOnWin) {\n vm = await packager.vm.value\n args = this.computeSignToolArgs(configuration, isWin, vm)\n } else {\n vm = new VmManager()\n args = configuration.computeSignToolArgs(isWin)\n }\n\n // signtool.exe (`/f`) is not safe to run concurrently — it races on the shared per-user crypto store.\n // Serialize real-Windows signtool invocations across processes; osslsigncode (`!isWin`) is file-isolated.\n const execSign = () => vm.exec(tool, args, { timeout, env: { ...process.env, ...(toolInfo.env || {}) } })\n await retry(() => (isWin ? withSigntoolLock(execSign) : execSign()), {\n retries: 2,\n interval: 15000,\n backoff: 10000,\n shouldRetry: (e: any) => {\n if (\n e.message.includes(\"The file is being used by another process\") ||\n e.message.includes(\"The specified timestamp server either could not be reached\") ||\n e.message.includes(\"No certificates were found that met all the given criteria.\") ||\n // Transient failure of SignerSignEx after cert selection, typically a concurrent-signtool race\n // on the per-user crypto store; the cross-process lock above makes this rare, retry covers the rest.\n e.message.includes(\"An error occurred while attempting to load the signing certificate\")\n ) {\n log.warn(`Attempt to code sign failed, another attempt will be made in 15 seconds: ${e.message}`)\n return true\n }\n return false\n },\n })\n }\n}\n\nexport class SigntoolSignManager extends SigntoolBaseSignManager {\n protected computeWindowsSignArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const signing = getSigntoolFamilyConfig(options.options)\n\n const inputFile = vm.toVmFile(options.path)\n const args = [\"sign\"]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const isRfc3161 = options.isNest || options.hash === \"sha256\"\n args.push(isRfc3161 ? \"/tr\" : \"/t\")\n const timestampUrl = isRfc3161 ? signing?.rfc3161TimeStampServer || \"http://timestamp.digicert.com\" : signing?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(timestampUrl)\n }\n\n // Certificate\n this.addCertificateArgs(args, options, vm, true)\n\n // Hash algorithm\n if (this.isLegacyToolset()) {\n // Legacy v0.0.0: Only add /fd for non-SHA1 (original behavior)\n if (options.hash !== \"sha1\") {\n args.push(\"/fd\", options.hash)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n args.push(\"/td\", \"sha256\")\n }\n }\n } else {\n // Modern: Always add /fd (required by new Windows Kits)\n args.push(\"/fd\", options.hash.toLowerCase())\n // Only add /td for RFC3161 timestamps (incompatible with /t)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\" && (options.isNest || options.hash === \"sha256\")) {\n args.push(\"/td\", \"sha256\")\n }\n }\n\n // Optional parameters\n this.addCommonSigningArgs(args, options, vm, true)\n\n // Windows-specific\n args.push(\"/debug\")\n args.push(inputFile) // Must be last\n\n return args\n }\n\n protected computeOsslsigncodeArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const signing = getSigntoolFamilyConfig(options.options)\n\n const inputFile = vm.toVmFile(options.path)\n const outputPath = this.getOutputPath(inputFile, options.hash)\n options.resultOutputPath = outputPath\n\n const args = [\"sign\", \"-in\", inputFile, \"-out\", outputPath]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const timestampUrl = signing?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(\"-t\", timestampUrl)\n }\n\n // Certificate file\n this.addCertificateArgs(args, options, vm, false)\n\n // Hash algorithm\n args.push(\"-h\", options.hash.toLowerCase())\n\n // Optional parameters (name, site, nest, password, additionalCert)\n this.addCommonSigningArgs(args, options, vm, false)\n\n // Proxy support\n const httpsProxy = process.env.HTTPS_PROXY\n if (httpsProxy?.length) {\n args.push(\"-p\", httpsProxy)\n }\n\n return args\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"signtoolBaseSignManager.js","sourceRoot":"","sources":["../../../src/codeSign/win/signtoolBaseSignManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAC7E,OAAO,EAAE,kBAAkB,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,mEAAmE;QACnE,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAA;QAEnD,gBAAgB;QAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAA;QAC1C,IAAI,UAAU,EAAE,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAC7B,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,4BAA4B,CAAC,QAAgB,EAAE,UAA2E;IACxI,MAAM,SAAS,GAAG,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACjE,IAAI,SAAS,IAAI,IAAI,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,yBAAyB,CACjC,uOAAuO,CACxO,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;IAChD,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IACjF,CAAC;IACD,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,aAAa,EAAE,CAAC;QAChE,OAAO,CAAC,QAAQ,CAAC,CAAA;IACnB,CAAC;IACD,OAAO,SAAS,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AACxC,CAAC","sourcesContent":["import { asArray, InvalidConfigurationError, log, retry } from \"builder-util\"\nimport { matchPublisherName, MemoLazy, parseDn, POWERSHELL_ASCII_ESCAPE_FUNCTION } from \"builder-util-runtime\"\nimport _fsExtra from \"fs-extra\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { Target } from \"../../core.js\"\nimport {\n isWindowsSigningDisabled,\n resolveWindowsSigningConfiguration,\n WindowsConfiguration,\n WindowsHsmSigningConfig,\n WindowsSigntoolFamilyConfig,\n WindowsSigntoolSigningConfig,\n} from \"../../options/winOptions.js\"\nimport AppXTarget from \"../../targets/win/AppxTarget.js\"\nimport MsixTarget from \"../../targets/win/MsixTarget.js\"\nimport { getSignToolPath } from \"../../toolsets/winCodeSign.js\"\nimport { ToolInfo } from \"../../util/bundledTool.js\"\nimport { resolveFunction } from \"../../util/resolve.js\"\nimport { withSigntoolLock } from \"../../util/toolsetLock.js\"\nimport { readCertInfo, readCertInfoFromX509 } from \"../certInfo.js\"\nimport { VmManager } from \"../../vm/vm.js\"\nimport type { WinPackager } from \"../../winPackager.js\"\nimport { importCertificate } from \"../codesign.js\"\nimport { derivePublisherName, PUBLISHER_NAME_DN_DOCS_URL, validatePublisherNameFormat } from \"./publisherName.js\"\nimport type { SignManager } from \"./signManager.js\"\nimport { WindowsSignOptions } from \"./windowsCodeSign.js\"\nimport { SignFileResult } from \"../signResult.js\"\nimport { BUILD_CHANGES_URL } from \"../../util/config/legacyOptions.js\"\n\nconst PUBLISHER_NAME_DOCS = `${BUILD_CHANGES_URL}#windows-publishername-is-validated-against-the-signing-certificate`\nconst { rename } = _fsExtra\n\nexport type CustomWindowsSign = (configuration: CustomWindowsSignTaskConfiguration, packager?: WinPackager) => Promise<any>\n\nexport interface WindowsSignToolOptions extends WindowsSignOptions {\n readonly name: string\n readonly site: string | null\n}\n\nexport interface FileCodeSigningInfo {\n readonly file: string\n readonly password: string | null\n}\n\nexport interface WindowsSignTaskConfiguration extends WindowsSignToolOptions {\n readonly cscInfo: FileCodeSigningInfo | CertificateFromStoreInfo | null\n\n // set if output path differs from input (e.g. osslsigncode cannot sign file in-place)\n resultOutputPath?: string\n\n hash: string\n isNest: boolean\n}\n\nexport interface CustomWindowsSignTaskConfiguration extends WindowsSignTaskConfiguration {\n computeSignToolArgs(isWin: boolean): Array<string>\n}\n\nexport interface CertificateInfo {\n readonly commonName: string\n readonly bloodyMicrosoftSubjectDn: string\n /**\n * The subject in the format Windows reports it (`X509Certificate2.Subject`), which electron-updater matches\n * publisherName against. Unset when `bloodyMicrosoftSubjectDn` already is in that format (certificate store).\n */\n readonly windowsSubjectDn?: string\n}\n\nexport interface CertificateFromStoreInfo {\n thumbprint: string\n subject: string\n store: string\n isLocalMachineStore: boolean\n}\n\ninterface CertInfo {\n Subject: string\n Thumbprint: string\n PSParentPath: string\n}\n\n/** Extracts the non-Azure signing config from WindowsConfiguration, or null for Azure/unset/disabled. */\nexport function getSigntoolFamilyConfig(config: WindowsConfiguration): WindowsSigntoolFamilyConfig | null {\n const s = resolveWindowsSigningConfiguration(config)\n if (s == null || s.type === \"azure\") {\n return null\n }\n return s\n}\n\n/** The certificate subject in the format Windows reports it, which electron-updater matches publisherName against. */\nexport function certificateWindowsSubjectDn(certInfo: CertificateInfo): string {\n return certInfo.windowsSubjectDn ?? certInfo.bloodyMicrosoftSubjectDn\n}\n\n/**\n * Matches configured publisher names against a certificate subject with the matcher electron-updater's update\n * signature verifier uses ({@link matchPublisherName}): a name must be a Distinguished Name (DN), and every RDN it\n * specifies must equal the certificate subject's (extra subject RDNs are ignored). Passes when ANY\n * configured name matches — multiple names are supported for certificate rotation. The subject is taken in the format\n * Windows reports it (as the updater sees it).\n */\nexport function publisherNameMatchesCertificate(publisherNames: Array<string>, certInfo: CertificateInfo): boolean {\n // matchPublisherName takes the parsed Get-AuthenticodeSignature output, as electron-updater passes it\n return matchPublisherName({ SignerCertificate: { Subject: certificateWindowsSubjectDn(certInfo) } }, publisherNames)\n}\n\nexport abstract class SigntoolBaseSignManager implements SignManager {\n protected readonly platformSpecificBuildOptions: WindowsConfiguration\n\n constructor(protected readonly packager: WinPackager) {\n this.platformSpecificBuildOptions = packager.platformOptions\n }\n\n readonly computedPublisherName = new Lazy<Array<string> | null>(async () => {\n // `win.sign: false` / `null` signs nothing, so no publisherName is derived: a build that writes app-update.yml then needs\n // win.verifyUpdateCodeSignature: false (or a win.sign object with publisherName), see missingUpdatePublisherNameError.\n if (isWindowsSigningDisabled(this.platformSpecificBuildOptions)) {\n return null\n }\n\n const signing = getSigntoolFamilyConfig(this.platformSpecificBuildOptions)\n const publisherName = signing?.publisherName\n if (publisherName === null) {\n return null\n } else if (publisherName != null) {\n await this.explicitPublisherNameValidation.value\n return asArray(publisherName)\n }\n\n // A custom `sign` hook signs with a certificate electron-builder doesn't see (not even one named in the config is known to be the one\n // the hook uses), so the publisher name that electron-updater trusts must be configured explicitly.\n if (signing?.sign != null) {\n throw new InvalidConfigurationError(\n \"A custom Windows signing hook (`win.sign.sign`) is configured without `win.sign.publisherName`. \" +\n \"electron-builder cannot tell which certificate the hook signs with, and electron-updater verifies the signature of downloaded updates against the publisherName in app-update.yml. \" +\n 'Set `win.sign.publisherName` to the subject of the certificate that your hook signs with, as a distinguished name (e.g. \"CN=My Company, O=My Company, C=US\"), ' +\n \"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly. \" +\n `See ${PUBLISHER_NAME_DOCS}`\n )\n }\n\n const certInfo = await this.lazyCertInfo.value\n if (certInfo?.commonName) {\n // `CN=<common name>`, quoted as Windows reports the signer subject (which electron-updater 7 matches against): pinning only the CN\n // keeps updates working across a certificate renewal that changes other subject attributes. A stricter pin is an explicit publisherName.\n return [derivePublisherName(certInfo.commonName)]\n }\n // Signed with a certificate without a CN (or whose subject cannot be read): electron-updater verifies downloaded updates against the\n // publisherName in app-update.yml, so the build needs one.\n if ((await this.cscInfo.value) != null) {\n throw new InvalidConfigurationError(\n \"Windows code signing is configured, but the publisher name cannot be determined at build time (the signing certificate has no Common Name). \" +\n \"electron-updater verifies the signature of downloaded updates against the publisherName in app-update.yml. \" +\n 'Set `win.sign.publisherName` to the subject of the certificate that signs your app, as a distinguished name (e.g. \"CN=My Company, O=My Company, C=US\"), ' +\n \"or set `win.verifyUpdateCodeSignature: false` (only if your updates are not Authenticode-signed or you don't use electron-updater) to opt out of update signature verification explicitly. \" +\n `See ${PUBLISHER_NAME_DN_DOCS_URL}`\n )\n }\n return null\n })\n\n readonly lazyCertInfo = new MemoLazy<MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>, CertificateInfo | null>(\n () => this.cscInfo,\n async csc => {\n const cscInfo = await csc.value\n if (cscInfo == null) {\n return null\n }\n\n if (\"subject\" in cscInfo) {\n const bloodyMicrosoftSubjectDn = cscInfo.subject\n return {\n // empty for a subject without a CN, like readCertInfo, so computedPublisherName requires an explicit publisherName\n commonName: parseDn(bloodyMicrosoftSubjectDn).get(\"CN\") ?? \"\",\n // read from the Windows certificate store, so already in the format Windows reports (windowsSubjectDn falls back to it)\n bloodyMicrosoftSubjectDn,\n }\n }\n\n const cscFile = cscInfo.file\n if (cscFile == null) {\n return null\n }\n\n const certExt = path.extname(cscFile).toLowerCase()\n if (certExt === \".p12\" || certExt === \".pfx\") {\n return await this.getCertInfo(cscFile, cscInfo.password || \"\")\n }\n // Non-PKCS12 files (.crt, .cer): parse as plain X.509.\n // Returns null when the CN is absent — caller must set publisherName explicitly.\n return await readCertInfoFromX509(cscFile)\n }\n )\n\n // Memoized so the check runs once per build even though signFile is invoked once per file.\n private readonly explicitPublisherNameValidation = new Lazy<void>(() => this.validateExplicitPublisherName())\n\n /**\n * When `publisherName` is explicitly configured, fail the build if an entry is not a distinguished name\n * (electron-updater 7 never matches one), whatever the signing route. Then, when the subject of the local code\n * signing certificate is known, fail the build if none of the configured names match the certificate.\n * This catches signing with the wrong certificate at build time — otherwise the mismatch only\n * surfaces at update time, when electron-updater rejects every update signed with that\n * certificate.\n *\n * The check is intentionally skipped whenever the actual signing certificate's subject is not\n * genuinely known: custom `sign` hooks, PKCS#11 without an extractable certificate file,\n * x509 certificate files without a CN, or any error while reading certificate info.\n * An explicit `publisherName: null` has nothing to validate (a build that writes `app-update.yml` with it fails in PublishManager).\n */\n protected async validateExplicitPublisherName(): Promise<void> {\n const signing = getSigntoolFamilyConfig(this.platformSpecificBuildOptions)\n const publisherName = signing?.publisherName\n if (publisherName == null) {\n // not configured (auto-derive) or explicit `null` (no opt-out any more: rejected where app-update.yml is written) — nothing to validate\n return\n }\n validatePublisherNameFormat(publisherName)\n if (signing?.sign != null) {\n // custom sign hook: electron-builder does not know which certificate the hook actually signs with\n return\n }\n const publisherNames = asArray(publisherName)\n if (publisherNames.length === 0) {\n return\n }\n\n let certInfo: CertificateInfo | null\n try {\n certInfo = await this.lazyCertInfo.value\n } catch (e: any) {\n // this check must only fire when the signing certificate's subject is genuinely known\n log.debug({ error: e.message || e }, \"skipping publisherName validation against the signing certificate (cannot read certificate info)\")\n return\n }\n if (certInfo == null) {\n return\n }\n\n if (!publisherNameMatchesCertificate(publisherNames, certInfo)) {\n throw new InvalidConfigurationError(\n `The configured publisherName does not match the subject of the code signing certificate. ` +\n `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` +\n ` Configured publisherName: ${publisherNames.join(\" | \")}\\n` +\n ` Certificate subject: ${certificateWindowsSubjectDn(certInfo)}\\n` +\n `Fix win.sign.publisherName (or sign with the intended certificate). To opt out of update signature verification entirely, set win.verifyUpdateCodeSignature: false.`\n )\n }\n }\n\n readonly cscInfo = new MemoLazy<WindowsConfiguration, FileCodeSigningInfo | CertificateFromStoreInfo | null>(\n () => this.platformSpecificBuildOptions,\n platformSpecificBuildOptions => {\n // `win.sign: false` / `null` signs nothing: no certificate is read (not even from CSC_LINK / WIN_CSC_LINK), so none\n // supplies an AppX/MSIX publisher, a publisherName for app-update.yml or a build-cache digest.\n if (isWindowsSigningDisabled(platformSpecificBuildOptions)) {\n return Promise.resolve(null)\n }\n const signing = getSigntoolFamilyConfig(platformSpecificBuildOptions)\n // signtool is the implicit default when win.sign is unset, so an absent config still\n // honours the WIN_CSC_LINK/cscLink fallback below (hsm/pkcs11 set signing.type explicitly).\n const isSigntool = signing == null || signing.type === \"signtool\"\n\n // signtool + hsm: store-based cert takes priority\n const subjectName = (signing as WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | null)?.certificateSubjectName\n const shaType = (signing as WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | null)?.certificateSha1\n if (subjectName != null || shaType != null) {\n return this.packager.vm.value\n .then(vm => this.getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))\n .catch((e: any) => {\n // https://github.com/electron-userland/electron-builder/pull/2397\n if (signing?.sign == null) {\n throw e\n } else {\n log.debug({ error: e }, \"getCertificateFromStoreInfo error\")\n return null\n }\n })\n }\n\n const certificateFile = signing?.certificateFile\n if (certificateFile != null) {\n // Only signtool mode uses a password (HSM private key lives in the HSM, not the cert file)\n const certificatePassword = isSigntool ? this.packager.getCscPassword() : null\n return Promise.resolve({\n file: certificateFile,\n password: certificatePassword == null ? null : certificatePassword.trim(),\n })\n }\n\n // WIN_CSC_LINK env var fallback: only for signtool mode (including the implicit default)\n if (isSigntool) {\n const cscLink = this.packager.getCscLink(\"WIN_CSC_LINK\")\n if (cscLink == null || cscLink === \"\") {\n return Promise.resolve(null)\n }\n\n return importCertificate(cscLink, this.packager.tempDirManager, this.packager.projectDir)\n .catch((e: any) => {\n if (e instanceof InvalidConfigurationError) {\n throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)\n } else {\n throw e\n }\n })\n .then(p => ({\n file: p,\n password: this.packager.getCscPassword(),\n }))\n }\n\n return Promise.resolve(null)\n }\n )\n\n initialize(): Promise<void> {\n return Promise.resolve()\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n async computePublisherName(target: Target, publisherName: string | null) {\n if ((target instanceof AppXTarget || target instanceof MsixTarget) && (await this.cscInfo.value) == null) {\n log.info({ reason: \"Windows Store only build\" }, \"AppX/MSIX package is not signed\")\n return publisherName ?? \"CN=ms\"\n }\n\n // When a signing cert is available, the cert's subject MUST be used so the APPX package\n // Publisher attribute matches the certificate — any mismatch causes SignerSign to fail with\n // ERROR_BAD_FORMAT. Only honour a user-supplied publisherName if it was explicitly configured\n // (non-null); otherwise derive from the certificate. The subject is written in the format Windows reports it\n // (`, `-separated, Windows attribute names such as S): MakeAppx rejects a multi-RDN Publisher separated by a bare `,`\n // or using the OpenSSL name ST.\n const certInfo = await this.lazyCertInfo.value\n const publisher = publisherName ?? (certInfo == null ? null : certificateWindowsSubjectDn(certInfo))\n if (publisher == null) {\n throw new Error(\"Internal error: cannot compute subject using certificate info\")\n }\n return publisher\n }\n\n /**\n * Called when cscInfo is null. Returns true to skip signing, false to proceed, or throws.\n * Override in subclasses with different null-cert behaviour (HSM throws, PKCS#11 proceeds).\n */\n protected handleNullCscInfo(customSign: CustomWindowsSign | string | null | undefined): boolean {\n return !customSign // default: skip when no cert and no custom sign hook\n }\n\n async signFile(options: WindowsSignOptions): Promise<SignFileResult> {\n const signing = getSigntoolFamilyConfig(options.options)\n const hashes = resolveSigningHashAlgorithms(options.path, signing?.signingHashAlgorithms)\n\n const name = this.packager.appInfo.productName\n const site = await this.packager.appInfo.computePackageUrl()\n\n const customSign = await resolveFunction(this.packager.appInfo.type, signing?.sign, \"sign\", await this.packager.getWorkspaceRoot())\n\n const cscInfo = await this.cscInfo.value\n\n if (cscInfo) {\n let logInfo: any = {\n file: log.filePath(options.path),\n }\n if (\"file\" in cscInfo) {\n logInfo = { ...logInfo, certificateFile: cscInfo.file }\n } else {\n logInfo = {\n ...logInfo,\n subject: cscInfo.subject,\n thumbprint: cscInfo.thumbprint,\n store: cscInfo.store,\n user: cscInfo.isLocalMachineStore ? \"local machine\" : \"current user\",\n }\n }\n log.info(logInfo, \"signing\")\n } else if (this.handleNullCscInfo(customSign)) {\n // the canonical \"signing skipped\" message is logged once in signWindows, which receives this reason\n return \"skipped:no-certificate\"\n }\n // validate an explicitly configured publisherName (its format on every signing route, and against the signing certificate when\n // known) before the first file is signed, so a wrong-certificate build fails even when no publish config exists\n await this.explicitPublisherNameValidation.value\n\n const executor = customSign || ((config: CustomWindowsSignTaskConfiguration, packager: WinPackager) => this.doSign(config, packager))\n let isNest = false\n for (const hash of hashes) {\n const taskConfiguration: WindowsSignTaskConfiguration = { ...options, name, site, cscInfo, hash, isNest }\n await Promise.resolve(\n executor(\n {\n ...taskConfiguration,\n computeSignToolArgs: isWin => this.computeSignToolArgs(taskConfiguration, isWin),\n },\n this.packager\n )\n )\n isNest = true\n if (taskConfiguration.resultOutputPath != null) {\n await rename(taskConfiguration.resultOutputPath, options.path)\n }\n }\n\n return customSign ? \"signed:custom\" : \"signed\"\n }\n\n async getCertInfo(file: string, password: string): Promise<CertificateInfo> {\n const errorMessagePrefix = \"Cannot extract publisher name from code signing certificate. As workaround, set win.sign.publisherName. Error: \"\n try {\n return await readCertInfo(file, password)\n } catch (e: any) {\n throw new InvalidConfigurationError(`${errorMessagePrefix}${e.message || e}`)\n }\n }\n\n // on windows be aware of http://stackoverflow.com/a/32640183/1910191\n computeSignToolArgs(options: WindowsSignTaskConfiguration, isWin: boolean, vm: VmManager = new VmManager()): Array<string> {\n return isWin ? this.computeWindowsSignArgs(options, vm) : this.computeOsslsigncodeArgs(options, vm)\n }\n\n protected isLegacyToolset(): boolean {\n const v = this.packager.config.toolsets?.winCodeSign\n // Only an explicit \"0.0.0\" pin is legacy; unset / null / \"latest\" / custom now resolve to a modern bundle.\n return v === \"0.0.0\"\n }\n\n protected abstract computeWindowsSignArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string>\n protected abstract computeOsslsigncodeArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string>\n\n // allowX509: set to true by HsmSignManager to permit .crt/.cer (public chain only, key is in HSM).\n protected addCertificateArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean, allowX509 = false): void {\n if (options.cscInfo == null) {\n throw new Error(\"No code signing certificate configured. Provide certificateFile, certificateSha1, or certificateSubjectName.\")\n }\n const certificateFile = (options.cscInfo as FileCodeSigningInfo).file\n\n if (certificateFile == null) {\n // Certificate from store (Windows only)\n if (!isWin) {\n throw new Error(\"certificateSha1/certificateSubjectName supported only on Windows\")\n }\n\n const cscInfo = options.cscInfo as CertificateFromStoreInfo\n args.push(\"/sha1\", cscInfo.thumbprint)\n args.push(\"/s\", cscInfo.store)\n if (cscInfo.isLocalMachineStore) {\n args.push(\"/sm\")\n }\n } else {\n const certExtension = path.extname(certificateFile).toLowerCase()\n\n if (certExtension === \".p12\" || certExtension === \".pfx\") {\n args.push(isWin ? \"/f\" : \"-pkcs12\", vm.toVmFile(certificateFile))\n } else if (isWin && allowX509 && (certExtension === \".crt\" || certExtension === \".cer\")) {\n args.push(\"/f\", vm.toVmFile(certificateFile))\n } else {\n throw new InvalidConfigurationError(`Please specify pkcs12 (.p12/.pfx) file, ${certificateFile} is not correct`)\n }\n }\n }\n\n protected addCommonSigningArgs(args: Array<string>, options: WindowsSignTaskConfiguration, vm: VmManager, isWin: boolean): void {\n if (options.name) {\n args.push(isWin ? \"/d\" : \"-n\", options.name)\n }\n\n if (options.site) {\n args.push(isWin ? \"/du\" : \"-i\", options.site)\n }\n\n if (options.isNest) {\n args.push(isWin ? \"/as\" : \"-nest\")\n }\n\n const password = (options.cscInfo as FileCodeSigningInfo)?.password\n if (password) {\n args.push(isWin ? \"/p\" : \"-pass\", password)\n }\n\n const signing = getSigntoolFamilyConfig(options.options)\n const additionalCert = signing?.additionalCertificateFile\n if (additionalCert) {\n args.push(isWin ? \"/ac\" : \"-ac\", vm.toVmFile(additionalCert))\n }\n }\n\n getOutputPath(inputPath: string, hash: string) {\n const extension = path.extname(inputPath)\n return path.join(path.dirname(inputPath), `${path.basename(inputPath, extension)}-signed-${hash}${extension}`)\n }\n\n async getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise<CertificateFromStoreInfo> {\n const signing = getSigntoolFamilyConfig(options) as WindowsSigntoolSigningConfig | WindowsHsmSigningConfig | null\n const certificateSubjectName = signing?.certificateSubjectName\n const certificateSha1 = signing?.certificateSha1?.toUpperCase()\n\n const ps = await vm.powershellCommand.value\n // the non-ASCII characters of a subject are escaped, so they read back losslessly whatever the console code page\n const rawResult = await vm.exec(ps, [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n `${POWERSHELL_ASCII_ESCAPE_FUNCTION}; $json = Get-ChildItem -Recurse Cert: -CodeSigningCert | Select-Object -Property Subject,PSParentPath,Thumbprint | ConvertTo-Json -Compress; if ($json) { ConvertTo-AsciiEscaped $json }`,\n ])\n const certList = rawResult.length === 0 ? [] : asArray<CertInfo>(JSON.parse(rawResult))\n for (const certInfo of certList) {\n if (\n (certificateSubjectName != null && !certInfo.Subject.includes(certificateSubjectName)) ||\n (certificateSha1 != null && certInfo.Thumbprint.toUpperCase() !== certificateSha1)\n ) {\n continue\n }\n\n const parentPath = certInfo.PSParentPath\n const store = parentPath.substring(parentPath.lastIndexOf(\"\\\\\") + 1)\n log.debug({ store, PSParentPath: parentPath }, \"auto-detect certificate store\")\n // https://github.com/electron-userland/electron-builder/issues/1717\n const isLocalMachineStore = parentPath.includes(\"Certificate::LocalMachine\")\n log.debug(null, \"auto-detect using of LocalMachine store\")\n return {\n thumbprint: certInfo.Thumbprint,\n subject: certInfo.Subject,\n store,\n isLocalMachineStore,\n }\n }\n\n throw new Error(`Cannot find certificate ${certificateSubjectName || certificateSha1}, all certs: ${rawResult}`)\n }\n\n async getToolPath(isWin = process.platform === \"win32\"): Promise<ToolInfo> {\n return getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin, this.packager.buildResourcesDir)\n }\n\n async doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {\n // https://github.com/electron-userland/electron-builder/pull/1944\n const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000\n let args: Array<string>\n let vm: VmManager\n // cscInfo can be null (e.g. PKCS#11 with no cert file); guard before using `in`.\n // CertificateFromStoreInfo (no `file` property) requires a Windows VM for cert-store lookup.\n const cscInfo = configuration.cscInfo\n const useVmIfNotOnWin = configuration.path.endsWith(\".appx\") || (cscInfo != null && !(\"file\" in cscInfo))\n const isWin = process.platform === \"win32\" || useVmIfNotOnWin\n const toolInfo = await getSignToolPath(this.packager.config.toolsets?.winCodeSign, isWin, this.packager.buildResourcesDir)\n const tool = toolInfo.path\n if (useVmIfNotOnWin) {\n vm = await packager.vm.value\n args = this.computeSignToolArgs(configuration, isWin, vm)\n } else {\n vm = new VmManager()\n args = configuration.computeSignToolArgs(isWin)\n }\n\n // signtool.exe (`/f`) is not safe to run concurrently — it races on the shared per-user crypto store.\n // Serialize real-Windows signtool invocations across processes; osslsigncode (`!isWin`) is file-isolated.\n const execSign = () => vm.exec(tool, args, { timeout, env: { ...process.env, ...(toolInfo.env || {}) } })\n await retry(() => (isWin ? withSigntoolLock(execSign) : execSign()), {\n retries: 2,\n interval: 15000,\n backoff: 10000,\n shouldRetry: (e: any) => {\n if (\n e.message.includes(\"The file is being used by another process\") ||\n e.message.includes(\"The specified timestamp server either could not be reached\") ||\n e.message.includes(\"No certificates were found that met all the given criteria.\") ||\n // Transient failure of SignerSignEx after cert selection, typically a concurrent-signtool race\n // on the per-user crypto store; the cross-process lock above makes this rare, retry covers the rest.\n e.message.includes(\"An error occurred while attempting to load the signing certificate\")\n ) {\n log.warn(`Attempt to code sign failed, another attempt will be made in 15 seconds: ${e.message}`)\n return true\n }\n return false\n },\n })\n }\n}\n\nexport class SigntoolSignManager extends SigntoolBaseSignManager {\n protected computeWindowsSignArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const signing = getSigntoolFamilyConfig(options.options)\n\n const inputFile = vm.toVmFile(options.path)\n const args = [\"sign\"]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const isRfc3161 = options.isNest || options.hash === \"sha256\"\n args.push(isRfc3161 ? \"/tr\" : \"/t\")\n const timestampUrl = isRfc3161 ? signing?.rfc3161TimeStampServer || \"http://timestamp.digicert.com\" : signing?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(timestampUrl)\n }\n\n // Certificate\n this.addCertificateArgs(args, options, vm, true)\n\n // Hash algorithm\n if (this.isLegacyToolset()) {\n // Legacy v0.0.0: Only add /fd for non-SHA1 (original behavior)\n if (options.hash !== \"sha1\") {\n args.push(\"/fd\", options.hash)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n args.push(\"/td\", \"sha256\")\n }\n }\n } else {\n // Modern: Always add /fd (required by new Windows Kits)\n args.push(\"/fd\", options.hash.toLowerCase())\n // Only add /td for RFC3161 timestamps (incompatible with /t)\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\" && (options.isNest || options.hash === \"sha256\")) {\n args.push(\"/td\", \"sha256\")\n }\n }\n\n // Optional parameters\n this.addCommonSigningArgs(args, options, vm, true)\n\n // Windows-specific\n args.push(\"/debug\")\n args.push(inputFile) // Must be last\n\n return args\n }\n\n protected computeOsslsigncodeArgs(options: WindowsSignTaskConfiguration, vm: VmManager): Array<string> {\n const signing = getSigntoolFamilyConfig(options.options)\n\n const inputFile = vm.toVmFile(options.path)\n const outputPath = this.getOutputPath(inputFile, options.hash)\n options.resultOutputPath = outputPath\n\n const args = [\"sign\", \"-in\", inputFile, \"-out\", outputPath]\n\n // Timestamping\n if (process.env.ELECTRON_BUILDER_OFFLINE !== \"true\") {\n const timestampUrl = signing?.timeStampServer || \"http://timestamp.digicert.com\"\n args.push(\"-t\", timestampUrl)\n }\n\n // Certificate file\n this.addCertificateArgs(args, options, vm, false)\n\n // Hash algorithm\n args.push(\"-h\", options.hash.toLowerCase())\n\n // Optional parameters (name, site, nest, password, additionalCert)\n this.addCommonSigningArgs(args, options, vm, false)\n\n // Proxy support\n const httpsProxy = process.env.HTTPS_PROXY\n if (httpsProxy?.length) {\n args.push(\"-p\", httpsProxy)\n }\n\n return args\n }\n}\n\n/**\n * The hash algorithms to sign `filePath` with, one signing pass each.\n *\n * - `.msi` holds a single signature, so it is signed once: with `sha256` unless `sha1` is the only algorithm requested.\n * - `.appx`, `.msix` and `.msixbundle` are always `sha256`.\n * - Everything else uses the configured list, defaulting to dual signing with `sha1` then `sha256`.\n *\n * Extensions are matched case-insensitively (`app.MSI` is an MSI). An empty list is a configuration error: it would\n * run no signing pass while the file is still reported as signed.\n */\nexport function resolveSigningHashAlgorithms(filePath: string, configured: Array<\"sha1\" | \"sha256\"> | \"sha1\" | \"sha256\" | null | undefined): Array<\"sha1\" | \"sha256\"> {\n const requested = configured == null ? null : asArray(configured)\n if (requested != null && requested.length === 0) {\n throw new InvalidConfigurationError(\n `win.sign.signingHashAlgorithms is an empty list, so no signing pass would run. List at least one of \"sha1\" or \"sha256\", remove the option to use the default [\"sha1\", \"sha256\"], or set win.sign to false to disable Windows signing.`\n )\n }\n const ext = path.extname(filePath).toLowerCase()\n if (ext === \".msi\") {\n return [requested != null && !requested.includes(\"sha256\") ? \"sha1\" : \"sha256\"]\n }\n if (ext === \".appx\" || ext === \".msix\" || ext === \".msixbundle\") {\n return [\"sha256\"]\n }\n return requested ?? [\"sha1\", \"sha256\"]\n}\n"]}
|