feat(electron): grant microphone and clipboard permissions#40
Merged
johannesjo merged 2 commits intojohannesjo:mainfrom Mar 28, 2026
Merged
feat(electron): grant microphone and clipboard permissions#40johannesjo merged 2 commits intojohannesjo:mainfrom
johannesjo merged 2 commits intojohannesjo:mainfrom
Conversation
johannesjo
reviewed
Mar 28, 2026
Owner
johannesjo
left a comment
There was a problem hiding this comment.
Thanks for the PR @Maskar — nice and clean change. Two things I'd like addressed before merging:
1. media permission grants camera access too (critical)
permission === 'media' passes for both audio and video requests. The handler's 4th parameter (details) includes mediaTypes which should be checked to restrict this to audio only:
session.defaultSession.setPermissionRequestHandler(
(_webContents, permission, callback, details) => {
if (permission === 'clipboard-read') {
return callback(true);
}
if (permission === 'media') {
const types = (details as { mediaTypes?: string[] }).mediaTypes ?? [];
// Only grant audio (microphone), deny video (camera)
return callback(types.every((t) => t === 'audio'));
}
callback(false);
},
);2. Missing NSMicrophoneUsageDescription for macOS (important)
With hardenedRuntime: true, macOS requires a usage description string for microphone access — without it the OS will silently deny the permission. Add via extendInfo in package.json:
"mac": {
"extendInfo": {
"NSMicrophoneUsageDescription": "Parallel Code needs microphone access for voice input in terminal sessions."
},
...
}Add permission handler for media (microphone) and clipboard-read access. Add audio-input entitlement for macOS builds.
221689f to
c507478
Compare
…UsageDescription - Check details.mediaTypes to grant only audio (microphone), deny video (camera) - Add NSMicrophoneUsageDescription for macOS hardened runtime compatibility
Owner
|
Thank you very much! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
media(microphone) andclipboard-readpermissions via Electron's permission handlercom.apple.security.device.audio-inputentitlement for macOS buildsMotivation
Voice input and clipboard access are blocked by default in Electron. This enables CLI tools that use microphone input and ensures Cmd+V paste works reliably in terminals.
Test plan