question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

macOS Store Crash: Entitlements as Binary Plist instead of Plist

See original GitHub issue

MAS-signed App crashes which results in the apps rejection by Apple.

After a few hours of investigation I figured out that there is an issue with the entitlements of the App. In the Console Application the following message is thrown.

failed to parse entitlements for MyApp[84767]: OSUnserializeXML: syntax error near line 1

I then enabled DEBUG=electron-osx-sign* which allowed me to see that the entitlements of the app were in binary plist format, not in plist format. The entitlements are provided as a valide plist, but codesign somehow “converts” it to the binary format.

In fact the current version available in the AppStore has the entitlements provided as plist, not as binary plist.

Any input on this odd behaviour?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
tinaciouscommented, Feb 21, 2021

I found this because I am also experiencing a similar error related to entitlements parsing:

  ⨯ Command failed: codesign --sign XXXX --force --timestamp --entitlements build/entitlements.mas.inherit.plist /path/to/project/dist/mas/MyAppName.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libEGL.dylib
Failed to parse entitlements: AMFIUnserializeXML: syntax error near line 6

I was able to find a solution. In case anyone comes across this, I will share what worked for me.

I ran the following scripts on my plist files:

plutil -convert xml1 build/entitlements.mas.plist
plutil -convert xml1 build/entitlements.mas.loginhelper.plist
plutil -convert xml1 build/entitlements.mas.inherit.plist

This modified each of my plist files to change whitespace characters. It looks like spaces have been converted to tabs, so perhaps some kind of auto-formatting ran in my editor to reformat the Plist files incorrectly. Running plutil -convert xml1 on them seems to fix it. Code signing is now passing for me.

Example diff:

diff --git a/build/entitlements.mas.inherit.plist b/build/entitlements.mas.inherit.plist
index 57d0b41..4759d0a 100644
--- a/build/entitlements.mas.inherit.plist
+++ b/build/entitlements.mas.inherit.plist
@@ -1,14 +1,14 @@
 <?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.cs.allow-jit</key>
-    <true />
-    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
-    <true />
-  </dict>
+<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.inherit</key>
+       <true/>
+</dict>
 </plist>
0reactions
1rachcommented, Feb 7, 2022

I’ve identified that when I open the file entitlements.mac.inherit.plist with vscode, and save it (tested on mac), the bug appears.

Solution ? Maybe there is an option in vscode about formatting the file… I don’t know.

Submit an issue to vscode ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

macOS Store Crash: Entitlements as Binary Plist instead of ...
The entitlements are provided as a valide plist, but codesign somehow "converts" it to the binary format. In fact the current version available ......
Read more >
Application killed after entitled … | Apple Developer Forums
After signing my player (just the binary) with entitlments and shared libraries without entitlements, player is killed without reason (error code or message)...
Read more >
Hardened runtime for macOS - Lazarus wiki
The hardened runtime was introduced by Apple in macOS 10.14 (Mojave) and ... You do this by creating an entitlements plist file like...
Read more >
Malformed Info.plist causes macOS crash - Stack Overflow
I just want to stress, in step (3) use "Run Without Building", so the Info.plist does not get overwritten by a new compile....
Read more >
Notarizing your macOS application - Unity - Manual
DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ... These entitlements are the minimum entitlements a macOS application requires to have a Hardened ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found