emailengine-app 2.79.2 → 2.79.4
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/.github/workflows/deploy.yml +92 -39
- package/.github/workflows/release.yaml +94 -34
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +54 -0
- package/copy-static-files.sh +23 -2
- package/lib/account/imap-data.js +36 -0
- package/lib/account.js +257 -41
- package/lib/api-routes/account-routes.js +7 -1
- package/lib/consts.js +12 -0
- package/lib/email-client/base-client.js +124 -46
- package/lib/email-client/gmail-client.js +12 -0
- package/lib/email-client/imap-client.js +74 -68
- package/lib/email-client/outlook-client.js +12 -0
- package/lib/enum-descriptions.js +1 -1
- package/lib/logger.js +43 -3
- package/lib/schemas.js +11 -1
- package/lib/ui-routes/account-routes.js +84 -6
- package/lib/ui-routes/dashboard-routes.js +22 -0
- package/lib/ui-routes/route-helpers.js +11 -5
- package/package.json +10 -10
- package/sbom.json +1 -1
- package/server.js +21 -9
- package/static/licenses.html +68 -138
- package/translations/messages.pot +65 -65
- package/views/accounts/account.hbs +47 -2
- package/views/legal.hbs +1 -1
|
@@ -16,7 +16,7 @@ const tokens = require('../tokens');
|
|
|
16
16
|
const { redis, documentsQueue } = require('../db');
|
|
17
17
|
const getSecret = require('../get-secret');
|
|
18
18
|
const capa = require('../capa');
|
|
19
|
-
const { Account } = require('../account');
|
|
19
|
+
const { Account, authFailureDisabledAt } = require('../account');
|
|
20
20
|
const { Gateway } = require('../gateway');
|
|
21
21
|
const { autodetectImapSettings, resolveAppPassword, getAppPassword } = require('../autodetect-imap-settings');
|
|
22
22
|
const { atomicIncrement } = require('../redis-operations');
|
|
@@ -1387,12 +1387,29 @@ function init(args) {
|
|
|
1387
1387
|
|
|
1388
1388
|
const canReadMail = (accountData.imap || accountData.oauth2) && !(accountData.imap && accountData.imap.disabled) && !DISABLE_MESSAGE_BROWSER;
|
|
1389
1389
|
|
|
1390
|
+
// The auth-failure safety net parks an account by setting imap.disabled, and for a
|
|
1391
|
+
// Gmail API or Outlook account that is a flag with nowhere to show: the IMAP and SMTP
|
|
1392
|
+
// cards below are hidden for API accounts, so the parked account reported nothing but
|
|
1393
|
+
// a neutral "Not syncing" and the operator had no way back that did not involve a raw
|
|
1394
|
+
// API call.
|
|
1395
|
+
const disabledByAuthFailureAt = authFailureDisabledAt(accountData);
|
|
1396
|
+
|
|
1390
1397
|
// Top-of-page alert for the account's primary problem, so a broken account is
|
|
1391
1398
|
// impossible to miss. Gated on the effective connection state (stateLabel.type) so a
|
|
1392
1399
|
// recovered account never shows a stale error; a stalled sync is surfaced separately
|
|
1393
1400
|
// because the account can otherwise be connected.
|
|
1394
1401
|
let accountAlert = null;
|
|
1395
|
-
if (
|
|
1402
|
+
if (disabledByAuthFailureAt) {
|
|
1403
|
+
// Ahead of the state alert: a parked account is not connecting at all, so why it
|
|
1404
|
+
// was switched off is the more actionable of the two.
|
|
1405
|
+
accountAlert = {
|
|
1406
|
+
title: 'Syncing was switched off',
|
|
1407
|
+
message:
|
|
1408
|
+
'EmailEngine stopped connecting this account after repeated authentication failures. Re-authenticating it turns syncing back on; "Resume syncing" retries with the stored credentials.',
|
|
1409
|
+
timeLabel: 'Switched off',
|
|
1410
|
+
time: disabledByAuthFailureAt
|
|
1411
|
+
};
|
|
1412
|
+
} else if (accountData.stateLabel && accountData.stateLabel.type === 'error') {
|
|
1396
1413
|
accountAlert = {
|
|
1397
1414
|
title: accountData.stateLabel.name,
|
|
1398
1415
|
message: accountData.stateLabel.error
|
|
@@ -1436,6 +1453,7 @@ function init(args) {
|
|
|
1436
1453
|
menuAccounts: true,
|
|
1437
1454
|
account: accountData,
|
|
1438
1455
|
accountAlert,
|
|
1456
|
+
accountParked: !!disabledByAuthFailureAt,
|
|
1439
1457
|
logs: logInfo,
|
|
1440
1458
|
smtpError: accountData.smtpStatus && accountData.smtpStatus.status === 'error',
|
|
1441
1459
|
|
|
@@ -1559,10 +1577,17 @@ function init(args) {
|
|
|
1559
1577
|
let account = request.params.account;
|
|
1560
1578
|
try {
|
|
1561
1579
|
request.logger.info({ msg: 'Requesting account reconnect', account });
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1580
|
+
|
|
1581
|
+
// Through requestReconnect() rather than dispatching here, so this button and
|
|
1582
|
+
// PUT /v1/account/{account}/reconnect share one answer. It declines for an account
|
|
1583
|
+
// the auth-failure safety net switched off, where the dispatch would be a no-op -
|
|
1584
|
+
// and since this caller always asks to reconnect, a false is that refusal. The
|
|
1585
|
+
// button is also rendered disabled in that state; this is what makes the refusal
|
|
1586
|
+
// real rather than cosmetic.
|
|
1587
|
+
let accountObject = new Account({ redis, account, call, secret: await getSecret() });
|
|
1588
|
+
|
|
1589
|
+
if (!(await accountObject.requestReconnect({ reconnect: true }))) {
|
|
1590
|
+
return { success: false, error: 'Syncing is switched off for this account. Use "Resume syncing" to turn it back on.' };
|
|
1566
1591
|
}
|
|
1567
1592
|
|
|
1568
1593
|
return {
|
|
@@ -1590,6 +1615,59 @@ function init(args) {
|
|
|
1590
1615
|
}
|
|
1591
1616
|
});
|
|
1592
1617
|
|
|
1618
|
+
// Turns an account back on after the auth-failure safety net switched it off. The only admin
|
|
1619
|
+
// UI route that reaches the flag for a Gmail API or Outlook account: their IMAP card, and with
|
|
1620
|
+
// it the "Disable IMAP" checkbox an IMAP account is re-enabled through, is not rendered.
|
|
1621
|
+
//
|
|
1622
|
+
// Lifts nothing but the safety net's own disable (see Account.clearAuthFailureDisable), so it
|
|
1623
|
+
// cannot be used to un-do an operator's deliberate send-only switch.
|
|
1624
|
+
server.route({
|
|
1625
|
+
method: 'POST',
|
|
1626
|
+
path: '/admin/accounts/{account}/resume',
|
|
1627
|
+
async handler(request) {
|
|
1628
|
+
let account = request.params.account;
|
|
1629
|
+
try {
|
|
1630
|
+
// clearAuthFailureDisable() needs nothing but the account hash, and the reconnect
|
|
1631
|
+
// below is dispatched from this module's own channel
|
|
1632
|
+
let accountObject = new Account({ redis, account });
|
|
1633
|
+
|
|
1634
|
+
if (!(await accountObject.clearAuthFailureDisable())) {
|
|
1635
|
+
return { success: false, error: 'This account was not switched off by EmailEngine' };
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
request.logger.info({ msg: 'Resumed an account that was switched off after authentication failures', account });
|
|
1639
|
+
|
|
1640
|
+
try {
|
|
1641
|
+
await call({ cmd: 'reconnect', account });
|
|
1642
|
+
} catch (err) {
|
|
1643
|
+
// The flag is already lifted, so the account is no longer parked. Losing the
|
|
1644
|
+
// dispatch only delays the connection until the next periodic reconnect.
|
|
1645
|
+
request.logger.error({ msg: 'Reconnect request failed', action: 'resume_account', account, err });
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
return { success: true };
|
|
1649
|
+
} catch (err) {
|
|
1650
|
+
request.logger.error({ msg: 'Failed to resume account', err, account });
|
|
1651
|
+
return { success: false, error: err.message };
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
options: {
|
|
1655
|
+
validate: {
|
|
1656
|
+
options: {
|
|
1657
|
+
stripUnknown: true,
|
|
1658
|
+
abortEarly: false,
|
|
1659
|
+
convert: true
|
|
1660
|
+
},
|
|
1661
|
+
|
|
1662
|
+
failAction,
|
|
1663
|
+
|
|
1664
|
+
params: Joi.object({
|
|
1665
|
+
account: accountIdSchema.required()
|
|
1666
|
+
})
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
|
|
1593
1671
|
server.route({
|
|
1594
1672
|
method: 'POST',
|
|
1595
1673
|
path: '/admin/accounts/{account}/sync',
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// /admin dashboard (stats counters), the legal page, and the upgrade page. Extracted
|
|
5
5
|
// verbatim from lib/routes-ui.js. The API reference lives in reference-routes.js.
|
|
6
6
|
|
|
7
|
+
const pathlib = require('path');
|
|
7
8
|
const { getStats, getBoolean, readEnvValue } = require('../tools');
|
|
8
9
|
const settings = require('../settings');
|
|
9
10
|
const { redis } = require('../db');
|
|
@@ -124,6 +125,27 @@ function init(args) {
|
|
|
124
125
|
}
|
|
125
126
|
});
|
|
126
127
|
|
|
128
|
+
// The same dependency inventory /sbom.json serves, on the admin surface.
|
|
129
|
+
//
|
|
130
|
+
// /sbom.json is deliberately behind the api-token strategy - the file names every package and
|
|
131
|
+
// version the instance runs - and that strategy has no session-cookie fallback, so a link to
|
|
132
|
+
// it from a rendered admin page answered a signed-in admin with a 401. Rather than widening
|
|
133
|
+
// the API gate for a browser, the download an operator clicks is served where their session
|
|
134
|
+
// already authenticates them, inside the EENGINE_ADMIN_ACCESS_ADDRESSES perimeter.
|
|
135
|
+
server.route({
|
|
136
|
+
method: 'GET',
|
|
137
|
+
path: '/admin/legal/sbom.json',
|
|
138
|
+
handler: {
|
|
139
|
+
file: {
|
|
140
|
+
path: pathlib.join(__dirname, '..', '..', 'sbom.json'),
|
|
141
|
+
confine: false,
|
|
142
|
+
// Named for the operator saving it, not for the route it came from
|
|
143
|
+
filename: 'sbom.json',
|
|
144
|
+
mode: 'attachment'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
127
149
|
server.route({
|
|
128
150
|
method: 'GET',
|
|
129
151
|
path: '/admin/upgrade',
|
|
@@ -19,7 +19,7 @@ const psl = require('psl');
|
|
|
19
19
|
const settings = require('../settings');
|
|
20
20
|
const { redis } = require('../db');
|
|
21
21
|
const { toolGrants } = require('../mcp/tools');
|
|
22
|
-
const { Account, accountsExist, accountSummary } = require('../account');
|
|
22
|
+
const { Account, accountsExist, accountSummary, authFailureDisabledAt } = 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');
|
|
@@ -205,12 +205,18 @@ function formatAccountData(account, gt) {
|
|
|
205
205
|
|
|
206
206
|
account.stateLabel = accountStateLabel(account.state, { lastErrorState: account.lastErrorState, disabledReason: account.disabledReason }, gt);
|
|
207
207
|
|
|
208
|
-
//
|
|
209
|
-
|
|
208
|
+
// An account the auth-failure safety net switched off reports the neutral "Not syncing", which
|
|
209
|
+
// says nothing about why it stopped or that a human has to act. Override the label to say so.
|
|
210
|
+
//
|
|
211
|
+
// Keyed on the marker the safety net writes, not on `imap.disabled` plus a leftover error:
|
|
212
|
+
// that flag is also the operator's send-only switch, so the old guess badged a deliberately
|
|
213
|
+
// send-only account "Connection failed" if it had ever failed to connect, and stayed silent
|
|
214
|
+
// about a parked account whose lastErrorState had been overwritten since.
|
|
215
|
+
if (authFailureDisabledAt(account)) {
|
|
210
216
|
account.stateLabel = {
|
|
211
217
|
type: 'error',
|
|
212
|
-
name: '
|
|
213
|
-
error: account.lastErrorState.description || account.lastErrorState.response
|
|
218
|
+
name: 'Syncing switched off',
|
|
219
|
+
error: account.lastErrorState && (account.lastErrorState.description || account.lastErrorState.response)
|
|
214
220
|
};
|
|
215
221
|
}
|
|
216
222
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emailengine-app",
|
|
3
|
-
"version": "2.79.
|
|
3
|
+
"version": "2.79.4",
|
|
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.
|
|
55
|
-
"@bull-board/hapi": "9.
|
|
54
|
+
"@bull-board/api": "9.4.0",
|
|
55
|
+
"@bull-board/hapi": "9.4.0",
|
|
56
56
|
"@elastic/elasticsearch": "8.15.3",
|
|
57
57
|
"@hapi/accept": "6.0.3",
|
|
58
58
|
"@hapi/bell": "13.1.0",
|
|
@@ -65,15 +65,15 @@
|
|
|
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.
|
|
68
|
+
"@postalsys/certs": "1.0.18",
|
|
69
69
|
"@postalsys/ee-client": "1.7.0",
|
|
70
|
-
"@postalsys/email-ai-tools": "1.13.
|
|
70
|
+
"@postalsys/email-ai-tools": "1.13.19",
|
|
71
71
|
"@postalsys/email-content": "0.1.3",
|
|
72
|
-
"@postalsys/email-text-tools": "2.4.
|
|
72
|
+
"@postalsys/email-text-tools": "2.4.14",
|
|
73
73
|
"@postalsys/gettext": "4.1.1",
|
|
74
74
|
"@postalsys/joi-messages": "1.0.5",
|
|
75
75
|
"@postalsys/templates": "2.0.2",
|
|
76
|
-
"@sentry/node": "10.
|
|
76
|
+
"@sentry/node": "10.71.0",
|
|
77
77
|
"@simplewebauthn/browser": "13.3.0",
|
|
78
78
|
"@simplewebauthn/server": "13.3.2",
|
|
79
79
|
"@zone-eu/mailsplit": "5.4.15",
|
|
@@ -93,15 +93,15 @@
|
|
|
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.
|
|
97
|
-
"ioredfour": "1.4.
|
|
96
|
+
"imapflow": "1.7.6",
|
|
97
|
+
"ioredfour": "1.4.3",
|
|
98
98
|
"ioredis": "6.0.0",
|
|
99
99
|
"ipaddr.js": "2.5.0",
|
|
100
100
|
"joi": "18.2.5",
|
|
101
101
|
"libbase64": "1.3.0",
|
|
102
102
|
"libmime": "5.4.2",
|
|
103
103
|
"libqp": "2.1.1",
|
|
104
|
-
"mailparser": "3.9.
|
|
104
|
+
"mailparser": "3.9.16",
|
|
105
105
|
"marked": "15.0.12",
|
|
106
106
|
"minimist": "1.2.8",
|
|
107
107
|
"murmurhash": "2.0.1",
|