emailengine-app 2.76.0 → 2.78.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 (165) hide show
  1. package/.github/workflows/release.yaml +24 -19
  2. package/.github/workflows/test.yml +80 -0
  3. package/.ncurc.js +14 -2
  4. package/.release-please-manifest.json +3 -0
  5. package/CHANGELOG.md +54 -0
  6. package/README.md +1 -1
  7. package/bin/emailengine.js +1 -1
  8. package/data/google-crawlers.json +1 -1
  9. package/encrypt.js +72 -5
  10. package/lib/account/expected-identity.js +88 -0
  11. package/lib/account.js +75 -26
  12. package/lib/address-strategies.js +18 -0
  13. package/lib/api-reference/code-samples.js +194 -0
  14. package/lib/api-reference/format.js +193 -0
  15. package/lib/api-reference/index.js +222 -0
  16. package/lib/api-reference/model.js +338 -0
  17. package/lib/api-reference/schema-tree.js +366 -0
  18. package/lib/api-routes/account-routes.js +136 -39
  19. package/lib/api-routes/behavior-notes.js +57 -0
  20. package/lib/api-routes/blocklist-routes.js +9 -9
  21. package/lib/api-routes/changes-routes.js +6 -4
  22. package/lib/api-routes/chat-routes.js +3 -3
  23. package/lib/api-routes/delivery-test-routes.js +24 -6
  24. package/lib/api-routes/export-routes.js +14 -12
  25. package/lib/api-routes/gateway-routes.js +11 -11
  26. package/lib/api-routes/license-routes.js +7 -7
  27. package/lib/api-routes/mailbox-routes.js +18 -9
  28. package/lib/api-routes/message-routes.js +55 -35
  29. package/lib/api-routes/oauth2-app-routes.js +22 -16
  30. package/lib/api-routes/outbox-routes.js +7 -7
  31. package/lib/api-routes/pubsub-routes.js +3 -3
  32. package/lib/api-routes/settings-routes.js +10 -9
  33. package/lib/api-routes/stats-routes.js +3 -3
  34. package/lib/api-routes/submit-routes.js +58 -8
  35. package/lib/api-routes/template-routes.js +13 -13
  36. package/lib/api-routes/token-routes.js +15 -10
  37. package/lib/api-routes/webhook-route-routes.js +5 -5
  38. package/lib/append-list.js +3 -14
  39. package/lib/arf-detect.js +23 -1
  40. package/lib/autodetect-imap-settings.js +40 -16
  41. package/lib/base32.js +30 -0
  42. package/lib/bounce-detect.js +182 -62
  43. package/lib/consts.js +7 -0
  44. package/lib/egress-filter.js +89 -8
  45. package/lib/email-client/base-client.js +72 -82
  46. package/lib/email-client/gmail-client.js +3 -3
  47. package/lib/email-client/imap/listing-diff.js +3 -3
  48. package/lib/email-client/imap/mailbox.js +5 -69
  49. package/lib/email-client/imap-client.js +3 -2
  50. package/lib/email-client/message-builder.js +13 -13
  51. package/lib/email-client/outlook-client.js +1 -1
  52. package/lib/enum-descriptions.js +130 -0
  53. package/lib/export.js +1 -1
  54. package/lib/gateway.js +1 -1
  55. package/lib/get-raw-email.js +1 -1
  56. package/lib/imapproxy/imap-core/lib/imap-connection.js +2 -2
  57. package/lib/imapproxy/imap-core/lib/imap-server.js +2 -2
  58. package/lib/imapproxy/imap-server.js +42 -28
  59. package/lib/imapproxy/upstream-client.js +38 -0
  60. package/lib/license-beacon.js +1 -1
  61. package/lib/llm-pre-process.js +1 -1
  62. package/lib/msgpack.js +62 -0
  63. package/lib/oauth/decode-jwt-payload.js +39 -0
  64. package/lib/oauth/outlook-identity.js +61 -0
  65. package/lib/oauth/retry-setup.js +38 -0
  66. package/lib/oauth2-apps.js +10 -4
  67. package/lib/openapi/build-document.js +318 -0
  68. package/lib/openapi/index.js +95 -0
  69. package/lib/openapi/joi-schema.js +523 -0
  70. package/lib/outbox.js +66 -3
  71. package/lib/pre-process.js +1 -1
  72. package/lib/read-env-value.js +37 -0
  73. package/lib/routes-ui.js +5 -1
  74. package/lib/schemas.js +88 -17
  75. package/lib/swagger-options.js +173 -0
  76. package/lib/templates.js +1 -1
  77. package/lib/tokens.js +70 -6
  78. package/lib/tools.js +117 -48
  79. package/lib/totp.js +67 -0
  80. package/lib/ui-routes/account-routes.js +91 -15
  81. package/lib/ui-routes/admin-config-routes.js +2 -7
  82. package/lib/ui-routes/admin-entities-routes.js +3 -0
  83. package/lib/ui-routes/auth-routes.js +6 -24
  84. package/lib/ui-routes/dashboard-routes.js +2 -26
  85. package/lib/ui-routes/reference-routes.js +198 -0
  86. package/lib/ui-routes/route-helpers.js +39 -0
  87. package/lib/utils/is-email.js +34 -0
  88. package/lib/utils/to-camel-case.js +17 -0
  89. package/lib/webhook-egress.js +37 -0
  90. package/lib/webhooks.js +1 -1
  91. package/package.json +27 -31
  92. package/prepare-bundle-deps.sh +28 -0
  93. package/release-please-config.json +11 -0
  94. package/sbom.json +1 -1
  95. package/server.js +11 -3
  96. package/static/css/flyonui.css +1 -1
  97. package/static/css/public.css +3 -0
  98. package/static/css/src/app.tailwind.css +113 -0
  99. package/static/js/app.js +69 -0
  100. package/static/js/ee-client.js +238 -8
  101. package/static/js/reference.js +1021 -0
  102. package/static/js/ui.js +61 -33
  103. package/static/licenses.html +658 -1560
  104. package/translations/README.md +64 -0
  105. package/translations/de.mo +0 -0
  106. package/translations/de.po +164 -120
  107. package/translations/en.po +200 -161
  108. package/translations/et.mo +0 -0
  109. package/translations/et.po +163 -120
  110. package/translations/fr.mo +0 -0
  111. package/translations/fr.po +163 -120
  112. package/translations/ja.mo +0 -0
  113. package/translations/ja.po +163 -120
  114. package/translations/messages.pot +84 -54
  115. package/translations/nl.mo +0 -0
  116. package/translations/nl.po +164 -120
  117. package/translations/pl.mo +0 -0
  118. package/translations/pl.po +163 -120
  119. package/views/account-identity-error.hbs +34 -0
  120. package/views/accounts/edit.hbs +1 -0
  121. package/views/accounts/register/imap.hbs +12 -2
  122. package/views/config/ai.hbs +1 -1
  123. package/views/config/document-store/chat.hbs +5 -5
  124. package/views/config/document-store/index.hbs +2 -2
  125. package/views/config/document-store/pre-processing/index.hbs +1 -1
  126. package/views/config/email-processing.hbs +1 -1
  127. package/views/config/imap-proxy.hbs +1 -1
  128. package/views/config/license.hbs +1 -1
  129. package/views/config/oauth/index.hbs +3 -3
  130. package/views/config/security.hbs +1 -1
  131. package/views/config/smtp.hbs +2 -2
  132. package/views/dashboard.hbs +1 -1
  133. package/views/layout/app.hbs +43 -8
  134. package/views/oauth-scope-error.hbs +1 -1
  135. package/views/partials/oauth_form.hbs +4 -4
  136. package/views/partials/reference/anchor-link.hbs +20 -0
  137. package/views/partials/reference/disclosure.hbs +37 -0
  138. package/views/partials/reference/nav.hbs +120 -0
  139. package/views/partials/reference/operation.hbs +127 -0
  140. package/views/partials/reference/params.hbs +20 -0
  141. package/views/partials/reference/schema-node.hbs +99 -0
  142. package/views/partials/reference/schema.hbs +19 -0
  143. package/views/partials/reference/section-heading.hbs +16 -0
  144. package/views/partials/reference/token-alert.hbs +49 -0
  145. package/views/partials/reference/try-field.hbs +31 -0
  146. package/views/partials/reference/try-it.hbs +78 -0
  147. package/views/partials/side_menu.hbs +1 -1
  148. package/views/partials/ui/badge.hbs +4 -2
  149. package/views/partials/ui/page-header.hbs +1 -1
  150. package/views/partials/ui/search-input.hbs +31 -0
  151. package/views/partials/ui/setting-ref.hbs +1 -1
  152. package/views/partials/ui/stat-card.hbs +4 -2
  153. package/views/partials/ui/tab.hbs +6 -1
  154. package/views/partials/ui/tabs.hbs +2 -2
  155. package/views/reference/index.hbs +76 -0
  156. package/views/reference/redirect.hbs +49 -0
  157. package/views/reference/tag.hbs +28 -0
  158. package/views/reference/token.hbs +49 -0
  159. package/views/tokens/index.hbs +9 -1
  160. package/views/webhooks/index.hbs +3 -3
  161. package/workers/api.js +194 -302
  162. package/workers/imap.js +1 -1
  163. package/workers/submit.js +1 -1
  164. package/workers/webhooks.js +2 -13
  165. package/views/swagger/index.hbs +0 -82
package/workers/imap.js CHANGED
@@ -23,7 +23,7 @@ const { MessagePortWritable, pipeToMessagePort } = require('../lib/message-port-
23
23
  const { packRpcError, unpackRpcError } = require('../lib/worker-rpc-error');
24
24
  const { getESClient } = require('../lib/document-store');
25
25
  const settings = require('../lib/settings');
26
- const msgpack = require('msgpack5')();
26
+ const msgpack = require('../lib/msgpack');
27
27
 
28
28
  const getSecret = require('../lib/get-secret');
29
29
 
package/workers/submit.js CHANGED
@@ -19,7 +19,7 @@ const { redis, queueConf, submitQueue } = require('../lib/db');
19
19
  const { Worker } = require('bullmq');
20
20
  const { Account } = require('../lib/account');
21
21
  const getSecret = require('../lib/get-secret');
22
- const msgpack = require('msgpack5')();
22
+ const msgpack = require('../lib/msgpack');
23
23
 
24
24
  const { EMAIL_FAILED_NOTIFY } = require('../lib/consts');
25
25
 
@@ -12,7 +12,7 @@ const { GooglePubSub } = require('../lib/oauth/pubsub/google');
12
12
 
13
13
  const { readEnvValue, threadStats, getDuration, httpAgent, getServiceSecret, maybeReloadHttpProxyAgent } = require('../lib/tools');
14
14
  const { sendWebhookRequest } = require('../lib/webhook-request');
15
- const { assertAllowedUrl, normalizePolicy, POLICY_OFF } = require('../lib/egress-filter');
15
+ const { validateWebhookTarget } = require('../lib/webhook-egress');
16
16
 
17
17
  const { initSentry } = require('../lib/sentry');
18
18
  initSentry('webhooks');
@@ -40,17 +40,6 @@ const NOTIFY_QC = (readEnvValue('EENGINE_NOTIFY_QC') && Number(readEnvValue('EEN
40
40
  // DEFAULT_WEBHOOK_REQUEST_TIMEOUT baked into sendWebhookRequest when unset
41
41
  const WEBHOOK_TIMEOUT = getDuration(readEnvValue('EENGINE_WEBHOOK_TIMEOUT')) || false;
42
42
 
43
- // Which destinations webhook deliveries may reach. An account-scoped API token can set both the
44
- // webhook URL and its custom headers, so without this the least-privileged credential in the
45
- // system can aim EmailEngine at anything its host can route to. Defaults to blocking the
46
- // link-local range (cloud instance metadata); `private` also blocks RFC1918 and friends, `off`
47
- // disables the check and restores redirect following. See lib/egress-filter.js
48
- const WEBHOOK_EGRESS_POLICY = normalizePolicy(readEnvValue('EENGINE_WEBHOOK_EGRESS_POLICY'));
49
-
50
- // Built once rather than per delivery. Null when the policy is off, which also restores fetch's
51
- // own redirect following in sendWebhookRequest().
52
- const validateWebhookTarget = WEBHOOK_EGRESS_POLICY === POLICY_OFF ? null : target => assertAllowedUrl(target, { policy: WEBHOOK_EGRESS_POLICY });
53
-
54
43
  let callQueue = new Map();
55
44
  let mids = 0;
56
45
 
@@ -424,7 +413,7 @@ const notifyWorker = new Worker(
424
413
  method: 'post',
425
414
  body,
426
415
  headers,
427
- dispatcher: httpAgent.retry,
416
+ dispatcher: httpAgent.webhook,
428
417
  timeout: WEBHOOK_TIMEOUT,
429
418
  validateTarget: validateWebhookTarget
430
419
  });
@@ -1,82 +0,0 @@
1
- {{!-- swagger-ui has no dark mode of its own (its stylesheet assumes a light
2
- page), so the reference renders as a light island: data-theme pins the
3
- FlyonUI tokens and color-scheme to light for this subtree even while
4
- the admin chrome around it is dark --}}
5
- <div data-theme="light" class="rounded-box bg-white" style="color-scheme: light">
6
- <div id="swagger-ui"></div>
7
- </div>
8
-
9
- <script src="/admin/swagger/resources/swagger-ui-bundle.js"></script>
10
- <script src="/admin/swagger/resources/swagger-ui-standalone-preset.js"></script>
11
- <script src="/admin/swagger/resources/extend.js" type="text/javascript"></script>
12
- <script>
13
- function getUrlVars() {
14
- const vars = [];
15
- let hash;
16
- const hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
17
- for (let i = 0; i < hashes.length; i++) {
18
- hash = hashes[i].split('=');
19
- vars.push(hash[0]);
20
- vars[hash[0]] = hash[1];
21
- }
22
- return vars;
23
- }
24
-
25
- document.addEventListener('DOMContentLoaded', function () {
26
-
27
- let url = window.location.search.match(/url=([^&]+)/);
28
- if (url && url.length > 1) {
29
- url = decodeURIComponent(url[1]);
30
- } else {
31
- url = "/swagger.json";
32
- }
33
-
34
- // pull validatorUrl string or null form server
35
- let validatorUrl = null;
36
- validatorUrl: '//online.swagger.io/validator';
37
-
38
- const ACCESS_TOKEN_QUERY_PARAM_NAME = 'access_token';
39
- const accessToken = getUrlVars()[ACCESS_TOKEN_QUERY_PARAM_NAME];
40
-
41
- fetch(url)
42
- .then(function (response) {
43
- return response.json()
44
- })
45
- .then(function (json) {
46
-
47
- if (json.openapi && json.openapi.startsWith('3.')) {
48
- json.servers = [{
49
- url: window.location.protocol + '//' + window.location.host,
50
- description: 'Current server'
51
- }];
52
- }
53
-
54
- const swaggerOptions = {
55
-
56
- // url: url + (accessToken ? (url.indexOf('?') < 0 ? '?' : '&') + ACCESS_TOKEN_QUERY_PARAM_NAME + '=' + accessToken : ''),
57
- spec: json,
58
- validatorUrl: validatorUrl,
59
- dom_id: '#swagger-ui',
60
- deepLinking: true,
61
- presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
62
- plugins: [SwaggerUIBundle.plugins.DownloadUrl],
63
- layout: 'StandaloneLayout',
64
- docExpansion: "list",
65
- tagsSorter: apisSorter.unsorted,
66
- operationsSorter: operationsSorter.method,
67
-
68
- // patch: uiCompleteScript -- Rendering
69
- onComplete: function () {
70
-
71
- },
72
- tryItOutEnabled: true,
73
- defaultModelsExpandDepth: 0,
74
- defaultModelExpandDepth: -1
75
- }
76
-
77
- const ui = SwaggerUIBundle(swaggerOptions);
78
-
79
- window.ui = ui;
80
- });
81
- });
82
- </script>