emailengine-app 2.79.9 → 2.80.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +73 -0
- package/README.md +6 -0
- package/config/default.toml +5 -1
- package/data/google-crawlers.json +1 -1
- package/encrypt.js +43 -0
- package/lib/account/account-state.js +62 -0
- package/lib/account.js +34 -2
- package/lib/api-routes/account-routes.js +101 -1
- package/lib/api-routes/blocklist-routes.js +24 -0
- package/lib/api-routes/delivery-test-routes.js +6 -0
- package/lib/api-routes/gateway-routes.js +30 -0
- package/lib/api-routes/index.js +1 -1
- package/lib/api-routes/license-routes.js +10 -0
- package/lib/api-routes/mcp-oauth-routes.js +3 -3
- package/lib/api-routes/mcp-routes.js +39 -21
- package/lib/api-routes/oauth2-app-routes.js +38 -1
- package/lib/api-routes/outbox-routes.js +6 -0
- package/lib/api-routes/permission-map.js +208 -43
- package/lib/api-routes/pubsub-routes.js +8 -0
- package/lib/api-routes/route-helpers.js +58 -11
- package/lib/api-routes/settings-routes.js +67 -6
- package/lib/api-routes/stats-routes.js +6 -0
- package/lib/api-routes/template-routes.js +21 -0
- package/lib/api-routes/token-routes.js +34 -2
- package/lib/api-routes/webhook-route-routes.js +13 -0
- package/lib/autodetect-imap-settings.js +349 -47
- package/lib/cert-handler.js +62 -0
- package/lib/consts.js +50 -6
- package/lib/db.js +12 -0
- package/lib/egress-fetch.js +21 -9
- package/lib/email-client/base-client.js +238 -67
- package/lib/email-client/credential-errors.js +122 -0
- package/lib/email-client/gmail/gmail-api.js +2 -1
- package/lib/email-client/gmail-client.js +70 -64
- package/lib/email-client/imap/connection-errors.js +52 -0
- package/lib/email-client/imap/listing-diff.js +47 -6
- package/lib/email-client/imap/login-failure.js +52 -0
- package/lib/email-client/imap/mailbox.js +457 -379
- package/lib/email-client/imap/subconnection.js +17 -12
- package/lib/email-client/imap/sync-operations.js +46 -59
- package/lib/email-client/imap-client.js +139 -101
- package/lib/email-client/message-builder.js +11 -11
- package/lib/email-client/outlook/graph-api.js +2 -1
- package/lib/email-client/outlook-client.js +219 -106
- package/lib/enum-descriptions.js +12 -2
- package/lib/imap-proxy-auth.js +58 -3
- package/lib/imapproxy/imap-server.js +53 -62
- package/lib/lua/h-del-if-equals.lua +39 -0
- package/lib/lua/h-set-if-equals.lua +39 -0
- package/lib/mcp/oauth.js +46 -8
- package/lib/mcp/protocol.js +78 -35
- package/lib/mcp/tools.js +53 -17
- package/lib/privileged-settings.js +147 -0
- package/lib/routes-ui.js +4 -34
- package/lib/schemas.js +92 -16
- package/lib/security-headers.js +15 -0
- package/lib/settings.js +13 -0
- package/lib/tls/catalog.js +428 -0
- package/lib/tls/context.js +302 -0
- package/lib/tls/der.js +223 -0
- package/lib/tls/listeners.js +62 -0
- package/lib/tls/provision.js +555 -0
- package/lib/tls/self-signed.js +282 -0
- package/lib/tls/status.js +480 -0
- package/lib/tls/store.js +667 -0
- package/lib/token-permission-view.js +252 -102
- package/lib/token-permissions.js +176 -26
- package/lib/tokens.js +7 -6
- package/lib/tools.js +73 -27
- package/lib/ui-routes/account-routes.js +43 -30
- package/lib/ui-routes/admin-config-routes.js +63 -22
- package/lib/ui-routes/admin-entities-routes.js +23 -13
- package/lib/ui-routes/auth-routes.js +16 -1
- package/lib/ui-routes/internals-routes.js +3 -5
- package/lib/ui-routes/mcp-consent-routes.js +72 -31
- package/lib/ui-routes/network-config-routes.js +54 -45
- package/lib/ui-routes/tls-config-routes.js +628 -0
- package/lib/utils/mailbox-path.js +51 -0
- package/lib/utils/severity.js +31 -0
- package/package.json +12 -12
- package/sbom.json +1 -1
- package/server.js +23 -1
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +11 -0
- package/static/js/app.js +34 -0
- package/static/js/public.js +6 -2
- package/static/js/ui.js +97 -61
- package/static/licenses.html +341 -1252
- package/translations/messages.pot +62 -56
- package/views/account/login-redirect.hbs +22 -0
- package/views/account/passkeys.hbs +2 -2
- package/views/accounts/account.hbs +2 -2
- package/views/accounts/browse.hbs +1 -1
- package/views/accounts/edit.hbs +1 -1
- package/views/accounts/register/imap-server.hbs +1 -1
- package/views/config/ai.hbs +1 -1
- package/views/config/branding.hbs +2 -2
- package/views/config/document-store/chat.hbs +1 -1
- package/views/config/document-store/index.hbs +1 -1
- package/views/config/imap-proxy.hbs +1 -4
- package/views/config/license.hbs +1 -1
- package/views/config/mcp.hbs +88 -52
- package/views/config/network.hbs +1 -1
- package/views/config/oauth/app.hbs +2 -2
- package/views/config/service.hbs +1 -1
- package/views/config/smtp.hbs +1 -4
- package/views/config/tls-upload.hbs +81 -0
- package/views/config/tls.hbs +593 -0
- package/views/config/webhooks.hbs +2 -2
- package/views/internals/index.hbs +1 -1
- package/views/layout/app.hbs +6 -6
- package/views/layout/login.hbs +5 -5
- package/views/layout/main.hbs +2 -2
- package/views/layout/prompt.hbs +3 -3
- package/views/layout/public.hbs +1 -1
- package/views/mcp/authorize.hbs +47 -45
- package/views/partials/ace_assets.hbs +1 -1
- package/views/partials/add_account_modal.hbs +1 -1
- package/views/partials/filter_editor_js.hbs +2 -2
- package/views/partials/gateway_js.hbs +1 -1
- package/views/partials/mcp_access_levels.hbs +16 -9
- package/views/partials/mcp_tool_count.hbs +15 -14
- package/views/partials/oauth_form.hbs +1 -1
- package/views/partials/public_theme_init.hbs +1 -1
- package/views/partials/side_menu.hbs +1 -0
- package/views/partials/template_form.hbs +1 -1
- package/views/partials/theme_init.hbs +1 -1
- package/views/partials/tls_security_card.hbs +25 -53
- package/views/partials/ui/alert-banner.hbs +3 -2
- package/views/partials/ui/badge.hbs +6 -2
- package/views/partials/ui/btn.hbs +5 -2
- package/views/partials/webhooks_editor_functions.hbs +1 -1
- package/views/reference/index.hbs +1 -1
- package/views/reference/redirect.hbs +1 -1
- package/views/reference/tag.hbs +1 -1
- package/views/reference/token.hbs +1 -1
- package/views/templates/template.hbs +1 -1
- package/views/tokens/new.hbs +175 -74
- package/views/unsubscribe.hbs +1 -1
- package/views/webhooks/webhook.hbs +1 -1
- package/workers/api.js +102 -142
- package/workers/imap-proxy.js +4 -1
- package/workers/smtp.js +51 -44
- package/views/partials/tls_security_js.hbs +0 -64
- package/views/partials/tls_security_modal.hbs +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.80.1](https://github.com/postalsys/emailengine/compare/v2.80.0...v2.80.1) (2026-09-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **accounts:** stop a delete in the startup window from reporting a failure ([b41896b](https://github.com/postalsys/emailengine/commit/b41896b6706a8165b5481db39abff2f4e3299a13))
|
|
9
|
+
* **admin:** keep the admin UI working behind an HTML-rewriting CDN ([c2e6596](https://github.com/postalsys/emailengine/commit/c2e659687f909e8eaa416407b0fb0b4e5c19ba09))
|
|
10
|
+
* **deps:** update imapflow to 2.0.1 for the Exchange Online IMAP4rev2 advertisement ([a6b1b8f](https://github.com/postalsys/emailengine/commit/a6b1b8f0408a404aca76c8d89e894538eb97f00f))
|
|
11
|
+
* **deps:** update imapflow to 2.0.2, bull-board to 9.10.0 and @postalsys/certs to 1.4.1 ([2817f41](https://github.com/postalsys/emailengine/commit/2817f4134437f75e8c1a27049c850d28adc6351c))
|
|
12
|
+
* **deps:** update nodemailer to 10.0.3 across the packages that pin it ([a791216](https://github.com/postalsys/emailengine/commit/a7912162425c8d7e5bcd3ae020ca875b9d950c91))
|
|
13
|
+
* **imap:** report a login the server could not serve as a connection failure, and announce a repeated failure once ([832d6ab](https://github.com/postalsys/emailengine/commit/832d6ab966e0ad0f490aa3137f8130520d12de13))
|
|
14
|
+
* **mcp:** add the mcp-manage surface scope ([4f5043c](https://github.com/postalsys/emailengine/commit/4f5043c0dc118e73fe90cc0851cb110856d6239e))
|
|
15
|
+
* **mcp:** expose the instance management tools ([08f35a8](https://github.com/postalsys/emailengine/commit/08f35a8a1433bfbf1c14d4f03051876bd7bd2571))
|
|
16
|
+
* **mcp:** keep the connection check out of the Observe level and the service URL out of a settings grant ([e85de25](https://github.com/postalsys/emailengine/commit/e85de254950f6d65e8c342f4f7b371fb96428704))
|
|
17
|
+
* **mcp:** keep the TLS mode and mail certificate checking out of a settings grant ([ad6428f](https://github.com/postalsys/emailengine/commit/ad6428ff5c4bdee1421fc1568a6b1810a9598894))
|
|
18
|
+
* **mcp:** offer instance management first on the consent prompt, the generator and the token form ([6022a5c](https://github.com/postalsys/emailengine/commit/6022a5cfa3d792d8b3fe0e08bfa3bfa324d7a500))
|
|
19
|
+
* **mcp:** read every MCP access decision off one section table ([136c860](https://github.com/postalsys/emailengine/commit/136c860f7586a23c644899526c995ff2533034cd))
|
|
20
|
+
* **tls:** let each listener choose the certificate it presents by default ([056ff8f](https://github.com/postalsys/emailengine/commit/056ff8feb4b9cc990b08c8c0484bac0c044a1e28))
|
|
21
|
+
* **tokens:** accept a per-section grant list on token permissions ([ca6ff34](https://github.com/postalsys/emailengine/commit/ca6ff34f8a13cab3f65c614ab5df4644b3bdfa09))
|
|
22
|
+
* **tokens:** keep a record that names no groups out of the sections the admin split created ([d817416](https://github.com/postalsys/emailengine/commit/d81741690a32c26329f0e993bb1f0ce16414f2dc))
|
|
23
|
+
* **tokens:** keep the built-in listeners and the AI endpoint out of a settings grant ([d069dd7](https://github.com/postalsys/emailengine/commit/d069dd7e706f39791e0591e134286cb17e699f66))
|
|
24
|
+
* **tokens:** make the management endpoints grantable in their own sections ([4f975bf](https://github.com/postalsys/emailengine/commit/4f975bf72aeb818bcb3b64c98473f7eef92d040b))
|
|
25
|
+
* **ui:** rebuild the stylesheet so the MCP configuration page gets its section spacing ([e99bd30](https://github.com/postalsys/emailengine/commit/e99bd30644442ced19bfa82f4139076352db7c17))
|
|
26
|
+
|
|
27
|
+
## [2.80.0](https://github.com/postalsys/emailengine/compare/v2.79.9...v2.80.0) (2026-09-09)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **tls:** manage certificates on their own page, with a real self-signed fallback ([42a1546](https://github.com/postalsys/emailengine/commit/42a154616fdb63b7c3c38de89cffd73110a45526))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* **accounts:** keep the authentication server's status out of API and IMAP proxy answers ([79264b0](https://github.com/postalsys/emailengine/commit/79264b0ce471b0dcbc6764e7b1b51b637d2b49f7))
|
|
38
|
+
* **accounts:** stop a credential-service blip from flooding auth webhooks ([51f4f35](https://github.com/postalsys/emailengine/commit/51f4f35c95b6527a9c93ef30eda8b55c629369fc))
|
|
39
|
+
* **admin:** let the account page re-authenticate an OAuth2 account again ([56245f7](https://github.com/postalsys/emailengine/commit/56245f7224eaa998143773a6847d83a9cb39b108))
|
|
40
|
+
* **admin:** stop forced SSO from silently swallowing admin form submissions ([9653c2d](https://github.com/postalsys/emailengine/commit/9653c2db2c1ed6ef0557396b673b2b8a32c94af0))
|
|
41
|
+
* **api:** reload the TLS listeners only when a settings write changed a value ([b2052ac](https://github.com/postalsys/emailengine/commit/b2052acb52cec2063b66af00dab94246edcfffeb))
|
|
42
|
+
* **autodiscovery:** keep a usable server entry when a hostless sibling follows it ([3796668](https://github.com/postalsys/emailengine/commit/37966686762ce7435314e8da25d7ba26add42c6f))
|
|
43
|
+
* **autodiscovery:** make Exchange autodiscovery work at all ([271d85c](https://github.com/postalsys/emailengine/commit/271d85c76349c5ee7259dd18da9d4a132caee0c1))
|
|
44
|
+
* **autodiscovery:** stop a result that names no server from ending a lookup ([e698c3c](https://github.com/postalsys/emailengine/commit/e698c3c2737f464e1d10be2099fb18a8640c7708))
|
|
45
|
+
* **deps:** update @bull-board/api and @bull-board/hapi to 9.9.0 ([14720fb](https://github.com/postalsys/emailengine/commit/14720fbd84a58d405119f865715a672f9b319091))
|
|
46
|
+
* **deps:** update @postalsys/certs to 1.2.1 ([eb2c958](https://github.com/postalsys/emailengine/commit/eb2c9580e2437a317eeea8742ddf9af5c88434e5))
|
|
47
|
+
* **deps:** update @postalsys/certs to 1.3.0 ([08c2d1b](https://github.com/postalsys/emailengine/commit/08c2d1b27ed4aa13bb8130a611dfa73ab164d82b))
|
|
48
|
+
* **gmail:** clear a stale watch failure once push is no longer configured ([b5884fe](https://github.com/postalsys/emailengine/commit/b5884fe886260cb6578db91a7425a37be7261f34))
|
|
49
|
+
* **gmail:** report no watch for an account whose application has no Pub/Sub app ([7e53a20](https://github.com/postalsys/emailengine/commit/7e53a20c45017e8a6484910507ecfd72c0ef75c6))
|
|
50
|
+
* **gmail:** stop a dead Pub/Sub watch from being invisible and self-perpetuating ([206e17d](https://github.com/postalsys/emailengine/commit/206e17da9c74ce10146df51ba40db7dab94aa273))
|
|
51
|
+
* **imap:** announce a folder that appeared while the primary was down ([2afd207](https://github.com/postalsys/emailengine/commit/2afd2070d69e6bb3b791a06a8a14b40ea0696641))
|
|
52
|
+
* **imap:** announce the deletion of a tracked folder missing from the stored listing ([2ead02f](https://github.com/postalsys/emailengine/commit/2ead02f858ac3472f1e86a2984d6fdaf0163a33f))
|
|
53
|
+
* **imap:** answer a malformed message identifier instead of throwing at it ([9be0c9c](https://github.com/postalsys/emailengine/commit/9be0c9ca12a2e7c960b25eb971e405756a766ab6))
|
|
54
|
+
* **imap:** collect the connection-closed error and the attachment download ([8d0e589](https://github.com/postalsys/emailengine/commit/8d0e58946b47054aaac626ec72b0a59ad0f0682a))
|
|
55
|
+
* **imap:** keep a folder found by a pass that could not register it ([0971a4d](https://github.com/postalsys/emailengine/commit/0971a4dee15c7d10dc31f02b5e01e67bb8192e3d))
|
|
56
|
+
* **imap:** match configured folder paths against the spelling the server reports ([328e56a](https://github.com/postalsys/emailengine/commit/328e56a3684530b94b056abbf25d7881417cd470))
|
|
57
|
+
* **imap:** restore the first-sync backfill and the return to the main mailbox ([b0b229c](https://github.com/postalsys/emailengine/commit/b0b229c12f41a0a8313462bafc638e22020673f0))
|
|
58
|
+
* **imap:** stop a disconnect mid-sync from announcing a message without its images ([fab2c15](https://github.com/postalsys/emailengine/commit/fab2c1560a1782e708967afb8bf916bd5e634574))
|
|
59
|
+
* **imap:** stop a read-only folder listing from swallowing the mailboxNew event ([ab76f0d](https://github.com/postalsys/emailengine/commit/ab76f0ddc77bbcc321d1cb207695a2d4e145ecba))
|
|
60
|
+
* **imap:** stop the duplicate mailboxDeleted and the dropped inbox counters ([edd0b0c](https://github.com/postalsys/emailengine/commit/edd0b0cf9e7d2073ab7623bcd6e7fe60bf5dc4c1))
|
|
61
|
+
* **outlook:** keep retrying a subscription the fast retries gave up on ([9583780](https://github.com/postalsys/emailengine/commit/9583780427310e9acdbdbf8351edfc7d5e97bf3d))
|
|
62
|
+
* **outlook:** report an account that can no longer subscribe to changes ([9da07ad](https://github.com/postalsys/emailengine/commit/9da07adc5f9b21aab827f609c6ae1cb98120cdbe))
|
|
63
|
+
* **outlook:** stop a subscription recovery from dropping a newer failure ([bd613fe](https://github.com/postalsys/emailengine/commit/bd613fe829bfa0dd51875752d584947ed623956f))
|
|
64
|
+
* **outlook:** take a subscription report back when the subscription is healthy, keep it across a login ([9bccba8](https://github.com/postalsys/emailengine/commit/9bccba8537c3da969588a0b720b8f5fa2413b3d5))
|
|
65
|
+
* **tls:** let an operator point ACME at a different CA without editing source ([13b382f](https://github.com/postalsys/emailengine/commit/13b382f6e501a3ec34985b3dd3f0c4c542d8716f))
|
|
66
|
+
* **tls:** order a first certificate only for a listener that would serve it ([950185f](https://github.com/postalsys/emailengine/commit/950185fbaed09f050020f136d6673f4e4cf83fc8))
|
|
67
|
+
* **tls:** read the failed renewal from the certificate library instead of inferring it ([c0e4bfd](https://github.com/postalsys/emailengine/commit/c0e4bfd167b3783dcb9d25db9b83a15208779d53))
|
|
68
|
+
* **tls:** redesign the certificates page around what each listener serves ([7dc42ba](https://github.com/postalsys/emailengine/commit/7dc42ba524f91310a36d991d7535e8a0837d6537))
|
|
69
|
+
* **tls:** replace the abandoned ACME stack and ask the CA when to renew ([9364eeb](https://github.com/postalsys/emailengine/commit/9364eebb30921675f3b3f95a03de66504e9ef342))
|
|
70
|
+
* **tls:** report a failed renewal, converge concurrent self-signed replacement ([b1ac9e3](https://github.com/postalsys/emailengine/commit/b1ac9e3102827036a717de695f5c24697f51c5b3))
|
|
71
|
+
* **tls:** report a half-set ACME override, drop the unused listener restart ([fe7771e](https://github.com/postalsys/emailengine/commit/fe7771eb38e2d8cdfb62353d1375d0b52df90eac))
|
|
72
|
+
* **tls:** say plainly that the API listener serves HTTP by default ([31e75ae](https://github.com/postalsys/emailengine/commit/31e75ae8f0a124890b6727e733cdaa17ddda5ec4))
|
|
73
|
+
* **tls:** serve an encrypted operator key, keep the listener settings on reload ([75d16d9](https://github.com/postalsys/emailengine/commit/75d16d93527606708cf0b19ba89288f54382b4e6))
|
|
74
|
+
* **tls:** stop a repeated request from starting a second order, report the listener's own state ([845d4e7](https://github.com/postalsys/emailengine/commit/845d4e7729ff05c8e042607c4639b2c808f88d10))
|
|
75
|
+
|
|
3
76
|
## [2.79.9](https://github.com/postalsys/emailengine/compare/v2.79.8...v2.79.9) (2026-09-07)
|
|
4
77
|
|
|
5
78
|
|
package/README.md
CHANGED
|
@@ -68,6 +68,12 @@ Refer to the [configuration documentation](https://learn.emailengine.app/docs/co
|
|
|
68
68
|
|
|
69
69
|
By default, EmailEngine only allows connections from localhost. To enable external access, either edit the config file or use the CLI option `--api.host="0.0.0.0"`. Ensure to secure external access with a firewall or proxy to allow only trusted sources.
|
|
70
70
|
|
|
71
|
+
### Content-Security-Policy
|
|
72
|
+
|
|
73
|
+
Since v2.79.9 the admin interface is served with a nonce-based Content-Security-Policy, so only the scripts EmailEngine rendered will run. A CDN or proxy that rewrites the HTML on its way to the browser breaks that, because the scripts it re-creates do not carry the nonce. Cloudflare's Rocket Loader is the common case: the admin pages still render, but nothing on them works, and the browser console reports blocked inline scripts. Turn such an optimizer off for the hostname EmailEngine is served from.
|
|
74
|
+
|
|
75
|
+
Set `EENGINE_CSP_MODE=report-only` to keep the policy out of the way while still logging violations to the browser console, or `EENGINE_CSP_MODE=off` to send only the framing protection. See the [configuration documentation](https://learn.emailengine.app/docs/configuration/environment-variables).
|
|
76
|
+
|
|
71
77
|
## Deployment
|
|
72
78
|
|
|
73
79
|
### Ubuntu or Debian
|
package/config/default.toml
CHANGED
|
@@ -28,7 +28,11 @@ maxSize = "5M" # maximum size of an attachment when submitting or uploading
|
|
|
28
28
|
#maxPayloadTimeout = "10s" # how long to wait for a request body to arrive
|
|
29
29
|
#proxy = false # trust X-Forwarded-For from a reverse proxy (restrict the peers with EENGINE_API_PROXY_ADDRESSES)
|
|
30
30
|
#cspMode = "enforce" # Content-Security-Policy delivery: "enforce", "report-only" (violations are only reported to the browser console) or "off"
|
|
31
|
-
# Serve the API over HTTPS by pointing at a certificate and key
|
|
31
|
+
# Serve the API over HTTPS by pointing at a certificate and key. Anything left unset falls back to
|
|
32
|
+
# what EmailEngine manages itself (an uploaded certificate, a Let's Encrypt one, or a self-signed
|
|
33
|
+
# certificate), so this section is only needed to pin a specific certificate here.
|
|
34
|
+
# The SMTP server and the IMAP proxy take the same values through EENGINE_SMTP_TLS_* and
|
|
35
|
+
# EENGINE_IMAPPROXY_TLS_* (use the _FILE suffix to read one from a file).
|
|
32
36
|
#[api.tls]
|
|
33
37
|
#certPath = "/path/to/cert.pem"
|
|
34
38
|
#keyPath = "/path/to/key.pem"
|
package/encrypt.js
CHANGED
|
@@ -20,6 +20,7 @@ const msgpack = require('./lib/msgpack');
|
|
|
20
20
|
|
|
21
21
|
const { REDIS_PREFIX, ENCRYPTED_APP_KEYS } = require('./lib/consts');
|
|
22
22
|
const { Settings: CertSettings } = require('@postalsys/certs/lib/settings');
|
|
23
|
+
const { TLS_KEY } = require('./lib/tls/store');
|
|
23
24
|
|
|
24
25
|
const DECRYPT_PASSWORDS = [].concat(config.decrypt || []);
|
|
25
26
|
|
|
@@ -310,6 +311,48 @@ async function main() {
|
|
|
310
311
|
}
|
|
311
312
|
|
|
312
313
|
console.log(`Updated ${updatedCerts} TLS private keys`);
|
|
314
|
+
|
|
315
|
+
// TLS material EmailEngine manages itself: the certificate an operator uploaded through the
|
|
316
|
+
// admin UI, and the self-signed certificate a listener falls back to. Both live in the `tls`
|
|
317
|
+
// hash as JSON with an encrypted `privateKey` field, and both need the same pass - an uploaded
|
|
318
|
+
// certificate that could not be decrypted after a rotation would take the listener down at the
|
|
319
|
+
// next restart, and there is no way to regenerate one.
|
|
320
|
+
let updatedTlsRecords = 0;
|
|
321
|
+
let tlsKey = TLS_KEY;
|
|
322
|
+
let tlsEntries = await redis.hgetall(tlsKey);
|
|
323
|
+
for (let field of Object.keys(tlsEntries || {})) {
|
|
324
|
+
let record;
|
|
325
|
+
try {
|
|
326
|
+
record = JSON.parse(tlsEntries[field]);
|
|
327
|
+
} catch (err) {
|
|
328
|
+
console.log(`TLS entry ${field}: failed to parse`);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (!record || !record.privateKey) {
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
try {
|
|
337
|
+
let updated = await processSecret(record.privateKey, encryptSecret);
|
|
338
|
+
if (updated === record.privateKey) {
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
record.privateKey = updated;
|
|
342
|
+
|
|
343
|
+
let result = await redis.hmset(tlsKey, { [field]: JSON.stringify(record) });
|
|
344
|
+
if (result === 'OK') {
|
|
345
|
+
console.log(`TLS entry ${field}: updated`);
|
|
346
|
+
} else {
|
|
347
|
+
console.log(`TLS entry ${field}: Unexpected response from DB: ${result}`);
|
|
348
|
+
}
|
|
349
|
+
updatedTlsRecords++;
|
|
350
|
+
} catch (err) {
|
|
351
|
+
console.error(`Could not process "${field}". Check decryption secrets.`);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
console.log(`Updated ${updatedTlsRecords} stored TLS certificates`);
|
|
313
356
|
}
|
|
314
357
|
|
|
315
358
|
main()
|
|
@@ -188,6 +188,67 @@ async function resetStateCount(redis, account, state) {
|
|
|
188
188
|
return result >= 0;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
// A stored timestamp is only as good as whatever wrote it: a corrupt or hand-edited record must
|
|
192
|
+
// degrade to null rather than fail the response schema and 500 the endpoint
|
|
193
|
+
function isoOrNull(date) {
|
|
194
|
+
return date && date.toString() !== 'Invalid Date' ? date.toISOString() : null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The state of a Gmail account's Pub/Sub watch, for whoever has to answer "is push working right
|
|
199
|
+
* now". Derived rather than stored: the account keeps the last successful arm (`lastWatch`,
|
|
200
|
+
* `watchResponse`, `watchExpiration`) and the last failure (`watchFailure`) as separate records,
|
|
201
|
+
* and neither answers the question on its own.
|
|
202
|
+
*
|
|
203
|
+
* Everything here is a timestamp or an enum EmailEngine produced, and nothing the provider wrote is
|
|
204
|
+
* quoted. The stored failure carries plenty that is: `req.response` is Google's body verbatim, and
|
|
205
|
+
* `err` is `formatTokenError()` output whenever the failure was a token fetch, which interpolates
|
|
206
|
+
* the provider's `error_description`. GET /v1/account/{id} is reachable by an account-bound tenant
|
|
207
|
+
* token, by an MCP token whose contents reach an LLM, and by a session token that lives in page
|
|
208
|
+
* HTML, so the reason a watch failed stays on the account page - behind an admin session, reading
|
|
209
|
+
* the stored record directly.
|
|
210
|
+
*
|
|
211
|
+
* A dead watch is not an error state: the Gmail client keeps syncing on its fallback poller, so
|
|
212
|
+
* mail is delayed rather than lost. That is why this is a field to read and not a webhook.
|
|
213
|
+
*
|
|
214
|
+
* @param {Object} accountData - Account data object
|
|
215
|
+
* @returns {Object|null} Watch state, or null for an account that has never armed one
|
|
216
|
+
*/
|
|
217
|
+
function formatGmailWatch(accountData) {
|
|
218
|
+
if (!accountData || (!accountData.watchResponse && !accountData.watchFailure)) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Push is configured on the linked application. An account whose application has no Pub/Sub
|
|
223
|
+
// app has no watch to report, whatever an earlier configuration left behind: the Gmail client
|
|
224
|
+
// clears that record when it next arms a watch, but a send-only or parked account never
|
|
225
|
+
// arms one, and its months-old failure would otherwise read as the current state.
|
|
226
|
+
if (accountData._app && !accountData._app.pubSubApp) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const failure = accountData.watchFailure;
|
|
231
|
+
|
|
232
|
+
// The response of the arm that is actually live wins. `watchExpiration` rides the default
|
|
233
|
+
// serializer branch, which skips a null, so a success that carried no expiration leaves the
|
|
234
|
+
// previous arm's number in place and preferring it would report a lapsed watch as active
|
|
235
|
+
const expiration = (accountData.watchResponse && accountData.watchResponse.expiration) || accountData.watchExpiration;
|
|
236
|
+
const expires = isoOrNull(expiration && new Date(Number(expiration)));
|
|
237
|
+
|
|
238
|
+
// The failure carries its own attempt time because a failed renewal no longer moves lastWatch -
|
|
239
|
+
// doing so used to buy a broken watch a full day of silence, whatever the retry timer wanted
|
|
240
|
+
const lastCheck = (failure && isoOrNull(failure.time && new Date(failure.time))) || isoOrNull(accountData.lastWatch && new Date(accountData.lastWatch));
|
|
241
|
+
|
|
242
|
+
let state = 'expired';
|
|
243
|
+
if (failure) {
|
|
244
|
+
state = 'error';
|
|
245
|
+
} else if (expires && new Date(expires) > new Date()) {
|
|
246
|
+
state = 'active';
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return { state, lastCheck, expires };
|
|
250
|
+
}
|
|
251
|
+
|
|
191
252
|
/**
|
|
192
253
|
* Formats the last error for API responses
|
|
193
254
|
* Returns null if account is connected or no error exists
|
|
@@ -246,6 +307,7 @@ module.exports = {
|
|
|
246
307
|
setLastErrorState,
|
|
247
308
|
clearLastErrorState,
|
|
248
309
|
formatLastError,
|
|
310
|
+
formatGmailWatch,
|
|
249
311
|
|
|
250
312
|
// State counters
|
|
251
313
|
getStateCount,
|
package/lib/account.js
CHANGED
|
@@ -39,6 +39,7 @@ const { checkAccountScopes: checkScopes } = require('./oauth/scope-checker');
|
|
|
39
39
|
const { ACCOUNT_STATES, ERROR_STATES, calculateEffectiveState, validateAccountState, getDisplayState, formatLastError } = require('./account/account-state');
|
|
40
40
|
const { decodeStoredMailboxEntry } = require('./email-client/imap/listing-diff');
|
|
41
41
|
const { readImapData } = require('./account/imap-data');
|
|
42
|
+
const { isTransientCredentialError, credentialErrorStatus } = require('./email-client/credential-errors');
|
|
42
43
|
|
|
43
44
|
// Shared Lock instance to prevent Redis connection leak (one subscriber per Lock instance)
|
|
44
45
|
// Previously, each Account created its own Lock, causing ~30k connections with 30k accounts
|
|
@@ -1739,7 +1740,12 @@ class Account {
|
|
|
1739
1740
|
if (entry.status) {
|
|
1740
1741
|
delete entry.status.path;
|
|
1741
1742
|
}
|
|
1742
|
-
|
|
1743
|
+
// Keyed the way the stored listing is keyed, because that is what the lookup
|
|
1744
|
+
// below uses. A server that spells the inbox "Inbox" reports it that way in
|
|
1745
|
+
// every LIST response while the stored hash holds the case-folded "INBOX", so
|
|
1746
|
+
// an unnormalized key silently dropped the live counters for the one folder
|
|
1747
|
+
// every account has.
|
|
1748
|
+
mailboxListingMap.set(normalizePath(entry.path), entry);
|
|
1743
1749
|
}
|
|
1744
1750
|
}
|
|
1745
1751
|
|
|
@@ -3162,7 +3168,33 @@ class Account {
|
|
|
3162
3168
|
if (await useAuthServerForOAuth2(accountData.oauth2, this.logger, { account: this.account, target: 'api' })) {
|
|
3163
3169
|
// resolve credentials
|
|
3164
3170
|
|
|
3165
|
-
let authData
|
|
3171
|
+
let authData;
|
|
3172
|
+
try {
|
|
3173
|
+
authData = await resolveCredentials(this.account, 'api');
|
|
3174
|
+
} catch (err) {
|
|
3175
|
+
// The authentication server's own HTTP status must not become EmailEngine's, which
|
|
3176
|
+
// is why resolveCredentials() keeps it in an `authRequest` record rather than on
|
|
3177
|
+
// err.statusCode. It is translated into a status of EmailEngine's own here:
|
|
3178
|
+
// returning it verbatim told an API client holding a perfectly valid EmailEngine
|
|
3179
|
+
// token that its token was rejected (401) or that the account does not exist (404).
|
|
3180
|
+
let transient = isTransientCredentialError(err);
|
|
3181
|
+
|
|
3182
|
+
this.logger.error({
|
|
3183
|
+
msg: 'Failed to resolve credentials from the authentication server',
|
|
3184
|
+
account: this.account,
|
|
3185
|
+
target: 'api',
|
|
3186
|
+
status: credentialErrorStatus(err) || undefined,
|
|
3187
|
+
transient,
|
|
3188
|
+
err
|
|
3189
|
+
});
|
|
3190
|
+
|
|
3191
|
+
let error = Boom.boomify(err, { statusCode: transient ? 503 : 403 });
|
|
3192
|
+
error.output.payload.code = transient ? 'AuthServerUnavailable' : 'AuthServerError';
|
|
3193
|
+
if (!transient) {
|
|
3194
|
+
error.output.payload.authenticationFailed = true;
|
|
3195
|
+
}
|
|
3196
|
+
throw error;
|
|
3197
|
+
}
|
|
3166
3198
|
|
|
3167
3199
|
return {
|
|
3168
3200
|
account: accountData.account,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const crypto = require('crypto');
|
|
4
4
|
const { redis } = require('../db');
|
|
5
5
|
const { Account, accountExists, authFailureDisabledAt } = require('../account');
|
|
6
|
+
const { formatGmailWatch } = require('../account/account-state');
|
|
6
7
|
const getSecret = require('../get-secret');
|
|
7
8
|
const { oauth2Apps, SERVICE_ACCOUNT_PROVIDERS } = require('../oauth2-apps');
|
|
8
9
|
const settings = require('../settings');
|
|
@@ -10,7 +11,7 @@ const { autodetectImapSettings } = require('../autodetect-imap-settings');
|
|
|
10
11
|
const Boom = require('@hapi/boom');
|
|
11
12
|
const Joi = require('joi');
|
|
12
13
|
const { failAction, getSignedFormData, getLogs, verifyAccountInfo } = require('../tools');
|
|
13
|
-
const { handleError, maskSecrets, MASKED, MASK_NOTE } = require('./route-helpers');
|
|
14
|
+
const { handleError, maskSecrets, assertNoNetworkOverride, MASKED, MASK_NOTE } = require('./route-helpers');
|
|
14
15
|
|
|
15
16
|
const {
|
|
16
17
|
settingsSchema,
|
|
@@ -105,6 +106,10 @@ async function init(args) {
|
|
|
105
106
|
});
|
|
106
107
|
|
|
107
108
|
try {
|
|
109
|
+
// A narrowed provisioning token may add an account, but not route its connection
|
|
110
|
+
// through a host of its own choosing - the same rule the submit routes apply
|
|
111
|
+
assertNoNetworkOverride(request);
|
|
112
|
+
|
|
108
113
|
if (request.payload.oauth2 && request.payload.oauth2.authorize) {
|
|
109
114
|
// redirect to OAuth2 consent screen
|
|
110
115
|
|
|
@@ -185,6 +190,13 @@ async function init(args) {
|
|
|
185
190
|
tags: ['api', 'Account'],
|
|
186
191
|
|
|
187
192
|
plugins: {
|
|
193
|
+
mcp: {
|
|
194
|
+
name: 'create_account',
|
|
195
|
+
title: 'Create account',
|
|
196
|
+
description:
|
|
197
|
+
'Register an email account. For an OAuth2 provider set oauth2.provider to the application id (from list_oauth2_apps) and oauth2.authorize to true: the response carries a redirect URL for the user to open and sign in, and no credentials are needed. For IMAP set imap and smtp with the host, port and auth the user supplied (autodiscover_settings finds the servers). Prefer create_account_setup_link when the user can open a link themselves, so no password passes through this conversation.',
|
|
198
|
+
omit: ['proxy', 'smtpEhloName', 'webhooksCustomHeaders', 'copy', 'locale', 'tz']
|
|
199
|
+
},
|
|
188
200
|
openapi: {
|
|
189
201
|
'x-ee-behavior': [BEHAVIOR.CREDENTIALS_VERIFIED_LATER],
|
|
190
202
|
responses: apiResponses(
|
|
@@ -340,6 +352,10 @@ async function init(args) {
|
|
|
340
352
|
});
|
|
341
353
|
|
|
342
354
|
try {
|
|
355
|
+
// The stored credential survives a partial update, so where the connection goes is
|
|
356
|
+
// the one thing a narrowed token must not decide (see the provisioning group)
|
|
357
|
+
assertNoNetworkOverride(request);
|
|
358
|
+
|
|
343
359
|
// Validate delegation fields are only used with OAuth2 provider
|
|
344
360
|
validateDelegationFields(request.payload);
|
|
345
361
|
|
|
@@ -357,6 +373,13 @@ async function init(args) {
|
|
|
357
373
|
tags: ['api', 'Account'],
|
|
358
374
|
|
|
359
375
|
plugins: {
|
|
376
|
+
mcp: {
|
|
377
|
+
name: 'update_account',
|
|
378
|
+
title: 'Update account',
|
|
379
|
+
description:
|
|
380
|
+
"Change an account's configuration: name, email, sync and notification settings, special folders, the webhook target, and the IMAP, SMTP or OAuth2 connection settings. Send only the fields to change. Changing a host makes the next connection authenticate to the new host with the stored credential, so confirm connection changes with the user.",
|
|
381
|
+
omit: ['proxy', 'smtpEhloName', 'webhooksCustomHeaders', 'copy', 'locale', 'tz']
|
|
382
|
+
},
|
|
360
383
|
openapi: {
|
|
361
384
|
'x-ee-behavior': [BEHAVIOR.CREDENTIALS_VERIFIED_LATER],
|
|
362
385
|
responses: apiResponses('Returns the account ID. Changed credentials take effect on the next connection.', 400, 401, 403, 404, 429, 500)
|
|
@@ -481,6 +504,14 @@ async function init(args) {
|
|
|
481
504
|
tags: ['api', 'Account'],
|
|
482
505
|
|
|
483
506
|
plugins: {
|
|
507
|
+
mcp: {
|
|
508
|
+
name: 'reconnect_account',
|
|
509
|
+
title: 'Reconnect account',
|
|
510
|
+
description:
|
|
511
|
+
"Ask the account's worker to close and re-open its connection. Use after fixing credentials or server settings, or when an account is stuck connecting.",
|
|
512
|
+
omit: ['reconnect'],
|
|
513
|
+
force: { reconnect: true }
|
|
514
|
+
},
|
|
484
515
|
openapi: {
|
|
485
516
|
'x-ee-behavior': [BEHAVIOR.SCHEDULED_ON_WORKER],
|
|
486
517
|
responses: apiResponses(
|
|
@@ -553,6 +584,13 @@ async function init(args) {
|
|
|
553
584
|
tags: ['api', 'Account'],
|
|
554
585
|
|
|
555
586
|
plugins: {
|
|
587
|
+
mcp: {
|
|
588
|
+
name: 'sync_account',
|
|
589
|
+
title: 'Sync account now',
|
|
590
|
+
description: "Ask the account's worker to run a sync now instead of waiting for the next scheduled one.",
|
|
591
|
+
omit: ['sync'],
|
|
592
|
+
force: { sync: true }
|
|
593
|
+
},
|
|
556
594
|
openapi: {
|
|
557
595
|
'x-ee-behavior': [BEHAVIOR.SCHEDULED_ON_WORKER],
|
|
558
596
|
responses: apiResponses(
|
|
@@ -630,6 +668,12 @@ async function init(args) {
|
|
|
630
668
|
tags: ['api', 'Account'],
|
|
631
669
|
|
|
632
670
|
plugins: {
|
|
671
|
+
mcp: {
|
|
672
|
+
name: 'delete_account',
|
|
673
|
+
title: 'Delete account',
|
|
674
|
+
description:
|
|
675
|
+
'Remove an account from this instance, with its synced index and the tokens bound to it. The mailbox at the provider is untouched. Set revoke to true to also revoke the OAuth2 grant at the provider. Confirm with the user before calling this.'
|
|
676
|
+
},
|
|
633
677
|
openapi: {
|
|
634
678
|
'x-ee-impact': IMPACT.DESTRUCTIVE,
|
|
635
679
|
'x-ee-behavior': [BEHAVIOR.DELETION_SCOPE],
|
|
@@ -713,6 +757,14 @@ async function init(args) {
|
|
|
713
757
|
tags: ['api', 'Account'],
|
|
714
758
|
|
|
715
759
|
plugins: {
|
|
760
|
+
mcp: {
|
|
761
|
+
name: 'flush_account',
|
|
762
|
+
title: 'Flush and re-sync account',
|
|
763
|
+
description:
|
|
764
|
+
"Discard the account's local index and sync it again from scratch. Every existing message counts as new again, so webhooks fire for all of them; use only when the index is broken or the sync settings changed. Confirm with the user before calling this.",
|
|
765
|
+
omit: ['flush'],
|
|
766
|
+
force: { flush: true }
|
|
767
|
+
},
|
|
716
768
|
openapi: {
|
|
717
769
|
'x-ee-impact': IMPACT.DESTRUCTIVE,
|
|
718
770
|
'x-ee-behavior': [BEHAVIOR.SCHEDULED_ON_WORKER],
|
|
@@ -1034,6 +1086,11 @@ async function init(args) {
|
|
|
1034
1086
|
result.lastError = accountData.state === 'connected' ? null : accountData.lastErrorState;
|
|
1035
1087
|
}
|
|
1036
1088
|
|
|
1089
|
+
let gmailWatch = formatGmailWatch(accountData);
|
|
1090
|
+
if (gmailWatch) {
|
|
1091
|
+
result.gmailWatch = gmailWatch;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1037
1094
|
// Stated rather than inferred; see the field's description in lib/schemas.js
|
|
1038
1095
|
result.authFailureDisabledAt = authFailureDisabledAt(accountData);
|
|
1039
1096
|
|
|
@@ -1177,6 +1234,20 @@ async function init(args) {
|
|
|
1177
1234
|
.description('Information about the last SMTP connection attempt. Null when no SMTP connection has been attempted')
|
|
1178
1235
|
.label('SMTPInfoStatus'),
|
|
1179
1236
|
|
|
1237
|
+
gmailWatch: Joi.object({
|
|
1238
|
+
state: Joi.string()
|
|
1239
|
+
.valid('active', 'expired', 'error')
|
|
1240
|
+
.example('active')
|
|
1241
|
+
.description('Whether the Pub/Sub watch is armed, lapsed, or failed to renew')
|
|
1242
|
+
.label('AccountGmailWatchState'),
|
|
1243
|
+
lastCheck: Joi.date().iso().allow(null).example('2021-07-08T07:06:34.336Z').description('When the watch was last renewed or attempted'),
|
|
1244
|
+
expires: Joi.date().iso().allow(null).example('2021-07-15T07:06:34.336Z').description('When the current watch lapses')
|
|
1245
|
+
})
|
|
1246
|
+
.description(
|
|
1247
|
+
'State of the Gmail Pub/Sub watch (Gmail API accounts only). A watch that is not active does not stop the account syncing - the client falls back to polling, so new mail is delayed rather than lost. Why a renewal failed is shown on the account page rather than here, because that text is written by the provider'
|
|
1248
|
+
)
|
|
1249
|
+
.label('AccountGmailWatch'),
|
|
1250
|
+
|
|
1180
1251
|
syncError: Joi.object({
|
|
1181
1252
|
path: Joi.string().example('INBOX').description('Mailbox folder path where the error occurred'),
|
|
1182
1253
|
time: Joi.date().iso().example('2021-07-08T07:06:34.336Z').description('When the error occurred'),
|
|
@@ -1498,6 +1569,13 @@ async function init(args) {
|
|
|
1498
1569
|
tags: ['api', 'Account'],
|
|
1499
1570
|
|
|
1500
1571
|
plugins: {
|
|
1572
|
+
mcp: {
|
|
1573
|
+
name: 'create_account_setup_link',
|
|
1574
|
+
title: 'Create account setup link',
|
|
1575
|
+
description:
|
|
1576
|
+
'Create a one-time link to the hosted setup form, where the user signs in to their mailbox themselves, so no password passes through this conversation. Give the link to the user. Set redirectUrl to where they should land afterwards; optionally account (the id to assign), name, email, expectedEmail (the setup is refused if they sign in as someone else) and type (an OAuth2 application id, or imap).',
|
|
1577
|
+
keep: ['account', 'name', 'email', 'expectedEmail', 'redirectUrl', 'type']
|
|
1578
|
+
},
|
|
1501
1579
|
openapi: {
|
|
1502
1580
|
responses: apiResponses('Returns a single-use URL for the hosted authentication form.', 400, 401, 403, 404, 429, 500)
|
|
1503
1581
|
}
|
|
@@ -1609,6 +1687,12 @@ async function init(args) {
|
|
|
1609
1687
|
cors: CORS_CONFIG,
|
|
1610
1688
|
|
|
1611
1689
|
plugins: {
|
|
1690
|
+
mcp: {
|
|
1691
|
+
name: 'get_account_logs',
|
|
1692
|
+
title: 'Get account connection log',
|
|
1693
|
+
description:
|
|
1694
|
+
'Read the stored connection log of an account: the raw IMAP or provider API trace, which names folders, message ids and subjects. Use it to find out why an account fails to connect or sync. Only kept while logging is enabled for the account or for the whole instance.'
|
|
1695
|
+
},
|
|
1612
1696
|
openapi: {
|
|
1613
1697
|
'x-ee-behavior': [BEHAVIOR.ACCOUNT_LOG_SCOPE],
|
|
1614
1698
|
produces: ['text/plain'],
|
|
@@ -1637,6 +1721,7 @@ async function init(args) {
|
|
|
1637
1721
|
|
|
1638
1722
|
async handler(request) {
|
|
1639
1723
|
try {
|
|
1724
|
+
assertNoNetworkOverride(request);
|
|
1640
1725
|
return await verifyAccountInfo(redis, request.payload, request.logger.child({ action: 'verify-account' }));
|
|
1641
1726
|
} catch (err) {
|
|
1642
1727
|
handleError(request, err);
|
|
@@ -1648,6 +1733,14 @@ async function init(args) {
|
|
|
1648
1733
|
tags: ['api', 'Account'],
|
|
1649
1734
|
|
|
1650
1735
|
plugins: {
|
|
1736
|
+
mcp: {
|
|
1737
|
+
name: 'verify_account_settings',
|
|
1738
|
+
title: 'Verify account settings',
|
|
1739
|
+
description:
|
|
1740
|
+
'Test IMAP and SMTP settings without saving them: connects and authenticates with the supplied host, port and credentials and reports what failed. Set mailboxes to true to also list the folders. Useful before create_account or update_account.',
|
|
1741
|
+
omit: ['proxy', 'smtpEhloName'],
|
|
1742
|
+
openWorld: true
|
|
1743
|
+
},
|
|
1651
1744
|
openapi: {
|
|
1652
1745
|
'x-ee-impact': IMPACT.READONLY,
|
|
1653
1746
|
responses: apiResponses(
|
|
@@ -1725,6 +1818,13 @@ async function init(args) {
|
|
|
1725
1818
|
tags: ['api', 'Settings'],
|
|
1726
1819
|
|
|
1727
1820
|
plugins: {
|
|
1821
|
+
mcp: {
|
|
1822
|
+
name: 'autodiscover_settings',
|
|
1823
|
+
title: 'Discover mail server settings',
|
|
1824
|
+
description:
|
|
1825
|
+
"Discover the IMAP and SMTP server settings for an email address from DNS and the provider's autoconfiguration. The natural first step before create_account or verify_account_settings for a mailbox that does not use an OAuth2 application.",
|
|
1826
|
+
openWorld: true
|
|
1827
|
+
},
|
|
1728
1828
|
openapi: {
|
|
1729
1829
|
responses: apiResponses(
|
|
1730
1830
|
'Returns the discovered IMAP and SMTP settings for the address, or empty values when nothing could be resolved.',
|
|
@@ -10,6 +10,7 @@ const { failAction } = require('../tools');
|
|
|
10
10
|
const { handleError } = require('./route-helpers');
|
|
11
11
|
const { accountIdSchema, blocklistListIdSchema, apiResponses } = require('../schemas');
|
|
12
12
|
const { IMPACT } = require('./operation-impact');
|
|
13
|
+
const { MCP_MAX_PAGE_SIZE } = require('../consts');
|
|
13
14
|
|
|
14
15
|
async function init(args) {
|
|
15
16
|
const { server, call, CORS_CONFIG } = args;
|
|
@@ -32,6 +33,12 @@ async function init(args) {
|
|
|
32
33
|
tags: ['api', 'Blocklists'],
|
|
33
34
|
|
|
34
35
|
plugins: {
|
|
36
|
+
mcp: {
|
|
37
|
+
name: 'list_blocklists',
|
|
38
|
+
title: 'List suppression lists',
|
|
39
|
+
description: 'List the suppression lists (blocklists) and how many addresses each holds, paged.',
|
|
40
|
+
bounds: { pageSize: MCP_MAX_PAGE_SIZE }
|
|
41
|
+
},
|
|
35
42
|
openapi: {
|
|
36
43
|
responses: apiResponses('Returns every blocklist with its entry count.', 400, 401, 403, 429, 500)
|
|
37
44
|
}
|
|
@@ -102,6 +109,12 @@ async function init(args) {
|
|
|
102
109
|
tags: ['api', 'Blocklists'],
|
|
103
110
|
|
|
104
111
|
plugins: {
|
|
112
|
+
mcp: {
|
|
113
|
+
name: 'get_blocklist',
|
|
114
|
+
title: 'Get suppression list',
|
|
115
|
+
description: 'List the addresses on one suppression list, paged, with the reason and source of each entry.',
|
|
116
|
+
bounds: { pageSize: MCP_MAX_PAGE_SIZE }
|
|
117
|
+
},
|
|
105
118
|
openapi: {
|
|
106
119
|
responses: apiResponses('Returns a page of entries on the blocklist.', 400, 401, 403, 404, 429, 500)
|
|
107
120
|
}
|
|
@@ -208,6 +221,12 @@ async function init(args) {
|
|
|
208
221
|
tags: ['api', 'Blocklists'],
|
|
209
222
|
|
|
210
223
|
plugins: {
|
|
224
|
+
mcp: {
|
|
225
|
+
name: 'add_to_blocklist',
|
|
226
|
+
title: 'Add to suppression list',
|
|
227
|
+
description:
|
|
228
|
+
'Add a recipient address to a suppression list, so messages sent with that list id are not delivered to it. Needs the account the block was raised for.'
|
|
229
|
+
},
|
|
211
230
|
openapi: {
|
|
212
231
|
responses: apiResponses('Returns whether the address was added or was already listed.', 400, 401, 403, 404, 429, 500)
|
|
213
232
|
}
|
|
@@ -276,6 +295,11 @@ async function init(args) {
|
|
|
276
295
|
tags: ['api', 'Blocklists'],
|
|
277
296
|
|
|
278
297
|
plugins: {
|
|
298
|
+
mcp: {
|
|
299
|
+
name: 'remove_from_blocklist',
|
|
300
|
+
title: 'Remove from suppression list',
|
|
301
|
+
description: 'Remove a recipient address from a suppression list, so messages to it are delivered again.'
|
|
302
|
+
},
|
|
279
303
|
openapi: {
|
|
280
304
|
'x-ee-impact': IMPACT.DESTRUCTIVE,
|
|
281
305
|
responses: apiResponses('Returns a deletion marker.', 400, 401, 403, 404, 429, 500)
|
|
@@ -278,6 +278,12 @@ ${now}`,
|
|
|
278
278
|
tags: ['api', 'Delivery Test'],
|
|
279
279
|
|
|
280
280
|
plugins: {
|
|
281
|
+
mcp: {
|
|
282
|
+
name: 'check_delivery_test',
|
|
283
|
+
title: 'Check delivery test',
|
|
284
|
+
description:
|
|
285
|
+
'Check the result of a delivery test started over the REST API: whether the probe message arrived, and its SPF, DKIM and DMARC results.'
|
|
286
|
+
},
|
|
281
287
|
openapi: {
|
|
282
288
|
responses: apiResponses(
|
|
283
289
|
'Returns the test result once it has completed, including SPF, DKIM and DMARC outcomes.',
|