Skip to content
TypeScript

fix(desktop): grant camera and microphone entitlements to the signed macOS app (#22170)

Theo Browneb232fa9f8ad9
diff --git a/scripts/build-desktop-artifact.test.ts b/scripts/build-desktop-artifact.test.ts
index 6fab8633672..77cf9ba3a26 100644
--- a/scripts/build-desktop-artifact.test.ts
+++ b/scripts/build-desktop-artifact.test.ts
@@ -2226,6 +2226,8 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
assert.include(entitlements, "<string>webcredentials:clerk.example.com</string>");
assert.include(entitlements, "<string>webcredentials:example.clerk.accounts.dev</string>");
assert.include(entitlements, "<key>com.apple.security.cs.allow-jit</key>");
+ assert.match(entitlements, /<key>com\.apple\.security\.device\.camera<\/key>\s*<true\/>/u);
+ assert.match(entitlements, /<key>com\.apple\.security\.device\.audio-input<\/key>\s*<true\/>/u);
assert.notInclude(entitlements, "keychain-access-groups");
assert.notInclude(entitlements, "com.apple.developer.web-browser.public-key-credential");
});
diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts
index 662e94f7f7d..66f05377c32 100644
--- a/scripts/build-desktop-artifact.ts
+++ b/scripts/build-desktop-artifact.ts
@@ -1406,6 +1406,14 @@ ${associatedDomains}
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
+ <!-- The hardened runtime denies camera and microphone to the app and every
+ child process, with no prompt, unless the app claims these. Terminals
+ and coding agents inherit the app's TCC identity, so without these a
+ command like ffmpeg or imagesnap gets silent access-denied. -->
+ <key>com.apple.security.device.camera</key>
+ <true/>
+ <key>com.apple.security.device.audio-input</key>
+ <true/>
</dict>
</plist>
`;
@@ -2883,6 +2891,10 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
"T3 Code connects to devices on your local network for remote environments and commands run by terminals and coding agents.",
NSScreenCaptureUsageDescription:
"T3 Code captures the active window when you use the window capture shortcut.",
+ NSCameraUsageDescription:
+ "T3 Code lets commands run by terminals and coding agents use the camera.",
+ NSMicrophoneUsageDescription:
+ "T3 Code lets commands run by terminals and coding agents use the microphone.",
// macOS lists an app under Default web browser only when it opens web
// pages as documents as well as http and https links (see protocols).
CFBundleDocumentTypes: [