emailengine-app 2.88.0 → 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 +14 -0
- package/data/google-crawlers.json +1 -1
- package/data/public_suffix_list.dat +109 -8
- package/lib/license-subscription.js +17 -11
- package/lib/node-version.js +99 -12
- package/lib/settings.js +4 -1
- package/lib/tools.js +5 -4
- package/lib/ui-routes/dashboard-routes.js +4 -0
- package/lib/web-safe-html.js +50 -6
- package/list-generate.js +56 -19
- package/package.json +22 -25
- package/sbom.json +246 -837
- package/server.js +31 -31
- package/static/licenses.html +1095 -491
- package/translations/messages.pot +18 -18
- package/views/dashboard.hbs +9 -0
- package/views/upgrade.hbs +25 -0
- package/lib/net-tos-guard.js +0 -42
package/lib/tools.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
// Before anything that makes an HTTP request, see the module
|
|
6
|
-
require('./net-tos-guard');
|
|
7
5
|
const { accountDataKey } = require('./redis-keys');
|
|
8
6
|
const { filterEmptyObjectValues } = require('./utils/filter-empty');
|
|
9
7
|
|
|
@@ -275,7 +273,10 @@ function buildFetchDispatcher(proxyUrl, extraOpts) {
|
|
|
275
273
|
if (SOCKS_SCHEMES.has(scheme)) {
|
|
276
274
|
return createSocksAgent(proxyUrl, AGENT_OPTS);
|
|
277
275
|
}
|
|
278
|
-
|
|
276
|
+
// proxyTunnel: undici 8 forwards a plain http:// request to the proxy in absolute form instead
|
|
277
|
+
// of tunnelling it, which is what undici 7 did and what proxies set up for EmailEngine have seen
|
|
278
|
+
// for every request since. A proxy that only allows CONNECT would refuse the forwarded form
|
|
279
|
+
return new ProxyAgent(Object.assign({}, AGENT_OPTS, { uri: proxyUrl, proxyTunnel: true }));
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
// Swaps the shared dispatchers over to `proxyUrl` (null for direct connections). The new fetch
|
|
@@ -777,7 +778,7 @@ async function maybeReloadTlsCertificates(call, logger, keys, context) {
|
|
|
777
778
|
|
|
778
779
|
// The public keys license files are verified against. runPrechecks() below carries the same three,
|
|
779
780
|
// encoded; a key added to one list has to be added to the other, or a license that passes here fails
|
|
780
|
-
// the API worker's precheck and every API route answers with an error (test/license-
|
|
781
|
+
// the API worker's precheck and every API route answers with an error (test/license-subscription-test.js
|
|
781
782
|
// checks that the two lists agree).
|
|
782
783
|
const LICENSE_VERIFY_KEYS = [
|
|
783
784
|
// main-key-1
|
|
@@ -11,6 +11,8 @@ const { redis } = require('../db');
|
|
|
11
11
|
const { ALLOWED_REDIS_LATENCY } = require('../consts');
|
|
12
12
|
const { ACCOUNT_STATE_DISPLAY } = require('./route-helpers');
|
|
13
13
|
const { ERROR_STATES } = require('../account/account-state');
|
|
14
|
+
// The release a process runs on does not change, so neither does what the pages say about it
|
|
15
|
+
const NODE_RUNTIME = require('../node-version').nodeRuntimeView(process.versions.node, !!process.pkg);
|
|
14
16
|
|
|
15
17
|
function init(args) {
|
|
16
18
|
const { server, call } = args;
|
|
@@ -91,6 +93,7 @@ function init(args) {
|
|
|
91
93
|
activityWindows,
|
|
92
94
|
|
|
93
95
|
redisWarnings: stats.redisWarnings || [],
|
|
96
|
+
nodeRuntime: NODE_RUNTIME,
|
|
94
97
|
|
|
95
98
|
redisPing: {
|
|
96
99
|
key: 'redisPing',
|
|
@@ -159,6 +162,7 @@ function init(args) {
|
|
|
159
162
|
'upgrade',
|
|
160
163
|
{
|
|
161
164
|
pageTitle: 'Upgrade',
|
|
165
|
+
nodeRuntime: NODE_RUNTIME,
|
|
162
166
|
isDO,
|
|
163
167
|
isRender,
|
|
164
168
|
isScriptInstalled,
|
package/lib/web-safe-html.js
CHANGED
|
@@ -365,13 +365,51 @@ function fitsWebSafeHtml(text) {
|
|
|
365
365
|
return ((text && text.html) || '').length + ((text && text.plain) || '').length <= WEB_SAFE_HTML_MAX_INPUT;
|
|
366
366
|
}
|
|
367
367
|
|
|
368
|
-
// What a body
|
|
369
|
-
// nothing to produce and can not carry markup. A body with no plain part says
|
|
370
|
-
function
|
|
368
|
+
// What a body renders as when it is not converted: its plain text, escaped and cut at the limit,
|
|
369
|
+
// which costs nothing to produce and can not carry markup. A body with no plain part says why instead
|
|
370
|
+
function plainWebSafeHtml(text, reason) {
|
|
371
371
|
const plain = typeof text.plain === 'string' ? text.plain.slice(0, WEB_SAFE_HTML_MAX_INPUT) : '';
|
|
372
|
-
return `<div style="white-space: pre-wrap">${he.escape(plain ||
|
|
372
|
+
return `<div style="white-space: pre-wrap">${he.escape(plain || reason)}</div>`;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Returns a function that hands out mimeHtml(), or null once loading it has failed.
|
|
377
|
+
*
|
|
378
|
+
* mimeHtml loads jsdom and juice from the bundles in @postalsys/email-text-tools, which need a
|
|
379
|
+
* newer Node.js than EmailEngine can start on (the undici inside jsdom throws when it is loaded on a
|
|
380
|
+
* release below 22.19, and the range jsdom declares starts at 22.22.2, see lib/node-version.js).
|
|
381
|
+
* A failed require() is not cached, so trying again would parse the whole bundle for every
|
|
382
|
+
* message: the first failure is logged and remembered, and web-safe HTML falls back to escaped
|
|
383
|
+
* plain text for the life of the process.
|
|
384
|
+
*
|
|
385
|
+
* @param {Function} load - Returns mimeHtml, throws when it can not be loaded
|
|
386
|
+
* @returns {Function} Returns mimeHtml or null
|
|
387
|
+
*/
|
|
388
|
+
function createMimeHtmlLoader(load) {
|
|
389
|
+
let failed = false;
|
|
390
|
+
let mimeHtml = null;
|
|
391
|
+
return () => {
|
|
392
|
+
if (mimeHtml || failed) {
|
|
393
|
+
return mimeHtml;
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
mimeHtml = load();
|
|
397
|
+
return mimeHtml;
|
|
398
|
+
} catch (err) {
|
|
399
|
+
failed = true;
|
|
400
|
+
logger.error({
|
|
401
|
+
msg: 'Failed to load the HTML sanitizer, web-safe HTML falls back to plain text',
|
|
402
|
+
nodeVersion: process.versions.node,
|
|
403
|
+
err
|
|
404
|
+
});
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Resolved at call time: touching textTools.mimeHtml is what loads jsdom
|
|
411
|
+
const getMimeHtml = createMimeHtmlLoader(() => textTools.mimeHtml);
|
|
412
|
+
|
|
375
413
|
/**
|
|
376
414
|
* Converts the bodies of a message object into sanitized, web-safe HTML.
|
|
377
415
|
*
|
|
@@ -380,7 +418,12 @@ function oversizedWebSafeHtml(text) {
|
|
|
380
418
|
*/
|
|
381
419
|
async function messageWebSafeHtml(messageData) {
|
|
382
420
|
if (!fitsWebSafeHtml(messageData.text)) {
|
|
383
|
-
return
|
|
421
|
+
return plainWebSafeHtml(messageData.text, 'This message is too large to display.');
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const mimeHtml = getMimeHtml();
|
|
425
|
+
if (!mimeHtml) {
|
|
426
|
+
return plainWebSafeHtml(messageData.text, 'This message can not be displayed: the HTML sanitizer failed to load.');
|
|
384
427
|
}
|
|
385
428
|
|
|
386
429
|
let html = stripReservedClasses(messageData.text.html);
|
|
@@ -405,7 +448,7 @@ async function messageWebSafeHtml(messageData) {
|
|
|
405
448
|
|
|
406
449
|
// mimeHtml() does not throw: on hostile input (thousands of nested elements or quote levels)
|
|
407
450
|
// it falls back to escaped text itself, which is what the catch that used to be here did
|
|
408
|
-
return
|
|
451
|
+
return mimeHtml(source);
|
|
409
452
|
}
|
|
410
453
|
|
|
411
454
|
/**
|
|
@@ -469,6 +512,7 @@ function applyWebSafeHtmlOptions(options) {
|
|
|
469
512
|
|
|
470
513
|
module.exports = {
|
|
471
514
|
WEB_SAFE_HTML_MAX_INPUT,
|
|
515
|
+
createMimeHtmlLoader,
|
|
472
516
|
messageWebSafeHtml,
|
|
473
517
|
webSafeTextResponse,
|
|
474
518
|
applyWebSafeHtmlOptions,
|
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,49 +65,49 @@
|
|
|
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
76
|
"@simplewebauthn/server": "14.1.0",
|
|
77
|
-
"@zone-eu/mailsplit": "5.4.
|
|
77
|
+
"@zone-eu/mailsplit": "5.4.31",
|
|
78
78
|
"@zone-eu/wild-config": "1.7.10",
|
|
79
|
-
"bullmq": "6.7.
|
|
79
|
+
"bullmq": "6.7.6",
|
|
80
80
|
"dotenv": "18.0.10",
|
|
81
|
-
"fast-xml-parser": "5.12.
|
|
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",
|
|
@@ -117,24 +117,21 @@
|
|
|
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.
|
|
126
|
+
"prettier": "3.10.1",
|
|
127
|
+
"resedit": "3.1.1",
|
|
128
128
|
"spdx-satisfies": "6.0.1",
|
|
129
129
|
"supertest": "7.3.2",
|
|
130
130
|
"tailwindcss": "4.3.5",
|
|
131
|
-
"xgettext-template": "
|
|
132
|
-
},
|
|
133
|
-
"overrides": {
|
|
134
|
-
"cheerio": "1.2.0"
|
|
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": [
|