feat: add 3 new plugin hooks : onBeforeBlobUpload, onBeforeDraftAutoS…#586
Merged
Conversation
…ave, onBeforeEditDraft
Member
|
also check out the new sidebar and popup options, if you need/want to use them |
paulhenry46
added a commit
to paulhenry46/webmail
that referenced
this pull request
Jul 9, 2026
paulhenry46
added a commit
to paulhenry46/webmail
that referenced
this pull request
Jul 12, 2026
…ocol plugin sandbox
14 tasks
rathlinus
pushed a commit
that referenced
this pull request
Jul 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 add 3 new hooks onBeforeBlobUpload, onBeforeDraftAutoSave, onBeforeEditDraft and 2 new host.api methods.
This is needed for true e2e encryption. Indeed, now, when we write an email and then send it encrypted with recipients pub key, the server has seen the drafts and attachments used in the email. This PR try to fix that.
Changes
Hooks
onBeforeBlobUploadfile transformer hook. It is called just before the file is uploaded to the server. This transforms the file and not its properties (name, type, etc) registered in email. It will be used to encrypt the attachments.onBeforeDraftAutoSaveAlmostSavedDraft transformer hook. It is called just before the draft is saved by client. It will be used to encrypt the content of the draft.onBeforeEditDraftEmail transformer hook. It is called just before the composer is populated with values from draft we edit. It is useful to decrypt the draft we encrypt earlier.Host API
Added
This is related to
onBeforeBlobUploadhook. Indeed, editing files uploaded is dangerous, so we want a permission for that. This new host API are created to prevent plugins without permission to just register theonBeforeBlobUploadwithout declaring the good permission. This new api methods allow the plugin to get the raw file and replace it before upload.Before uploading email-composer save the file in a store of indexedDB and pass the ID to the transformer. The plugins can edit file and save it to the indexedDB. They return the new ID of the File saved in indexedDB. The save method automatically remove precedent version of File in the indexedDB.
plugin-storage
We added the store
file-pluginto save the files and expose the fileStorage API used in the API host methods.Related Issues
This add hooks to create a PGP plugin to (#481)
Type of Change
Checklist
npm run typecheck && npm run lintand there are no errorsnpm run build)locales/) if my changes affect user-facing text (N/A)Screenshots / Demo
Notes for Reviewers
The two new API methods are privileged tiers.