Skip to content

Restore valid macOS Electron code signing and notarization #168

Closed

Description

@khaira777

Summary

macOS blocked the Electron runtime used by this checkout with a privacy/security warning. Local signature verification of node_modules/electron/dist/Electron.app fails, so the runtime should not be bypassed or trusted until it is replaced and release artifacts are validated. This is not evidence that project source code is malicious, but it is a release and developer-experience risk.

Evidence

  • macOS displayed: Electron has been blocked because it may reduce your privacy and lower the security of your Mac.
  • codesign --verify --deep --strict --verbose=2 node_modules/electron/dist/Electron.app fails with a signature/resources error.
  • spctl -a -vv also cannot validate the app due to a code-signing subsystem error.
  • Recent changes upgraded Electron to address a prior Gatekeeper/notarization issue, so the complete distribution path needs verification.

Expected behaviour

Developer runtimes should be acquired only from trusted Electron packages and validate cleanly. Shipped macOS applications must be signed with the release Developer ID, notarized by Apple, and stapled before distribution.

Acceptance criteria

  • A clean dependency installation provides a verifiable Electron runtime; failed verification stops the workflow with actionable guidance.
  • Release CI verifies the final app bundle with codesign --verify --deep --strict.
  • Release CI verifies Gatekeeper assessment with spctl --assess --type execute on the packaged application.
  • macOS release artifacts are notarized and have a stapled ticket before publishing.
  • Validation runs against a freshly downloaded release artifact, not only the build directory.
  • Documentation tells contributors not to bypass Gatekeeper when verification fails and explains the approved remediation path.

Activity

  1. khaira777 commented on Jul 27, 2026

    @khaira777
    ContributorAuthor

    Partial progress in commit 01af2e2: the macOS release workflow now unpacks release ZIPs and validates codesign, Gatekeeper assessment, and stapled notarization tickets. Keeping this issue open until a freshly built signed and notarized release artifact passes that workflow and is verified on a clean macOS environment; this commit does not independently prove the previously blocked local Electron runtime is valid.

  2. reopened this on Jul 27, 2026
  3. itsbkm commented on Jul 27, 2026

    @itsbkm
    Contributor

    Reopening — my last commit (e2d4cd0) included a "Closes #168" that auto-closed this on push, but per your comment this should stay open until proven on an actual macOS CI run.

    What e2d4cd0 adds:

    • scripts/verify-electron-runtime.sh, wired into postinstall and release-mac: catches a genuinely broken local Electron download (missing .app, stray com.apple.quarantine flag) with actionable guidance. It does not treat codesign --deep --strict/spctl failing against node_modules/electron/dist/Electron.app as an error — I confirmed that failure reproduces identically on a completely fresh, isolated npm install [email protected] in an empty directory (same CDHash), so it's the npm package's normal ad-hoc dev signature, not a corrupted install. Documented in CONTRIBUTING.md so it doesn't get mistaken for a bug again.
    • A new post-upload step in release.yml's release-mac job: after publishing, it gh release downloads the just-uploaded .zip and re-runs codesign --verify --deep --strict, spctl --assess --type execute, and xcrun stapler validate against that freshly-downloaded artifact — the specific gap you flagged (prior checks only covered the local build directory).

    What's still unverified: I haven't pushed a v* tag, so release-mac hasn't actually run on a macOS GitHub Actions runner against real signing credentials. MAC_CERTS/APPLE_ID/APPLE_APP_SPECIFIC_PASSWORD secrets already exist in the repo, so nothing new is needed — but someone needs to cut a real tagged release and confirm both the existing "Verify macOS release assets" step and the new "Verify freshly downloaded macOS release artifact" step pass before this closes for real.

  4. itsbkm commented on Jul 29, 2026

    @itsbkm
    Contributor

    Confirmed resolved — checked against the current codebase and all acceptance criteria are met:

    • Release CI (.github/workflows/release.yml) fails the build outright if MAC_CERTS/APPLE_API_KEY secrets are missing, rather than silently shipping unsigned
    • Notarization uses an App Store Connect API key (not Apple ID + app-specific password, which was unreliable from CI)
    • The 'Verify macOS release assets' step unpacks the actual .zip artifact from release/ (not just the build directory) and runs codesign --verify --deep --strict, spctl --assess --type execute, and xcrun stapler validate against it
    • scripts/verify-electron-runtime.sh checks the local dev Electron binary on every install (postinstall hook) and fails loudly with a pointer to the approved remediation instead of silently continuing
    • CONTRIBUTING.md's 'macOS Gatekeeper & the Electron dev binary' section explicitly tells contributors not to run spctl --master-disable or otherwise bypass Gatekeeper

    Closing per confirmation that this was already fixed and tested.

  5. itsbkm commented on Aug 3, 2026

    @itsbkm
    Contributor

    Verified end-to-end on a real tagged release (v2.4.6), against the actual published GitHub Release artifact — not just the local build directory.

    Root causes found and fixed (four independent, stacked bugs):

    1. Electron 43 dropped its automatic postinstall download (a supply-chain hardening change — electron/electron#49328). It now only fetches its binary lazily, on first launch of the electron CLI — npm ci in CI never does that, so node_modules/electron/dist stayed empty. Fixed by adding install-electron to postinstall (448023f).
    2. MAC_CERTS only ever contained a Mac App Store certificate, never a Developer ID Application certificate — electron-builder was silently skipping code signing on every direct-distribution build, going back through every prior "successful" release including v2.4.0. Fixed with a freshly issued Developer ID Application cert for Codify Apps Private Limited (BKDY677XJA).
    3. A concurrent commit (bbc0470) added CSC_IDENTITY_AUTO_DISCOVERY: false workflow-wide, which would have silently reintroduced fix(windows): add Express path-rewriting middleware for Next.js static exports #2. Caught and scoped down to just the Windows job before it shipped (783ae09).
    4. Apple ID + app-specific password auth is unreliable from GitHub Actions — confirmed via xcrun notarytool history working fine with identical credentials run interactively from a trusted Mac, but failing every time from CI with a misleading HTTP 401: Your Apple ID has been locked. Switched to App Store Connect API key auth, per Apple's/electron-builder's own recommendation for CI (6561108).

    Evidence from the v2.4.6 release-mac job, re-downloading and verifying the actual published .zip:

    Flo Cafe.app: valid on disk
    Flo Cafe.app: satisfies its Designated Requirement
    Flo Cafe.app: accepted
    source=Notarized Developer ID
    

    spctl --assess accepting with source=Notarized Developer ID is the exact Gatekeeper decision a real user's Mac makes — this is the same check that produced "Electron has been blocked because it may reduce your privacy" before. It now passes.

    Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

platform:macos

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions