Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(desktop): declare microphone access so voice input works on macOS (#2293)

Max924174fe748c
diff --git a/desktop/README.md b/desktop/README.md
index a276a70c8..51f48f6b6 100644
--- a/desktop/README.md
+++ b/desktop/README.md
@@ -377,6 +377,18 @@ v1 uses OS-default notification activation; explicit cross-platform show/focus
and session deep-link targets require follow-up work. See
`../docs/plans/desktop-notifications-sse.md` for the frozen contract.
+## Microphone
+
+Workbench voice input records through `getUserMedia` inside the WebView. On
+macOS, wry grants the WebKit-level media request, but the OS still gates the
+microphone on two bundle facts: `src-tauri/Info.plist` (merged by Tauri into the
+generated one) declares `NSMicrophoneUsageDescription`, and the hardened-runtime
+entitlements grant `com.apple.security.device.audio-input`. Without the usage
+description macOS denies access with no prompt; without the entitlement a
+Developer ID–signed build is denied the same way. The first recording shows the
+standard macOS prompt; a later denial is changed in System Settings → Privacy &
+Security → Microphone. `tests/notarization_preflight.rs` pins both facts.
+
## CI
`.github/workflows/desktop-shell.yml` runs on macOS and Windows whenever
diff --git a/desktop/src-tauri/Entitlements.plist b/desktop/src-tauri/Entitlements.plist
index 9aaca5486..24d288195 100644
--- a/desktop/src-tauri/Entitlements.plist
+++ b/desktop/src-tauri/Entitlements.plist
@@ -2,12 +2,20 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <!-- Deliberately empty. WKWebView's JavaScript engine JITs in
- WebKit-owned helper processes, so the embedding Tauri process needs
- no executable-memory exception, and the notary does not require one.
- Granting com.apple.security.cs.allow-unsigned-executable-memory here
- would weaken the hardened runtime for the whole process. Re-adding
- any entitlement must carry evidence that the app process itself
- needs it. -->
+ <!-- Every entitlement here must carry evidence that the app process
+ itself needs it.
+
+ Deliberately absent: com.apple.security.cs.allow-unsigned-executable-memory.
+ WKWebView's JavaScript engine JITs in WebKit-owned helper processes,
+ so the embedding Tauri process needs no executable-memory exception,
+ and the notary does not require one. Granting it would weaken the
+ hardened runtime for the whole process.
+
+ audio-input: Workbench voice input records through getUserMedia.
+ Under the hardened runtime, macOS attributes WebKit's capture to this
+ app and denies microphone access unless the app holds this
+ entitlement (paired with NSMicrophoneUsageDescription in Info.plist). -->
+ <key>com.apple.security.device.audio-input</key>
+ <true/>
</dict>
</plist>
diff --git a/desktop/src-tauri/Info.plist b/desktop/src-tauri/Info.plist
new file mode 100644
index 000000000..ee0d3bb6b
--- /dev/null
+++ b/desktop/src-tauri/Info.plist
@@ -0,0 +1,13 @@
+<?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>
+ <!-- Merged by the Tauri bundler into the generated Info.plist. The
+ Workbench's voice input calls getUserMedia inside WKWebView; wry
+ grants the WebKit-level media request, but macOS TCC denies
+ microphone access outright (no prompt, NotAllowedError in the page)
+ unless the host app declares why it needs the microphone. -->
+ <key>NSMicrophoneUsageDescription</key>
+ <string>Avibe uses the microphone for voice input in the Workbench.</string>
+</dict>
+</plist>
diff --git a/desktop/src-tauri/tests/notarization_preflight.rs b/desktop/src-tauri/tests/notarization_preflight.rs
index 6032d9e00..b08b3bd16 100644
--- a/desktop/src-tauri/tests/notarization_preflight.rs
+++ b/desktop/src-tauri/tests/notarization_preflight.rs
@@ -49,19 +49,60 @@ fn the_macos_bundle_declares_the_hardened_runtime_and_entitlements() {
);
}
+/// `<key>` names in a plist, ignoring XML comments so explanatory prose can
+/// never satisfy or break an assertion.
+fn plist_keys(plist: &str) -> Vec<String> {
+ let mut body = String::new();
+ let mut rest = plist;
+ while let Some(start) = rest.find("<!--") {
+ body.push_str(&rest[..start]);
+ rest = rest[start..].split_once("-->").map_or("", |(_, tail)| tail);
+ }
+ body.push_str(rest);
+ body.split("<key>")
+ .skip(1)
+ .filter_map(|chunk| chunk.split_once("</key>").map(|(key, _)| key.trim().to_owned()))
+ .collect()
+}
+
#[test]
-fn entitlements_grant_no_executable_memory_exception() {
- let entitlements = read_to_string(&entitlements_path());
+fn entitlements_grant_only_microphone_input() {
+ let keys = plist_keys(&read_to_string(&entitlements_path()));
// WKWebView's JavaScript engine JITs inside WebKit-owned helper
// processes; the embedding Tauri process itself needs no
// executable-memory exception, and the notary does not require one.
- // Granting it would weaken the hardened runtime for the whole process,
- // so its absence is the invariant: any re-add must come with evidence
- // that the app process itself needs it.
- assert!(
- !entitlements.contains("<key>"),
- "entitlements must stay empty; in particular no executable-memory exception for the embedding process"
+ // Granting it would weaken the hardened runtime for the whole process.
+ //
+ // The single allowed entitlement is audio input: Workbench voice input
+ // records through getUserMedia, and under the hardened runtime macOS
+ // denies that capture unless the app holds it. Any further addition must
+ // come with evidence that the app process itself needs it.
+ assert_eq!(
+ keys,
+ vec!["com.apple.security.device.audio-input".to_owned()],
+ "entitlements must grant exactly audio input; in particular no executable-memory exception"
+ );
+}
+
+#[test]
+fn the_bundle_declares_why_it_uses_the_microphone() {
+ // Tauri merges `Info.plist` next to tauri.conf.json into the bundle's
+ // generated one. Without this usage description macOS denies microphone
+ // access outright — no prompt — so the Workbench's getUserMedia fails.
+ let path = crate_dir().join("Info.plist");
+ let plist = read_to_string(&path);
+ assert_eq!(
+ plist_keys(&plist),
+ vec!["NSMicrophoneUsageDescription".to_owned()],
+ "Info.plist carries only the microphone usage description"
);
+ let description = plist
+ .split_once("<key>NSMicrophoneUsageDescription</key>")
+ .and_then(|(_, tail)| tail.split_once("<string>"))
+ .and_then(|(_, tail)| tail.split_once("</string>"))
+ .map(|(value, _)| value.trim())
+ .unwrap_or_default();
+ assert!(!description.is_empty(), "the microphone usage description is non-empty");
}
#[test]