EXC_BAD_ACCESS (Code Signature Invalid) MAS-DEV
mattehalen opened this issue · comments
"electron-builder": "^22.11.7",
"electron": "^13.1.2",
"mas-dev": "electron-builder --mac mas-dev",
I have seen that there have been some issues about this before but I couldn't get help from those to work for me.
When doing the:
"mas-dev": "electron-builder --mac mas-dev",
It gives me this:
> electron-builder --mac mas-dev
• electron-builder version=22.11.7 os=20.5.0
• loaded configuration file=package.json ("build" field)
• writing effective config file=electron-output/builder-effective-config.yaml
• packaging platform=mas arch=x64 electron=13.1.2 appOutDir=electron-output/mas-dev
• signing file=electron-output/mas-dev/Scheduled-Countdown.app identityName=Developer ID Application: Mathias Halen (F8993Q6N82) identityHash=62FE87616A97471C3305B7F4E4F77914EBD6CE44 provisioningProfile=./build/Mac_App_Store_Provisioning_Profile.provisionprofile
• signing file=electron-output/mas-dev/Scheduled-Countdown.app identityName=Mac Developer: Mathias Halen (R54DSM4AB8) identityHash=61D21C2F5BF90DF2D6D5F5E7FF2A4687166F300B provisioningProfile=./build/Mac_App_Store_Provisioning_Profile.provisionprofile
I can see that the app gets signed with my Mac Developer but I still get :
Time Awake Since Boot: 1800 seconds
System Integrity Protection: enabled
Crashed Thread: 0
Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace CODESIGNING, Code 0x1
Any idea how to fix?
Just a shot in the dark here, but that sounds like your app entitlements are not properly set up. Can you post it here? I'm not familiar with mas/mas-dev targets, but I can still take a gander
entitlements.mas.plist
<?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.app-sandbox</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
entitlements.mas.inherit.plist
<?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.app-sandbox</key>
<true/>
<key>com.apple.security.inherit</key>
<true/>
</dict>
</plist>
package.json
package.json
{
"name": "Scheduled-Countdown",
"author": "Mathias Halén",
"version": "0.0.24",
"private": true,
"description": "More info comming soon",
"main": "main.js",
"build": {
"appId": "com.Scheduled-countdown-macos",
"productName": "Scheduled-Countdown",
"afterSign": "electron-builder-notarize",
"mac": {
"type": "distribution",
"target": [
"pkg"
],
"artifactName": "${productName}-${version}-${os}.${ext}",
"category": "public.app-category.utilities",
"provisioningProfile": "./build/Mac_App_Store_Provisioning_Profile.provisionprofile",
"entitlements": "./build/entitlements.mac.plist",
"icon": "./assets/Scheduled-countdown.icns",
"hardenedRuntime": true,
"gatekeeperAssess": true
},
"pkg": {
"installLocation": "/Applications",
"allowAnywhere": true,
"allowCurrentUserHome": true,
"allowRootDirectory": true,
"identity": "61D21C2F5BF90DF2D6D5F5E7FF2A4687166F300B"
},
"mas": {
"category": "public.app-category.utilities",
"entitlements": "build/entitlements.mas.plist",
"entitlementsInherit": "build/entitlements.mas.inherit.plist"
},
"win": {
"target": [
"appx",
"nsis"
],
"icon": "./assets/icon.jpg"
},
"appx": {
"applicationId": "ScheduledCountdown",
"backgroundColor": "#464646",
"displayName": "Scheduled-Countdown",
"identityName": "4555MathiasHaln.Scheduled-countdown",
"publisher": "CN=2D0EA3D9-1A4C-4E8D-A3D2-24A828687B48",
"publisherDisplayName": "Mathias Halén",
"languages": "EN-US"
},
"nsis": {
"createStartMenuShortcut": true,
"perMachine": true,
"oneClick": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"installerIcon": "icon.ico"
},
"directories": {
"buildResources": "assets/",
"output": "electron-output/"
},
"files": [
"**/*",
"assets/icon.ico",
"./assets/win/Square44x44Logo.png",
"./assets/win/Square150x150Logo.png",
"./assets/win/StoreLogo.png",
"./electron-output/appx/Square44x44Logo.png",
"./electron-output/appx/Square150x150Logo.png",
"./electron-output/appx/StoreLogo.png"
]
},
"scripts": {
"electron": "electron .",
"dist": "electron-builder",
"macdist": "electron-builder --mac",
"mas": "electron-builder --mac mas",
"mas-dev": "electron-builder --mac mas-dev",
"dmg": "electron-builder --mac dmg",
"dmgSigned": "CSC_IDENTITY_AUTO_DISCOVERY=true electron-builder --mac dmg",
"windist": "electron-builder --win",
"debug": "node --inspect ./index.js",
"debug-brk": "node --inspect-brk ./index.js"
},
"dependencies": {
"apn": "^2.2.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"debug": "~4.3.1",
"electron-log": "^4.3.5",
"electron-rpc": "^2.0.1",
"express": "~4.17.1",
"http-errors": "~1.8.0",
"ip": "^1.1.5",
"jzz": "^1.3.4",
"pug": ">=3.0.2",
"socket.io": "^2.3.0",
"uuid": "^8.3.2",
"yarn": "^1.22.10"
},
"devDependencies": {
"electron": "^13.1.2",
"electron-builder": "^22.11.7",
"electron-packager": "^15.2.0",
"electron-osx-sign": "^0.5.0",
"electron-builder-notarize":"^1.2.0",
"nodemon": "^2.0.7"
}
}
I have also tried removing my entitlements
& entitlementsInherit
under mas
because I know that the "afterSign": "electron-builder-notarize",
has a built-in one it uses if there is no entitlements.
The problem here is that the build-in one doesn't add Sandbox so I cant upload that to AppStore.
<?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-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
So my problem is that my MAS app crashes and behaves strangely when Apple test it and I have no way to test it myself. And the MAS-DEV only gives me CODE Signature Invalid
For mas-dev builds, maybe it needs to have hardenedRuntime: false
in order to allow local testing
Ref: electron/osx-sign#200 (comment)
I think I solved my problem.
I only had provisionprofile for mas and not one for masdev.