osx-sign icon indicating copy to clipboard operation
osx-sign copied to clipboard

electron-osx-sign does not handle app with spaces

Open lcheunglci opened this issue 5 years ago • 2 comments
trafficstars

I have an electron app that has spaces in the name "My App.app" and ran into an issue with codesigning.

I ran the following:

electron-osx-sign "My App.app" --platform=darwin --type=distribution --identity="Developer ID: my company id" --keychain="..." --entitlements="..." --hardened-runtime --entitlements-inherit="..." --no-gatekeeper-assess

Sign failed: Command failed: codesign --sign SOME_GUID --force --keychain ... --timestamp --options runtime --entitlements ... My App.app/Contents/_CodeSignature: No such file or directory

However, if I go into the My App.app/Contents/MacOS/My\ App and rename it without space, it'll codesign successfully, but the app does not launch unless the executable and the .app match so I rename it back after it's signed but when I use xcrun to notarize the app, I get an invalid package error. It points to the binary that I renamed saying "The signature of the binary is invalid."

Are electron applications with spaces in the name not allowed? or is this a bug?

Also, this is running on macOS Mojave 10.14.6.

lcheunglci avatar Oct 13 '20 22:10 lcheunglci

I found 2 workarounds. One was to change the Product Name in the package.json with no space, and the other was by renaming the generated .app with no spaces instead of renaming the executable inside and I was able to run electron-osx-sign to codesign successfully and was also able to notarize successfully.

I also manage to fix electron-osx-sign so that I can use space in the PR https://github.com/electron/electron-osx-sign/pull/238

lcheunglci avatar Oct 15 '20 00:10 lcheunglci

I've added a comment in the PR #238, perhaps, it's a better if the documentation indicates that app name with spaces are not supported in this tool and throw an exception during validation, so it won't fail during the actual codesign step.

lcheunglci avatar Feb 20 '22 01:02 lcheunglci