Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using extendInfo doesn't add the entries in the correct location in Info.plist #8971

Open
coffecup25 opened this issue Mar 18, 2025 · 1 comment

Comments

@coffecup25
Copy link

Description

When building my electron app with electron-builder, the macOS permissions for audio capture (NSAudioCaptureUsageDescription and NSMicrophoneUsageDescription) are not being properly included in the final Info.plist file.

The issue appears to be related to how these permission strings are formatted in the generated Info.plist. They are incorrectly included with numeric indexed keys (<key>0</key>, <key>1</key>, etc.) instead of directly as top-level entries.

Reproduction

  1. Build the app using electron-builder with the configuration from electron-builder.yml
  2. Examine the generated Info.plist in the .app package
  3. Notice that NSAudioCaptureUsageDescription and NSMicrophoneUsageDescription are included in a numerically indexed dictionary rather than at the root level

Current Configuration

In electron-builder.yml, we configure the permissions using extendInfo:

mac:
  extendInfo:
    - NSCameraUsageDescription: Application requests access to the device's camera.
    - NSScreenCaptureUsageDescription: Application requires screen capture access.
    - NSMicrophoneUsageDescription: Application requests access to the microphone to record your voice.
    - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
    - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
    - NSAudioCaptureUsageDescription: Please allow access in order to capture the meeting audio.
    - CFBundleURLTypes:
        - CFBundleURLSchemes:
          - strawberry
        - CFBundleTypeRole: Editor

Expected Behavior

The permissions should be added directly to the root level of Info.plist like this:

<key>NSMicrophoneUsageDescription</key>
<string>Application requests access to the microphone to record your voice.</string>
<key>NSAudioCaptureUsageDescription</key>
<string>Please allow access in order to capture the meeting audio.</string>

Actual Behavior

The permissions are added with numeric indices as parent keys:

<key>0</key>
<dict>
    <key>NSCameraUsageDescription</key>
    <string>Application requests access to the device's camera.</string>
</dict>
<key>1</key>
<dict>
    <key>NSScreenCaptureUsageDescription</key>
    <string>Application requires screen capture access.</string>
</dict>
<!-- etc. -->

Workaround

Manually adding these permission entries directly to the Info.plist file after the build and re-code signing the app resolves the issue.

Environment

  • electron-builder versions tested: 26.0.1 and 25.1.8
  • Electron versions tested: 33.3.0 and 35 (latest)
  • OS: macOS
  • Entitlements: Appropriate entitlements for camera/microphone are in place

Additional Notes

The relevant entitlements are correctly configured in the entitlements.mac.plist file:

<key>com.apple.security.device.microphone</key>
<true/>
<key>com.apple.security.device.audio-input</key>
<true/>
@mmaietta
Copy link
Collaborator

Pretty sure your YAML syntax is incorrect. A YAML sequence is an array

key:
  - string1
  - string2      
  - string3

https://stackoverflow.com/a/33136212/3498974

A YAML map is:

keyMapping: 
    key1: value1
    key2: value2

https://stackoverflow.com/a/34328811/3498974

Please try using a map

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

No branches or pull requests

2 participants