emailengine-app 2.78.0 → 2.79.1
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 +23 -13
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +68 -0
- package/config/e2e.toml +2 -1
- package/config/test.toml +2 -1
- package/data/google-crawlers.json +1 -1
- package/lib/account.js +112 -36
- package/lib/api-reference/format.js +91 -4
- package/lib/api-reference/model.js +144 -19
- package/lib/api-reference/schema-tree.js +282 -28
- package/lib/api-routes/account-routes.js +80 -34
- package/lib/api-routes/blocklist-routes.js +21 -47
- package/lib/api-routes/chat-routes.js +10 -12
- package/lib/api-routes/delivery-test-routes.js +6 -26
- package/lib/api-routes/export-routes.js +2 -0
- package/lib/api-routes/gateway-routes.js +52 -11
- package/lib/api-routes/license-routes.js +2 -0
- package/lib/api-routes/mailbox-routes.js +29 -26
- package/lib/api-routes/message-routes.js +27 -21
- package/lib/api-routes/oauth2-app-routes.js +11 -29
- package/lib/api-routes/operation-impact.js +80 -0
- package/lib/api-routes/outbox-routes.js +15 -5
- package/lib/api-routes/permission-map.js +401 -0
- package/lib/api-routes/route-helpers.js +294 -9
- package/lib/api-routes/route-metadata.js +28 -0
- package/lib/api-routes/settings-routes.js +66 -38
- package/lib/api-routes/stats-routes.js +2 -2
- package/lib/api-routes/submit-routes.js +53 -31
- package/lib/api-routes/template-routes.js +3 -0
- package/lib/api-routes/token-routes.js +526 -72
- package/lib/api-routes/webhook-route-routes.js +14 -4
- package/lib/arf-detect.js +17 -4
- package/lib/auth-token.js +80 -8
- package/lib/bounce-detect.js +28 -17
- package/lib/consts.js +16 -0
- package/lib/db.js +26 -2
- package/lib/delivery-error.js +30 -1
- package/lib/email-client/base-client.js +27 -41
- package/lib/email-client/gmail-client.js +23 -17
- package/lib/email-client/imap/mailbox.js +58 -59
- package/lib/email-client/imap/subconnection.js +10 -7
- package/lib/email-client/imap/sync-operations.js +46 -46
- package/lib/email-client/imap-client.js +85 -28
- package/lib/email-client/message-builder.js +3 -3
- package/lib/email-client/notification-handler.js +1 -1
- package/lib/email-client/outlook/graph-api.js +10 -4
- package/lib/email-client/outlook-client.js +56 -64
- package/lib/email-client/smtp-pool-manager.js +1 -1
- package/lib/enum-descriptions.js +92 -2
- package/lib/export.js +1 -1
- package/lib/field-usage.js +133 -0
- package/lib/gateway.js +1 -1
- package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +3 -3
- package/lib/imapproxy/imap-core/lib/commands/id.js +2 -13
- package/lib/imapproxy/imap-core/lib/commands/starttls.js +1 -1
- package/lib/imapproxy/imap-core/lib/imap-command.js +21 -5
- package/lib/imapproxy/imap-core/lib/imap-connection.js +15 -5
- package/lib/imapproxy/imap-server.js +27 -7
- package/lib/license-beacon.js +4 -9
- package/lib/lists.js +49 -1
- package/lib/llm-pre-process.js +5 -5
- package/lib/logger.js +5 -1
- package/lib/lua/h-set-new-mark.lua +36 -0
- package/lib/message-port-stream.js +84 -1
- package/lib/metrics-collector.js +2 -2
- package/lib/oauth/gmail.js +9 -12
- package/lib/oauth/mail-ru.js +5 -7
- package/lib/oauth/outlook.js +9 -9
- package/lib/oauth/pubsub/google.js +25 -10
- package/lib/oauth/scope-checker.js +1 -1
- package/lib/oauth2-apps.js +290 -292
- package/lib/openapi/build-document.js +20 -8
- package/lib/openapi/joi-schema.js +20 -0
- package/lib/outbox.js +85 -17
- package/lib/pre-process.js +8 -8
- package/lib/queue-stats.js +49 -0
- package/lib/read-env-value.js +1 -1
- package/lib/reconnection-manager.js +2 -2
- package/lib/rewrite-text-nodes.js +4 -3
- package/lib/routes-ui.js +4 -0
- package/lib/schemas.js +218 -162
- package/lib/settings.js +98 -5
- package/lib/sub-script.js +2 -1
- package/lib/swagger-options.js +2 -1
- package/lib/templates.js +4 -4
- package/lib/threads.js +2 -2
- package/lib/token-audit-log.js +231 -0
- package/lib/token-permission-view.js +219 -0
- package/lib/token-permissions.js +172 -0
- package/lib/tokens.js +247 -66
- package/lib/tools.js +142 -37
- package/lib/ui-routes/account-routes.js +42 -15
- package/lib/ui-routes/admin-config-routes.js +18 -10
- package/lib/ui-routes/admin-entities-routes.js +117 -38
- package/lib/ui-routes/auth-routes.js +30 -24
- package/lib/ui-routes/export-routes.js +10 -4
- package/lib/ui-routes/oauth-config-routes.js +12 -12
- package/lib/ui-routes/reference-routes.js +3 -3
- package/lib/ui-routes/route-helpers.js +78 -2
- package/lib/ui-routes/settings-page.js +1 -1
- package/lib/ui-routes/smtp-test-routes.js +1 -1
- package/lib/ui-routes/suppression-list-routes.js +299 -0
- package/lib/ui-routes/unsubscribe-routes.js +19 -29
- package/lib/utils/decode-headers.js +42 -0
- package/lib/utils/header-map.js +48 -0
- package/lib/utils/network.js +2 -2
- package/lib/utils/unsafe-key.js +59 -0
- package/lib/web-safe-html.js +1 -1
- package/lib/webhook-routing.js +84 -0
- package/lib/webhooks.js +48 -14
- package/package.json +11 -10
- package/sbom.json +1 -1
- package/server.js +116 -55
- package/static/css/flyonui.css +1 -1
- package/static/css/src/app.tailwind.css +136 -9
- package/static/js/reference.js +456 -10
- package/static/js/ui.js +43 -0
- package/static/licenses.html +51 -41
- package/translations/messages.pot +59 -59
- package/views/accounts/account.hbs +75 -13
- package/views/accounts/browse.hbs +19 -36
- package/views/accounts/edit.hbs +2 -2
- package/views/config/logging.hbs +6 -0
- package/views/config/oauth/app.hbs +0 -2
- package/views/config/security.hbs +13 -0
- package/views/gateways/edit.hbs +1 -1
- package/views/gateways/gateway.hbs +2 -2
- package/views/gateways/index.hbs +7 -7
- package/views/partials/accounts_table.hbs +7 -7
- package/views/partials/oauth_form.hbs +0 -15
- package/views/partials/reference/disclosure.hbs +8 -2
- package/views/partials/reference/operation.hbs +47 -13
- package/views/partials/reference/params.hbs +17 -1
- package/views/partials/reference/schema-node.hbs +110 -52
- package/views/partials/reference/schema-tools.hbs +25 -0
- package/views/partials/reference/try-it.hbs +84 -11
- package/views/partials/side_menu.hbs +1 -0
- package/views/partials/ui/checkbox.hbs +2 -2
- package/views/partials/ui/tabs.hbs +7 -1
- package/views/reference/token.hbs +4 -0
- package/views/suppression-lists/index.hbs +85 -0
- package/views/suppression-lists/list.hbs +87 -0
- package/views/templates/index.hbs +10 -4
- package/views/templates/template.hbs +1 -1
- package/views/tokens/index.hbs +53 -6
- package/views/tokens/new.hbs +334 -5
- package/workers/api.js +185 -102
- package/workers/documents.js +46 -26
- package/workers/export.js +20 -8
- package/workers/imap-proxy.js +2 -2
- package/workers/imap.js +77 -78
- package/workers/smtp.js +13 -7
- package/workers/submit.js +40 -30
- package/workers/webhooks.js +80 -26
- package/lib/feature-flags.js +0 -48
|
@@ -5,8 +5,10 @@ const { redis } = require('../db');
|
|
|
5
5
|
const { Account } = require('../account');
|
|
6
6
|
const getSecret = require('../get-secret');
|
|
7
7
|
const { failAction } = require('../tools');
|
|
8
|
-
const { handleError } = require('./route-helpers');
|
|
8
|
+
const { handleError, assertNoNetworkOverride } = require('./route-helpers');
|
|
9
9
|
const BEHAVIOR = require('./behavior-notes');
|
|
10
|
+
const { IMPACT } = require('./operation-impact');
|
|
11
|
+
const { FIELD_USAGE } = require('../field-usage');
|
|
10
12
|
const {
|
|
11
13
|
messageReferenceSchema,
|
|
12
14
|
fromAddressSchema,
|
|
@@ -36,7 +38,12 @@ const deliveryAttemptsSchema = Joi.number().integer().example(10).description('H
|
|
|
36
38
|
const gatewaySchema = Joi.string().max(256).example('example').description('Optional SMTP gateway ID for message routing').label('MessageGateway');
|
|
37
39
|
|
|
38
40
|
const dsnSchema = Joi.object({
|
|
39
|
-
id: Joi.string()
|
|
41
|
+
id: Joi.string()
|
|
42
|
+
.trim()
|
|
43
|
+
.empty('')
|
|
44
|
+
.max(256)
|
|
45
|
+
.example('order-4815-notify')
|
|
46
|
+
.description('The envelope identifier that would be included in the response (ENVID)'),
|
|
40
47
|
return: Joi.string()
|
|
41
48
|
.trim()
|
|
42
49
|
.empty('')
|
|
@@ -47,12 +54,19 @@ const dsnSchema = Joi.object({
|
|
|
47
54
|
notify: Joi.array()
|
|
48
55
|
.single()
|
|
49
56
|
.items(Joi.string().valid('never', 'success', 'failure', 'delay').meta({ enumDescriptions: ENUM_DESCRIPTIONS.dsnNotify }).label('NotifyEntry'))
|
|
57
|
+
.example(['failure', 'delay'])
|
|
50
58
|
.description('Defines the conditions under which a DSN response should be sent')
|
|
51
59
|
.label('DsnNotify'),
|
|
52
|
-
recipient: Joi.string().trim().empty('').email().description('The email address the DSN should be sent (ORCPT)')
|
|
60
|
+
recipient: Joi.string().trim().empty('').email().example('bounces@example.com').description('The email address the DSN should be sent (ORCPT)')
|
|
53
61
|
}).description('Request DSN notifications');
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
// Refused for a token that carries a `permissions` record, see assertNoNetworkOverride() - the
|
|
64
|
+
// override decides where a session carrying the account's SMTP credentials connects, so it is not
|
|
65
|
+
// something a narrowed credential may set. Said in the description because the alternative is a 403
|
|
66
|
+
// that reads as a permission bug.
|
|
67
|
+
const proxySchema = settingsSchema.proxyUrl.description(
|
|
68
|
+
'Optional proxy URL to use when connecting to the SMTP server. A token with restricted permissions can not set this - it redirects a session that carries the account credentials'
|
|
69
|
+
);
|
|
56
70
|
|
|
57
71
|
const localAddressSchema = ipSchema.description('Optional local IP address to bind to when connecting to the SMTP server');
|
|
58
72
|
|
|
@@ -61,7 +75,8 @@ const idempotencyResponseSchema = Joi.object({
|
|
|
61
75
|
status: Joi.string()
|
|
62
76
|
.valid('MISS', 'HIT')
|
|
63
77
|
.example('MISS')
|
|
64
|
-
.description('Whether
|
|
78
|
+
.description('Whether this response was produced now or replayed from the idempotency cache')
|
|
79
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.idempotencyStatus })
|
|
65
80
|
})
|
|
66
81
|
.description('Idempotency info, present when an Idempotency-Key header was used')
|
|
67
82
|
.label('ResponseIdempotency');
|
|
@@ -83,6 +98,8 @@ async function init(args) {
|
|
|
83
98
|
});
|
|
84
99
|
|
|
85
100
|
try {
|
|
101
|
+
assertNoNetworkOverride(request);
|
|
102
|
+
|
|
86
103
|
return await accountObject.queueMessage(request.payload, {
|
|
87
104
|
source: 'api',
|
|
88
105
|
idempotencyKey: request.headers['idempotency-key'],
|
|
@@ -108,6 +125,7 @@ async function init(args) {
|
|
|
108
125
|
|
|
109
126
|
plugins: {
|
|
110
127
|
openapi: {
|
|
128
|
+
'x-ee-impact': IMPACT.SENDS,
|
|
111
129
|
'x-ee-behavior': [BEHAVIOR.QUEUED_DELIVERY, BEHAVIOR.SENT_FOLDER_UPLOAD],
|
|
112
130
|
responses: apiResponses(
|
|
113
131
|
'Returns the queue ID the message was accepted under. Delivery happens asynchronously - a 200 means queued, not sent.',
|
|
@@ -150,9 +168,8 @@ async function init(args) {
|
|
|
150
168
|
.truthy('Y', 'true', '1')
|
|
151
169
|
.falsy('N', 'false', 0)
|
|
152
170
|
.default(false)
|
|
153
|
-
.description(
|
|
154
|
-
|
|
155
|
-
)
|
|
171
|
+
.description('For MS Graph accounts: send as structured JSON instead of raw MIME')
|
|
172
|
+
.meta({ usage: FIELD_USAGE.useStructuredFormat })
|
|
156
173
|
}).label('SubmitQuery'),
|
|
157
174
|
|
|
158
175
|
headers: submitHeadersSchema,
|
|
@@ -164,9 +181,8 @@ async function init(args) {
|
|
|
164
181
|
from: Joi.string().email().allow('').example('sender@example.com'),
|
|
165
182
|
to: Joi.array().items(Joi.string().email().required().example('recipient@example.com')).single().label('SmtpEnvelopeTo')
|
|
166
183
|
})
|
|
167
|
-
.description(
|
|
168
|
-
|
|
169
|
-
)
|
|
184
|
+
.description('An optional object specifying the SMTP envelope used during email transmission')
|
|
185
|
+
.meta({ usage: FIELD_USAGE.messageEnvelope })
|
|
170
186
|
.label('SMTPEnvelope')
|
|
171
187
|
.when('mailMerge', {
|
|
172
188
|
is: Joi.exist().not(false, null),
|
|
@@ -177,9 +193,8 @@ async function init(args) {
|
|
|
177
193
|
.base64()
|
|
178
194
|
.max(MAX_ATTACHMENT_SIZE)
|
|
179
195
|
.example('TUlNRS1WZXJzaW9uOiAxLjANClN1YmplY3Q6IGhlbGxvIHdvcmxkDQoNCkhlbGxvIQ0K')
|
|
180
|
-
.description(
|
|
181
|
-
|
|
182
|
-
)
|
|
196
|
+
.description('A Base64-encoded email message in RFC 822 format')
|
|
197
|
+
.meta({ usage: FIELD_USAGE.messageRaw })
|
|
183
198
|
.label('RFC822Raw')
|
|
184
199
|
.when('mailMerge', {
|
|
185
200
|
is: Joi.exist().not(false, null),
|
|
@@ -237,12 +252,16 @@ async function init(args) {
|
|
|
237
252
|
format: Joi.string()
|
|
238
253
|
.valid('html', 'markdown')
|
|
239
254
|
.default('html')
|
|
240
|
-
.description('Markup language
|
|
255
|
+
.description('Markup language the template is written in')
|
|
256
|
+
.meta({ enumDescriptions: ENUM_DESCRIPTIONS.renderFormat })
|
|
241
257
|
.label('RenderFormat'),
|
|
242
|
-
params: Joi.object()
|
|
258
|
+
params: Joi.object()
|
|
259
|
+
.label('RenderValues')
|
|
260
|
+
.example({ firstName: 'Nyan', orderId: '4815' })
|
|
261
|
+
.description('An object of variables for the template renderer')
|
|
243
262
|
})
|
|
244
263
|
.allow(false)
|
|
245
|
-
.description('Template rendering options')
|
|
264
|
+
.description('Template rendering options. Set to `false` to send the template as-is, without rendering it.')
|
|
246
265
|
.when('mailMerge', {
|
|
247
266
|
is: Joi.exist().not(false, null),
|
|
248
267
|
then: Joi.forbidden('y')
|
|
@@ -254,7 +273,10 @@ async function init(args) {
|
|
|
254
273
|
Joi.object({
|
|
255
274
|
to: addressSchema.label('ToAddress').required(),
|
|
256
275
|
messageId: Joi.string().max(996).example('<test123@example.com>').description('Message ID'),
|
|
257
|
-
params: Joi.object()
|
|
276
|
+
params: Joi.object()
|
|
277
|
+
.label('RenderValues')
|
|
278
|
+
.example({ firstName: 'Nyan', orderId: '4815' })
|
|
279
|
+
.description('An object of variables for the template renderer'),
|
|
258
280
|
sendAt: Joi.date()
|
|
259
281
|
.iso()
|
|
260
282
|
.example('2021-07-08T07:06:34.336Z')
|
|
@@ -262,9 +284,8 @@ async function init(args) {
|
|
|
262
284
|
}).label('MailMergeListEntry')
|
|
263
285
|
)
|
|
264
286
|
.min(1)
|
|
265
|
-
.description(
|
|
266
|
-
|
|
267
|
-
)
|
|
287
|
+
.description('Mail merge options. A separate email is generated for each recipient')
|
|
288
|
+
.meta({ usage: FIELD_USAGE.mailMerge })
|
|
268
289
|
.label('MailMergeList'),
|
|
269
290
|
|
|
270
291
|
attachments: Joi.array()
|
|
@@ -293,9 +314,8 @@ async function init(args) {
|
|
|
293
314
|
.max(256)
|
|
294
315
|
.allow(false, null)
|
|
295
316
|
.example('AAAAAQAACnAcde')
|
|
296
|
-
.description(
|
|
297
|
-
|
|
298
|
-
)
|
|
317
|
+
.description('References an existing attachment by its ID instead of providing new attachment content')
|
|
318
|
+
.meta({ usage: FIELD_USAGE.attachmentReference })
|
|
299
319
|
.label('AttachmentReference')
|
|
300
320
|
}).label('UploadAttachment')
|
|
301
321
|
)
|
|
@@ -318,9 +338,8 @@ async function init(args) {
|
|
|
318
338
|
copy: Joi.boolean()
|
|
319
339
|
.allow(null)
|
|
320
340
|
.example(null)
|
|
321
|
-
.description(
|
|
322
|
-
|
|
323
|
-
),
|
|
341
|
+
.description("If set then either copies the message to the Sent Mail folder or not. If not set then uses the account's default setting")
|
|
342
|
+
.meta({ usage: FIELD_USAGE.messageCopy }),
|
|
324
343
|
|
|
325
344
|
sentMailPath: Joi.string()
|
|
326
345
|
.empty('')
|
|
@@ -489,6 +508,8 @@ async function init(args) {
|
|
|
489
508
|
});
|
|
490
509
|
|
|
491
510
|
try {
|
|
511
|
+
assertNoNetworkOverride(request);
|
|
512
|
+
|
|
492
513
|
return await accountObject.queueMessage(request.payload || {}, {
|
|
493
514
|
source: 'api',
|
|
494
515
|
idempotencyKey: request.headers['idempotency-key'],
|
|
@@ -509,6 +530,7 @@ async function init(args) {
|
|
|
509
530
|
|
|
510
531
|
plugins: {
|
|
511
532
|
openapi: {
|
|
533
|
+
'x-ee-impact': IMPACT.SENDS,
|
|
512
534
|
'x-ee-behavior': [BEHAVIOR.QUEUED_DELIVERY, BEHAVIOR.SENT_FOLDER_UPLOAD],
|
|
513
535
|
|
|
514
536
|
// Every property of this payload is an optional override, so a snippet
|
|
@@ -570,16 +592,16 @@ async function init(args) {
|
|
|
570
592
|
to: Joi.array().items(Joi.string().email().required().example('recipient@example.com')).single().label('DraftSmtpEnvelopeTo')
|
|
571
593
|
})
|
|
572
594
|
.description(
|
|
573
|
-
|
|
595
|
+
'An optional object specifying the SMTP envelope used during email transmission. Only used when the message is delivered over SMTP'
|
|
574
596
|
)
|
|
597
|
+
.meta({ usage: FIELD_USAGE.messageEnvelope })
|
|
575
598
|
.label('DraftSMTPEnvelope'),
|
|
576
599
|
|
|
577
600
|
copy: Joi.boolean()
|
|
578
601
|
.allow(null)
|
|
579
602
|
.example(null)
|
|
580
|
-
.description(
|
|
581
|
-
|
|
582
|
-
),
|
|
603
|
+
.description("If set then either copies the message to the Sent Mail folder or not. If not set then uses the account's default setting")
|
|
604
|
+
.meta({ usage: FIELD_USAGE.messageCopy }),
|
|
583
605
|
|
|
584
606
|
sentMailPath: Joi.string()
|
|
585
607
|
.empty('')
|
|
@@ -9,6 +9,7 @@ const { failAction } = require('../tools');
|
|
|
9
9
|
const { handleError, throwNotFound } = require('./route-helpers');
|
|
10
10
|
|
|
11
11
|
const { templateSchemas, accountIdSchema, apiResponses } = require('../schemas');
|
|
12
|
+
const { IMPACT } = require('./operation-impact');
|
|
12
13
|
|
|
13
14
|
// Template owner field shared by all template response schemas
|
|
14
15
|
const templateAccountIdSchema = accountIdSchema.required().allow(null).description('Account ID. Null for public templates');
|
|
@@ -386,6 +387,7 @@ async function init(args) {
|
|
|
386
387
|
|
|
387
388
|
plugins: {
|
|
388
389
|
openapi: {
|
|
390
|
+
'x-ee-impact': IMPACT.DESTRUCTIVE,
|
|
389
391
|
responses: apiResponses('Returns a deletion marker.', 400, 401, 403, 429, 500)
|
|
390
392
|
}
|
|
391
393
|
},
|
|
@@ -450,6 +452,7 @@ async function init(args) {
|
|
|
450
452
|
|
|
451
453
|
plugins: {
|
|
452
454
|
openapi: {
|
|
455
|
+
'x-ee-impact': IMPACT.DESTRUCTIVE,
|
|
453
456
|
responses: apiResponses('Returns the number of templates removed.', 400, 401, 403, 404, 429, 500)
|
|
454
457
|
}
|
|
455
458
|
},
|