Commit Graph
98 Commits
Author SHA1 Message Date
Linus Rath 1f89e89ce5 feat: let plugins refresh their message-list badges, which now need only the read permission 2026-10-14 06:26:10 +02:00
Linus Rath 49511dff38 feat: let plugins read their own non-secret admin settings without the admin permission 2026-10-14 06:23:10 +02:00
Linus Rath e9b2ef3258 fix: let plugin frames use forms without letting them post anywhere 2026-10-14 06:19:12 +02:00
Linus Rath 8bf4df4513 feat: add a notifications panel for plugin notifications and app errors 2026-10-14 05:25:16 +02:00
Linus Rath 1ba53655e5 fix: let identity hooks stop a plugin's change, send notification clicks to plugins that show notifications, and mark reading mail as high risk 2026-10-14 04:37:24 +02:00
Linus Rath 8ad8f44e78 Merge branch 'feat/plugin-host-apis' into feat/plugin-system-audit
# Conflicts:
#	lib/plugin-sandbox/permission-text.ts
#	lib/plugin-sandbox/permissions.ts
#	lib/protocol-handlers/mailto.ts
#	locales/en/common.json
2026-10-14 04:34:14 +02:00
Linus Rath 5d9268c923 feat: let plugins add buttons, calendar day labels and pages, and use connected accounts from the sandbox 2026-10-14 04:31:43 +02:00
Linus Rath 3a83c00e00 feat: describe every place a plugin can show UI in one catalogue, with a permission for each area 2026-10-14 04:31:43 +02:00
Linus Rath 437bb1d11a test: require every plugin permission to gate a method, hook or slot 2026-10-14 04:28:24 +02:00
Linus Rath 3a65964d26 feat: let plugins show notifications that name the plugin 2026-10-14 04:26:16 +02:00
Linus Rath ead925c1b8 feat: let plugins open a filled-in composer and save drafts 2026-10-14 04:23:17 +02:00
Linus Rath 08e2d65944 feat: let untrusted plugins save attachments and message sources of a given message 2026-10-14 04:16:31 +02:00
Linus Rath 60257bb732 feat: let users connect accounts for plugins in a dialog the plugin can't read, and disconnect them in settings 2026-10-14 04:14:13 +02:00
Linus Rath 8fd6bc42c3 feat: let plugins read any message, list a folder and see the folders 2026-10-14 04:13:33 +02:00
Linus Rath 121d8ba30c feat: let plugins manage templates, sender signatures and the out-of-office reply 2026-10-14 04:06:06 +02:00
Linus Rath 3df031edd1 feat: let plugins read and change calendar events and tasks 2026-10-14 04:02:47 +02:00
Linus Rath a3cb9e630e refactor: describe every plugin hook in one catalogue
The hook buses, the permission each hook needs and the docs were three
separate lists that had drifted: 145 of 198 hooks were never fired and
nothing noticed. `lib/plugin-hook-catalog.ts` now names each hook with
its kind, permission, payload and when it fires; the permission check
reads it, and a test fails for any catalogued hook without a call site.
Groups still being wired in this branch are listed in that test.

Also:
- new before-hooks for archive, spam, read state, star, keywords, folder
  changes, RSVP, event import, tasks, file moves, settings, identities,
  filters and out-of-office, plus onComposerClose and onSyncStateChange
- removed hooks that can never fire: the S/MIME group (S/MIME is a
  plugin now), onMobileViewSwitch, onSidebarAppChange and the
  registerShortcut pseudo-hook
- smime:read no longer grants anything; manifests that name it still
  install, with a warning
2026-10-14 03:14:29 +02:00
Linus Rath 8ef7ec022f fix: deliver a plugin OAuth callback only to the plugin that started the flow 2026-10-14 03:04:17 +02:00
Linus Rath bf1d8fd2c3 fix: stop keeping unanswered plugin hook calls and old slot callbacks around 2026-10-14 03:02:12 +02:00
Linus Rath ada81d5f8f fix: hide the Next.js dev badge inside plugin slots and warn that dev sandboxes are not isolated 2026-10-14 03:01:13 +02:00
Linus Rath 3bfc0e69d0 fix: check attachments a plugin adds to the composer and keep callbacks out of shouldShow 2026-10-14 02:58:47 +02:00
Linus Rath 2adb1e2b12 fix: size toolbar plugin slots to their content and give composer plugin buttons their own row 2026-10-14 02:53:46 +02:00
Linus Rath cef2438c33 fix: let untrusted plugins upload attachments for the composer again 2026-10-14 02:34:31 +02:00
Linus Rath f048db7b52 fix: count each plugin hook failure once and keep a plugin that kept failing turned off 2026-10-14 02:33:45 +02:00
Linus Rath a491eab317 fix: hash WKD names with WebCrypto instead of shipping a Node crypto polyfill to the browser 2026-10-14 02:31:39 +02:00
Linus Rath 23c4c654d7 fix: limit what a plugin can store, download, toast and send to a WKD lookup, and report refused admin config writes 2026-10-14 02:30:54 +02:00
Linus Rath 22846b4a9b fix: keep blob uploads privileged-only and derive the WebAuthn salt from the calling plugin 2026-10-14 02:28:11 +02:00
Linus Rath bb562362b8 fix: lay out plugin slots right-to-left in Arabic, Hebrew and Persian and use the app font size 2026-10-14 02:24:45 +02:00
Linus Rath a21dbc92ec fix: switch running plugins to a new language right away and fall back from de-CH to de 2026-10-14 02:23:40 +02:00
Linus Rath 8f70951555 fix: give plugins their default settings and apply setting changes without a reload 2026-10-14 02:21:45 +02:00
Linus Rath eadff464a3 fix: keep plugin shortcuts behind ui:keyboard and off the keys the app and browser use 2026-10-14 02:19:10 +02:00
Linus Rath ff1d1f399d fix: limit plugin dialogs to one at a time, name the plugin in each and offer to turn it off 2026-10-14 02:15:45 +02:00
Linus Rath be3debdcb4 fix: never send a message when a plugin that checks it before sending fails or does not answer 2026-10-14 02:11:59 +02:00
Linus Rath 592db209db fix: sign plugin bundles when they are installed and require the signature for privileged plugins 2026-10-14 02:05:47 +02:00
Linus Rath e720be7e17 feat: let users install their own plugins, with admin review of the actual code
The admin page offered "User Plugin Uploads" and "Require Admin
Approval", but nothing in Settings used them: there was no upload, no
uninstall and no way to ask for approval, and the admin had no list of
requests. The approval code that existed pinned a hash of the code only
and showed the admin a manifest the browser sent, never the code.

Now:
- Settings > Plugins has an install button (when uploads are allowed),
  a remove button for the user's own plugins, and lists in plain
  language what each plugin may do, high-risk items first
- an install sends the ZIP to the server, which reads the manifest and
  code itself and pins the request to a hash of both
- the admin Plugins tab lists requests with the code and approves or
  denies them; a user may have 10 open requests
- a user plugin is checked again on every start, so a revoked approval
  or turning user plugins off takes effect
- the consent dialog and the plugin settings are translated, use the
  theme colours, and show the sites a plugin may send data to
2026-10-14 02:03:26 +02:00
Linus Rath c45533646e fix: give slot plugins the message, event or contact only with the matching read permission 2026-10-14 01:31:30 +02:00
Linus Rath 9bff740a89 fix: keep plugin network access to the origins in its manifest 2026-10-14 01:27:02 +02:00
Linus Rath 4d733aa598 chore: remove unused exports and the dead plugin error boundary 2026-10-13 13:36:51 +02:00
Linus Rath 22ffc36ca9 feat: let plugins run a message-list search with a JMAP filter #1024 2026-10-11 19:39:58 +02:00
Linus Rath 2522dbd804 fix: keep the plugin denylist and unit tests from breaking Lite and Docker builds 2026-09-26 21:38:57 +02:00
Linus Rath 0040e5daca fix: keep plugin storage per account and delete it on sign-out
`api.storage` kept one `plugin:<id>:` namespace for everyone signed in
to the browser and left it behind after signing out, so a plugin read
what it had stored for the previous account, such as quick-notes'
notes on someone else's mail.

Keys now carry the account (`plugin:<id>:@<account>:<key>`). Signing an
account out or removing it deletes its keys, and a full sign-out
deletes all plugin storage. Keys written before this change are handed
to the first account that uses the plugin. Uninstalling a plugin still
removes everything under its prefix.
2026-09-26 16:47:29 +02:00
Linus Rath 6d2255ad0d fix: keep plugin http.post away from credentialed and admin routes
`http.post` attaches the user's Authorization header to any same-origin
path the plugin's own manifest lists in `apiPostPaths`. A plugin with
only `http:post` could list the JMAP passthrough and get full JMAP
access, or reach `/api/admin/*`, `/api/settings` and the other
credentialed routes. The host now refuses those paths whatever the
manifest says, checked on the decoded path the router sees. Plugins
keep reaching their own sidecar routes.
2026-09-26 15:01:42 +02:00
Linus Rath f98779b0d0 fix: require manifest permissions for plugin hooks and slots
Only the host API methods checked a plugin's permissions. Every hook
and slot the sandbox reported was wired as-is, so a plugin declaring no
permissions could rewrite recipients and body of every outgoing mail
through `onTransformOutgoingEmail`, replace displayed bodies through
`onRenderEmailBody`, or read all fetched mail through
`onEmailsFetched`. Admin-installed plugins are managed, so users never
saw a consent prompt for any of it.

Each hook and slot now maps to a permission in
`lib/plugin-sandbox/permissions.ts`, checked the same way as API calls
(declared, and managed or granted). Hooks that change what is sent need
`email:send`, display takeovers need `email:render-takeover`, and a hook
or slot missing from the table is refused. Logout and account switches
stay implicit so plugins can always drop per-account state.
2026-09-26 14:26:33 +02:00
Linus Rath d5c0996519 fix: bind the plugin sandbox to its framing window (GHSA-96cx-gx36-3g79) 2026-09-17 20:31:39 +02:00
Linus Rath b168e45e22 Merge pull request #975 from bartfaizoli76/feature/plugin-dialog-open
feat: api.ui.openDialog + plugin-dialog slot for large, clickable custom UI
2026-09-07 17:42:42 +02:00
Linus Rath 93b8d99ff9 fix(): refill missing managed bundles from the server #636 2026-09-07 16:52:20 +02:00
bartfaizoli76 2adc281a9d feat: add ui.openDialog + 'plugin-dialog' slot for large, clickable custom UI
Every existing plugin slot renders wherever it's placed in the page (a
toolbar row, an attachment's hover-action bar, etc.) and is constrained
by that spot's own CSS - fine for small controls, but there's no way
for a plugin to show a large custom UI (a graphical file browser, a
multi-step wizard) since even a position:fixed overlay rendered from
inside such a slot is clipped to the surrounding row's own layout, not
the real page (confirmed live building the webdav-storage plugin: a
folder browser rendered but was squeezed into an unusable sliver).

Adds:
- host-dialog.ts: new 'custom' DialogKind + awaitCustomDialog(), reusing
  the existing confirm/alert/prompt queue plumbing.
- host-api.ts: 'ui.openDialog' API method.
- runtime.tsx: sandbox-side api.ui.openDialog(opts) proxy.
- plugin-types.ts: new 'plugin-dialog' SlotName - a plugin implements
  this slot with its actual custom UI.
- plugin-dialog-host.tsx: renders the requested slot via the existing
  PluginIframeSlot INSIDE the dialog's real app-root fixed overlay
  (position: fixed; inset: 0, above everything) instead of the
  confirm/prompt form, for kind: 'custom'. Resolves via a generic
  onResult callback in extraProps (marshalled the same way
  composer-attachment-source's onAttach already is - no new plumbing
  needed there).

A plugin calls api.ui.openDialog({ slot: 'plugin-dialog', extraProps,
title, width }) and awaits the Promise, which resolves to whatever its
own slot component passes to props.onResult(), or null if the user
closes the dialog without doing so.
2026-09-05 18:57:49 +02:00
Michael Richter 84617d6186 feat: OAuth handler for plugins; extended contacts and addressbook API 2026-08-31 09:55:06 +02:00
Roman Varlakov 7928f72ee2 feat: real byte progress for attachment uploads, stock and plugin-offloaded
The composer chip only knew a boolean: `uploading` flipped on, an
indeterminate bar animated at 40% width, and nothing anywhere carried a
percentage, so a large attachment on a slow link looked frozen for the
whole transfer. The JMAP client has been able to report real progress
since #333 gave uploadBlob an XHR path with onProgress; the composer
just never passed it.

Stock path: pass onProgress and the existing AbortController's signal to
client.uploadBlob. The chip's bar becomes determinate as soon as bytes
are reported (falling back to the indeterminate animation otherwise),
and cancel now aborts the transfer itself instead of being checked only
once the upload has finished.

Plugin offload path (#751): a plugin that offloads an attachment moves
the bytes itself via api.http.post, which the composer cannot observe.
It also cannot be handed a callback: the sandbox bridge marshals
functions host-to-plugin only, and the File a plugin holds is a
structured clone, so object identity cannot correlate its request back
to an attachment. The staged file id can: the composer generated it and
handed it to onBeforeBlobUpload. A plugin echoes it back as the new
optional `progressFileId` on the post options; the host sends the Blob
via XMLHttpRequest (fetch exposes no upload progress events) and reports
bytes into a host-side registry keyed by that id, which the composer
subscribes to before running the hook. Progress never crosses into the
sandbox, and reports for an id the composer is not tracking are dropped,
so the plugin API grows exactly one optional field. Calls without
progressFileId keep the fetch path untouched.

Closes #754
2026-08-23 19:44:56 +06:00
Paulhenry Saux d82a8e5ca5 feat(plugins): new plugin API method: getPublicKeyFromWKD 2026-08-22 20:55:45 +02:00