Hardened runtime causes app to crash on open. (Signed and notarized)
See original GitHub issue-
Versions:
electron
:5.0.6
electron-builder
:21.0.11
electron-notarize
:0.1.1
electron-webpack
:2.7.4
Working on
:MacOS Catalina 10.15 Beta 3 (19A501i)
Xcode
:Xcode 11 beta 3
-
What I’m trying to do: Sign and notarize an electron, web-packed, react desktop application for distribution outside the mac store.
-
Problem and exact case of error:
- Build the app unsigned, unnotarized, no hardened runtime: runs ✅
- Build the app signed, no hardened runtime: runs ✅
- Build the app signed, hardened runtime: (build and sign successful) error below when opening app ❌
- Build the app signed, hardened runtime, notarize: (build, sign and notatrize successful) error below when opening app ❌
- In both the error cases I’ve run: 1/ Verify code signing ✅
test.app: valid on disk
test.app: satisfies its Designated Requirement
2/ Verify code notarization ✅
test.app: accepted
source=Notarized Developer ID
origin=Developer ID Application: XXX, Inc. (XXXXXXXXXX)
- Entitlements for mac
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
</dict>
-
Target: darwin
-
Error dump
Process: Test [7467]
Path: /Users/USER/Documents/*/Test.app/Contents/MacOS/Test
Identifier: ai.XXXX.desktop
Version: 0.0.4 (0.0.4)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Test [7467]
User ID: 501
Date/Time: 2019-07-10 16:44:52.073 -0400
OS Version: Mac OS X 10.15 (19A501i)
Time Awake Since Boot: 27000 seconds
Time Since Wake: 11000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes: 0x0000000000000032, 0x00001a9c2b202040
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace CODESIGNING, Code 0x2
...
Logical CPU: 6
Error Code: 0x00000015 (invalid protections for user instruction write)
Trap Number: 14
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:149 (15 by maintainers)
Top Results From Across the Web
App not launching after signing wi… | Apple Developer Forums
Exactly, the problem was that the app was crashing after signing with the hardened runtime enabled (notarization process was not involved yet).
Read more >Why does my Xamarin.Mac application crash when I enable ...
The executable does not have the hardened runtime enabled. To try and correct this issue, I have added the --options parameter for the...
Read more >How to resolve hardened runtime crashes on Mojave? - MSDN
Sign in to vote. User388418 posted. We're seeing a crash every time we start a hardened runtime RELEASE app on Mojave - reduced...
Read more >Getting started with App Wrapper 3 - Ohanaware.com
Build your application in your development tool; Open App Wrapper ... as the Harden Runtime security protocols may cause your application to ...
Read more >Hardened runtime for macOS - Lazarus wiki
Fallback Solution: Disable Runtime Code Signing Enforcement with the “com.apple.security.cs.allow-unsigned-executable-memory” entitlement. Issue ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Finally, the app went blank after hardened runtime code sign because my entitlements miss a key-value pair:
Spent couples of days trying every possible solution…hope this would help someone like me.
@UdaraJay Alright, I’ve finally got it working. The trick was two fold.
First:
Set both entitlements and entitlementsInherit in your mac build settings. Here’s mine:
Then, in my entitlements file, I stripped it down to only what I need.
com.apple.security.cs.allow-unsigned-executable-memory is really the key one here. Others mentioned adding another one, but I was back to the signing crash when I did that.