emailengine-app 2.84.2 → 2.85.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 (86) hide show
  1. package/.ncurc.js +5 -3
  2. package/.prettierignore +5 -1
  3. package/.prettierrc.js +2 -0
  4. package/.release-please-manifest.json +1 -1
  5. package/CHANGELOG.md +33 -0
  6. package/Dockerfile +6 -0
  7. package/README.md +1 -1
  8. package/bin/emailengine.js +434 -408
  9. package/copy-static-files.sh +39 -14
  10. package/data/google-crawlers.json +1 -1
  11. package/data/public_suffix_list.dat +16562 -0
  12. package/eslint.config.js +81 -99
  13. package/lib/account.js +36 -5
  14. package/lib/api-reference/format.js +4 -3
  15. package/lib/api-routes/account-routes.js +177 -12
  16. package/lib/api-routes/blocklist-routes.js +23 -2
  17. package/lib/api-routes/delivery-test-routes.js +26 -3
  18. package/lib/api-routes/export-routes.js +28 -2
  19. package/lib/api-routes/gateway-routes.js +28 -2
  20. package/lib/api-routes/mailbox-routes.js +41 -2
  21. package/lib/api-routes/message-routes.js +97 -3
  22. package/lib/api-routes/oauth2-app-routes.js +48 -15
  23. package/lib/api-routes/outbox-routes.js +45 -11
  24. package/lib/api-routes/permission-map.js +12 -1
  25. package/lib/api-routes/settings-routes.js +23 -2
  26. package/lib/api-routes/submit-routes.js +336 -309
  27. package/lib/api-routes/template-routes.js +38 -2
  28. package/lib/api-routes/token-routes.js +142 -96
  29. package/lib/api-routes/webhook-route-routes.js +13 -2
  30. package/lib/bounce-detect.js +397 -205
  31. package/lib/consts.js +5 -4
  32. package/lib/email-client/base-client.js +10 -31
  33. package/lib/email-client/gmail-client.js +9 -11
  34. package/lib/email-client/imap/mailbox.js +3 -19
  35. package/lib/email-client/imap/subconnection.js +1 -1
  36. package/lib/email-client/imap-client.js +1 -1
  37. package/lib/email-client/notification-handler.js +1 -2
  38. package/lib/gateway.js +2 -3
  39. package/lib/hapi-request-logger.js +107 -0
  40. package/lib/imapproxy/imap-core/README.md +6 -5
  41. package/lib/mcp/tools.js +37 -8
  42. package/lib/notify-attachments.js +17 -0
  43. package/lib/oauth/outlook-mailbox.js +35 -0
  44. package/lib/oauth/state.js +24 -0
  45. package/lib/oauth2-apps.js +1 -1
  46. package/lib/pbkdf2-phc.js +1 -1
  47. package/lib/schemas.js +1 -1
  48. package/lib/sso.js +1 -1
  49. package/lib/swagger-options.js +1 -1
  50. package/lib/thread-diagnostics.js +46 -0
  51. package/lib/timezones.js +109 -0
  52. package/lib/token-permission-view.js +3 -3
  53. package/lib/tools.js +40 -10
  54. package/lib/totp.js +2 -5
  55. package/lib/translations.js +1 -2
  56. package/lib/ui-routes/account-routes.js +475 -454
  57. package/lib/ui-routes/account-setup.js +99 -0
  58. package/lib/ui-routes/admin-config-routes.js +88 -10
  59. package/lib/ui-routes/admin-entities-routes.js +91 -7
  60. package/lib/ui-routes/auth-routes.js +90 -38
  61. package/lib/ui-routes/internals-routes.js +5 -0
  62. package/lib/ui-routes/oauth-config-routes.js +124 -82
  63. package/lib/ui-routes/route-helpers.js +19 -3
  64. package/lib/ui-routes/tls-config-routes.js +58 -15
  65. package/lib/utils/back-off.js +82 -0
  66. package/lib/utils/murmurhash3.js +66 -0
  67. package/lib/utils/public-suffix.js +122 -0
  68. package/lib/utils/random-id.js +26 -0
  69. package/lib/utils/version.js +74 -0
  70. package/lib/webhook-routing.js +27 -0
  71. package/lib/webhooks.js +41 -6
  72. package/package.json +27 -29
  73. package/sbom.json +7980 -1
  74. package/server.js +634 -441
  75. package/static/licenses.html +181 -1006
  76. package/translations/messages.pot +62 -63
  77. package/views/config/ai.hbs +1 -1
  78. package/views/config/security.hbs +2 -2
  79. package/views/config/service.hbs +3 -0
  80. package/views/internals/index.hbs +8 -0
  81. package/views/partials/webhook_form.hbs +1 -1
  82. package/views/suppression-lists/index.hbs +1 -1
  83. package/workers/api.js +738 -583
  84. package/workers/export.js +1 -1
  85. package/workers/submit.js +1 -1
  86. package/workers/webhooks.js +16 -32
@@ -51,32 +51,57 @@ cp node_modules/flyonui/flyonui.js static/js/flyonui.js
51
51
  # Rebuild the compiled admin UI stylesheet (Tailwind v4 + FlyonUI)
52
52
  npm run build:css
53
53
 
54
- # Both JSON artifacts below are refreshed from the network and are committed, so a failed fetch
54
+ # The artifacts below are regenerated (mostly from the network) and are committed, so a failed fetch
55
55
  # must not be allowed to damage the copy already in the tree. A plain `> file` redirect truncates
56
56
  # before the command runs, which is how a GitHub 500 once left a zero-byte sbom.json behind - and
57
57
  # under `set -e` it also aborts the rest of this script, silently skipping the licence and gettext
58
58
  # regeneration that npm run update chains after it. Each fetch therefore lands in a sibling temp
59
- # file, is checked for being valid JSON, and only then replaces the committed one. The temp file
60
- # is created next to its target rather than in $TMPDIR so the move is a rename within the same
61
- # filesystem, never a copy that could be interrupted half-written.
62
- fetch_json() {
59
+ # file, is checked for being complete (valid JSON, or a format-specific check), and only then
60
+ # replaces the committed one. The temp file is created next to its target rather than in $TMPDIR
61
+ # so the move is a rename within the same filesystem, never a copy that could be interrupted
62
+ # half-written.
63
+ #
64
+ # fetch_checked TARGET CHECK COMMAND...: CHECK is a node script that throws unless the file named
65
+ # by process.argv[1] is a complete copy of what TARGET (process.argv[2]) should hold. A CHECK that
66
+ # exits with status 3 instead says the new copy changes nothing that matters, and the committed one
67
+ # is kept without a warning.
68
+ fetch_checked() {
63
69
  local target="$1"
64
- shift
65
- local tmp
70
+ local check="$2"
71
+ shift 2
72
+ local tmp status
66
73
  tmp=$(mktemp "${target}.XXXXXX")
67
- if "$@" > "$tmp" && node -e 'JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"))' "$tmp"; then
74
+ if "$@" > "$tmp" && node -e "$check" "$tmp" "$target"; then
75
+ # mktemp creates the file 0600
76
+ chmod 644 "$tmp"
68
77
  mv "$tmp" "$target"
69
78
  else
79
+ status=$?
70
80
  rm -f "$tmp"
71
- echo "WARNING: failed to refresh ${target}, keeping the previous copy" >&2
81
+ if [ "$status" -ne 3 ]; then
82
+ echo "WARNING: failed to refresh ${target}, keeping the previous copy" >&2
83
+ fi
72
84
  fi
73
85
  }
74
86
 
87
+ fetch_json() {
88
+ local target="$1"
89
+ shift
90
+ fetch_checked "$target" 'JSON.parse(require("fs").readFileSync(process.argv[1], "utf8"))' "$@"
91
+ }
92
+
75
93
  fetch_json data/google-crawlers.json wget -q -O - https://developers.google.com/static/crawling/ipranges/special-crawlers.json
76
94
  node -e 'console.log("Google crawlers updated: "+require("./data/google-crawlers.json").creationTime);'
77
95
 
78
- # brew install gh
79
- # gh auth login
80
- # gh ext install advanced-security/gh-sbom
81
- # gh sbom -c -l > sbom.json
82
- fetch_json sbom.json gh sbom
96
+ # The Public Suffix List, read by lib/utils/public-suffix.js. Kept verbatim (it is MPL-2.0 and carries
97
+ # its own licence header), and only accepted when both sections arrived whole: a truncated list would
98
+ # not fail to parse, it would just quietly know fewer suffixes.
99
+ fetch_checked data/public_suffix_list.dat 'const t=require("fs").readFileSync(process.argv[1],"utf8");for(const m of ["===BEGIN ICANN DOMAINS===","===END ICANN DOMAINS===","===BEGIN PRIVATE DOMAINS===","===END PRIVATE DOMAINS==="])if(!t.includes(m))throw new Error("missing "+m)' wget -q -O - https://publicsuffix.org/list/public_suffix_list.dat
100
+ grep -m1 '^// VERSION:' data/public_suffix_list.dat || true
101
+
102
+ # The SBOM shipped in the binary and served at /sbom.json, generated from the installed tree by npm
103
+ # (SPDX 2.3). Runtime dependencies only: dev tooling never reaches an instance. It used to come
104
+ # from GitHub's dependency graph (gh sbom), which only knows a lockfile once it has been pushed, so
105
+ # every dependency bump needed a second update after the push to catch up. npm stamps each run with
106
+ # a new creation time and document namespace, so a copy that differs in nothing else is not taken.
107
+ fetch_checked sbom.json 'const fs=require("fs");const strip=f=>{const d=JSON.parse(fs.readFileSync(f,"utf8"));delete d.documentNamespace;delete d.creationInfo.created;return JSON.stringify(d)};const next=strip(process.argv[1]);let prev=null;try{prev=strip(process.argv[2])}catch{}if(next===prev)process.exit(3)' npm sbom --sbom-format spdx --omit dev
@@ -1,5 +1,5 @@
1
1
  {
2
- "creationTime": "2026-10-16T14:46:08.000000",
2
+ "creationTime": "2026-10-20T14:46:18.000000",
3
3
  "prefixes": [
4
4
  {
5
5
  "ipv6Prefix": "2001:4860:4801:2008::/64"