Failed to run Electron Helper in sandbox environment

559 views Asked by At

I had a problem when submitting my electron app to the apple store

ERROR ITMS-90296: "App sandbox not enabled. The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list: [( "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/Frameworks/SmarterBack Helper EH.app/Contents/MacOS/SmarterBack Helper EH", "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/Frameworks/SmarterBack Helper NP.app/Contents/MacOS/SmarterBack Helper NP", "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/Frameworks/SmarterBack Helper.app/Contents/MacOS/SmarterBack Helper", "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/MacOS/SmarterBack" )] Refer to App Sandbox page at https://developer.apple.com/devcenter/mac/app-sandbox/ for more information on sandboxing your app."

so I changed my .plist file to enable sandbox and everything went well with the submitting, but there was another problem with that fix, now my app doesn’t want to start because it can’t find “SmarterBack Helper”

[8801:0907/140725.080936:FATAL:atom_main_delegate_mac.mm(50)] Unable to find helper app
0   Electron Framework                  0x000000010c4fdde3 _ZN9brightray12MainDelegate24OverrideChildProcessPathEv + 836531
1   Electron Framework                  0x000000010c4d3297 _ZN9brightray12MainDelegate24OverrideChildProcessPathEv + 661607
2   Electron Framework                  0x000000010c2c2169 _ZN4atom16AtomMainDelegate24OverrideChildProcessPathEv + 377
3   Electron Framework                  0x000000010c4314fb _ZN9brightray12MainDelegate20BasicStartupCompleteEPi + 107
4   Electron Framework                  0x000000010c2c17ed _ZN4atom16AtomMainDelegate20BasicStartupCompleteEPi + 237
5   Electron Framework                  0x000000010c6a7311 _ZN9brightray12MainDelegate24OverrideChildProcessPathEv + 2578657
6   Electron Framework                  0x000000010c6a6bde _ZN9brightray12MainDelegate24OverrideChildProcessPathEv + 2576814
7   Electron Framework                  0x000000010c2be747 AtomMain + 71
8   SmarterBack Helper                  0x000000010c2b6f26 main + 38
9   libdyld.dylib                       0x00007fff9a371235 start + 1
10  ???                                 0x0000000000000010 0x0 + 16

This is my child.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/>
    <key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
    <true/>
  </dict>
</plist>

parent.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.inherit</key>
    <true/>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.application-groups</key>
    <string>com.smarterback.desktop</string>
  </dict>
</plist>

and finally my script for sign

#!/bin/bash

# Name of your app.
APP="SmarterBack"
# The path of your app to sign.
APP_PATH="release-builds/SmarterBack-mas-x64/SmarterBack.app"
# The path to the location you want to put the signed package.
RESULT_PATH="/Users/katerina/Desktop/$APP.pkg"
# The name of certificates you requested.
APP_KEY="3rd Party Mac Developer Application: JENGO LLC (63UV74H5Q5)"
INSTALLER_KEY="3rd Party Mac Developer Installer: JENGO LLC (63UV74H5Q5)"
# The path of your plist files.
CHILD_PLIST="child.plist"
PARENT_PLIST="parent.plist"

FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"

sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Electron Framework"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework/Versions/A/Libraries/libnode.dylib"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework"

sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/Contents/MacOS/$APP Helper"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper EH.app/Contents/MacOS/$APP Helper EH"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper EH.app/"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper NP.app/Contents/MacOS/$APP Helper NP"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper NP.app/"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/MacOS/$APP"
sudo codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/Info.plist"
sudo codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH"

codesign --verify --deep --display --verbose=4 "$APP_PATH"

sudo productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"

From what I understand I have to sign all my files and to enable sandbox, but when I do that when I start my app I see white box with nothing in it because the the app is unable to find helper. Has anyone had that problem before?

0

There are 0 answers