emailengine-app 2.87.2 → 2.89.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.
- package/.ncurc.js +24 -44
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +37 -0
- package/ENVIRONMENT.md +26 -23
- package/LICENSE_EMAILENGINE.txt +20 -12
- package/app.json +3 -3
- package/bin/emailengine.js +7 -11
- package/data/google-crawlers.json +1 -1
- package/data/public_suffix_list.dat +155 -16
- package/lib/account.js +69 -49
- package/lib/admin-password.js +85 -0
- package/lib/api-routes/license-routes.js +9 -0
- package/lib/api-token-auth.js +21 -5
- package/lib/calendar-event.js +15 -3
- package/lib/consts.js +5 -0
- package/lib/db.js +1 -0
- package/lib/email-client/base-client.js +36 -15
- package/lib/email-client/gmail-client.js +20 -6
- package/lib/email-client/imap/connection-errors.js +30 -1
- package/lib/email-client/imap/session-expiry.js +83 -0
- package/lib/email-client/imap-client.js +12 -2
- package/lib/email-client/smtp-pool-manager.js +66 -8
- package/lib/export.js +147 -22
- package/lib/graph-notifications.js +60 -0
- package/lib/imap-proxy-auth.js +52 -18
- package/lib/imapproxy/imap-core/lib/commands/id.js +4 -2
- package/lib/imapproxy/imap-core/lib/imap-command.js +44 -4
- package/lib/imapproxy/imap-server.js +10 -1
- package/lib/imapproxy/proxy-handoff.js +100 -5
- package/lib/license-subscription.js +244 -0
- package/lib/node-version.js +99 -12
- package/lib/oauth/gmail.js +18 -0
- package/lib/oauth/outlook-identity.js +54 -12
- package/lib/prepared-password.js +38 -0
- package/lib/queue-browser/index.js +6 -6
- package/lib/queue-job-actions.js +59 -4
- package/lib/read-env-value.js +46 -21
- package/lib/redis-url.js +23 -0
- package/lib/response-stream.js +69 -1
- package/lib/revocation-events.js +79 -0
- package/lib/schemas.js +18 -2
- package/lib/settings.js +50 -24
- package/lib/sso.js +23 -0
- package/lib/submit-penalty.js +24 -0
- package/lib/submit-processor.js +10 -2
- package/lib/tokens.js +6 -0
- package/lib/tools.js +90 -18
- package/lib/ui-routes/admin-config-routes.js +3 -276
- package/lib/ui-routes/auth-routes.js +13 -64
- package/lib/ui-routes/dashboard-routes.js +4 -0
- package/lib/ui-routes/license-routes.js +326 -0
- package/lib/web-safe-html.js +74 -1
- package/lib/webhook-delivery.js +21 -20
- package/lib/webhook-penalty.js +18 -17
- package/lib/webhooks.js +18 -0
- package/list-generate.js +56 -19
- package/package.json +28 -31
- package/sbom.json +373 -964
- package/scan.js +2 -0
- package/server.js +273 -100
- package/static/css/flyonui.css +2 -2
- package/static/js/ui.js +11 -4
- package/static/licenses.html +1108 -504
- package/translations/messages.pot +18 -18
- package/views/config/license.hbs +43 -16
- package/views/dashboard.hbs +9 -0
- package/views/partials/side_menu.hbs +1 -1
- package/views/upgrade.hbs +25 -0
- package/workers/api.js +108 -107
- package/workers/imap.js +4 -6
- package/lib/net-tos-guard.js +0 -42
package/lib/webhook-penalty.js
CHANGED
|
@@ -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
|
|
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
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
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
|
|
54
|
-
*
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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/list-generate.js
CHANGED
|
@@ -53,10 +53,7 @@ const ASSET_PACKAGES = [
|
|
|
53
53
|
const LICENSE_OVERRIDES = {
|
|
54
54
|
// our own package; the LICENSE file is MIT but package.json lacks the
|
|
55
55
|
// license field (fix upstream in postalsys/gettext, then drop this)
|
|
56
|
-
'@postalsys/gettext': 'MIT'
|
|
57
|
-
// declares the free-text "MIT (http://mootools.net/license.txt)"
|
|
58
|
-
// instead of an SPDX id
|
|
59
|
-
slick: 'MIT'
|
|
56
|
+
'@postalsys/gettext': 'MIT'
|
|
60
57
|
};
|
|
61
58
|
|
|
62
59
|
// Hand-vendored assets that are not npm dependencies. gateExempt entries skip
|
|
@@ -162,26 +159,66 @@ function collect(dirs, section) {
|
|
|
162
159
|
if (pkg.private || !pkg.name || pkg.name === packageData.name) {
|
|
163
160
|
continue;
|
|
164
161
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
162
|
+
addPackage(pkg, section, { homepage: homepageOf(pkg), licenseText: () => findLicenseText(dir) });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Lists a package under a section, once per name and version. `licenseText` is read only for a
|
|
167
|
+
// package not seen before
|
|
168
|
+
function addPackage(pkg, section, { homepage, licenseText }) {
|
|
169
|
+
let key = `${pkg.name}@${pkg.version}`;
|
|
170
|
+
let entry = packages.get(key);
|
|
171
|
+
if (!entry) {
|
|
172
|
+
entry = {
|
|
173
|
+
name: pkg.name,
|
|
174
|
+
version: pkg.version || '',
|
|
175
|
+
license: LICENSE_OVERRIDES[pkg.name] || (typeof pkg.license === 'string' ? pkg.license : (pkg.license && pkg.license.type) || ''),
|
|
176
|
+
homepage,
|
|
177
|
+
sections: [],
|
|
178
|
+
licenseText: licenseText()
|
|
179
|
+
};
|
|
180
|
+
packages.set(key, entry);
|
|
181
|
+
}
|
|
182
|
+
if (!entry.sections.includes(section)) {
|
|
183
|
+
entry.sections.push(section);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Packages bundled into a dependency's own files, which npm ls never sees: @postalsys/email-text-tools
|
|
188
|
+
// ships jsdom and juice, with everything they load, as dist/vendor/<name>.cjs. Such a package lists
|
|
189
|
+
// the bundled packages in dist/vendor/<name>.packages.json and their license texts, in the same
|
|
190
|
+
// order, in dist/vendor/<name>.LICENSES.txt (a header, then one "name@version (license)" block per
|
|
191
|
+
// package, separated by a line of dashes). They are runtime code like any other dependency, so the
|
|
192
|
+
// license gate below applies to them too.
|
|
193
|
+
const VENDOR_SEPARATOR = '\n\n' + '-'.repeat(72) + '\n\n';
|
|
194
|
+
|
|
195
|
+
function collectVendored(dirs) {
|
|
196
|
+
for (let dir of dirs) {
|
|
197
|
+
let vendorDir = path.join(dir, 'dist', 'vendor');
|
|
198
|
+
if (!fs.existsSync(vendorDir)) {
|
|
199
|
+
continue;
|
|
177
200
|
}
|
|
178
|
-
|
|
179
|
-
|
|
201
|
+
for (let file of fs.readdirSync(vendorDir).filter(name => name.endsWith('.packages.json'))) {
|
|
202
|
+
let bundled = JSON.parse(fs.readFileSync(path.join(vendorDir, file), 'utf8'));
|
|
203
|
+
let licensesFile = path.join(vendorDir, file.replace(/\.packages\.json$/, '.LICENSES.txt'));
|
|
204
|
+
let texts = new Map();
|
|
205
|
+
if (fs.existsSync(licensesFile)) {
|
|
206
|
+
for (let block of fs.readFileSync(licensesFile, 'utf8').split(VENDOR_SEPARATOR).slice(1)) {
|
|
207
|
+
let [title, ...rest] = block.split('\n\n');
|
|
208
|
+
let text = rest.join('\n\n').trim();
|
|
209
|
+
texts.set(title.replace(/ \(.*\)$/, ''), /^Licensed under [^\n]*\.$/.test(text) ? null : text);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
for (let pkg of bundled) {
|
|
213
|
+
addPackage(pkg, 'runtime', { homepage: null, licenseText: () => texts.get(`${pkg.name}@${pkg.version}`) || null });
|
|
214
|
+
}
|
|
180
215
|
}
|
|
181
216
|
}
|
|
182
217
|
}
|
|
183
218
|
|
|
184
|
-
|
|
219
|
+
const runtimeDirs = prodDependencyPaths();
|
|
220
|
+
collect(runtimeDirs, 'runtime');
|
|
221
|
+
collectVendored(runtimeDirs);
|
|
185
222
|
collect(
|
|
186
223
|
ASSET_PACKAGES.map(name => path.join(__dirname, 'node_modules', name)),
|
|
187
224
|
'assets'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emailengine-app",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.89.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"productTitle": "EmailEngine",
|
|
6
6
|
"description": "Email Sync Engine",
|
|
@@ -65,76 +65,73 @@
|
|
|
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": "
|
|
69
|
-
"@postalsys/email-ai-tools": "
|
|
70
|
-
"@postalsys/email-content": "0.1.
|
|
71
|
-
"@postalsys/email-text-tools": "
|
|
72
|
-
"@postalsys/gettext": "4.3.
|
|
68
|
+
"@postalsys/certs": "3.0.0",
|
|
69
|
+
"@postalsys/email-ai-tools": "3.0.1",
|
|
70
|
+
"@postalsys/email-content": "0.1.22",
|
|
71
|
+
"@postalsys/email-text-tools": "3.0.1",
|
|
72
|
+
"@postalsys/gettext": "4.3.1",
|
|
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
|
|
77
|
-
"@zone-eu/mailsplit": "5.4.
|
|
76
|
+
"@simplewebauthn/server": "14.1.0",
|
|
77
|
+
"@zone-eu/mailsplit": "5.4.31",
|
|
78
78
|
"@zone-eu/wild-config": "1.7.10",
|
|
79
|
-
"bullmq": "6.7.
|
|
80
|
-
"dotenv": "18.0.
|
|
81
|
-
"fast-xml-parser": "5.12.
|
|
79
|
+
"bullmq": "6.7.6",
|
|
80
|
+
"dotenv": "18.0.10",
|
|
81
|
+
"fast-xml-parser": "5.12.1",
|
|
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.
|
|
87
|
+
"imapflow": "2.12.1",
|
|
88
88
|
"ioredfour": "2.2.0",
|
|
89
89
|
"ioredis": "6.0.0",
|
|
90
90
|
"ipaddr.js": "2.5.0",
|
|
91
91
|
"joi": "18.3.2",
|
|
92
92
|
"libbase64": "1.4.1",
|
|
93
|
-
"libmime": "5.6.
|
|
94
|
-
"libqp": "3.0.
|
|
95
|
-
"mailparser": "3.14.
|
|
93
|
+
"libmime": "5.6.5",
|
|
94
|
+
"libqp": "3.0.2",
|
|
95
|
+
"mailparser": "3.14.4",
|
|
96
96
|
"marked": "15.0.12",
|
|
97
97
|
"minimist": "1.2.8",
|
|
98
|
-
"nodemailer": "10.
|
|
98
|
+
"nodemailer": "10.6.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.
|
|
104
|
+
"smtp-server": "3.21.5",
|
|
105
105
|
"socks": "2.8.10",
|
|
106
|
-
"undici": "
|
|
106
|
+
"undici": "8.12.4"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@eslint/js": "10.0.1",
|
|
110
|
-
"@iconify-json/tabler": "1.2.
|
|
110
|
+
"@iconify-json/tabler": "1.2.46",
|
|
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.
|
|
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",
|
|
119
119
|
"eerawlog": "1.5.5",
|
|
120
|
-
"eslint": "10.
|
|
120
|
+
"eslint": "10.15.0",
|
|
121
121
|
"eslint-config-prettier": "10.1.8",
|
|
122
122
|
"flyonui": "2.4.1",
|
|
123
123
|
"gettext-parser": "7.0.1",
|
|
124
124
|
"globals": "17.14.0",
|
|
125
125
|
"pino-pretty": "13.2.0",
|
|
126
|
-
"prettier": "3.
|
|
127
|
-
"resedit": "3.1.
|
|
128
|
-
"spdx-satisfies": "6.0.
|
|
129
|
-
"supertest": "7.3.
|
|
130
|
-
"tailwindcss": "4.3.
|
|
131
|
-
"xgettext-template": "
|
|
132
|
-
},
|
|
133
|
-
"overrides": {
|
|
134
|
-
"cheerio": "1.2.0"
|
|
126
|
+
"prettier": "3.10.1",
|
|
127
|
+
"resedit": "3.1.1",
|
|
128
|
+
"spdx-satisfies": "6.0.1",
|
|
129
|
+
"supertest": "7.3.2",
|
|
130
|
+
"tailwindcss": "4.3.5",
|
|
131
|
+
"xgettext-template": "7.0.0"
|
|
135
132
|
},
|
|
136
133
|
"engines": {
|
|
137
|
-
"node": ">=
|
|
134
|
+
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
|
138
135
|
},
|
|
139
136
|
"pkg": {
|
|
140
137
|
"scripts": [
|