Skip to content

fix(desktop): add macOS microphone entitlement for signed builds - #99

Open
JianP-Ciallo wants to merge 1 commit into
AnnaSuSu:mainfrom
JianP-Ciallo:fix/mac-microphone-entitlement
Open

JianP-Ciallo wants to merge 1 commit into
AnnaSuSu:mainfrom
JianP-Ciallo:fix/mac-microphone-entitlement

Conversation

@JianP-Ciallo

Copy link
Copy Markdown

问题

macOS 正式签名版里,Copilot 的"自己"(麦克风)一路可能始终没有声音,即使用户已经在系统设置里允许了麦克风。

electron-builder 默认给 macOS 构建开启 hardened runtime;仓库里没有 build/entitlements.mac.plist 时,app bundle 只拿到 com.apple.security.cs.allow-jit(见 electron-builder macOS 文档 的默认 entitlements 表)。hardened runtime 下缺少 com.apple.security.device.audio-input 时,应用无法读取麦克风输入(Apple Configuring the hardened runtime / Electron 代码签名文档)。

electron-builder.yml 里已经有 NSMicrophoneUsageDescription,但那是 Info.plist 的权限说明,不能代替签名 entitlement。

改动

新增 apps/desktop/build/entitlements.mac.plist(buildResources: build 下 electron-builder 会自动识别):

  • 保留当前默认的 com.apple.security.cs.allow-jit(该文件会替换默认值,而不是合并)
  • 增加 com.apple.security.device.audio-input

不改 helper 的 entitlements,也不影响 Windows/Linux 构建。

验证

  • plistlib 解析通过,内容只有上述两项。
  • 未在 Mac 实机上验证。 只有配置了 MAC_CSC_LINK 等签名 secrets 的 Developer ID 签名包会触发这个问题;当前未签名包可能不受影响。建议有签名环境时用 codesign -d --entitlements - TechSpar.app 确认,并实测 Copilot 麦克风电平。

electron-builder signs macOS builds with the hardened runtime by default
and, without build/entitlements.mac.plist, gives the app bundle only
com.apple.security.cs.allow-jit. Under the hardened runtime the app then
cannot read microphone input, so the Copilot "自己" channel stays silent
in Developer ID signed releases even after the user grants permission.

Add build/entitlements.mac.plist (auto-detected via buildResources) with
allow-jit, preserving the current default, plus device.audio-input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant