Skip to content

[PM-42047] fix(desktop): install the Firefox native messaging manifest on macOS - #22452

Open
fabriziobagala wants to merge 1 commit into
bitwarden:mainfrom
fabriziobagala:fix/macos-firefox-native-messaging-manifest
Open

[PM-42047] fix(desktop): install the Firefox native messaging manifest on macOS#22452
fabriziobagala wants to merge 1 commit into
bitwarden:mainfrom
fabriziobagala:fix/macos-firefox-native-messaging-manifest

Conversation

@fabriziobagala

Copy link
Copy Markdown

🎟️ Tracking

Fixes #22027

📔 Objective

On macOS the Firefox native messaging manifest is never installed, so biometric unlock never works in Firefox while it works in Chrome on the same machine.

getDarwinNMHS() returns one path per browser, used both to detect that the browser is installed and as the directory to install into. That holds for every browser except Firefox: its profiles live in Application Support/Firefox/, but its manifests belong in Application Support/Mozilla/, which Firefox itself does not create - Bitwarden or another native messaging host does. Gating installation on existsSync() of Mozilla/ therefore makes the manifest its own precondition, and Firefox is skipped forever with Firefox not found, skipping. It is also why the Firefox/Zen mkdir from #21784 never runs on an affected machine: it sits inside the branch that is never taken.

The fix is limited to detection. A new getDarwinDetectPaths() returns the paths that prove a browser is installed - for Firefox, Application Support/Firefox/ plus the existing Mozilla/ as a fallback; for every other browser, the current path unchanged. getDarwinNMHS() and writeManifest() are untouched, so #21568 is not reintroduced. Installing each browser's manifest is now wrapped in a try/catch: Firefox is the first entry in the map, and at startup main.ts calls generateManifests() and listen() inside one try, so a failure there would stop the native messaging server from starting at all.

This does mean Mozilla/ can be created when it is missing, which the note on #21784 rules out ("We do not want to create the browser directory"). Nothing is created for a browser that is not installed - Mozilla/ only appears once Application Support/Firefox/ has been observed, and only on macOS - but the letter of that rule is not preserved, and it deserves an explicit decision. Linux, Snap and Flatpak are unchanged.

Both MAS entitlements gain one entry - /Library/Application Support/Mozilla, without a trailing slash - alongside the existing NativeMessagingHosts/ subpath, which is left untouched: a subpath exception rooted at Mozilla/NativeMessagingHosts cannot authorize creating its own parent. Widening the leaf entry to Mozilla/ instead would have made it the only non-leaf grant of the thirteen, and would have reached Mozilla/ManagedStorage/ and Mozilla/Certificates/. This is the one part I cannot exercise - an unsandboxed local build permits the write regardless - so it is worth confirming on a signed MAS build.

Also adds native-messaging.main.spec.ts, which the module did not have.

@fabriziobagala
fabriziobagala requested a review from a team as a code owner August 16, 2026 15:35
@fabriziobagala
fabriziobagala requested a review from coroiu August 16, 2026 15:35
@bitwarden-bot

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! We've added this to our internal tracking system for review.
ID: PM-42047
Link: https://bitwarden.atlassian.net/browse/PM-42047

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@bitwarden-bot bitwarden-bot changed the title fix(desktop): install the Firefox native messaging manifest on macOS [PM-42047] fix(desktop): install the Firefox native messaging manifest on macOS Aug 16, 2026
@bitwarden-bot bitwarden-bot added community-pr needs-qa Marks a PR as requiring QA approval labels Aug 16, 2026
@pamperer562580892423

Copy link
Copy Markdown

@fabriziobagala Just FYI, I think someone else proposed a fix for this issue a few days ago: #22409 (also @Donnerbart)

@fabriziobagala

fabriziobagala commented Aug 18, 2026

Copy link
Copy Markdown
Author

@fabriziobagala Just FYI, I think someone else proposed a fix for this issue a few days ago: #22409 (also @Donnerbart)

@pamperer562580892423 Thanks for the info, but I hadn't realized anyone was already working on it. I created this PR because the bug had become too annoying, so I tried to fix it. On my MacBook, I applied the workaround I described in the issue. I hope this PR is helpful; if not, feel free to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-pr needs-qa Marks a PR as requiring QA approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firefox native messaging manifest is never installed on macOS

3 participants