电子:协同设计削弱了我在 macOS 上的应用程序的某些功能
electron: codesigning cripples some features of my app on macOS
目标
我的 Electron 应用程序由一个前端进程和一个后端子进程组成。在 macOS 上,后端需要 macOS 上的一些功能,例如访问用户桌面和麦克风。后端是通过 Xcode 构建的,并分别使用相同的开发人员 ID 进行了代码签名。
首先运行,系统会要求用户根据能力授予权限。在随后的启动中,该应用程序应该 运行 在没有用户干预的情况下顺利进行。在通过 Electron 进行代码设计之前工作正常。
我已准备好通过 electron-osx-sign
对应用程序进行代码签名,并希望该应用程序能够正常运行。
问题
在使用 Electron 签名时,我以这种方式使用记录的 electron-forge
选项
"osxSign": {
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"identity": "Mac Developer: ME (my id)"
},
"osxNotarize": "require:./notarize.js",
我的权利是这样做的
<?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.debugger</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>
</dict>
</plist>
和公证脚本 returns false
,在这种情况下。
在此之后,首先 运行,系统不再提示用户请求权限。权限似乎已被默默授予。
我试过其他选项,例如
"gatekeeper-assess": false,
"hardened-runtime": true,
"signature-flags": "library"
任何这些都会破坏应用程序,即功能将丢失并且没有错误消息。
问题
这些行为是设计使然的吗?我应该如何在使用和不使用代码签名的情况下实现预期的行为?
自己解决了。
问题既不在于现有的授权条目,也不在于 package.json
选项,而是缺少授权条目:
<key>com.apple.security.get-task-allow</key>
<true/>
应用在添加后得到权限提示。
目标
我的 Electron 应用程序由一个前端进程和一个后端子进程组成。在 macOS 上,后端需要 macOS 上的一些功能,例如访问用户桌面和麦克风。后端是通过 Xcode 构建的,并分别使用相同的开发人员 ID 进行了代码签名。
首先运行,系统会要求用户根据能力授予权限。在随后的启动中,该应用程序应该 运行 在没有用户干预的情况下顺利进行。在通过 Electron 进行代码设计之前工作正常。
我已准备好通过 electron-osx-sign
对应用程序进行代码签名,并希望该应用程序能够正常运行。
问题
在使用 Electron 签名时,我以这种方式使用记录的 electron-forge
选项
"osxSign": {
"entitlements": "entitlements.plist",
"entitlements-inherit": "entitlements.plist",
"identity": "Mac Developer: ME (my id)"
},
"osxNotarize": "require:./notarize.js",
我的权利是这样做的
<?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.debugger</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.automation.apple-events</key>
<true/>
</dict>
</plist>
和公证脚本 returns false
,在这种情况下。
在此之后,首先 运行,系统不再提示用户请求权限。权限似乎已被默默授予。
我试过其他选项,例如
"gatekeeper-assess": false,
"hardened-runtime": true,
"signature-flags": "library"
任何这些都会破坏应用程序,即功能将丢失并且没有错误消息。
问题
这些行为是设计使然的吗?我应该如何在使用和不使用代码签名的情况下实现预期的行为?
自己解决了。
问题既不在于现有的授权条目,也不在于 package.json
选项,而是缺少授权条目:
<key>com.apple.security.get-task-allow</key>
<true/>
应用在添加后得到权限提示。