Thunderbird Support for Browserpass #395
Open
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
This PR adds Thunderbird email client support to the Browserpass extension. It allows users to store and retrieve email credentials (IMAP, SMTP, POP3) and OAuth tokens (Gmail, Microsoft, Fastmail) from their
passpassword store instead of Thunderbird's built-in password manager.I am already running the implementation locally since a few days. I have tried different setups, fixed several issues on the way and also ran into Thunderbird issues.
For debugging purposes I have added quite some logging, which should not hurt and probably at least be kept until more users tried the extension.
I am interested in this feature myself and got some time to work on this.
It turned out to be much more code then originally anticipated but there were a lot of edge cases to cover and will probably be some more.
Any feedback is appreciated.
Features
passpassTechnical Implementation
Why Separate Builds?
Thunderbird requires WebExtension Experiments to hook into its authentication system, which Firefox doesn't allow for non-privileged add-ons. The experiment API provides access to:
MsgAuthPrompt- Intercepts IMAP/SMTP/POP3 password promptsOAuth2Module- Intercepts OAuth token requests for CalDAV/CardDAVbrowserRequest- Monitors OAuth browser windows for autofillTherefore, the extension is built separately:
make firefox- Standard browser extensionmake thunderbird- Includes experimental credentials APIThe core extension code remains shared; only the manifest and experiment files differ.
Architecture
Requirements
make hosts-thunderbird-userto registerTesting
make thunderbirdcd thunderbird && zip -r browserpass-thunderbird.xpi *Password Store Organization
The
https/directory is for OAuth identity provider login pages (e.g., Google, Okta) that appear in the OAuth browser window during account setup.Design Decisions
1. Offline Startup Control
Thunderbird is forced to start offline to prevent auth requests before the extension is ready (This seems to be a Thunderbird issue). Once hooks are registered, Thunderbird goes online automatically. User's "Always offline" preference is respected.
2. OAuth Token Caching
Tokens retrieved from
passare cached for 8 hours to reduce GPG decryption overhead. Cache is cleared on token update or after the timeout expires.3. Credential Migration
Credentials are migrated from Thunderbird's password manager to
pass. Existingpassentries are not overwritten.4. Service-Specific OAuth Storage
OAuth tokens are stored in service-specific directories (
oauth/mail/,oauth/caldav/,oauth/carddav/) because different services may request tokens with different scopes. A calendar app might request a token with calendar-only permissions, while mail needs separate permissions. Sharing a single token would break services that require permissions the new token doesn't have.Known Limitations
Breaking Changes
None - this is additive functionality that is mainly added to the Thunderbird extension.
Related PRs
A companion PR to browserpass-native is required to register the native host for Thunderbird:
hosts-thunderbird-userandhosts-thunderbirdMakefile targetsfirefox-host.jsonnative messaging manifestReferences