emailengine-app 2.79.8 → 2.79.9

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.
Files changed (133) hide show
  1. package/.github/dependabot.yml +22 -0
  2. package/.github/workflows/test.yml +39 -0
  3. package/.release-please-manifest.json +1 -1
  4. package/CHANGELOG.md +20 -0
  5. package/DOCKER_DEPLOYMENT.md +6 -7
  6. package/Dockerfile +35 -11
  7. package/config/default.toml +2 -1
  8. package/copy-static-files.sh +23 -5
  9. package/data/google-crawlers.json +1 -1
  10. package/lib/account.js +26 -1
  11. package/lib/api-routes/bull-board-routes.js +3 -2
  12. package/lib/api-routes/route-helpers.js +8 -0
  13. package/lib/auth-token.js +73 -2
  14. package/lib/autodetect-imap-settings.js +33 -25
  15. package/lib/consts.js +8 -1
  16. package/lib/egress-fetch.js +133 -0
  17. package/lib/export.js +35 -2
  18. package/lib/handlebars-helpers.js +129 -0
  19. package/lib/imap-proxy-auth.js +41 -21
  20. package/lib/imapproxy/imap-core/README.md +1 -0
  21. package/lib/imapproxy/imap-core/lib/tls-options.js +5 -46
  22. package/lib/imapproxy/imap-server.js +9 -10
  23. package/lib/openapi/index.js +3 -0
  24. package/lib/outbox.js +28 -3
  25. package/lib/rate-limit.js +23 -4
  26. package/lib/schemas.js +10 -3
  27. package/lib/security-headers.js +396 -0
  28. package/lib/sentry.js +36 -4
  29. package/lib/smtp-auth.js +86 -7
  30. package/lib/tools.js +265 -120
  31. package/lib/ui-routes/account-routes.js +4 -3
  32. package/lib/ui-routes/export-routes.js +4 -0
  33. package/lib/ui-routes/mcp-consent-routes.js +7 -0
  34. package/lib/ui-routes/network-config-routes.js +4 -3
  35. package/lib/ui-routes/route-helpers.js +24 -8
  36. package/lib/ui-routes/smtp-test-routes.js +7 -0
  37. package/lib/webhook-egress.js +5 -0
  38. package/package.json +21 -24
  39. package/sbom.json +1 -1
  40. package/server.js +37 -36
  41. package/static/js/ace/css/ace.css +1462 -0
  42. package/static/js/ace/css/kuroir-1.png +0 -0
  43. package/static/js/ace/css/kuroir-2.png +0 -0
  44. package/static/js/ace/css/main-1.png +0 -0
  45. package/static/js/ace/css/main-10.svg +4 -0
  46. package/static/js/ace/css/main-11.svg +5 -0
  47. package/static/js/ace/css/main-12.svg +4 -0
  48. package/static/js/ace/css/main-13.png +0 -0
  49. package/static/js/ace/css/main-14.png +0 -0
  50. package/static/js/ace/css/main-15.png +0 -0
  51. package/static/js/ace/css/main-16.png +0 -0
  52. package/static/js/ace/css/main-17.png +0 -0
  53. package/static/js/ace/css/main-18.png +0 -0
  54. package/static/js/ace/css/main-19.png +0 -0
  55. package/static/js/ace/css/main-2.png +0 -0
  56. package/static/js/ace/css/main-20.png +0 -0
  57. package/static/js/ace/css/main-21.png +0 -0
  58. package/static/js/ace/css/main-22.png +0 -0
  59. package/static/js/ace/css/main-23.png +0 -0
  60. package/static/js/ace/css/main-24.png +0 -0
  61. package/static/js/ace/css/main-25.svg +1 -0
  62. package/static/js/ace/css/main-26.png +0 -0
  63. package/static/js/ace/css/main-3.png +0 -0
  64. package/static/js/ace/css/main-4.png +0 -0
  65. package/static/js/ace/css/main-5.svg +7 -0
  66. package/static/js/ace/css/main-6.svg +9 -0
  67. package/static/js/ace/css/main-7.svg +7 -0
  68. package/static/js/ace/css/main-8.svg +9 -0
  69. package/static/js/ace/css/main-9.svg +6 -0
  70. package/static/js/ace/css/theme/kuroir.css +78 -0
  71. package/static/js/ace/css/theme/tomorrow_night.css +128 -0
  72. package/static/js/ace/css/theme/tomorrow_night_eighties.css +128 -0
  73. package/static/js/ace/css/theme/xcode.css +106 -0
  74. package/static/js/ace/css/tomorrow_night-1.png +0 -0
  75. package/static/js/ace/css/tomorrow_night-2.png +0 -0
  76. package/static/js/ace/css/tomorrow_night_eighties-1.png +0 -0
  77. package/static/js/ace/css/tomorrow_night_eighties-2.png +0 -0
  78. package/static/js/ace/css/xcode-1.png +0 -0
  79. package/static/js/ace/css/xcode-2.png +0 -0
  80. package/static/js/ee-client.js +256 -102
  81. package/static/js/public.js +7 -0
  82. package/static/js/ui.js +32 -0
  83. package/static/licenses.html +331 -291
  84. package/static/vendor/simplewebauthn/browser.min.js +2 -2
  85. package/translations/messages.pot +203 -157
  86. package/views/accounts/account.hbs +15 -37
  87. package/views/accounts/browse.hbs +3 -1
  88. package/views/accounts/edit.hbs +1 -1
  89. package/views/accounts/register/imap-server.hbs +1 -1
  90. package/views/config/ai.hbs +1 -1
  91. package/views/config/branding.hbs +2 -2
  92. package/views/config/document-store/chat.hbs +1 -1
  93. package/views/config/document-store/index.hbs +1 -1
  94. package/views/config/imap-proxy.hbs +1 -1
  95. package/views/config/license.hbs +1 -1
  96. package/views/config/mcp.hbs +1 -1
  97. package/views/config/network.hbs +14 -16
  98. package/views/config/oauth/app.hbs +2 -2
  99. package/views/config/service.hbs +1 -1
  100. package/views/config/smtp.hbs +1 -1
  101. package/views/config/webhooks.hbs +2 -2
  102. package/views/error.hbs +4 -2
  103. package/views/internals/index.hbs +1 -1
  104. package/views/layout/app.hbs +3 -11
  105. package/views/mcp/authorize.hbs +1 -1
  106. package/views/partials/ace_assets.hbs +13 -0
  107. package/views/partials/add_account_modal.hbs +1 -1
  108. package/views/partials/address_list.hbs +4 -4
  109. package/views/partials/filter_editor_js.hbs +2 -2
  110. package/views/partials/gateway_js.hbs +1 -1
  111. package/views/partials/oauth_form.hbs +1 -1
  112. package/views/partials/public_theme_init.hbs +1 -1
  113. package/views/partials/template_form.hbs +2 -2
  114. package/views/partials/test_send.hbs +7 -4
  115. package/views/partials/theme_init.hbs +1 -1
  116. package/views/partials/ui/details.hbs +2 -2
  117. package/views/partials/webhooks_editor_functions.hbs +1 -1
  118. package/views/reference/redirect.hbs +1 -1
  119. package/views/templates/template.hbs +2 -2
  120. package/views/tokens/new.hbs +1 -1
  121. package/views/unsubscribe.hbs +1 -1
  122. package/views/webhooks/webhook.hbs +2 -2
  123. package/workers/api.js +42 -112
  124. package/workers/export.js +1 -5
  125. package/workers/imap.js +1 -3
  126. package/workers/smtp.js +12 -43
  127. package/workers/submit.js +6 -12
  128. package/workers/webhooks.js +6 -17
  129. package/static/front/EmailEngine_logo_horiz.png +0 -0
  130. package/static/front/EmailEngine_logo_vert.png +0 -0
  131. package/static/front/index.html +0 -57
  132. package/static/front/logo.png +0 -0
  133. package/static/vendor/handlebars/handlebars.min-v4.7.9.js +0 -29
@@ -16,7 +16,7 @@ const { REDIS_PREFIX } = require('../consts');
16
16
  const { failAction, getServiceHostname, reloadTlsServers } = require('../tools');
17
17
  const { ADDRESS_STRATEGIES, settingsSchema } = require('../schemas');
18
18
  const { updatePublicInterfaces } = require('../utils/network');
19
- const { getServerStatus, cachedTemplates } = require('./route-helpers');
19
+ const { getServerStatus, compiledFragments } = require('./route-helpers');
20
20
  const { registerSettingsPage } = require('./settings-page');
21
21
 
22
22
  const configSmtpSchema = {
@@ -146,7 +146,6 @@ function init(args) {
146
146
  imapStrategies: ADDRESS_STRATEGIES.map(entry => Object.assign({ selected: values.imapStrategy === entry.key }, entry)),
147
147
 
148
148
  addresses: await listPublicInterfaces([].concat(values.localAddresses || [])),
149
- addressListTemplate: cachedTemplates.addressList,
150
149
  defaultSmtpEhloName: await getServiceHostname()
151
150
  };
152
151
  },
@@ -186,7 +185,9 @@ function init(args) {
186
185
 
187
186
  return {
188
187
  success: true,
189
- addresses: await listPublicInterfaces(localAddresses)
188
+ // The page swaps its table body for this: the same partial the page was
189
+ // rendered with, so a rescan cannot drift from first paint
190
+ html: compiledFragments.addressList({ addresses: await listPublicInterfaces(localAddresses) })
190
191
  };
191
192
  } catch (err) {
192
193
  request.logger.error({ msg: 'Failed loading public IP addresses', err });
@@ -6,20 +6,20 @@
6
6
  // be extracted without stranding a helper its sibling groups still need. Pure functions
7
7
  // and cached data only - this module registers no routes.
8
8
  //
9
- // Every symbol below was moved verbatim from lib/routes-ui.js. The only change is in
10
- // cachedTemplates: its __dirname-relative paths gain one extra '..' because this file
11
- // lives one directory deeper (lib/ui-routes/) than the original (lib/).
9
+ // Every symbol below was moved verbatim from lib/routes-ui.js, apart from compiledFragments,
10
+ // which replaced the raw template sources the monolith handed to the browser.
12
11
 
13
12
  const Boom = require('@hapi/boom');
14
13
  const util = require('util');
15
14
  const fs = require('fs');
16
15
  const pathlib = require('path');
17
16
  const psl = require('psl');
17
+ const handlebars = require('handlebars');
18
18
 
19
19
  const settings = require('../settings');
20
20
  const { redis } = require('../db');
21
21
  const { toolGrants } = require('../mcp/tools');
22
- const { Account, accountsExist, accountSummary, isAuthFailureDisabled } = require('../account');
22
+ const { Account, accountsExist, accountSummary, isAuthFailureDisabled, isAccessTokenInvalidated } = require('../account');
23
23
  const { REDIS_PREFIX, DEFAULT_PAGE_SIZE } = require('../consts');
24
24
  const { oauth2ProviderData } = require('../oauth2-apps');
25
25
  const exampleDocumentsPayloads = require('../payload-examples-documents.json');
@@ -44,9 +44,22 @@ const OPEN_AI_MODELS = [
44
44
  }
45
45
  ];
46
46
 
47
- const cachedTemplates = {
48
- addressList: fs.readFileSync(pathlib.join(__dirname, '..', '..', 'views', 'partials', 'address_list.hbs'), 'utf-8'),
49
- testSend: fs.readFileSync(pathlib.join(__dirname, '..', '..', 'views', 'partials', 'test_send.hbs'), 'utf-8')
47
+ // Partials a page renders again after it has loaded: the delivery-test results and the address
48
+ // list after an IP rescan. They used to be shipped to the browser as source and compiled there,
49
+ // which runs `new Function` and would need 'unsafe-eval' in the Content-Security-Policy the
50
+ // admin surface sends. Compiled once here instead, outside vision but on the same handlebars
51
+ // instance it renders with, so the helpers and partials registered on it resolve at render
52
+ // time; the JSON endpoints return the rendered HTML. Not going through vision is deliberate: its
53
+ // per-request view context consumes the pending flash messages. What a fragment therefore lacks
54
+ // is that context - no `cspNonce`, so a fragment can never carry an inline <script>.
55
+ const FRAGMENT_COMPILE_OPTIONS = { preventIndent: true }; // matches the vision compileOptions in workers/api.js
56
+
57
+ const compiledFragments = {
58
+ addressList: handlebars.compile(
59
+ fs.readFileSync(pathlib.join(__dirname, '..', '..', 'views', 'partials', 'address_list.hbs'), 'utf-8'),
60
+ FRAGMENT_COMPILE_OPTIONS
61
+ ),
62
+ testSend: handlebars.compile(fs.readFileSync(pathlib.join(__dirname, '..', '..', 'views', 'partials', 'test_send.hbs'), 'utf-8'), FRAGMENT_COMPILE_OPTIONS)
50
63
  };
51
64
 
52
65
  const getOpenAiModels = async (models, selectedModel) => {
@@ -244,6 +257,9 @@ function formatAccountData(account, gt) {
244
257
  account.oauth2.expiresStr = account.oauth2.expires ? account.oauth2.expires.toISOString() : false;
245
258
  account.oauth2.generatedStr = account.oauth2.generated ? account.oauth2.generated.toISOString() : false;
246
259
 
260
+ // the view names the state instead of printing the inverted range the invalidation leaves
261
+ account.oauth2.accessTokenInvalidated = isAccessTokenInvalidated(account.oauth2);
262
+
247
263
  if (account.outlookSubscription) {
248
264
  account.outlookSubscription.subscriptionExpiresStr = account.outlookSubscription.expirationDateTime
249
265
  ? account.outlookSubscription.expirationDateTime.toISOString()
@@ -593,7 +609,7 @@ module.exports = {
593
609
  accountPickerSelection,
594
610
  identityErrorView,
595
611
  OPEN_AI_MODELS,
596
- cachedTemplates,
612
+ compiledFragments,
597
613
  getOpenAiModels,
598
614
  closedAfterConnectMessage,
599
615
  accountStateLabel,
@@ -13,6 +13,7 @@ const getSecret = require('../get-secret');
13
13
  const { failAction, httpAgent } = require('../tools');
14
14
  const { accountIdSchema } = require('../schemas');
15
15
  const { REDIS_PREFIX } = require('../consts');
16
+ const { compiledFragments } = require('./route-helpers');
16
17
  const packageData = require('../../package.json');
17
18
 
18
19
  const SMTP_TEST_HOST = 'https://api.nodemailer.com';
@@ -207,6 +208,12 @@ ${now}`,
207
208
  if (testResponse.spf && testResponse.spf.status && testResponse.spf.status.comment) {
208
209
  testResponse.spf.status.comment = testResponse.spf.status.comment.replace(/^[^:\s]+:s*/, '');
209
210
  }
211
+
212
+ if (testResponse.status === 'success') {
213
+ // The page shows the results through this fragment rather than
214
+ // compiling the template in the browser, which the admin CSP forbids
215
+ testResponse.html = compiledFragments.testSend(testResponse);
216
+ }
210
217
  }
211
218
 
212
219
  return testResponse;
@@ -13,6 +13,11 @@ const { assertAllowedUrl, createEgressLookup, normalizePolicy, POLICY_OFF } = re
13
13
  // system can aim EmailEngine at anything its host can route to. Defaults to blocking the
14
14
  // link-local range (cloud instance metadata); `private` also blocks RFC1918 and friends, `off`
15
15
  // disables the check and restores redirect following. See lib/egress-filter.js
16
+ //
17
+ // The autodiscovery lookups (lib/autodetect-imap-settings.js) apply the same policy: their
18
+ // destinations are derived from the domain of a caller-supplied email address, which a DNS record
19
+ // can point anywhere. One policy rather than two because they guard the same thing, the host's
20
+ // network position, and an operator who tuned it for webhooks meant the tuning for all egress.
16
21
  const WEBHOOK_EGRESS_POLICY = normalizePolicy(readEnvValue('EENGINE_WEBHOOK_EGRESS_POLICY'));
17
22
 
18
23
  const policyEnabled = WEBHOOK_EGRESS_POLICY !== POLICY_OFF;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emailengine-app",
3
- "version": "2.79.8",
3
+ "version": "2.79.9",
4
4
  "private": false,
5
5
  "productTitle": "EmailEngine",
6
6
  "description": "Email Sync Engine",
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "homepage": "https://emailengine.app/",
53
53
  "dependencies": {
54
- "@bull-board/api": "9.6.1",
55
- "@bull-board/hapi": "9.6.1",
54
+ "@bull-board/api": "9.8.0",
55
+ "@bull-board/hapi": "9.8.0",
56
56
  "@elastic/elasticsearch": "8.15.3",
57
57
  "@hapi/accept": "6.0.3",
58
58
  "@hapi/bell": "13.1.0",
@@ -65,17 +65,17 @@
65
65
  "@msgpack/msgpack": "3.1.3",
66
66
  "@phc/pbkdf2": "1.1.14",
67
67
  "@postalsys/bounce-classifier": "3.0.0",
68
- "@postalsys/certs": "1.0.19",
69
- "@postalsys/ee-client": "1.7.0",
70
- "@postalsys/email-ai-tools": "1.13.24",
71
- "@postalsys/email-content": "0.1.4",
72
- "@postalsys/email-text-tools": "2.4.15",
68
+ "@postalsys/certs": "1.1.1",
69
+ "@postalsys/ee-client": "1.8.0",
70
+ "@postalsys/email-ai-tools": "1.14.3",
71
+ "@postalsys/email-content": "0.1.5",
72
+ "@postalsys/email-text-tools": "2.4.16",
73
73
  "@postalsys/gettext": "4.1.1",
74
74
  "@postalsys/joi-messages": "1.0.5",
75
75
  "@postalsys/templates": "2.0.2",
76
76
  "@sentry/node": "10.73.0",
77
- "@simplewebauthn/browser": "13.3.0",
78
- "@simplewebauthn/server": "13.3.3",
77
+ "@simplewebauthn/browser": "14.0.0",
78
+ "@simplewebauthn/server": "14.0.1",
79
79
  "@zone-eu/mailsplit": "5.4.16",
80
80
  "@zone-eu/wild-config": "1.7.6",
81
81
  "ace-builds": "1.44.0",
@@ -93,42 +93,42 @@
93
93
  "html-to-text": "10.0.1",
94
94
  "ical.js": "1.5.0",
95
95
  "iconv-lite": "0.7.3",
96
- "imapflow": "1.7.8",
96
+ "imapflow": "2.0.0",
97
97
  "ioredfour": "1.4.3",
98
98
  "ioredis": "6.0.0",
99
99
  "ipaddr.js": "2.5.0",
100
- "joi": "18.2.5",
100
+ "joi": "18.2.8",
101
101
  "libbase64": "1.3.0",
102
102
  "libmime": "5.4.3",
103
103
  "libqp": "2.1.1",
104
- "mailparser": "3.9.20",
104
+ "mailparser": "3.9.23",
105
105
  "marked": "15.0.12",
106
106
  "minimist": "1.2.8",
107
107
  "murmurhash": "2.0.1",
108
108
  "nanoid": "3.3.18",
109
- "nodemailer": "9.1.1",
109
+ "nodemailer": "10.0.1",
110
110
  "pino": "10.3.1",
111
111
  "prom-client": "15.1.3",
112
112
  "psl": "1.15.0",
113
- "pubface": "1.1.9",
113
+ "pubface": "1.1.12",
114
114
  "punycode.js": "2.3.1",
115
115
  "qrcode": "1.5.4",
116
- "smtp-server": "3.19.6",
117
- "socks": "2.8.9",
116
+ "smtp-server": "3.19.9",
117
+ "socks": "2.8.10",
118
118
  "timezones-list": "3.1.0",
119
- "undici": "7.29.0"
119
+ "undici": "7.29.1"
120
120
  },
121
121
  "devDependencies": {
122
122
  "@eslint/js": "10.0.1",
123
123
  "@iconify-json/tabler": "1.2.38",
124
124
  "@iconify/tailwind4": "1.2.3",
125
- "@playwright/test": "1.62.1",
125
+ "@playwright/test": "1.63.0",
126
126
  "@tailwindcss/cli": "4.3.3",
127
127
  "acorn": "8.18.0",
128
128
  "acorn-walk": "8.3.5",
129
129
  "chai": "4.5.0",
130
130
  "eerawlog": "1.5.5",
131
- "eslint": "10.9.1",
131
+ "eslint": "10.10.0",
132
132
  "flyonui": "2.4.1",
133
133
  "pino-pretty": "13.1.3",
134
134
  "prettier": "3.9.6",
@@ -143,7 +143,7 @@
143
143
  "deepmerge-ts": "^8.0.1"
144
144
  },
145
145
  "engines": {
146
- "node": ">=20.x"
146
+ "node": ">=20.0.0"
147
147
  },
148
148
  "pkg": {
149
149
  "scripts": [
@@ -157,14 +157,11 @@
157
157
  "static/**/*",
158
158
  "views/**/*",
159
159
  "lib/lua/**/*",
160
- "node_modules/bull/lib/commands/**/*",
161
160
  "translations/**/*",
162
161
  "node_modules/@postalsys/joi-messages/translations/*",
163
162
  "node_modules/@postalsys/bounce-classifier/model/**/*",
164
163
  "node_modules/@postalsys/email-content/dist/detect/patterns/*.json",
165
164
  "node_modules/jsdom/lib/jsdom/browser/default-stylesheet.css",
166
- "node_modules/nodemailer/lib/well-known/*.json",
167
- "node_modules/nodemailer/package.json",
168
165
  "LICENSE_EMAILENGINE.txt",
169
166
  "version-info.json",
170
167
  "sbom.json"