fix: grant media permissions to fix call crashes#2331
fix: grant media permissions to fix call crashes#2331IsmaelMartinez wants to merge 4 commits intomainfrom
Conversation
Teams' calling component crashes during _getInitialState because Electron does not grant media permissions by default. This adds permission handling at three layers: 1. setPermissionRequestHandler - grants camera/microphone/display-capture requests so Teams can access devices without a prompt dialog 2. setPermissionCheckHandler - returns true for trusted Teams origins so navigator.permissions.query() reports the correct state 3. Preload permissions.query() override - directly patches the renderer Permissions API to report 'granted' for media, covering Chromium version differences in how the native handler maps to the JS API Supersedes #2289. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
✅ Changelog entry generated and committed to this PR: The file You can edit it directly in this PR if needed. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue causing Teams' calling module to crash during initialization by implementing a multi-layered approach to ensure media permissions (camera, microphone, display-capture) are consistently granted within the Electron environment. It prevents permission-related failures that arise from Electron's default behavior or Chromium version inconsistencies, thereby stabilizing the calling experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive, multi-layered approach to grant media permissions, aiming to resolve call-related crashes. The changes in preload.js to override navigator.permissions.query and the use of setPermissionRequestHandler in mainAppWindow/index.js are well-implemented. However, I've identified a security vulnerability in the implementation of setPermissionCheckHandler where the origin check is not strict enough, potentially allowing malicious origins to be granted permissions. Please see my detailed comment.
📦 PR Build Artifacts✅ Build successful! Download artifacts: 🐧 Linuxx86_64 (434.04 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage arm64 (425.24 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage armv7l (403.29 MB) - Contains: .deb, .rpm, .tar.gz, .AppImage 🍎 macOSx86_64 (124.84 MB) - Contains: .dmg 🪟 Windowsx86_64 (105.41 MB) - Contains: .exe installer 📝 Note: Snap packages (.snap) are built in a separate workflow 🕐 Last updated: 2026-03-13 07:41 UTC |
📦 PR Snap Build Artifacts✅ Snap builds successful! Download artifacts: 🐧 Linux Snap Packagesx86_64 (107.27 MB) arm64 (104.18 MB) armv7l (98.41 MB) 📝 Note: Other package formats (.deb, .rpm, .AppImage, .dmg, .exe) are built in the main workflow |
Use URL parsing with exact match instead of startsWith to prevent subdomain bypass (e.g. teams.microsoft.com.evil.com). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|



Summary
setPermissionRequestHandlerto explicitly grant camera, microphone, and display-capture permission requests. Without this, Electron may block or prompt for media access, causing Teams' calling module to fail during initialisation.setPermissionCheckHandlerfor trusted Teams origins so synchronous permission checks return the correct state.navigator.permissions.query()in the preload script to report'granted'for media permissions. This covers a gap where Electron's native handler may not fully map to the renderer's Permissions API, depending on the Chromium version bundled with Electron.These three layers together ensure Teams' calling component sees granted permissions at every point it checks during
_getInitialState, which is where the crash occurs before WebRTC negotiation even begins.Supersedes #2289. Addresses #2221.
Test plan
🤖 Generated with Claude Code