matrix-synapse 1.140.0__cp39-abi3-musllinux_1_2_aarch64.whl → 1.141.0__cp39-abi3-musllinux_1_2_aarch64.whl

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.

Potentially problematic release.


This version of matrix-synapse might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: matrix-synapse
3
- Version: 1.140.0
3
+ Version: 1.141.0
4
4
  Summary: Homeserver for the Matrix decentralised comms protocol
5
5
  License: AGPL-3.0-or-later OR LicenseRef-Element-Commercial
6
6
  Author: Matrix.org Team and Contributors
@@ -4,7 +4,7 @@ synapse/_pydantic_compat.py,sha256=87dKeVb2Anau0frkNqq3y8XC5ZwJ3jLyVOsWSEwsCZ8,2
4
4
  synapse/event_auth.py,sha256=fTm9uAf2iC6bIJuP7QH_7zz26VrqPLIqsoXKXkGINME,47090
5
5
  synapse/notifier.py,sha256=-qPQQiKxrxwU5Cr3Uzv8PIoyWcNKfBipKemOBzELbT4,35910
6
6
  synapse/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- synapse/server.py,sha256=ARplbOkStxgqjWZVc63RokcWGBtnfDW-LeLWT7Q6lSQ,44912
7
+ synapse/server.py,sha256=3JfefqrjLSeX7Gv8ZA9E103E4O6l05uDkfIghkAfNxg,45069
8
8
  synapse/synapse_rust.abi3.so,sha256=baXAwJnS5K039tqfWT-yVk7kE5AF1oZJRrzSh3WtEA4,11800609
9
9
  synapse/visibility.py,sha256=tRZzUn7X8nn2I9U74aORe0MB5KQZ60zTRWjqihSMsyY,31475
10
10
  synapse/_scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -13,7 +13,7 @@ synapse/_scripts/generate_config.py,sha256=KaYWiSVP50PQnhDvrfW6iKiIsPDn_PeAKnm43
13
13
  synapse/_scripts/generate_log_config.py,sha256=9lnzZeWYZTQtM-Y1iCt4kOegL4TkqZ2l21qPCbOBhPA,1459
14
14
  synapse/_scripts/generate_signing_key.py,sha256=lauzE2E0agnKNv7jhhSlV54htRLm9uX1GGVR2aFl9gM,1541
15
15
  synapse/_scripts/generate_workers_map.py,sha256=PymWyPFa33HCSvGvK_ltAUoZMM7EFHUCKGiC2xqqncg,10260
16
- synapse/_scripts/hash_password.py,sha256=umsXOUS2Tb1TZsn5xBKySA8cPgRJOT1_H8nqUmyAO1w,2174
16
+ synapse/_scripts/hash_password.py,sha256=m6NTSEkFMyvUc4bEBtRGpF-fUBZKPmL1slrVrqKQU14,2621
17
17
  synapse/_scripts/move_remote_media_to_new_store.py,sha256=VOGFBrZM3qBW4ysmdD8XW9vNTXJOF7IyBRSpoh7pRdc,3780
18
18
  synapse/_scripts/register_new_matrix_user.py,sha256=CIdZpokRTis07Jw3SyUeH3WX-zPBJLEHh_4Gs_NSwbs,10757
19
19
  synapse/_scripts/review_recent_signups.py,sha256=MeEnHMpHiLGBh6xvwSyH4RSDM7YZKkygtC3-lDGJvCU,6422
@@ -30,12 +30,12 @@ synapse/api/ratelimiting.py,sha256=XJWgsdRtiX0I8QvYv5DbVGhI24ZNnNXO_FreIMPckOY,1
30
30
  synapse/api/room_versions.py,sha256=QDzw9X5qpFBxB9XaSmYgRpFwV1dl3V1R42dlUvoCu5w,18925
31
31
  synapse/api/urls.py,sha256=XVlSEhTE06_ABi2tjMTPVjOYApizA_RTIbtF4LYsWQ4,4378
32
32
  synapse/api/auth/__init__.py,sha256=DR8l59rRPhC_SIQshcqGgzDfECTTt9diw5R3Y55ooOg,7007
33
- synapse/api/auth/base.py,sha256=3mERbu-n4LHBqIDBr32r3v9urEu_S3XNOYEQexDwi48,15563
33
+ synapse/api/auth/base.py,sha256=pEGeMnlzuzM8sngb_do5MdcSBQWZZmiL6CIwF4Y1FlA,15548
34
34
  synapse/api/auth/internal.py,sha256=qn6RJCPRvTv9bTTFDwVW7KdRiDgbidQMM9DAknbl-Bo,11405
35
35
  synapse/api/auth/mas.py,sha256=mRjT9dXcELdypXS8VR0uE2jPKv_shpuq3BvtfyleTDw,16143
36
36
  synapse/api/auth/msc3861_delegated.py,sha256=SfuEl0oZX4CGIRir6liPDsA2JowdhYt6XwYweNBFiM0,24162
37
37
  synapse/app/__init__.py,sha256=SA64haCokU2G02egH6Oz5IXQYjfMZZNpS2WSrcJjFWw,1937
38
- synapse/app/_base.py,sha256=eGDIixPs1OiKgtPGwMRZYG5wfNAZy_guJaDJDlvoc7E,30734
38
+ synapse/app/_base.py,sha256=1dWeO2lo7ys1sXBctgq3wvIHChgl1XGfK56qYHmCTpA,30249
39
39
  synapse/app/admin_cmd.py,sha256=oUY3WDJ3-Su7R3t1sHyOWldnTgI84MVKVCFeJE8ER8M,12780
40
40
  synapse/app/appservice.py,sha256=8kcF8yev36b8nFs_lI0VfEWgosAXl78aEQr0IZPrWAk,1060
41
41
  synapse/app/client_reader.py,sha256=8kcF8yev36b8nFs_lI0VfEWgosAXl78aEQr0IZPrWAk,1060
@@ -45,7 +45,7 @@ synapse/app/federation_reader.py,sha256=8kcF8yev36b8nFs_lI0VfEWgosAXl78aEQr0IZPr
45
45
  synapse/app/federation_sender.py,sha256=8kcF8yev36b8nFs_lI0VfEWgosAXl78aEQr0IZPrWAk,1060
46
46
  synapse/app/frontend_proxy.py,sha256=8kcF8yev36b8nFs_lI0VfEWgosAXl78aEQr0IZPrWAk,1060
47
47
  synapse/app/generic_worker.py,sha256=Y3XYVWBk1kQrjO74TBb4pboAsqK7TBolWpgPF1FWK4s,15705
48
- synapse/app/homeserver.py,sha256=65-0hHxx8BR7uiQlKzrRL6ZM9uq--FNdsNIQhv527AM,17211
48
+ synapse/app/homeserver.py,sha256=jilEa1K4HyOpRiFOAmsMbOaU1B6d7a_aAbFyXRkxCvg,17069
49
49
  synapse/app/media_repository.py,sha256=8kcF8yev36b8nFs_lI0VfEWgosAXl78aEQr0IZPrWAk,1060
50
50
  synapse/app/phone_stats_home.py,sha256=xLcw-uk2bfiJeQtGc6VYNq2vBfBg-Z7AmH5D2ub2XrY,10655
51
51
  synapse/app/pusher.py,sha256=8kcF8yev36b8nFs_lI0VfEWgosAXl78aEQr0IZPrWAk,1060
@@ -71,7 +71,7 @@ synapse/config/cas.py,sha256=frR7DzZ2V27WvMKaGEKvC2_LuyvKNuONEVtys4E-9gU,4240
71
71
  synapse/config/consent.py,sha256=4KJbfMPrloJBrB2jQqLLF4ZWKOsLXmymRYBIOJW5RKs,2669
72
72
  synapse/config/database.py,sha256=0M2sSGKkg1uLcDz3E5W0_iTH3M-MJTndW0KlVivOcxk,6591
73
73
  synapse/config/emailconfig.py,sha256=ic_zF9CzX5SKPVJqBH4gRg5E3cGCIifv2sbCVPsjgak,15877
74
- synapse/config/experimental.py,sha256=0PKcAQtMMzvp48WO-W0NzeIoIVY8Us6jqB48vTbT_3s,23391
74
+ synapse/config/experimental.py,sha256=c2ZMO1ApocXAIE0ser6cLsNpzEJ3zRfqAVWW4VsWwB0,23182
75
75
  synapse/config/federation.py,sha256=iu7ONXr--4WXrhT-YZX95l1Tyt3DWLBJmZpZ3OqvGCA,4470
76
76
  synapse/config/homeserver.py,sha256=22RCwv4f5oJX_Sjj3gtQ_ryqYavvnF1GfhYFXyK-Qrc,4713
77
77
  synapse/config/jwt.py,sha256=NOFTtnGewnmaeTJL4P1-dFNQhlsH153ZENmJGBwT_Pw,1949
@@ -137,7 +137,7 @@ synapse/handlers/account_data.py,sha256=CQAfVkJPMQsbl53lRZK_lHmkR0O2RM80rjwCfa9g
137
137
  synapse/handlers/account_validity.py,sha256=5HS1hL1rGe72xaOLENGwFrVsjXaezhEBWIctAMqWhlU,13924
138
138
  synapse/handlers/admin.py,sha256=P7e3bwsIDxOvRIzlZOArfMRWtJD-KkyLzDfubsUEq3k,22800
139
139
  synapse/handlers/appservice.py,sha256=vtqScclvlKH_LJYcG9v8BtG70aS9VL60-9tFM48fiz0,40481
140
- synapse/handlers/auth.py,sha256=9QcBvL7FCi0SBA5ipJ31HsXunmRPXj8lNO7LtNRqylo,99772
140
+ synapse/handlers/auth.py,sha256=MtwCo5_HDILviQdHtg6WEz2hHtLKe5qhDPf8jDyMAso,100948
141
141
  synapse/handlers/cas.py,sha256=ce7bB1gXa2VWRb4l36WmxP3V7nD5JrIdMOusYRysBOk,15313
142
142
  synapse/handlers/deactivate_account.py,sha256=snM3YHgREAHsbn8XwcFpSq8SW7-8_AFS5i2jCsAVaKE,14602
143
143
  synapse/handlers/delayed_events.py,sha256=ApA9UiujQ3q33HcPwolOrRvRQkzDvgbALIaOvYV_-Bg,25948
@@ -229,7 +229,7 @@ synapse/metrics/_gc.py,sha256=s2k-GPFUItKGrLuIujrYQWlt-0bJE81WtLVbLfnhjZQ,8304
229
229
  synapse/metrics/_reactor_metrics.py,sha256=crp4x_VgjavL9Es2lo5JLXrzRr3wzTyK54q_gCViv6k,6002
230
230
  synapse/metrics/_types.py,sha256=XjukHeHdmh5xcELjdh0ZuLWpKlwpRFMedoM2MK3Mmko,1196
231
231
  synapse/metrics/background_process_metrics.py,sha256=L3-hiIX_PRITvCMsGGa5UXDAibBbd5zafkvc5xPpOYA,22473
232
- synapse/metrics/common_usage_metrics.py,sha256=j6ekGWIXaob2Z8sLWj1mPVQXZmLs0ejb50btPHzWV-U,2947
232
+ synapse/metrics/common_usage_metrics.py,sha256=guOeJ84ARHNxHH8OLdw_e-MhMRqFfyJfdlTfY5nso1w,2941
233
233
  synapse/metrics/jemalloc.py,sha256=H1Dn6B0Ob-PWX4lww78fYMJg8X6pfuXdB5YjURkKs1U,8341
234
234
  synapse/module_api/__init__.py,sha256=CrWUBuWF9DgRMZwN8GTGQn_OZVL1IHcmqpHOjM3_-wc,80233
235
235
  synapse/module_api/errors.py,sha256=Xq9K1Rax-QLVPClaubhqg0C7onDdrJGqBPFtlnD34A8,1272
@@ -360,12 +360,12 @@ synapse/rest/client/auth.py,sha256=x5SMw7kYn77fnElR2RAyO_iEACEfOacAhvby5PjEFec,8
360
360
  synapse/rest/client/auth_metadata.py,sha256=NvDi6eyG5g_-t4fU_HhjJG9bW2HSATHGyryuPcrt82U,4417
361
361
  synapse/rest/client/capabilities.py,sha256=tJP3ZFHbyjV2jkkK8bIcYUGd-SW_Kc-O6izkV5cv4dU,4534
362
362
  synapse/rest/client/delayed_events.py,sha256=R5PQt7CpezcmodUz7B5GYSPZq8Faj35GBhIyzmjzzsM,3883
363
- synapse/rest/client/devices.py,sha256=fSKSBB3FitAWbZF-psmBBAXi9iw8JAgGb-thdZ1g-e8,19533
363
+ synapse/rest/client/devices.py,sha256=29kauab4ELBxD7CQiZCkJoJddeOtb7p59z8f8N_mtpA,19377
364
364
  synapse/rest/client/directory.py,sha256=P12dOFUFXYUDJSBwpBpHI_ry-c-m3sDrihpnqeNMI0s,7395
365
365
  synapse/rest/client/events.py,sha256=ig7fi3b2VduD1_-yj82wensWQFbwMFwd-lv9cHyCSAQ,4067
366
366
  synapse/rest/client/filter.py,sha256=_jDRkrDVqrb0_wqn9vrSjIiH3yFI1Aia8zkcAORUxJo,3802
367
367
  synapse/rest/client/initial_sync.py,sha256=4cA5LRSpTCiIA72fzemNqUbwW4CkvB70TWUI95VsK94,2368
368
- synapse/rest/client/keys.py,sha256=4AP1FAwWiOfXAHOtA5BBV9DbHy6udkrD3PHwqH1Rpcc,25452
368
+ synapse/rest/client/keys.py,sha256=b-jadOWP8v0P2MIGmivUGx-a0pVC7dB4CF3A8XdXhYI,25311
369
369
  synapse/rest/client/knock.py,sha256=KtOGjb9W1Jjpe5hAlOkEVU9DuzGsmpLHXrevVNYno-8,3558
370
370
  synapse/rest/client/login.py,sha256=OJhwDvlwNXJSf-8YEqTk1Rtbtz_lkkTr2jlVtdsmCU0,28379
371
371
  synapse/rest/client/login_token_request.py,sha256=iG2GE6ueI_t9syphFxJRdamkwpC3QcF1Oxaq2rnqLqg,4284
@@ -1023,7 +1023,7 @@ synapse/util/logcontext.py,sha256=WLB1FgS7BIJyeCpzc5ltm9gr8EEr0dBY7_kQ31S7_wM,12
1023
1023
  synapse/util/logformatter.py,sha256=dK6fhkz97KEiVj2zJWl-VJ_y4i9kqH-zIN2AHytG6_U,895
1024
1024
  synapse/util/macaroons.py,sha256=QmTwmKGxfNrPC6Ef59hz75-q4agZEwED4bE3pyeG3QM,12134
1025
1025
  synapse/util/manhole.py,sha256=XT4Mj2bbv9q3ZMsxiTJbWJuLjT4ExeJSPklgqTa42QQ,8349
1026
- synapse/util/metrics.py,sha256=T5WjREtVFTsFgSWIqJa0_79BuYKFwfquwSK_ppvpvtM,11826
1026
+ synapse/util/metrics.py,sha256=E2MTVyGbEcIdCC2ftgMBj7bhsppPhw_xtkya23IFbgA,12046
1027
1027
  synapse/util/module_loader.py,sha256=DU0IzaYrvP2ol8aJ56HQonuBNkO9ouVy9VuJQDZx7rM,4003
1028
1028
  synapse/util/msisdn.py,sha256=8nwe3uXLmaDt0jOuYUDbHUVXyjC1llf19iRxCx-IAmA,1707
1029
1029
  synapse/util/patch_inline_callbacks.py,sha256=rIRrab18mVLJ5NFacoz_SouSfU1HWI0Ql3Ztl5lZ8uc,9322
@@ -1049,10 +1049,10 @@ synapse/util/caches/response_cache.py,sha256=pfiktchF_NUhFYU96nIRcPBfsQMSpBo4Zun
1049
1049
  synapse/util/caches/stream_change_cache.py,sha256=OaYpW9ZhVz6nLqkeSUnav3QztWgxoc6U2f_OHu7AqQI,13341
1050
1050
  synapse/util/caches/treecache.py,sha256=ZgINF6s_O7NnP4-sI3kEYS2hMLxVeI8Kb3EiFUVVrWA,5948
1051
1051
  synapse/util/caches/ttlcache.py,sha256=kYDG8koywsTukoEpXJuqBsmk5Du1MFEQfBrPN97uw8E,5818
1052
- matrix_synapse-1.140.0.dist-info/AUTHORS.rst,sha256=KvPRmsv8L-ZN9AA51KsR-4fZu0ajfkCbSNNH9rhRUO4,1611
1053
- matrix_synapse-1.140.0.dist-info/LICENSE-AGPL-3.0,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
1054
- matrix_synapse-1.140.0.dist-info/LICENSE-COMMERCIAL,sha256=EZfebSnFA3xtm1w2B9cuqpC1BF8tYjQA6HCCX9z3Zm4,255
1055
- matrix_synapse-1.140.0.dist-info/METADATA,sha256=4pgE02jWITvgAKVvQ7hrOPpL4UW5rn24GmOI_TXH5MA,17002
1056
- matrix_synapse-1.140.0.dist-info/WHEEL,sha256=qD05PE4oken3fxhpRz34QZ_OG3AXOlk_2cjvD0ZWlqI,108
1057
- matrix_synapse-1.140.0.dist-info/entry_points.txt,sha256=Xf4Z-Sp4lk8P9pbRhSD40XrhhkooqYWm1OtxUlPwPgs,709
1058
- matrix_synapse-1.140.0.dist-info/RECORD,,
1052
+ matrix_synapse-1.141.0.dist-info/AUTHORS.rst,sha256=KvPRmsv8L-ZN9AA51KsR-4fZu0ajfkCbSNNH9rhRUO4,1611
1053
+ matrix_synapse-1.141.0.dist-info/LICENSE-AGPL-3.0,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
1054
+ matrix_synapse-1.141.0.dist-info/LICENSE-COMMERCIAL,sha256=EZfebSnFA3xtm1w2B9cuqpC1BF8tYjQA6HCCX9z3Zm4,255
1055
+ matrix_synapse-1.141.0.dist-info/METADATA,sha256=okmM7NfYC7A4x_0lJePCOJQuCXLPeqzU99oyE0HbGO8,17002
1056
+ matrix_synapse-1.141.0.dist-info/WHEEL,sha256=qD05PE4oken3fxhpRz34QZ_OG3AXOlk_2cjvD0ZWlqI,108
1057
+ matrix_synapse-1.141.0.dist-info/entry_points.txt,sha256=Xf4Z-Sp4lk8P9pbRhSD40XrhhkooqYWm1OtxUlPwPgs,709
1058
+ matrix_synapse-1.141.0.dist-info/RECORD,,
@@ -73,8 +73,18 @@ def main() -> None:
73
73
 
74
74
  pw = unicodedata.normalize("NFKC", password)
75
75
 
76
+ bytes_to_hash = pw.encode("utf8") + password_pepper.encode("utf8")
77
+ if len(bytes_to_hash) > 72:
78
+ # bcrypt only looks at the first 72 bytes
79
+ print(
80
+ f"Password + pepper is too long ({len(bytes_to_hash)} bytes); truncating to 72 bytes for bcrypt. "
81
+ "This is expected behaviour and will not affect a user's ability to log in. 72 bytes is "
82
+ "sufficient entropy for a password."
83
+ )
84
+ bytes_to_hash = bytes_to_hash[:72]
85
+
76
86
  hashed = bcrypt.hashpw(
77
- pw.encode("utf8") + password_pepper.encode("utf8"),
87
+ bytes_to_hash,
78
88
  bcrypt.gensalt(bcrypt_rounds),
79
89
  ).decode("ascii")
80
90
 
synapse/api/auth/base.py CHANGED
@@ -302,12 +302,9 @@ class BaseAuth:
302
302
  (the user_id URI parameter allows an application service to masquerade
303
303
  any applicable user in its namespace)
304
304
  - what device the application service should be treated as controlling
305
- (the device_id[^1] URI parameter allows an application service to masquerade
305
+ (the device_id URI parameter allows an application service to masquerade
306
306
  as any device that exists for the relevant user)
307
307
 
308
- [^1] Unstable and provided by MSC3202.
309
- Must use `org.matrix.msc3202.device_id` in place of `device_id` for now.
310
-
311
308
  Returns:
312
309
  the application service `Requester` of that request
313
310
 
@@ -319,7 +316,8 @@ class BaseAuth:
319
316
  - The returned device ID, if present, has been checked to be a valid device ID
320
317
  for the returned user ID.
321
318
  """
322
- DEVICE_ID_ARG_NAME = b"org.matrix.msc3202.device_id"
319
+ # TODO: We can drop unstable support after 2026-01-01 (couple months after stable support)
320
+ UNSTABLE_DEVICE_ID_ARG_NAME = b"org.matrix.msc3202.device_id"
323
321
 
324
322
  app_service = self.store.get_app_service_by_token(access_token)
325
323
  if app_service is None:
@@ -341,13 +339,11 @@ class BaseAuth:
341
339
  else:
342
340
  effective_user_id = app_service.sender
343
341
 
344
- effective_device_id: Optional[str] = None
345
-
346
- if (
347
- self.hs.config.experimental.msc3202_device_masquerading_enabled
348
- and DEVICE_ID_ARG_NAME in request.args
349
- ):
350
- effective_device_id = request.args[DEVICE_ID_ARG_NAME][0].decode("utf8")
342
+ effective_device_id_args = request.args.get(
343
+ b"device_id", request.args.get(UNSTABLE_DEVICE_ID_ARG_NAME)
344
+ )
345
+ if effective_device_id_args:
346
+ effective_device_id = effective_device_id_args[0].decode("utf8")
351
347
  # We only just set this so it can't be None!
352
348
  assert effective_device_id is not None
353
349
  device_opt = await self.store.get_device(
@@ -359,6 +355,8 @@ class BaseAuth:
359
355
  f"Application service trying to use a device that doesn't exist ('{effective_device_id}' for {effective_user_id})",
360
356
  Codes.UNKNOWN_DEVICE,
361
357
  )
358
+ else:
359
+ effective_device_id = None
362
360
 
363
361
  return create_requester(
364
362
  effective_user_id, app_service=app_service, device_id=effective_device_id
synapse/app/_base.py CHANGED
@@ -64,7 +64,6 @@ from twisted.web.resource import Resource
64
64
  import synapse.util.caches
65
65
  from synapse.api.constants import MAX_PDU_SIZE
66
66
  from synapse.app import check_bind_error
67
- from synapse.app.phone_stats_home import start_phone_stats_home
68
67
  from synapse.config import ConfigError
69
68
  from synapse.config._base import format_config_error
70
69
  from synapse.config.homeserver import HomeServerConfig
@@ -592,9 +591,9 @@ async def start(hs: "HomeServer", freeze: bool = True) -> None:
592
591
  # we're not using systemd.
593
592
  sdnotify(b"RELOADING=1")
594
593
 
595
- for sighup_callbacks in _instance_id_to_sighup_callbacks_map.values():
596
- for func, args, kwargs in sighup_callbacks:
597
- func(*args, **kwargs)
594
+ for sighup_callbacks in _instance_id_to_sighup_callbacks_map.values():
595
+ for func, args, kwargs in sighup_callbacks:
596
+ func(*args, **kwargs)
598
597
 
599
598
  sdnotify(b"READY=1")
600
599
 
@@ -683,15 +682,6 @@ async def start(hs: "HomeServer", freeze: bool = True) -> None:
683
682
  if hs.config.worker.run_background_tasks:
684
683
  hs.start_background_tasks()
685
684
 
686
- # TODO: This should be moved to same pattern we use for other background tasks:
687
- # Add to `REQUIRED_ON_BACKGROUND_TASK_STARTUP` and rely on
688
- # `start_background_tasks` to start it.
689
- await hs.get_common_usage_metrics_manager().setup()
690
-
691
- # TODO: This feels like another pattern that should refactored as one of the
692
- # `REQUIRED_ON_BACKGROUND_TASK_STARTUP`
693
- start_phone_stats_home(hs)
694
-
695
685
  if freeze:
696
686
  # We now freeze all allocated objects in the hopes that (almost)
697
687
  # everything currently allocated are things that will be used for the
synapse/app/homeserver.py CHANGED
@@ -430,9 +430,7 @@ def setup(
430
430
 
431
431
  await _base.start(hs, freeze)
432
432
 
433
- # TODO: This should be moved to `SynapseHomeServer.start_background_tasks` (not
434
- # `HomeServer.start_background_tasks`) (this way it matches the behavior of only
435
- # running on `main`)
433
+ # TODO: Feels like this should be moved somewhere else.
436
434
  hs.get_datastores().main.db_pool.updates.start_doing_background_updates()
437
435
 
438
436
  # Register a callback to be invoked once the reactor is running
@@ -412,11 +412,6 @@ class ExperimentalConfig(Config):
412
412
  "msc2409_to_device_messages_enabled", False
413
413
  )
414
414
 
415
- # The portion of MSC3202 which is related to device masquerading.
416
- self.msc3202_device_masquerading_enabled: bool = experimental.get(
417
- "msc3202_device_masquerading", False
418
- )
419
-
420
415
  # The portion of MSC3202 related to transaction extensions:
421
416
  # sending device list changes, one-time key counts and fallback key
422
417
  # usage to application services.
synapse/handlers/auth.py CHANGED
@@ -1683,8 +1683,22 @@ class AuthHandler:
1683
1683
  # Normalise the Unicode in the password
1684
1684
  pw = unicodedata.normalize("NFKC", password)
1685
1685
 
1686
+ bytes_to_hash = pw.encode(
1687
+ "utf8"
1688
+ ) + self.hs.config.auth.password_pepper.encode("utf8")
1689
+ if len(bytes_to_hash) > 72:
1690
+ # bcrypt only looks at the first 72 bytes.
1691
+ #
1692
+ # Note: we explicitly DO NOT log the length of the user's password here.
1693
+ logger.debug(
1694
+ "Password + pepper is too long; truncating to 72 bytes for bcrypt. "
1695
+ "This is expected behaviour and will not affect a user's ability to log in. 72 bytes is "
1696
+ "sufficient entropy for a password."
1697
+ )
1698
+ bytes_to_hash = bytes_to_hash[:72]
1699
+
1686
1700
  return bcrypt.hashpw(
1687
- pw.encode("utf8") + self.hs.config.auth.password_pepper.encode("utf8"),
1701
+ bytes_to_hash,
1688
1702
  bcrypt.gensalt(self.bcrypt_rounds),
1689
1703
  ).decode("ascii")
1690
1704
 
@@ -1706,9 +1720,20 @@ class AuthHandler:
1706
1720
  def _do_validate_hash(checked_hash: bytes) -> bool:
1707
1721
  # Normalise the Unicode in the password
1708
1722
  pw = unicodedata.normalize("NFKC", password)
1723
+ password_pepper = self.hs.config.auth.password_pepper
1724
+
1725
+ bytes_to_hash = pw.encode("utf8") + password_pepper.encode("utf8")
1726
+ if len(bytes_to_hash) > 72:
1727
+ # bcrypt only looks at the first 72 bytes
1728
+ logger.debug(
1729
+ "Password + pepper is too long; truncating to 72 bytes for bcrypt. "
1730
+ "This is expected behaviour and will not affect a user's ability to log in. 72 bytes is "
1731
+ "sufficient entropy for a password."
1732
+ )
1733
+ bytes_to_hash = bytes_to_hash[:72]
1709
1734
 
1710
1735
  return bcrypt.checkpw(
1711
- pw.encode("utf8") + self.hs.config.auth.password_pepper.encode("utf8"),
1736
+ bytes_to_hash,
1712
1737
  checked_hash,
1713
1738
  )
1714
1739
 
@@ -62,7 +62,7 @@ class CommonUsageMetricsManager:
62
62
  """
63
63
  return await self._collect()
64
64
 
65
- async def setup(self) -> None:
65
+ def setup(self) -> None:
66
66
  """Keep the gauges for common usage metrics up to date."""
67
67
  self._hs.run_as_background_process(
68
68
  desc="common_usage_metrics_update_gauges",
@@ -112,7 +112,7 @@ class DeleteDevicesRestServlet(RestServlet):
112
112
  else:
113
113
  raise e
114
114
 
115
- if requester.app_service and requester.app_service.msc4190_device_management:
115
+ if requester.app_service:
116
116
  # MSC4190 can skip UIA for this endpoint
117
117
  pass
118
118
  else:
@@ -192,7 +192,7 @@ class DeviceRestServlet(RestServlet):
192
192
  else:
193
193
  raise
194
194
 
195
- if requester.app_service and requester.app_service.msc4190_device_management:
195
+ if requester.app_service:
196
196
  # MSC4190 allows appservices to delete devices through this endpoint without UIA
197
197
  # It's also allowed with MSC3861 enabled
198
198
  pass
@@ -227,7 +227,7 @@ class DeviceRestServlet(RestServlet):
227
227
  body = parse_and_validate_json_object_from_request(request, self.PutBody)
228
228
 
229
229
  # MSC4190 allows appservices to create devices through this endpoint
230
- if requester.app_service and requester.app_service.msc4190_device_management:
230
+ if requester.app_service:
231
231
  created = await self.device_handler.upsert_device(
232
232
  user_id=requester.user.to_string(),
233
233
  device_id=device_id,
@@ -543,15 +543,11 @@ class SigningKeyUploadServlet(RestServlet):
543
543
  if not keys_are_different:
544
544
  return 200, {}
545
545
 
546
- # MSC4190 can skip UIA for replacing cross-signing keys as well.
547
- is_appservice_with_msc4190 = (
548
- requester.app_service and requester.app_service.msc4190_device_management
549
- )
550
-
551
546
  # The keys are different; is x-signing set up? If no, then this is first-time
552
547
  # setup, and that is allowed without UIA, per MSC3967.
553
548
  # If yes, then we need to authenticate the change.
554
- if is_cross_signing_setup and not is_appservice_with_msc4190:
549
+ # MSC4190 can skip UIA for replacing cross-signing keys as well.
550
+ if is_cross_signing_setup and not requester.app_service:
555
551
  # With MSC3861, UIA is not possible. Instead, the auth service has to
556
552
  # explicitly mark the master key as replaceable.
557
553
  if self.hs.config.mas.enabled:
synapse/server.py CHANGED
@@ -62,6 +62,7 @@ from synapse.api.auth_blocking import AuthBlocking
62
62
  from synapse.api.filtering import Filtering
63
63
  from synapse.api.ratelimiting import Ratelimiter, RequestRatelimiter
64
64
  from synapse.app._base import unregister_sighups
65
+ from synapse.app.phone_stats_home import start_phone_stats_home
65
66
  from synapse.appservice.api import ApplicationServiceApi
66
67
  from synapse.appservice.scheduler import ApplicationServiceScheduler
67
68
  from synapse.config.homeserver import HomeServerConfig
@@ -643,6 +644,8 @@ class HomeServer(metaclass=abc.ABCMeta):
643
644
  for i in self.REQUIRED_ON_BACKGROUND_TASK_STARTUP:
644
645
  getattr(self, "get_" + i + "_handler")()
645
646
  self.get_task_scheduler()
647
+ self.get_common_usage_metrics_manager().setup()
648
+ start_phone_stats_home(self)
646
649
 
647
650
  def get_reactor(self) -> ISynapseReactor:
648
651
  """
synapse/util/metrics.py CHANGED
@@ -323,9 +323,13 @@ class DynamicCollectorRegistry(CollectorRegistry):
323
323
  if server_hooks.get(metric_name) is not None:
324
324
  # TODO: This should be an `assert` since registering the same metric name
325
325
  # multiple times will clobber the old metric.
326
- # We currently rely on this behaviour as we instantiate multiple
327
- # `SyncRestServlet`, one per listener, and in the `__init__` we setup a new
328
- # LruCache.
326
+ #
327
+ # We currently rely on this behaviour in a few places:
328
+ # - We instantiate multiple `SyncRestServlet`, one per listener, and in the
329
+ # `__init__` we setup a new `LruCache`.
330
+ # - We instantiate multiple `ApplicationService` (one per configured
331
+ # application service) which use the `@cached` decorator on some methods.
332
+ #
329
333
  # Once the above behaviour is changed, this should be changed to an `assert`.
330
334
  logger.error(
331
335
  "Metric named %s already registered for server %s",