emailengine-app 2.87.1 → 2.88.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 (73) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +31 -0
  3. package/ENVIRONMENT.md +26 -23
  4. package/LICENSE_EMAILENGINE.txt +20 -12
  5. package/app.json +3 -3
  6. package/bin/emailengine.js +7 -11
  7. package/data/google-crawlers.json +1 -1
  8. package/data/public_suffix_list.dat +48 -10
  9. package/lib/account.js +69 -49
  10. package/lib/admin-password.js +85 -0
  11. package/lib/api-routes/license-routes.js +9 -0
  12. package/lib/api-token-auth.js +21 -5
  13. package/lib/calendar-event.js +15 -3
  14. package/lib/consts.js +5 -0
  15. package/lib/db.js +1 -0
  16. package/lib/dbsc/index.js +292 -0
  17. package/lib/dbsc/jwt.js +157 -0
  18. package/lib/dbsc/protocol.js +132 -0
  19. package/lib/dbsc/store.js +136 -0
  20. package/lib/email-client/base-client.js +36 -15
  21. package/lib/email-client/gmail-client.js +20 -6
  22. package/lib/email-client/imap/connection-errors.js +30 -1
  23. package/lib/email-client/imap/session-expiry.js +83 -0
  24. package/lib/email-client/imap-client.js +12 -2
  25. package/lib/email-client/smtp-pool-manager.js +66 -8
  26. package/lib/export.js +147 -22
  27. package/lib/graph-notifications.js +60 -0
  28. package/lib/imap-proxy-auth.js +52 -18
  29. package/lib/imapproxy/imap-core/lib/commands/id.js +4 -2
  30. package/lib/imapproxy/imap-core/lib/imap-command.js +44 -4
  31. package/lib/imapproxy/imap-server.js +10 -1
  32. package/lib/imapproxy/proxy-handoff.js +100 -5
  33. package/lib/license-subscription.js +238 -0
  34. package/lib/oauth/gmail.js +18 -0
  35. package/lib/oauth/outlook-identity.js +54 -12
  36. package/lib/prepared-password.js +38 -0
  37. package/lib/privileged-settings.js +6 -0
  38. package/lib/queue-browser/index.js +6 -6
  39. package/lib/queue-job-actions.js +59 -4
  40. package/lib/read-env-value.js +46 -21
  41. package/lib/redis-url.js +23 -0
  42. package/lib/response-stream.js +69 -1
  43. package/lib/revocation-events.js +79 -0
  44. package/lib/routes-ui.js +4 -1
  45. package/lib/schemas.js +26 -2
  46. package/lib/session-default.js +13 -3
  47. package/lib/settings.js +47 -24
  48. package/lib/sso.js +23 -0
  49. package/lib/submit-penalty.js +24 -0
  50. package/lib/submit-processor.js +10 -2
  51. package/lib/tokens.js +6 -0
  52. package/lib/tools.js +86 -15
  53. package/lib/ui-routes/admin-config-routes.js +30 -281
  54. package/lib/ui-routes/auth-routes.js +17 -64
  55. package/lib/ui-routes/dbsc-routes.js +43 -0
  56. package/lib/ui-routes/license-routes.js +326 -0
  57. package/lib/web-safe-html.js +29 -0
  58. package/lib/webhook-delivery.js +21 -20
  59. package/lib/webhook-penalty.js +18 -17
  60. package/lib/webhooks.js +18 -0
  61. package/package.json +18 -18
  62. package/sbom.json +294 -294
  63. package/scan.js +2 -0
  64. package/server.js +253 -80
  65. package/static/css/flyonui.css +2 -2
  66. package/static/js/ui.js +11 -4
  67. package/static/licenses.html +27 -27
  68. package/translations/messages.pot +17 -17
  69. package/views/config/license.hbs +43 -16
  70. package/views/config/security.hbs +37 -0
  71. package/views/partials/side_menu.hbs +1 -1
  72. package/workers/api.js +128 -109
  73. package/workers/imap.js +4 -6
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "2.87.1"
2
+ ".": "2.88.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.88.0](https://github.com/postalsys/emailengine/compare/v2.87.2...v2.88.0) (2026-11-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * monthly-plan licenses, and pause instead of removing a lapsed subscription license ([9250815](https://github.com/postalsys/emailengine/commit/92508150ec250fd4d307665ac3cd4dabdbf2aed2))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * accept only provider-verified identities when pinning an OAuth2 account setup ([1e9b6c1](https://github.com/postalsys/emailengine/commit/1e9b6c1ef2360446227b7bee9cd5c328cd573b56))
14
+ * close admin sign-in gaps around passkeys, SSO and the password check ([a4c4409](https://github.com/postalsys/emailengine/commit/a4c44090532e423d7cef3e5ee9492e466a67c102))
15
+ * do not retry an SMTP delivery that ran into the deadline, and report final failures as final ([48d0983](https://github.com/postalsys/emailengine/commit/48d098362043e5aa080a42addcbec450eee64075))
16
+ * e2e overlay flakes, and a confirmation OK that could read as declined ([b3559b3](https://github.com/postalsys/emailengine/commit/b3559b3187e484c781b37c1ce484d7a19095685c))
17
+ * end change streams on revocation, remove exports with their account, refuse queue metadata as a job ([53e7948](https://github.com/postalsys/emailengine/commit/53e7948da6b5cbee161a611ebe444696e020a7a3))
18
+ * end IMAP proxy sessions on revocation and stop NIL arguments from crashing the proxy ([6e2756e](https://github.com/postalsys/emailengine/commit/6e2756e963780fe285affed519c48f3e79a0d787))
19
+ * find an account's exports through an index instead of a keyspace scan ([2ab5ba1](https://github.com/postalsys/emailengine/commit/2ab5ba17bf347deff0467b8d7fc597906bf4a31b))
20
+ * keep one account's mail, webhooks and senders from monopolising the shared workers ([381c4fd](https://github.com/postalsys/emailengine/commit/381c4fd03e700b6bfb9be6222b3e5421e90e8720))
21
+ * record a confirmation's OK click before the dialog reports closing ([c754c9f](https://github.com/postalsys/emailengine/commit/c754c9fa0207941c601991d3d3ca26098f0b45d1))
22
+ * refuse to start when a _FILE secret can not be read and stop disabling TLS checks on Heroku ([71d4191](https://github.com/postalsys/emailengine/commit/71d419116758e40e98d0f94c7c9f398ea2ce536f))
23
+ * replace Microsoft 365 IMAP sessions before their access token expires ([500e4d2](https://github.com/postalsys/emailengine/commit/500e4d2b7714337c9bf35b6c3447035c0280dba0))
24
+ * update dependencies ([5997ced](https://github.com/postalsys/emailengine/commit/5997cedd1fefd00d4951d0a3d76879d0341e02af))
25
+
26
+ ## [2.87.2](https://github.com/postalsys/emailengine/compare/v2.87.1...v2.87.2) (2026-11-05)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * bind admin sessions to the signing-in device (beta, off by default) ([a62a421](https://github.com/postalsys/emailengine/commit/a62a421eb26ada313c5f556d49477082c5f639b4))
32
+ * bind admin sessions to the signing-in device (beta, off by default) ([da02403](https://github.com/postalsys/emailengine/commit/da02403b4f386af47324cfdcf9d505fe5a91ccf7))
33
+
3
34
  ## [2.87.1](https://github.com/postalsys/emailengine/compare/v2.87.0...v2.87.1) (2026-11-05)
4
35
 
5
36
 
package/ENVIRONMENT.md CHANGED
@@ -5,7 +5,9 @@ configuration file key (see `config/default.toml`); the environment variable win
5
5
 
6
6
  Any variable can also be read from a file: set `<NAME>_FILE` to the path of a file holding the
7
7
  value (the Docker and Kubernetes secrets convention). Surrounding whitespace in the file is
8
- trimmed, and a variable set directly wins over its `_FILE` form.
8
+ trimmed, and a variable set directly wins over its `_FILE` form. A `_FILE` path that can not be
9
+ read stops EmailEngine at startup with the variable and the path named, rather than running as if
10
+ the value were not set.
9
11
 
10
12
  Durations take a number with a unit (`30s`, `10m`, `1h`, `7d`) or plain milliseconds unless the
11
13
  entry says otherwise. Sizes take a number with a unit (`5MB`, `1GB`) or plain bytes.
@@ -14,28 +16,29 @@ entry says otherwise. Sizes take a number with a unit (`5MB`, `1GB`) or plain by
14
16
 
15
17
  ## Core
16
18
 
17
- | Variable | Default | Description |
18
- | --------------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
19
- | `EENGINE_REDIS` | `redis://127.0.0.1:6379/8` | Redis connection URI. `REDIS_URL` is read when this is unset. |
20
- | `EENGINE_REDIS_PREFIX` | none | Prefix for every Redis key, so several instances can share one database. |
21
- | `EENGINE_SECRET` | none | Encryption secret for stored credentials. Changing it makes stored credentials unreadable; use `emailengine encrypt` to rotate. |
22
- | `EENGINE_PORT` | `3000` | API and admin UI port. `PORT` is read when this is unset. |
23
- | `EENGINE_HOST` | `127.0.0.1` | API and admin UI bind address. |
24
- | `EENGINE_TIMEOUT` | `10s` | How long an API request waits for a worker to answer (duration). |
25
- | `EENGINE_LOG_LEVEL` | `trace` | Logging level. |
26
- | `EENGINE_LOG_RAW` | `false` | Log raw IMAP and SMTP protocol traffic. Credentials are masked either way. |
27
- | `EENGINE_SETTINGS` | none | JSON object of settings, re-applied on every start. A value saved in the admin UI for one of its keys reverts at the next restart. |
28
- | `EENGINE_PREPARED_TOKEN` | none | A base64url msgpack-encoded API token to provision at start. |
29
- | `EENGINE_PREPARED_PASSWORD` | none | A base64url PBKDF2 admin password hash to apply at start. Writing a different hash ends every admin session. |
30
- | `EENGINE_PREPARED_LICENSE` | none | A license key to apply at start. |
31
- | `EENGINE_REQUIRE_API_AUTH` | none | Initial value for whether API requests need an access token (`true`/`false`), used when the setting has never been saved. |
32
- | `EENGINE_ENABLE_OAUTH_TOKENS_API` | none | Initial value for the setting that allows the OAuth2 access token API, used when it has never been saved. |
33
- | `EENGINE_CONNECTION_SETUP_DELAY` | `0` | Pause between two account assignments while accounts are handed to workers, to spread the connection load at start (duration). |
34
- | `EENGINE_UPDATE_CHECK_DISABLED` | `false` | Stop checking for new EmailEngine releases. |
35
- | `EENGINE_BEACON_DISABLED` | `false` | Opt out of the anonymized feature-usage diagnostics sent with license validation. License validation itself is unaffected. |
36
- | `EENGINE_DISABLE_SETUP_WARNINGS` | `false` | Hide the setup warning banners in the admin UI. |
37
- | `EENGINE_DOCEAN` | none | Set by the DigitalOcean one-click image; adjusts the dashboard and diagnostics. Not for manual use. |
38
- | `EENGINE_INSTALL_SCRIPT` | none | Set by the install script; adjusts the dashboard and diagnostics. Not for manual use. |
19
+ | Variable | Default | Description |
20
+ | --------------------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21
+ | `EENGINE_REDIS` | `redis://127.0.0.1:6379/8` | Redis connection URI. `REDIS_URL` is read when this is unset. |
22
+ | `EENGINE_REDIS_TLS_REJECT_UNAUTHORIZED` | `true` | Set to `false` to accept a Redis server certificate no CA signed, for managed services such as the Heroku Redis add-on. Applies to a `rediss://` connection only; every other connection is still verified. |
23
+ | `EENGINE_REDIS_PREFIX` | none | Prefix for every Redis key, so several instances can share one database. |
24
+ | `EENGINE_SECRET` | none | Encryption secret for stored credentials. Changing it makes stored credentials unreadable; use `emailengine encrypt` to rotate. |
25
+ | `EENGINE_PORT` | `3000` | API and admin UI port. `PORT` is read when this is unset. |
26
+ | `EENGINE_HOST` | `127.0.0.1` | API and admin UI bind address. |
27
+ | `EENGINE_TIMEOUT` | `10s` | How long an API request waits for a worker to answer (duration). |
28
+ | `EENGINE_LOG_LEVEL` | `trace` | Logging level. |
29
+ | `EENGINE_LOG_RAW` | `false` | Log raw IMAP and SMTP protocol traffic. Credentials are masked either way. |
30
+ | `EENGINE_SETTINGS` | none | JSON object of settings, re-applied on every start. A value saved in the admin UI for one of its keys reverts at the next restart. |
31
+ | `EENGINE_PREPARED_TOKEN` | none | A base64url msgpack-encoded API token to provision at start. |
32
+ | `EENGINE_PREPARED_PASSWORD` | none | A base64url PBKDF2 admin password hash to apply at start. Writing a different hash ends every admin session. |
33
+ | `EENGINE_PREPARED_LICENSE` | none | A license key to apply at start. |
34
+ | `EENGINE_REQUIRE_API_AUTH` | none | Initial value for whether API requests need an access token (`true`/`false`), used when the setting has never been saved. |
35
+ | `EENGINE_ENABLE_OAUTH_TOKENS_API` | none | Initial value for the setting that allows the OAuth2 access token API, used when it has never been saved. |
36
+ | `EENGINE_CONNECTION_SETUP_DELAY` | `0` | Pause between two account assignments while accounts are handed to workers, to spread the connection load at start (duration). |
37
+ | `EENGINE_UPDATE_CHECK_DISABLED` | `false` | Stop checking for new EmailEngine releases. |
38
+ | `EENGINE_BEACON_DISABLED` | `false` | Opt out of the anonymized feature-usage diagnostics sent with license validation. License validation itself is unaffected. |
39
+ | `EENGINE_DISABLE_SETUP_WARNINGS` | `false` | Hide the setup warning banners in the admin UI. |
40
+ | `EENGINE_DOCEAN` | none | Set by the DigitalOcean one-click image; adjusts the dashboard and diagnostics. Not for manual use. |
41
+ | `EENGINE_INSTALL_SCRIPT` | none | Set by the install script; adjusts the dashboard and diagnostics. Not for manual use. |
39
42
 
40
43
  ## Workers and queues
41
44
 
@@ -1,6 +1,8 @@
1
1
  # EMAILENGINE LICENSE AGREEMENT
2
2
 
3
- > Version 2.1, 17 October 2023
3
+ > Version 3.0, published 10 November 2026, in effect from 10 December 2026. Until that date version 2.1 (17 October 2023) applies to customers who accepted it.
4
+ >
5
+ > What changed in 3.0: the Software is licensed for business use; Section 4 describes the online license check and monthly-plan keys; Section 7 replaces the 30 days after a subscription expired with the rules of the Terms of Service (no extra time after a cancellation, 7 or 28 days after a failed renewal, and the Software pauses instead of discarding the key); a shared key can be revoked at once; liability is capped at the fees paid in the last 12 months; Section 11 states that the email the Software handles never reaches Postal Systems OÜ.
4
6
 
5
7
  **PLEASE CAREFULLY READ THIS EMAILENGINE LICENSE AGREEMENT ("AGREEMENT"). THIS AGREEMENT CONSTITUTES A LEGALLY BINDING AGREEMENT BETWEEN YOU AND POSTAL SYSTEMS OÜ AND GOVERNS YOUR USE OF THE SOFTWARE (DEFINED BELOW). IF YOU DO NOT AGREE WITH THIS AGREEMENT, YOU MAY NOT USE THE SOFTWARE. IF YOU ARE USING THE SOFTWARE ON BEHALF OF A LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE AUTHORITY TO AGREE TO THIS AGREEMENT ON BEHALF OF SUCH ENTITY. IF YOU DO NOT HAVE SUCH AUTHORITY, DO NOT USE THE SOFTWARE IN ANY MANNER.**
6
8
 
@@ -11,26 +13,29 @@ This Agreement is entered into by and between Postal Systems OÜ and you, or the
11
13
  * 1.1. "Postal Systems OÜ" refers to the entity providing the EmailEngine software.
12
14
  * 1.2. "Software" refers to the EmailEngine application, including all its versions, updates, modifications, accompanying documentation, and related materials.
13
15
  * 1.3. "You" or "User" refers to the individual or entity installing, accessing, or using the Software.
14
- * 1.4. "License Key" refers to the unique code provided by Postal Systems OÜ upon purchasing a subscription which activates the full features of the Software beyond the trial period.
16
+ * 1.4. "License Key" refers to the unique code provided by Postal Systems OÜ which activates the full features of the Software beyond the trial period: for an active subscription, for a lifetime plan, or as a trial license.
15
17
  * 1.5. "Instance" refers to a copy of EmailEngine run on a local machine or on a server. A single instance runs on a single machine but can utilize multiple CPU cores without limitations.
18
+ * 1.6. "Subscription" refers to a paid subscription purchased at https://postalsys.com under the Postal Systems Terms of Service (https://postalsys.com/tos), billed monthly or yearly.
16
19
 
17
20
  **2. GRANT OF LICENSE**
18
21
 
19
- * 2.1. Postal Systems OÜ grants You a revocable, non-exclusive, non-transferable, limited license to download, install, and use the Software for a 14-day free trial period.
22
+ * 2.1. Postal Systems OÜ grants You a revocable, non-exclusive, non-transferable, limited license to download, install, and use the Software for evaluation, including with a 14-day trial license.
20
23
  * 2.2. Upon purchase of a subscription from https://postalsys.com, You are entitled to generate and use License Keys for the Software. The paid subscription covers all versions of EmailEngine and all updates and modifications.
21
- * 2.3. Once the trial period concludes, the core functionality of the Software ceases to operate until a valid License Key is provided.
22
- * 2.4. This license grants you the right to use the Software for both personal and commercial purposes.
24
+ * 2.3. Without a valid License Key the core functionality of the Software does not operate: accounts do not sync and no email is processed.
25
+ * 2.4. The Software is licensed for business and professional use. By using it You confirm that You are not acting as a consumer.
23
26
 
24
27
  **3. TRIAL PERIOD**
25
28
 
26
- * 3.1. The Software can be used freely with all its features for a period of 14 days from the first installation.
27
- * 3.2. After the trial period expires, the Software will require a License Key to operate.
29
+ * 3.1. The Software can request a free trial license that enables all its features for 14 days. Trial licenses are available for recent releases of the Software and are limited per network address.
30
+ * 3.2. When the trial license expires, the Software requires a License Key to operate.
28
31
  * 3.3. Postal Systems OÜ reserves the right to offer extensions or variations of the trial period on a case-by-case basis.
29
32
 
30
33
  **4. LICENSE KEYS**
31
34
 
32
35
  * 4.1. License Keys can be generated by users or organizations that have an active subscription from Postal Systems OÜ. These License Keys can be reused within the purchasing organization without limitations.
33
36
  * 4.2. Distribution or sharing of License Keys to third parties, not associated with the purchasing user's organization, is strictly prohibited.
37
+ * 4.3. License Keys of a Subscription are checked online. The Software contacts postalsys.com about once a day, more often while a payment is overdue, and at startup for keys of a monthly plan. It sends the License Key, the Software version, an identifier of the installation and, unless switched off with the `EENGINE_BEACON_DISABLED` setting, a summary of which features are in use. No email content, addresses or credentials are sent. The Software keeps working when postalsys.com cannot be reached.
38
+ * 4.4. License Keys of a monthly plan require a recent release of the Software; older releases cannot load them. License Keys created under a yearly plan stop working when the Subscription moves to monthly billing.
34
39
 
35
40
  **5. USE OF SOFTWARE AND COMPONENTS**
36
41
 
@@ -47,19 +52,21 @@ This Agreement is entered into by and between Postal Systems OÜ and you, or the
47
52
 
48
53
  **7. EXPIRATION OF LICENSE KEYS**
49
54
 
50
- * 7.1. License Keys are bound to the subscription period. Should your subscription expire, all License Keys generated by you or your organization will become invalid after 30 days from the subscription expiration date.
51
- * 7.2. Any instance of the Software using such an expired key will cease to function after the aforementioned 30-day period.
55
+ * 7.1. License Keys of a Subscription are valid while the Subscription is paid. After a cancellation they stop working at the end of the period that was paid for, with no further grace period.
56
+ * 7.2. If a renewal payment fails, License Keys keep working for 7 days after the renewal date on a monthly plan and for 28 days on a yearly plan.
57
+ * 7.3. When that time has passed, the Software pauses: it stops processing email and answering its API, but keeps the License Key, the accounts and the data, and resumes when the Subscription is in good standing again (checked automatically within an hour, or at once from the License page).
58
+ * 7.4. Releases of the Software published before this version follow the rules of the version of this Agreement they were published with.
52
59
 
53
60
  **8. TERMINATION**
54
61
 
55
62
  * 8.1. Postal Systems OÜ reserves the right to terminate your license to use the Software if you violate any terms of this EULA.
56
- * 8.2. In the event of a termination, you will be provided with a written notice, sent to the email address used during your subscription to the EmailEngine, outlining the reasons for the termination.
63
+ * 8.2. In the event of a termination, you will be provided with a written notice, sent to the email address used during your subscription to the EmailEngine, outlining the reasons for the termination. A License Key that has been shared outside Your organization, leaked or misused may be revoked immediately, with the notice following.
57
64
  * 8.3. Upon termination, all rights granted to you under this EULA will cease, and you must promptly cease all use of the Software.
58
65
 
59
66
  **9. LIMITATION OF LIABILITY**
60
67
 
61
68
  * 9.1. Postal Systems OÜ shall not be responsible for any indirect damages, losses, or expenses that may arise from your use or misuse of the Software.
62
- * 9.2. Postal Systems OÜ’s liability for direct damages arising from or related to your use of the Software shall be limited to a maximum aggregate amount of 50€ over the life of the software usage.
69
+ * 9.2. Postal Systems OÜ’s total liability for direct damages arising from or related to your use of the Software shall be limited to the fees You paid to Postal Systems OÜ in the 12 months before the event giving rise to the claim. Nothing in this Agreement limits liability that cannot be limited by law.
63
70
 
64
71
  **10. GOVERNING LAW & JURISDICTION**
65
72
 
@@ -68,7 +75,8 @@ This Agreement is entered into by and between Postal Systems OÜ and you, or the
68
75
 
69
76
  **11. DATA PROTECTION & PRIVACY**
70
77
 
71
- * 11.1. By using the Software, you consent to the collection, processing, and use of any personal data as required for the functionality of the Software. The specifics of data handling and storage will be outlined in the company's Privacy Policy, which can be accessed on the company's website.
78
+ * 11.1. The Software is self-hosted: it runs on systems You operate, and the mailboxes, messages and credentials it handles never reach Postal Systems OÜ. For that data You are the controller, and Postal Systems OÜ is not Your processor.
79
+ * 11.2. Postal Systems OÜ receives only what the license check in Section 4.3 sends. How it handles that data is described in its Privacy Policy at https://postalsys.com/privacy.
72
80
 
73
81
  **12. ACCEPTANCE**
74
82
 
package/app.json CHANGED
@@ -31,9 +31,9 @@
31
31
  "value": "0.0.0.0",
32
32
  "required": true
33
33
  },
34
- "NODE_TLS_REJECT_UNAUTHORIZED": {
35
- "description": "Disable TLS certificate validation. Sorry for this, but otherwise EmailEngine is not able to connect to the Heroku Redis addon.",
36
- "value": "0",
34
+ "EENGINE_REDIS_TLS_REJECT_UNAUTHORIZED": {
35
+ "description": "The Heroku Redis add-on presents a self-signed certificate, so certificate validation is turned off for the Redis connection only. Every other connection is still verified.",
36
+ "value": "false",
37
37
  "required": true
38
38
  }
39
39
  }
@@ -22,6 +22,7 @@ const pathlib = require('path');
22
22
  const settings = require('../lib/settings');
23
23
  const { checkLicense } = require('../lib/tools');
24
24
  const pbkdf2 = require('../lib/pbkdf2-phc');
25
+ const { setAdminPassword } = require('../lib/admin-password');
25
26
  const { generateWebhookTable } = require('../lib/consts');
26
27
  const { Account } = require('../lib/account');
27
28
  const getSecret = require('../lib/get-secret');
@@ -390,20 +391,15 @@ function runPassword() {
390
391
  let updatePassword = async () => {
391
392
  let passwordHash = await pbkdf2.hash(password);
392
393
 
393
- let authData = await settings.get('authData');
394
-
395
- authData = authData || {};
396
- authData.user = authData.user || 'admin';
397
- authData.password = passwordHash;
398
- authData.passwordVersion = Date.now();
399
-
400
- await settings.set('authData', authData);
394
+ // Stores the hash, ends every session and removes the passkeys
395
+ await setAdminPassword(passwordHash, {
396
+ settings,
397
+ passkeys: require('../lib/passkeys'),
398
+ logger: { info() {}, error: entry => console.error(entry.msg, entry.err ? entry.err.message : '') }
399
+ });
401
400
  await settings.set('totpEnabled', false);
402
401
  await settings.set('totpSeed', false);
403
402
 
404
- let passkeys = require('../lib/passkeys');
405
- await passkeys.deleteAllCredentials(authData.user);
406
-
407
403
  return { password, passwordHash };
408
404
  };
409
405
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "creationTime": "2026-11-04T15:46:00.000000",
2
+ "creationTime": "2026-11-09T15:46:02.000000",
3
3
  "prefixes": [
4
4
  {
5
5
  "ipv6Prefix": "2001:4860:4801:2008::/64"
@@ -5,8 +5,8 @@
5
5
  // Please pull this list from, and only from https://publicsuffix.org/list/public_suffix_list.dat,
6
6
  // rather than any other VCS sites. Pulling from any other URL is not guaranteed to be supported.
7
7
 
8
- // VERSION: 2026-10-31_14-17-28_UTC
9
- // COMMIT: 73f8cc701c084fe07d888ec552b2f0b53281a674
8
+ // VERSION: 2026-11-09_13-00-17_UTC
9
+ // COMMIT: ab73a956765706dc3f42dbac5c7e48df2297e1ac
10
10
 
11
11
  // Instructions on pulling and using this list can be found at https://publicsuffix.org/list/.
12
12
 
@@ -6369,9 +6369,13 @@ net.vi
6369
6369
  org.vi
6370
6370
 
6371
6371
  // vn : https://vnnic.vn/en/domain-name-vn/domain-name/cctldvn
6372
+ // https://vnnic.vn/sites/default/files/vn.cctld.domains.txt
6373
+ // Submitted by registry <dnsabuse-support@vnnic.vn> 2026-10-05
6372
6374
  vn
6373
6375
  ac.vn
6376
+ ad.vn
6374
6377
  ai.vn
6378
+ ap.vn
6375
6379
  biz.vn
6376
6380
  com.vn
6377
6381
  edu.vn
@@ -6383,6 +6387,7 @@ int.vn
6383
6387
  io.vn
6384
6388
  name.vn
6385
6389
  net.vn
6390
+ on.vn
6386
6391
  org.vn
6387
6392
  pro.vn
6388
6393
 
@@ -12388,10 +12393,6 @@ claude.app
12388
12393
  claudeusercontent.com
12389
12394
  frame.claudeusercontent.com
12390
12395
 
12391
- // Anysphere Inc : https://cursor.com
12392
- // Submitted by Benson Liu <security@cursor.com>
12393
- *.cursorusercontent.com
12394
-
12395
12396
  // Apigee : https://apigee.com/
12396
12397
  // Submitted by Apigee Security Team <security@apigee.com>
12397
12398
  apigee.io
@@ -12537,6 +12538,10 @@ bnr.la
12537
12538
  // Submitted by Andy Ortlieb <aortlieb@atlassian.com>
12538
12539
  bitbucket.io
12539
12540
 
12541
+ // Bitgate, Inc. : https://ship.page
12542
+ // Submitted by Bitgate, Inc. <abuse@bitgate.com>
12543
+ ship.place
12544
+
12540
12545
  // Blackbaud, Inc. : https://www.blackbaud.com
12541
12546
  // Submitted by Paul Crowder <paul.crowder@blackbaud.com>
12542
12547
  blackbaudcdn.net
@@ -12545,6 +12550,10 @@ blackbaudcdn.net
12545
12550
  // Submitted by Luke Bratch <luke@bratch.co.uk>
12546
12551
  of.je
12547
12552
 
12553
+ // BlitzWorks : https://blitz.cloud
12554
+ // Submitted by BlitzWorks <hallo@blitzworks.io>
12555
+ prod.page
12556
+
12548
12557
  // Block, Inc. : https://block.xyz
12549
12558
  // Submitted by Jonathan Boice <security@block.xyz>
12550
12559
  square.site
@@ -12603,6 +12612,10 @@ radio.fm
12603
12612
  cdn.bubble.io
12604
12613
  bubbleapps.io
12605
12614
 
12615
+ // Butterfly Effect Pte. Ltd. : https://manus.im
12616
+ // Submitted by Manus Security Team <security@manus.ai>
12617
+ manus.space
12618
+
12606
12619
  // bwCloud-OS : https://bwcloud-os.de/
12607
12620
  // Submitted by Klara Mall <dns@bwcloud-os.de>
12608
12621
  *.bwcloud-os-instance.de
@@ -13046,6 +13059,10 @@ dyn.now
13046
13059
  heimdns.online
13047
13060
  ddns.wtf
13048
13061
 
13062
+ // Docs Flowy : https://docsflowy.com
13063
+ // Submitted by Haykel Maaoui <hello@docsflowy.com>
13064
+ docsflowy.site
13065
+
13049
13066
  // DotArai : https://www.dotarai.com/
13050
13067
  // Submitted by Atsadawat Netcharadsang <atsadawat@dotarai.co.th>
13051
13068
  online.th
@@ -14542,6 +14559,10 @@ co.technology
14542
14559
  linkyard-cloud.ch
14543
14560
  linkyard.cloud
14544
14561
 
14562
+ // Linkyhost : https://www.linkyhost.com
14563
+ // Submitted by Linkyhost Support <support@linkyhost.com>
14564
+ linkyhost.page
14565
+
14545
14566
  // Linode : https://linode.com
14546
14567
  // Submitted by <security@linode.com>
14547
14568
  members.linode.com
@@ -14591,6 +14612,7 @@ lohmus.me
14591
14612
  // Lovable : https://lovable.dev
14592
14613
  // Submitted by Fabian Hedin <security@lovable.dev>
14593
14614
  lovable.app
14615
+ auth.lovable.app
14594
14616
  lovableproject.com
14595
14617
  lovable.run
14596
14618
  lovable.sh
@@ -15318,6 +15340,10 @@ ox.rs
15318
15340
  // Submitted by Charly Coste <changaco@changaco.oy.lc>
15319
15341
  oy.lc
15320
15342
 
15343
+ // Page Lemon : https://pagelemon.com
15344
+ // Submitted by Aporia Research Ltd <hi@pagelemon.com>
15345
+ pagelemon.dev
15346
+
15321
15347
  // Pagefog : https://pagefog.com/
15322
15348
  // Submitted by Derek Myers <derek@pagefog.com>
15323
15349
  pgfog.com
@@ -15717,6 +15743,11 @@ sakura.tv
15717
15743
  // Submitted by Asheesh Laroia <asheesh@sandstorm.io>
15718
15744
  sandcats.io
15719
15745
 
15746
+ // Sanity Inc. : https://www.sanity.io/
15747
+ // Submitted by Josh Ellis <security@sanity.io>
15748
+ sanity.run
15749
+ sanity.studio
15750
+
15720
15751
  // Sav.com, LLC : https://marketing.sav.com/
15721
15752
  // Submitted by Mukul Kudegave <mukul@sav.com>
15722
15753
  sav.case
@@ -15885,6 +15916,10 @@ vipsinaapp.com
15885
15916
  // Submitted by Skylar Challand <support@siteleaf.com>
15886
15917
  siteleaf.net
15887
15918
 
15919
+ // Sliplane GmbH : https://sliplane.io
15920
+ // Submitted by Jonas Scholz <support@sliplane.io>
15921
+ sliplane.app
15922
+
15888
15923
  // Small Technology Foundation : https://small-tech.org
15889
15924
  // Submitted by Aral Balkan <aral@small-tech.org>
15890
15925
  small-web.org
@@ -15947,6 +15982,13 @@ my.de
15947
15982
  *.nxa.eu
15948
15983
  nx.gw
15949
15984
 
15985
+ // SpaceXSI : https://x.ai/
15986
+ // Submitted by Benson Liu <security@x.ai>
15987
+ *.apps.grok.bot
15988
+ *.pages.grok.bot
15989
+ *.cursorusercontent.com
15990
+ grok.me
15991
+
15950
15992
  // Spawnbase : https://spawnbase.ai
15951
15993
  // Submitted by Alexander Zuev <security@spawnbase.ai>
15952
15994
  spawnbase.app
@@ -16478,10 +16520,6 @@ weeklylottery.org.uk
16478
16520
  wpenginepowered.com
16479
16521
  js.wpenginepowered.com
16480
16522
 
16481
- // xAI : https://x.ai/
16482
- // Submitted by Asim Shrestha <security@x.ai>
16483
- grok.me
16484
-
16485
16523
  // XenonCloud GbR : https://xenoncloud.net
16486
16524
  // Submitted by Julian Uphoff <publicsuffixlist@xenoncloud.net>
16487
16525
  *.xenonconnect.de
package/lib/account.js CHANGED
@@ -26,8 +26,10 @@ const { ownAccountKeyFilter } = require('./account/own-account-key');
26
26
  const { extractMultiValues, createTransaction } = require('./redis-operations');
27
27
  const outbox = require('./outbox');
28
28
  const tokens = require('./tokens');
29
+ const { Export } = require('./export');
30
+ const { publishRevocation } = require('./revocation-events');
29
31
  const { randomId } = require('./utils/random-id');
30
- const { REDIS_PREFIX, AUTH_FAILURE_DISABLED_FIELD, AUTH_FAILURE_DISABLED_LEGACY_DESCRIPTION } = require('./consts');
32
+ const { REDIS_PREFIX, AUTH_FAILURE_DISABLED_FIELD, AUTH_FAILURE_DISABLED_LEGACY_DESCRIPTION, OAUTH_TOKEN_MIN_VALIDITY } = require('./consts');
31
33
  const { webSafeTextResponse, applyWebSafeHtmlOptions } = require('./web-safe-html');
32
34
  const { checkAccountScopes: checkScopes } = require('./oauth/scope-checker');
33
35
  const { ACCOUNT_STATES, ERROR_STATES, calculateEffectiveState, validateAccountState, getDisplayState, formatLastError } = require('./account/account-state');
@@ -192,6 +194,38 @@ class Account {
192
194
  this.logger = options.logger || logger;
193
195
  }
194
196
 
197
+ /**
198
+ * Refuses to bind an OAuth2 user that another live account of the same app already holds.
199
+ *
200
+ * The binding (`oapp:h:<app>`, user to account) is how Pub/Sub notifications for a Gmail user
201
+ * find their account, so claiming another account's user re-routes that account's notifications.
202
+ * The check used to load the other account through this instance's loadAccountData(), which only
203
+ * ever loads its own record and refused the other id, so it never found a conflict and the binding
204
+ * was overwritten. A binding whose account is gone, or now holds a different user, is stale and
205
+ * may be taken over.
206
+ *
207
+ * @param {string} provider - OAuth2 app id
208
+ * @param {string} user - OAuth2 user (the login)
209
+ * @throws {Boom} 400 AccountAlreadyExists
210
+ */
211
+ async assertOAuth2UserUnbound(provider, user) {
212
+ const userKey = user.toLowerCase();
213
+ const bound = await this.redis.hget(`${REDIS_PREFIX}oapp:h:${provider}`, userKey);
214
+ if (!bound || bound === this.account) {
215
+ return;
216
+ }
217
+
218
+ // Only the oauth2 field, which is all the comparison needs and which is not decrypted here
219
+ const existing = await new Account({ redis: this.redis, account: bound, logger: this.logger }).getStoredField('oauth2');
220
+
221
+ if (existing?.provider === provider && existing.auth?.user?.toLowerCase() === userKey) {
222
+ let error = Boom.boomify(new Error('Another account for the same OAuth2 user already exists'), { statusCode: 400 });
223
+ error.output.payload.code = 'AccountAlreadyExists';
224
+ error.output.payload.existingAccount = bound;
225
+ throw error;
226
+ }
227
+ }
228
+
195
229
  getLock() {
196
230
  return this.lock || getSharedLock();
197
231
  }
@@ -1116,6 +1150,11 @@ class Account {
1116
1150
 
1117
1151
  await this.dispatchPostUpdateCommands(accountData, oldAccountData, reauthorized, disabledIntent);
1118
1152
 
1153
+ if (disabledIntent === true && !isImapDisabled(oldAccountData)) {
1154
+ // IMAP was switched off, which ends the account's proxied IMAP sessions
1155
+ await publishRevocation({ type: 'account', account: this.account });
1156
+ }
1157
+
1119
1158
  return {
1120
1159
  account: this.account
1121
1160
  };
@@ -1249,27 +1288,7 @@ class Account {
1249
1288
  pipeline = pipeline.hdel(`${REDIS_PREFIX}oapp:h:${addProvider}`, accountData._oldOAuth2User.toLowerCase());
1250
1289
  }
1251
1290
  if (accountData.oauth2?.auth?.user) {
1252
- // check if already exists
1253
- let existingAppBinding = await this.redis.hget(
1254
- `${REDIS_PREFIX}oapp:h:${accountData.oauth2.provider}`,
1255
- accountData.oauth2.auth?.user?.toLowerCase()
1256
- );
1257
- if (existingAppBinding && existingAppBinding !== this.account) {
1258
- let existingAccount;
1259
- try {
1260
- existingAccount = await this.loadAccountData(existingAppBinding);
1261
- } catch (err) {
1262
- // account not found
1263
- }
1264
-
1265
- if (existingAccount?.oauth2?.auth?.user === accountData.oauth2.auth?.user) {
1266
- let message = 'Another account for the same OAuth2 user already exists';
1267
- let error = Boom.boomify(new Error(message), { statusCode: 400 });
1268
- error.output.payload.code = 'AccountAlreadyExists';
1269
- error.output.payload.existingAccount = existingAppBinding;
1270
- throw error;
1271
- }
1272
- }
1291
+ await this.assertOAuth2UserUnbound(accountData.oauth2.provider, accountData.oauth2.auth.user);
1273
1292
  pipeline = pipeline.hset(`${REDIS_PREFIX}oapp:h:${addProvider}`, accountData.oauth2?.auth?.user?.toLowerCase(), this.account);
1274
1293
  }
1275
1294
  }
@@ -1591,27 +1610,7 @@ class Account {
1591
1610
  if (accountData.oauth2 && accountData.oauth2.provider) {
1592
1611
  pipeline = pipeline.sadd(`${REDIS_PREFIX}oapp:a:${accountData.oauth2.provider}`, this.account);
1593
1612
  if (accountData.oauth2.auth?.user) {
1594
- // check if already exists
1595
- let existingAppBinding = await this.redis.hget(
1596
- `${REDIS_PREFIX}oapp:h:${accountData.oauth2.provider}`,
1597
- accountData.oauth2.auth?.user?.toLowerCase()
1598
- );
1599
- if (existingAppBinding && existingAppBinding !== this.account) {
1600
- let existingAccount;
1601
- try {
1602
- existingAccount = await this.loadAccountData(existingAppBinding);
1603
- } catch (err) {
1604
- // account not found
1605
- }
1606
-
1607
- if (existingAccount?.oauth2?.auth?.user === accountData.oauth2.auth?.user) {
1608
- let message = 'Another account for the same OAuth2 user already exists';
1609
- let error = Boom.boomify(new Error(message), { statusCode: 400 });
1610
- error.output.payload.code = 'AccountAlreadyExists';
1611
- error.output.payload.existingAccount = existingAppBinding;
1612
- throw error;
1613
- }
1614
- }
1613
+ await this.assertOAuth2UserUnbound(accountData.oauth2.provider, accountData.oauth2.auth.user);
1615
1614
 
1616
1615
  pipeline = pipeline.hset(`${REDIS_PREFIX}oapp:h:${accountData.oauth2.provider}`, accountData.oauth2.auth?.user?.toLowerCase(), this.account);
1617
1616
  }
@@ -1799,6 +1798,19 @@ class Account {
1799
1798
  this.logger.error({ msg: 'Failed to delete the access tokens of an account', account: this.account, err });
1800
1799
  }
1801
1800
 
1801
+ // Sessions the account or its tokens opened end now
1802
+ await publishRevocation({ type: 'account', account: this.account });
1803
+
1804
+ // Its exports go with it, best effort like the tokens above: the account has to go anyway
1805
+ try {
1806
+ const exports = await Export.deleteForAccount(this.account);
1807
+ if (exports) {
1808
+ this.logger.info({ msg: 'Removed exports of a deleted account', account: this.account, exports });
1809
+ }
1810
+ } catch (err) {
1811
+ this.logger.error({ msg: 'Failed to remove the exports of a deleted account', account: this.account, err });
1812
+ }
1813
+
1802
1814
  // Results are positional: [0] is the outbox HKEYS, [1] the account key UNLINK. Both indexes
1803
1815
  // move if a command is inserted ahead of them.
1804
1816
  let queuedMessageIds = (result && result[0] && result[0][1]) || [];
@@ -2554,11 +2566,18 @@ class Account {
2554
2566
  }
2555
2567
  }
2556
2568
 
2557
- async renewAccessToken(oauth2Opts) {
2569
+ /**
2570
+ * Renews the stored OAuth2 access token unless it is valid for at least `minValidity`
2571
+ * @param {Object} [oauth2Opts] - Options for the OAuth2 client
2572
+ * @param {Object} [opts]
2573
+ * @param {number} [opts.minValidity=OAUTH_TOKEN_MIN_VALIDITY] - Lifetime in milliseconds the stored token must have left to be kept
2574
+ */
2575
+ async renewAccessToken(oauth2Opts, opts) {
2576
+ const minValidity = opts?.minValidity || OAUTH_TOKEN_MIN_VALIDITY;
2558
2577
  let lockKey = ['oauth', this.account].join(':');
2559
2578
 
2560
2579
  let accountData = await this.loadAccountData(this.account, false);
2561
- if (accountData.oauth2?.expires > new Date(Date.now() + 30 * 1000)) {
2580
+ if (accountData.oauth2?.expires > new Date(Date.now() + minValidity)) {
2562
2581
  return accountData;
2563
2582
  }
2564
2583
 
@@ -2566,7 +2585,7 @@ class Account {
2566
2585
  this.getLock(),
2567
2586
  lockKey,
2568
2587
  { ttl: 5 * 60 * 1000, wait: 1 * 60 * 1000 },
2569
- () => this.renewAccessTokenLocked(oauth2Opts),
2588
+ () => this.renewAccessTokenLocked(oauth2Opts, minValidity),
2570
2589
  refuseUnavailableLock(this.logger, 'Failed to get renewal lock', { account: this.account, lockKey })
2571
2590
  );
2572
2591
  }
@@ -2575,8 +2594,9 @@ class Account {
2575
2594
  * The part of renewAccessToken() that runs under the renewal lock: renews unless another
2576
2595
  * holder renewed meanwhile
2577
2596
  * @param {Object} oauth2Opts
2597
+ * @param {number} [minValidity=OAUTH_TOKEN_MIN_VALIDITY] - Lifetime in milliseconds a token renewed meanwhile must have left
2578
2598
  */
2579
- async renewAccessTokenLocked(oauth2Opts) {
2599
+ async renewAccessTokenLocked(oauth2Opts, minValidity = OAUTH_TOKEN_MIN_VALIDITY) {
2580
2600
  try {
2581
2601
  let accountData = await this.loadAccountData(this.account, false);
2582
2602
 
@@ -2585,7 +2605,7 @@ class Account {
2585
2605
  accountData.oauth2 &&
2586
2606
  accountData.oauth2.accessToken &&
2587
2607
  accountData.oauth2.expires &&
2588
- accountData.oauth2.expires > new Date(Date.now() + 30 * 1000)
2608
+ accountData.oauth2.expires > new Date(Date.now() + minValidity)
2589
2609
  ) {
2590
2610
  this.logger.info({
2591
2611
  msg: 'OAuth2 access token renewed while locked',
@@ -2753,7 +2773,7 @@ class Account {
2753
2773
  let accessToken;
2754
2774
  let cached = false;
2755
2775
 
2756
- if (!accountData.oauth2.accessToken || !accountData.oauth2.expires || accountData.oauth2.expires < new Date(now + 30 * 1000)) {
2776
+ if (!accountData.oauth2.accessToken || !accountData.oauth2.expires || accountData.oauth2.expires < new Date(now + OAUTH_TOKEN_MIN_VALIDITY)) {
2757
2777
  // renew access token
2758
2778
  try {
2759
2779
  await this.renewAccessToken();