emailengine-app 2.87.1 → 2.88.0

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 (73) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +31 -0
  3. package/ENVIRONMENT.md +26 -23
  4. package/LICENSE_EMAILENGINE.txt +20 -12
  5. package/app.json +3 -3
  6. package/bin/emailengine.js +7 -11
  7. package/data/google-crawlers.json +1 -1
  8. package/data/public_suffix_list.dat +48 -10
  9. package/lib/account.js +69 -49
  10. package/lib/admin-password.js +85 -0
  11. package/lib/api-routes/license-routes.js +9 -0
  12. package/lib/api-token-auth.js +21 -5
  13. package/lib/calendar-event.js +15 -3
  14. package/lib/consts.js +5 -0
  15. package/lib/db.js +1 -0
  16. package/lib/dbsc/index.js +292 -0
  17. package/lib/dbsc/jwt.js +157 -0
  18. package/lib/dbsc/protocol.js +132 -0
  19. package/lib/dbsc/store.js +136 -0
  20. package/lib/email-client/base-client.js +36 -15
  21. package/lib/email-client/gmail-client.js +20 -6
  22. package/lib/email-client/imap/connection-errors.js +30 -1
  23. package/lib/email-client/imap/session-expiry.js +83 -0
  24. package/lib/email-client/imap-client.js +12 -2
  25. package/lib/email-client/smtp-pool-manager.js +66 -8
  26. package/lib/export.js +147 -22
  27. package/lib/graph-notifications.js +60 -0
  28. package/lib/imap-proxy-auth.js +52 -18
  29. package/lib/imapproxy/imap-core/lib/commands/id.js +4 -2
  30. package/lib/imapproxy/imap-core/lib/imap-command.js +44 -4
  31. package/lib/imapproxy/imap-server.js +10 -1
  32. package/lib/imapproxy/proxy-handoff.js +100 -5
  33. package/lib/license-subscription.js +238 -0
  34. package/lib/oauth/gmail.js +18 -0
  35. package/lib/oauth/outlook-identity.js +54 -12
  36. package/lib/prepared-password.js +38 -0
  37. package/lib/privileged-settings.js +6 -0
  38. package/lib/queue-browser/index.js +6 -6
  39. package/lib/queue-job-actions.js +59 -4
  40. package/lib/read-env-value.js +46 -21
  41. package/lib/redis-url.js +23 -0
  42. package/lib/response-stream.js +69 -1
  43. package/lib/revocation-events.js +79 -0
  44. package/lib/routes-ui.js +4 -1
  45. package/lib/schemas.js +26 -2
  46. package/lib/session-default.js +13 -3
  47. package/lib/settings.js +47 -24
  48. package/lib/sso.js +23 -0
  49. package/lib/submit-penalty.js +24 -0
  50. package/lib/submit-processor.js +10 -2
  51. package/lib/tokens.js +6 -0
  52. package/lib/tools.js +86 -15
  53. package/lib/ui-routes/admin-config-routes.js +30 -281
  54. package/lib/ui-routes/auth-routes.js +17 -64
  55. package/lib/ui-routes/dbsc-routes.js +43 -0
  56. package/lib/ui-routes/license-routes.js +326 -0
  57. package/lib/web-safe-html.js +29 -0
  58. package/lib/webhook-delivery.js +21 -20
  59. package/lib/webhook-penalty.js +18 -17
  60. package/lib/webhooks.js +18 -0
  61. package/package.json +18 -18
  62. package/sbom.json +294 -294
  63. package/scan.js +2 -0
  64. package/server.js +253 -80
  65. package/static/css/flyonui.css +2 -2
  66. package/static/js/ui.js +11 -4
  67. package/static/licenses.html +27 -27
  68. package/translations/messages.pot +17 -17
  69. package/views/config/license.hbs +43 -16
  70. package/views/config/security.hbs +37 -0
  71. package/views/partials/side_menu.hbs +1 -1
  72. package/workers/api.js +128 -109
  73. package/workers/imap.js +4 -6
@@ -6,18 +6,19 @@
6
6
  // that accepts the connection and never answers costs the whole attempt timeout (30 seconds by
7
7
  // default). One account pointing its own webhook URL at such a target, and generating a dozen
8
8
  // events a minute, kept the queue busy with timeouts and delayed every other account's
9
- // deliveries behind them, indefinitely. So a target whose attempt just ran into the timeout is
10
- // penalised: for a short while, deliveries to the same origin are moved back to the delayed set
9
+ // deliveries behind them, indefinitely. So a target whose attempt held the worker for most of the
10
+ // timeout is penalised: for a short while, deliveries to the same origin are moved back to the delayed set
11
11
  // instead of being attempted, and the queue spends its time on targets that answer. The
12
12
  // penalised delivery is not lost, it is tried again once the penalty is over, with its attempt
13
13
  // count unchanged.
14
14
  //
15
- // Only the slow failures count. A refused or reset connection and a name that does not resolve
16
- // fail in milliseconds, so they never hold the queue, and penalising them would defer every
17
- // delivery to a receiver for a minute because it was restarting when one attempt arrived. A
18
- // target answering with an HTTP status, any status, is not penalised either: it answered
19
- // quickly, and the retry schedule already spaces those out. Nor is an egress or redirect
20
- // refusal, which fails the job for good anyway.
15
+ // Only the slow attempts count: one that ran into a deadline, and one that held the worker for at
16
+ // least half the attempt timeout before it ended, whatever the receiver answered. The receiver
17
+ // chooses its answer, so keying on it let a target hold every attempt just short of the timeout
18
+ // and answer 500, or 200, and never be penalised. A refused or reset connection and a name that
19
+ // does not resolve fail in milliseconds, so they never hold the queue, and penalising them would
20
+ // defer every delivery to a receiver for a minute because it was restarting when one attempt
21
+ // arrived. Nor is an egress or redirect refusal penalised, which fails the job for good anyway.
21
22
 
22
23
  const { createHash } = require('crypto');
23
24
  const { REDIS_PREFIX } = require('./consts');
@@ -50,19 +51,19 @@ function penaltyKey(url) {
50
51
  }
51
52
 
52
53
  /**
53
- * How long a target is penalised after a failed attempt, in milliseconds; 0 when the failure is
54
- * not the kind that holds the queue.
54
+ * How long a target is penalised after an attempt, in milliseconds; 0 when the attempt is not the
55
+ * kind that holds the queue.
55
56
  *
56
- * @param {Error} err - the failure
57
+ * @param {Error|null} err - the failure, or null for a delivered attempt
57
58
  * @param {Number} attemptTimeout - the per-attempt wall clock cap, in milliseconds
59
+ * @param {Number} [duration] - how long the attempt took, in milliseconds
58
60
  * @returns {Number}
59
61
  */
60
- function penaltyFor(err, attemptTimeout) {
61
- if (!err || typeof err !== 'object') {
62
- return 0;
63
- }
64
- let code = err.code || (err.cause && err.cause.code);
65
- if (!code || !SLOW_FAILURE_CODES.has(code)) {
62
+ function penaltyFor(err, attemptTimeout, duration) {
63
+ let code = err && typeof err === 'object' && (err.code || (err.cause && err.cause.code));
64
+ let timedOut = !!code && SLOW_FAILURE_CODES.has(code);
65
+ let slow = Number(attemptTimeout) > 0 && Number(duration) >= Number(attemptTimeout) / 2;
66
+ if (!timedOut && !slow) {
66
67
  return 0;
67
68
  }
68
69
  // twice the attempt cap: long enough that a dozen events a minute to a dead target no
package/lib/webhooks.js CHANGED
@@ -631,6 +631,13 @@ class WebhooksHandler {
631
631
  } else if (data.text && truncateTextContents(data.text, notifyTextSize)) {
632
632
  data.text.hasMore = true;
633
633
  }
634
+
635
+ // The web-safe copy replaces the HTML below, after this limit was applied to the HTML,
636
+ // so it is held to the same limit: with inline images embedded it can be far larger
637
+ if (data.text && notifyText && notifyTextSize && typeof data.text._generatedHtml === 'string' && data.text._generatedHtml.length > notifyTextSize) {
638
+ data.text._generatedHtml = data.text._generatedHtml.substr(0, notifyTextSize);
639
+ data.text.hasMore = true;
640
+ }
634
641
  }
635
642
 
636
643
  if (data.headers) {
@@ -655,6 +662,17 @@ class WebhooksHandler {
655
662
  delete data.otp;
656
663
  }
657
664
 
665
+ // Calendar files are attachments too, and their description is message text: both used to
666
+ // be copied in whole whatever the two limits said
667
+ for (let calendarEvent of data.calendarEvents || []) {
668
+ if (calendarEvent.content && !withinNotifyAttachmentSize(calendarEvent, notifyAttachmentSize)) {
669
+ delete calendarEvent.content;
670
+ }
671
+ if (notifyTextSize && typeof calendarEvent.description === 'string' && calendarEvent.description.length > notifyTextSize) {
672
+ calendarEvent.description = calendarEvent.description.substr(0, notifyTextSize);
673
+ }
674
+ }
675
+
658
676
  // remove attachment contents
659
677
  if (data.attachments) {
660
678
  for (let attachment of data.attachments) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emailengine-app",
3
- "version": "2.87.1",
3
+ "version": "2.88.0",
4
4
  "private": false,
5
5
  "productTitle": "EmailEngine",
6
6
  "description": "Email Sync Engine",
@@ -65,26 +65,26 @@
65
65
  "@hapi/vision": "7.0.3",
66
66
  "@msgpack/msgpack": "3.1.3",
67
67
  "@postalsys/bounce-classifier": "3.1.0",
68
- "@postalsys/certs": "2.0.4",
69
- "@postalsys/email-ai-tools": "2.4.2",
70
- "@postalsys/email-content": "0.1.20",
71
- "@postalsys/email-text-tools": "2.6.3",
68
+ "@postalsys/certs": "2.0.5",
69
+ "@postalsys/email-ai-tools": "2.4.3",
70
+ "@postalsys/email-content": "0.1.21",
71
+ "@postalsys/email-text-tools": "2.6.4",
72
72
  "@postalsys/gettext": "4.3.0",
73
73
  "@postalsys/joi-messages": "1.4.1",
74
74
  "@postalsys/templates": "2.1.1",
75
75
  "@sentry/node-core": "10.78.0",
76
- "@simplewebauthn/server": "14.0.3",
76
+ "@simplewebauthn/server": "14.1.0",
77
77
  "@zone-eu/mailsplit": "5.4.30",
78
78
  "@zone-eu/wild-config": "1.7.10",
79
- "bullmq": "6.7.0",
80
- "dotenv": "18.0.9",
79
+ "bullmq": "6.7.3",
80
+ "dotenv": "18.0.10",
81
81
  "fast-xml-parser": "5.12.0",
82
82
  "handlebars": "4.7.10",
83
83
  "he": "1.2.0",
84
84
  "html-to-text": "10.0.1",
85
85
  "ical.js": "2.2.1",
86
86
  "iconv-lite": "0.7.3",
87
- "imapflow": "2.10.2",
87
+ "imapflow": "2.11.0",
88
88
  "ioredfour": "2.2.0",
89
89
  "ioredis": "6.0.0",
90
90
  "ipaddr.js": "2.5.0",
@@ -92,27 +92,27 @@
92
92
  "libbase64": "1.4.1",
93
93
  "libmime": "5.6.4",
94
94
  "libqp": "3.0.1",
95
- "mailparser": "3.14.2",
95
+ "mailparser": "3.14.3",
96
96
  "marked": "15.0.12",
97
97
  "minimist": "1.2.8",
98
- "nodemailer": "10.3.1",
98
+ "nodemailer": "10.5.0",
99
99
  "pino": "10.3.1",
100
100
  "prom-client": "15.1.3",
101
101
  "pubface": "1.2.0",
102
102
  "punycode.js": "2.3.1",
103
103
  "qrcode-generator": "2.0.4",
104
- "smtp-server": "3.21.3",
104
+ "smtp-server": "3.21.4",
105
105
  "socks": "2.8.10",
106
- "undici": "7.30.1"
106
+ "undici": "7.30.2"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@eslint/js": "10.0.1",
110
- "@iconify-json/tabler": "1.2.43",
110
+ "@iconify-json/tabler": "1.2.44",
111
111
  "@iconify/tailwind4": "1.2.3",
112
112
  "@playwright/test": "1.63.0",
113
113
  "@postalsys/ee-client": "1.10.0",
114
114
  "@simplewebauthn/browser": "14.0.0",
115
- "@tailwindcss/cli": "4.3.4",
115
+ "@tailwindcss/cli": "4.3.5",
116
116
  "ace-builds": "1.45.2",
117
117
  "acorn": "8.19.0",
118
118
  "acorn-walk": "8.3.5",
@@ -125,9 +125,9 @@
125
125
  "pino-pretty": "13.2.0",
126
126
  "prettier": "3.9.10",
127
127
  "resedit": "3.1.0",
128
- "spdx-satisfies": "6.0.0",
129
- "supertest": "7.3.1",
130
- "tailwindcss": "4.3.4",
128
+ "spdx-satisfies": "6.0.1",
129
+ "supertest": "7.3.2",
130
+ "tailwindcss": "4.3.5",
131
131
  "xgettext-template": "5.0.0"
132
132
  },
133
133
  "overrides": {