fix(ci): sign the macOS .app ad-hoc when no certificate is available - #257
Merged
Conversation
electron-builder signed the bundle itself until 26.15.3. Its macPackager
carried a `noIdentity && fallBackToAdhoc` branch handing back
`Identity("-")` when no certificate was found — mandatory on arm64, where
an unsigned binary will not launch. 26.15.3 replaced that path with
`findSigningIdentity`, which returns null instead, so `sign()` leaves on
`return false` and nothing signs the bundle. What ships is the bare
linker signature on the Electron binary: `Identifier=Electron`,
`Sealed Resources=none`.
macOS keys TCC grants to an app's code signature, so such a bundle can
never hold one. v1.9.0-rc.1 asked for Accessibility, the user granted it,
`AXIsProcessTrusted()` still returned false, and the editable-cursor
preflight re-opened the same dialog on every press of record. Recording
was impossible on macOS.
Sign ad-hoc ourselves with the runtime and entitlements electron-builder
would have applied, on both arches — 26.8.1 only fell back on arm64, so
Intel DMGs were never signed at all.
The verification step that should have caught this was gated on signing
being enabled, i.e. it never ran for the only builds that could be
unsigned. Make it unconditional, and assert the signing identifier
against the bundle id: `codesign --verify` passes on the bare linker
signature too, so the identifier is the only thing that separates a
bundle macOS can attach permissions to from one it cannot.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v1.9.0-rc.1 cannot record on macOS. The app asks for Accessibility, the user grants it, and it asks again — forever. The permission code is not at fault: the
.appin the published DMG is not signed at all, and macOS keys TCC grants to an app's code signature, so the grant has nothing to attach to.Compare the DMGs:
IdentifierSealed Resourcescom.etiennelescot.openscreencom.etiennelescot.openscreenElectronIdentifier=Electronwith no sealed resources is the raw linker signature on the Electron binary. electron-builder never re-signed the bundle.Root cause
The
electron-builder ^26.8.1 → ^26.15.3bump inpackage.json. CI setsCSC_IDENTITY_AUTO_DISCOVERY=falsewhen the signing secrets are absent, which is every RC. In 26.8.1,macPackager.sign()ended at:26.15.3 replaced that whole block with
findSigningIdentity, which returns null, andsign()leaves onreturn false. There is no ad-hoc fallback anywhere in 26.15.3'sout/. No config changed between the two tags — the version bump is the only variable.Why the symptom is total
requestMacCursorAccessibilityAccessreadsaccessibilityTrustedfrom the cursor helper, which isAXIsProcessTrusted(). That stays false however many times the box is ticked. The preflight inuseScreenRecorder.tsreturns before the countdown, andhandlers.tsre-opens the deep-link dialog. With the HUD in its defaulteditable-overlaycursor mode there is no way through.Why nothing caught it
Verify .app code signatureis gated onsteps.signing.outputs.enabled == 'true'— so it never ran on the only builds that could be unsigned. Every macOS check in the job was green.Changes
.appwhen no certificate is available, with the same--options runtimeandmacos.entitlementselectron-builder would have applied. Both arches: 26.8.1 only fell back on arm64, so Intel DMGs were never signed at all.CFBundleIdentifier.codesign --verify --deep --strictpasses on the bare linker signature too, so structure alone would not have caught this; the identifier is what separates a bundle macOS can attach permissions to from one it cannot.Related issue
Refs #
Type of change
Release impact
Desktop impact
Testing
Verified against the three real bundles on an M-series Mac, since the failure is only observable in a packaged
.app:which is byte-for-byte the shape of the working v1.8.0-rc.9 bundle.
The new guard, run against all three:
Workflow YAML parses (
js-yaml);npm run docs:checkis OK.Users already on rc.1 can unstick themselves without waiting for rc.2 — quit the app, re-sign it with the
codesignline above, thentccutil reset All com.etiennelescot.openscreento drop the orphaned entries.Note
npm run build:machas the same hole for anyone building locally without a certificate. Left out of this PR to keep it to the published-artifact path.