emailengine-app 2.87.2 → 2.89.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 (71) hide show
  1. package/.ncurc.js +24 -44
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +37 -0
  4. package/ENVIRONMENT.md +26 -23
  5. package/LICENSE_EMAILENGINE.txt +20 -12
  6. package/app.json +3 -3
  7. package/bin/emailengine.js +7 -11
  8. package/data/google-crawlers.json +1 -1
  9. package/data/public_suffix_list.dat +155 -16
  10. package/lib/account.js +69 -49
  11. package/lib/admin-password.js +85 -0
  12. package/lib/api-routes/license-routes.js +9 -0
  13. package/lib/api-token-auth.js +21 -5
  14. package/lib/calendar-event.js +15 -3
  15. package/lib/consts.js +5 -0
  16. package/lib/db.js +1 -0
  17. package/lib/email-client/base-client.js +36 -15
  18. package/lib/email-client/gmail-client.js +20 -6
  19. package/lib/email-client/imap/connection-errors.js +30 -1
  20. package/lib/email-client/imap/session-expiry.js +83 -0
  21. package/lib/email-client/imap-client.js +12 -2
  22. package/lib/email-client/smtp-pool-manager.js +66 -8
  23. package/lib/export.js +147 -22
  24. package/lib/graph-notifications.js +60 -0
  25. package/lib/imap-proxy-auth.js +52 -18
  26. package/lib/imapproxy/imap-core/lib/commands/id.js +4 -2
  27. package/lib/imapproxy/imap-core/lib/imap-command.js +44 -4
  28. package/lib/imapproxy/imap-server.js +10 -1
  29. package/lib/imapproxy/proxy-handoff.js +100 -5
  30. package/lib/license-subscription.js +244 -0
  31. package/lib/node-version.js +99 -12
  32. package/lib/oauth/gmail.js +18 -0
  33. package/lib/oauth/outlook-identity.js +54 -12
  34. package/lib/prepared-password.js +38 -0
  35. package/lib/queue-browser/index.js +6 -6
  36. package/lib/queue-job-actions.js +59 -4
  37. package/lib/read-env-value.js +46 -21
  38. package/lib/redis-url.js +23 -0
  39. package/lib/response-stream.js +69 -1
  40. package/lib/revocation-events.js +79 -0
  41. package/lib/schemas.js +18 -2
  42. package/lib/settings.js +50 -24
  43. package/lib/sso.js +23 -0
  44. package/lib/submit-penalty.js +24 -0
  45. package/lib/submit-processor.js +10 -2
  46. package/lib/tokens.js +6 -0
  47. package/lib/tools.js +90 -18
  48. package/lib/ui-routes/admin-config-routes.js +3 -276
  49. package/lib/ui-routes/auth-routes.js +13 -64
  50. package/lib/ui-routes/dashboard-routes.js +4 -0
  51. package/lib/ui-routes/license-routes.js +326 -0
  52. package/lib/web-safe-html.js +74 -1
  53. package/lib/webhook-delivery.js +21 -20
  54. package/lib/webhook-penalty.js +18 -17
  55. package/lib/webhooks.js +18 -0
  56. package/list-generate.js +56 -19
  57. package/package.json +28 -31
  58. package/sbom.json +373 -964
  59. package/scan.js +2 -0
  60. package/server.js +273 -100
  61. package/static/css/flyonui.css +2 -2
  62. package/static/js/ui.js +11 -4
  63. package/static/licenses.html +1108 -504
  64. package/translations/messages.pot +18 -18
  65. package/views/config/license.hbs +43 -16
  66. package/views/dashboard.hbs +9 -0
  67. package/views/partials/side_menu.hbs +1 -1
  68. package/views/upgrade.hbs +25 -0
  69. package/workers/api.js +108 -107
  70. package/workers/imap.js +4 -6
  71. package/lib/net-tos-guard.js +0 -42
@@ -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-14_18-45-38_UTC
9
+ // COMMIT: dfe55f3548d0fe51c04b8d2903507a01fdec57ad
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
 
@@ -11270,6 +11275,10 @@ ltd.ua
11270
11275
  a2hosted.com
11271
11276
  cpserver.com
11272
11277
 
11278
+ // abyme : https://abyme.studio
11279
+ // Submitted by Richard Mathieson <psl@abyme.studio>
11280
+ abyme.dev
11281
+
11273
11282
  // ActiveTrail : https://www.activetrail.biz/
11274
11283
  // Submitted by Ofer Kalaora <postmaster@activetrail.com>
11275
11284
  activetrail.biz
@@ -11306,6 +11315,10 @@ africa.com
11306
11315
  // Submitted by Simon Farshid <security@assistant-ui.com>
11307
11316
  *.auiusercontent.com
11308
11317
 
11318
+ // Agile Developer : https://agiledeveloper.de
11319
+ // Submitted by Görkem Sinirlioglu <info@agiledeveloper.de>
11320
+ agilevibes.app
11321
+
11309
11322
  // Agnat sp. z o.o. : https://domena.pl
11310
11323
  // Submitted by Przemyslaw Plewa <it-admin@domena.pl>
11311
11324
  beep.pl
@@ -12374,6 +12387,13 @@ eero-stage.online
12374
12387
 
12375
12388
  // concludes Amazon
12376
12389
 
12390
+ // Amba : https://amba.dev
12391
+ // Submitted by Amba Abuse Desk <abuse@amba.dev>
12392
+ app.amba.host
12393
+ cdn.amba.host
12394
+ fn.amba.host
12395
+ go.amba.host
12396
+
12377
12397
  // Anomaly : https://opencode.ai
12378
12398
  // Submitted by Dax Raad <security@anoma.ly>
12379
12399
  opentunnel.xyz
@@ -12388,10 +12408,6 @@ claude.app
12388
12408
  claudeusercontent.com
12389
12409
  frame.claudeusercontent.com
12390
12410
 
12391
- // Anysphere Inc : https://cursor.com
12392
- // Submitted by Benson Liu <security@cursor.com>
12393
- *.cursorusercontent.com
12394
-
12395
12411
  // Apigee : https://apigee.com/
12396
12412
  // Submitted by Apigee Security Team <security@apigee.com>
12397
12413
  apigee.io
@@ -12477,6 +12493,11 @@ myasustor.com
12477
12493
  *.atlassian-isolated-3p.com
12478
12494
  cdn.prod.atlassian-dev.net
12479
12495
 
12496
+ // Automattic Inc. : https://automattic.com
12497
+ // Submitted by Stefano Sala <support@spacefast.com>
12498
+ space.fast
12499
+ view.fast
12500
+
12480
12501
  // AVM : https://avm.de
12481
12502
  // Submitted by Andreas Weise <a.weise@avm.de>
12482
12503
  myfritz.link
@@ -12520,6 +12541,10 @@ beagleboard.io
12520
12541
  // Submitted by Herman Martinus <admin@bearblog.dev>
12521
12542
  bearblog.dev
12522
12543
 
12544
+ // Bearly : https://bearly.ai
12545
+ // Submitted by Bearly Support <support@bearly.ai>
12546
+ bearly.sh
12547
+
12523
12548
  // Beget LLC : https://beget.com
12524
12549
  // Submitted by Lev Nekrasov & Nikita Radchenko <admin@beget.com>
12525
12550
  *.beget.app
@@ -12537,6 +12562,10 @@ bnr.la
12537
12562
  // Submitted by Andy Ortlieb <aortlieb@atlassian.com>
12538
12563
  bitbucket.io
12539
12564
 
12565
+ // Bitgate, Inc. : https://ship.page
12566
+ // Submitted by Bitgate, Inc. <abuse@bitgate.com>
12567
+ ship.place
12568
+
12540
12569
  // Blackbaud, Inc. : https://www.blackbaud.com
12541
12570
  // Submitted by Paul Crowder <paul.crowder@blackbaud.com>
12542
12571
  blackbaudcdn.net
@@ -12545,6 +12574,10 @@ blackbaudcdn.net
12545
12574
  // Submitted by Luke Bratch <luke@bratch.co.uk>
12546
12575
  of.je
12547
12576
 
12577
+ // BlitzWorks : https://blitz.cloud
12578
+ // Submitted by BlitzWorks <hallo@blitzworks.io>
12579
+ prod.page
12580
+
12548
12581
  // Block, Inc. : https://block.xyz
12549
12582
  // Submitted by Jonathan Boice <security@block.xyz>
12550
12583
  square.site
@@ -12603,6 +12636,10 @@ radio.fm
12603
12636
  cdn.bubble.io
12604
12637
  bubbleapps.io
12605
12638
 
12639
+ // Butterfly Effect Pte. Ltd. : https://manus.im
12640
+ // Submitted by Manus Security Team <security@manus.ai>
12641
+ manus.space
12642
+
12606
12643
  // bwCloud-OS : https://bwcloud-os.de/
12607
12644
  // Submitted by Klara Mall <dns@bwcloud-os.de>
12608
12645
  *.bwcloud-os-instance.de
@@ -12773,6 +12810,10 @@ objects.rma.cloudscale.ch
12773
12810
  lpg.objectstorage.ch
12774
12811
  rma.objectstorage.ch
12775
12812
 
12813
+ // Cloudzyro Ltd : https://cloudzyro.com
12814
+ // Submitted by Kofi Agyem <psl@cloudzyro.com>
12815
+ cloudzyro.app
12816
+
12776
12817
  // Clovyr : https://clovyr.io
12777
12818
  // Submitted by Patrick Nielsen <patrick@clovyr.io>
12778
12819
  wnext.app
@@ -12874,6 +12915,10 @@ craft.me
12874
12915
  // Submitted by Ales Krajnik <ales.krajnik@craynic.com>
12875
12916
  realm.cz
12876
12917
 
12918
+ // Curia : https://curiabots.com
12919
+ // Submitted by Curia <psl@crbts.app>
12920
+ crbts.app
12921
+
12877
12922
  // cyber_Folks S.A. : https://cyberfolks.pl
12878
12923
  // Submitted by Bartlomiej Kida <security@cyberfolks.pl>
12879
12924
  cfolks.pl
@@ -12925,6 +12970,10 @@ mydatto.com
12925
12970
  dattolocal.net
12926
12971
  mydatto.net
12927
12972
 
12973
+ // ddns.ge : https://nic.ddns.ge
12974
+ // Submitted by John Snow <support@mail.ddns.ge>
12975
+ ddns.ge
12976
+
12928
12977
  // ddnss.de : https://www.ddnss.de/
12929
12978
  // Submitted by Robert Niedziela <webmaster@ddnss.de>
12930
12979
  ddnss.de
@@ -13046,6 +13095,10 @@ dyn.now
13046
13095
  heimdns.online
13047
13096
  ddns.wtf
13048
13097
 
13098
+ // Docs Flowy : https://docsflowy.com
13099
+ // Submitted by Haykel Maaoui <hello@docsflowy.com>
13100
+ docsflowy.site
13101
+
13049
13102
  // DotArai : https://www.dotarai.com/
13050
13103
  // Submitted by Atsadawat Netcharadsang <atsadawat@dotarai.co.th>
13051
13104
  online.th
@@ -13395,8 +13448,13 @@ webredirect.org
13395
13448
  myddns.rocks
13396
13449
 
13397
13450
  // dynv6 : https://dynv6.com
13398
- // Submitted by Dominik Menke <dom@digineo.de>
13451
+ // Submitted by Dominik Menke <dynv6@digineo.de>
13452
+ dns.army
13453
+ v6.army
13454
+ dns.navy
13455
+ v6.navy
13399
13456
  dynv6.net
13457
+ v6.rocks
13400
13458
 
13401
13459
  // E4YOU spol. s.r.o. : https://e4you.cz/
13402
13460
  // Submitted by Vladimir Dudr <info@e4you.cz>
@@ -13756,6 +13814,10 @@ freemyip.com
13756
13814
  // Submitted by Daniel A. Maierhofer <vorstand@funkfeuer.at>
13757
13815
  wien.funkfeuer.at
13758
13816
 
13817
+ // FurryBox : https://www.furry.box
13818
+ // Submitted by Aether <furry@org.digital>
13819
+ xwx.me
13820
+
13759
13821
  // Future Versatile Group. : https://www.fvg-on.net/
13760
13822
  // T.Kabu <webmaster@fvg-on.net>
13761
13823
  daemon.asia
@@ -14003,6 +14065,10 @@ goupile.fr
14003
14065
  // Submitted by Richard Baker <richard.baker@digital.cabinet-office.gov.uk>
14004
14066
  pymnt.uk
14005
14067
 
14068
+ // Government of Germany : https://dachmarke.gov.de/
14069
+ // Submitted by Digitale Dachmarke <support@dachmarke.gov.de>
14070
+ gov.de
14071
+
14006
14072
  // Government of the Netherlands : https://www.government.nl
14007
14073
  // Submitted by <domeinnaam@minaz.nl>
14008
14074
  gov.nl
@@ -14179,11 +14245,6 @@ iki.fi
14179
14245
  ibxos.it
14180
14246
  iliadboxos.it
14181
14247
 
14182
- // Imagine : https://imagine.dev
14183
- // Submitted by Steven Nguyen <security@imagine.dev>
14184
- imagine.diy
14185
- imagine-proxy.work
14186
-
14187
14248
  // Incsub, LLC : https://incsub.com/
14188
14249
  // Submitted by Aaron Edwards <sysadmins@incsub.com>
14189
14250
  smushcdn.com
@@ -14542,6 +14603,10 @@ co.technology
14542
14603
  linkyard-cloud.ch
14543
14604
  linkyard.cloud
14544
14605
 
14606
+ // Linkyhost : https://www.linkyhost.com
14607
+ // Submitted by Linkyhost Support <support@linkyhost.com>
14608
+ linkyhost.page
14609
+
14545
14610
  // Linode : https://linode.com
14546
14611
  // Submitted by <security@linode.com>
14547
14612
  members.linode.com
@@ -14591,6 +14656,7 @@ lohmus.me
14591
14656
  // Lovable : https://lovable.dev
14592
14657
  // Submitted by Fabian Hedin <security@lovable.dev>
14593
14658
  lovable.app
14659
+ auth.lovable.app
14594
14660
  lovableproject.com
14595
14661
  lovable.run
14596
14662
  lovable.sh
@@ -14656,6 +14722,10 @@ luyani.net
14656
14722
  // Submitted by Damien Tournoud <dtournoud@magento.cloud>
14657
14723
  *.magentosite.cloud
14658
14724
 
14725
+ // Magic Pages : https://www.magicpages.co
14726
+ // Submitted by Jannis Fedoruk-Betschki <help@magicpages.co>
14727
+ mymagic.page
14728
+
14659
14729
  // Magic Patterns : https://www.magicpatterns.com
14660
14730
  // Submitted by Teddy Ni <security@magicpatterns.com>
14661
14731
  magicpatterns.app
@@ -14695,6 +14765,7 @@ hra.health
14695
14765
  // MedusaJS, Inc : https://medusajs.com/
14696
14766
  // Submitted by Stevche Radevski <engineering@medusajs.com>
14697
14767
  medusajs.app
14768
+ medusajs.site
14698
14769
 
14699
14770
  // Memset hosting : https://www.memset.com
14700
14771
  // Submitted by Tom Whitwell <domains@memset.com>
@@ -14876,6 +14947,12 @@ mocha.app
14876
14947
  mochausercontent.com
14877
14948
  mocha-sandbox.dev
14878
14949
 
14950
+ // Modelence : https://modelence.com/
14951
+ // Submitted by Modelence Security <security@modelence.com>
14952
+ modelence.app
14953
+ cloud.modelence.app
14954
+ sandbox.modelence.app
14955
+
14879
14956
  // MODX Systems LLC : https://modx.com
14880
14957
  // Submitted by Elizabeth Southwell <elizabeth@modx.com>
14881
14958
  modx.dev
@@ -15018,6 +15095,10 @@ torun.pl
15018
15095
  nh-serv.co.uk
15019
15096
  nimsite.uk
15020
15097
 
15098
+ // Ninjaneer Media : https://ninjaneer.au
15099
+ // Submitted by the Ninjaneer Media team <admin@ninjaneer.au>
15100
+ ninjaneer-sites.com
15101
+
15021
15102
  // No-IP.com : https://noip.com/
15022
15103
  // Submitted by Deven Reza <publicsuffixlist@noip.com>
15023
15104
  mmafan.biz
@@ -15193,6 +15274,10 @@ prvcy.page
15193
15274
  observablehq.cloud
15194
15275
  static.observableusercontent.com
15195
15276
 
15277
+ // omg.dev : https://omg.dev
15278
+ // Submitted by omg.dev Security <security@omg.dev>
15279
+ omgs.page
15280
+
15196
15281
  // OMG.LOL : https://omg.lol
15197
15282
  // Submitted by Adam Newbold <adam@omg.lol>
15198
15283
  omg.lol
@@ -15314,10 +15399,18 @@ own.pm
15314
15399
  // Submitted by Adam Grand <webmaster@mail.ox.rs>
15315
15400
  ox.rs
15316
15401
 
15402
+ // OxyPages : https://oxypages.com
15403
+ // Submitted by Oxy Pages <hello@oxypages.com>
15404
+ myoxypages.com
15405
+
15317
15406
  // oy.lc
15318
15407
  // Submitted by Charly Coste <changaco@changaco.oy.lc>
15319
15408
  oy.lc
15320
15409
 
15410
+ // Page Lemon : https://pagelemon.com
15411
+ // Submitted by Aporia Research Ltd <hi@pagelemon.com>
15412
+ pagelemon.dev
15413
+
15321
15414
  // Pagefog : https://pagefog.com/
15322
15415
  // Submitted by Derek Myers <derek@pagefog.com>
15323
15416
  pgfog.com
@@ -15538,6 +15631,10 @@ ravpage.co.il
15538
15631
  readthedocs-hosted.com
15539
15632
  readthedocs.io
15540
15633
 
15634
+ // ReadWriteExecute, Inc : https://www.rwx.com
15635
+ // Submitted by Dan Manges <security@rwx.com>
15636
+ rwx.run
15637
+
15541
15638
  // Red Hat, Inc. OpenShift : https://openshift.redhat.com/
15542
15639
  // Submitted by Tim Kramer <tkramer@rhcloud.com>
15543
15640
  rhcloud.com
@@ -15551,6 +15648,12 @@ instances.spawn.cc
15551
15648
  *.clusters.rdpa.co
15552
15649
  *.srvrless.rdpa.co
15553
15650
 
15651
+ // Reliant Labs : https://reliantlabs.io
15652
+ // Submitted by Reliant Labs Security <security@reliantlabs.io>
15653
+ reliantlabs.dev
15654
+ sites.reliantlabs.dev
15655
+ reliantpreview.dev
15656
+
15554
15657
  // Render : https://render.com
15555
15658
  // Submitted by Anurag Goel <dev@render.com>
15556
15659
  onrender.com
@@ -15631,6 +15734,10 @@ io.noc.ruhr-uni-bochum.de
15631
15734
  // Submitted by Tech Support <support@rasnet.ru>
15632
15735
  ras.ru
15633
15736
 
15737
+ // Sail Research Co. : https://sailresearch.com/
15738
+ // Submitted by Sail Support <support@sailresearch.com>
15739
+ sail.box
15740
+
15634
15741
  // Sakura Frp : https://www.natfrp.com
15635
15742
  // Submitted by Bobo Liu <support@natfrp.cloud>
15636
15743
  nyat.app
@@ -15717,6 +15824,11 @@ sakura.tv
15717
15824
  // Submitted by Asheesh Laroia <asheesh@sandstorm.io>
15718
15825
  sandcats.io
15719
15826
 
15827
+ // Sanity Inc. : https://www.sanity.io/
15828
+ // Submitted by Josh Ellis <security@sanity.io>
15829
+ sanity.run
15830
+ sanity.studio
15831
+
15720
15832
  // Sav.com, LLC : https://marketing.sav.com/
15721
15833
  // Submitted by Mukul Kudegave <mukul@sav.com>
15722
15834
  sav.case
@@ -15869,6 +15981,13 @@ shopitsite.com
15869
15981
  shopware.shop
15870
15982
  shopware.store
15871
15983
 
15984
+ // Show Corporation : https://doma.in
15985
+ // Submitted by Xiufeng Guo <support@cctld.com>
15986
+ co.fo
15987
+ com.fo
15988
+ wz.io
15989
+ wz.org
15990
+
15872
15991
  // Siemens Mobility GmbH
15873
15992
  // Submitted by Oliver Graebner <security@mo-siemens.io>
15874
15993
  mo-siemens.io
@@ -15885,6 +16004,10 @@ vipsinaapp.com
15885
16004
  // Submitted by Skylar Challand <support@siteleaf.com>
15886
16005
  siteleaf.net
15887
16006
 
16007
+ // Sliplane GmbH : https://sliplane.io
16008
+ // Submitted by Jonas Scholz <support@sliplane.io>
16009
+ sliplane.app
16010
+
15888
16011
  // Small Technology Foundation : https://small-tech.org
15889
16012
  // Submitted by Aral Balkan <aral@small-tech.org>
15890
16013
  small-web.org
@@ -15947,6 +16070,13 @@ my.de
15947
16070
  *.nxa.eu
15948
16071
  nx.gw
15949
16072
 
16073
+ // SpaceXSI : https://x.ai/
16074
+ // Submitted by Benson Liu <security@x.ai>
16075
+ *.apps.grok.bot
16076
+ *.pages.grok.bot
16077
+ *.cursorusercontent.com
16078
+ grok.me
16079
+
15950
16080
  // Spawnbase : https://spawnbase.ai
15951
16081
  // Submitted by Alexander Zuev <security@spawnbase.ai>
15952
16082
  spawnbase.app
@@ -16167,6 +16297,10 @@ telebit.io
16167
16297
  // Submitted by Rob Picard <security@goteleport.com>
16168
16298
  teleport.sh
16169
16299
 
16300
+ // Terramind.com, Inc. : https://terramind.com
16301
+ // Submitted by Terramind Sites <sites@terramind.com>
16302
+ terramind.io
16303
+
16170
16304
  // Thingdust AG : https://thingdust.com/
16171
16305
  // Submitted by Adrian Imboden <adi@thingdust.com>
16172
16306
  *.firenet.ch
@@ -16336,6 +16470,10 @@ now.sh
16336
16470
  // Submitted by Danko Aleksejevs <danko@very.lv>
16337
16471
  2038.io
16338
16472
 
16473
+ // VibeKit : https://vibekit.bot/
16474
+ // Submitted by Brian Boisjoli <info@vibekit.bot>
16475
+ vibekit.page
16476
+
16339
16477
  // Virtual-Info : https://www.virtual-info.info/
16340
16478
  // Submitted by Adnan RIHAN <hostmaster@v-info.info>
16341
16479
  v-info.info
@@ -16353,6 +16491,10 @@ deus-canvas.com
16353
16491
  vivenushop.com
16354
16492
  vivenushop.dev
16355
16493
 
16494
+ // Voati : https://voati.org
16495
+ // Submitted by Voati Support <support@voati.org>
16496
+ voati.host
16497
+
16356
16498
  // Voorloper.com : https://voorloper.com
16357
16499
  // Submitted by Nathan van Bakel <info@voorloper.com>
16358
16500
  voorloper.cloud
@@ -16372,6 +16514,7 @@ wal.app
16372
16514
  // Wasmer: https://wasmer.io
16373
16515
  // Submitted by Lorentz Kinde <security@wasmer.io>
16374
16516
  wasmer.app
16517
+ sm.run
16375
16518
 
16376
16519
  // Webflow, Inc. : https://www.webflow.com
16377
16520
  // Submitted by Webflow Security Team <security@webflow.com>
@@ -16478,10 +16621,6 @@ weeklylottery.org.uk
16478
16621
  wpenginepowered.com
16479
16622
  js.wpenginepowered.com
16480
16623
 
16481
- // xAI : https://x.ai/
16482
- // Submitted by Asim Shrestha <security@x.ai>
16483
- grok.me
16484
-
16485
16624
  // XenonCloud GbR : https://xenoncloud.net
16486
16625
  // Submitted by Julian Uphoff <publicsuffixlist@xenoncloud.net>
16487
16626
  *.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();