electron / osx-sign

Codesign Electron macOS apps
BSD 2-Clause "Simplified" License
565 stars 96 forks source link

Could not create string from entitlements data #235

Closed kaoben closed 2 years ago

kaoben commented 4 years ago

hi I am new Electron I have problem could not create string from entitlements data when build electron with mac os

marckohlbrugge commented 3 years ago

I'm running into the same issue. A few months ago it worked fine.

Relevant log:

Notarizing chat.wip.menubar found at /Users/marc/Sites/wip-menubar/release/mac/WIP.app
  ⨯ Command failed: codesign --sign REMOVEDREMOVEDREMOVEDREMOVED --force --timestamp --entitlements /var/folders/pt/removedremoved/T/tmp-entitlements-6db4-0.plist /Users/marc/Sites/wip-menubar/release/mas/WIP.app
Could not create string from entitlements data
  stackTrace=
                                                                                                                                                                                                                                                                                                    Error: Command failed: codesign --sign REMOVEDREMOVEDREMOVEDREMOVED --force --timestamp --entitlements /var/folders/pt/removedremoved/T/tmp-entitlements-6db4-0.plist /Users/marc/Sites/wip-menubar/release/mas/WIP.app
                                                                                                                                                                                                                                                                                                    Could not create string from entitlements data

                                                                                                                                                                                                                                                                                                        at ChildProcess.exithandler (child_process.js:295:12)
                                                                                                                                                                                                                                                                                                        at ChildProcess.emit (events.js:210:5)
                                                                                                                                                                                                                                                                                                        at maybeClose (internal/child_process.js:1021:16)
                                                                                                                                                                                                                                                                                                        at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
marckohlbrugge commented 3 years ago

Here's what my entitlements file looks like:

CleanShot 2020-10-20 at 19 14 31@2x

Note that it's not a plain text file. Opening up the file in a plain text editor shows some weird encoding characters.

marckohlbrugge commented 3 years ago

Running with verbose flag it shows this:

/var/folders/pt/9yhw_43s1l37hj41w2tbnrx00000gn/T/tmp-entitlements-72e6-0.plist: unrecognized blob type (accepting blindly)
/var/folders/pt/9yhw_43s1l37hj41w2tbnrx00000gn/T/tmp-entitlements-72e6-0.plist: invalid length in entitlement blob
marckohlbrugge commented 3 years ago

After running plutil -convert xml1 on the plist file, code signing seems to work.

So it appears that the plist file is being created in a binary format, while the codesign command expects the XML format. I'm not sure where that's going wrong though?

marckohlbrugge commented 3 years ago

👍 Upgrading all dev dependencies and restarting my Mac resolved the issue.

alexgurr commented 3 years ago

I'm getting this too. The tmp copied entitlements file seems to be binary (presumably from this command spawning command=/Users/alexgurr/Documents/GitHub/X/node_modules/app-builder-bin/mac/app-builder encode-plist). Don't really know what else to do at this point.

mifi commented 3 years ago

I'm getting this in Github Actions. Last successful build was july 13.

mifi commented 3 years ago

Actually I am not using electron-osx-sign, but I got this error with electron-builder. I upgraded to the newest version of electron-builder and it was resolved.

MarshallOfSound commented 2 years ago

Sounds like this is a combination of a badly formatted plist and some dependency updates. Closing out to clear up the open issues, if this is still impacting someone please raise a new issue