matrix-synapse 1.145.0rc2__cp310-abi3-manylinux_2_28_x86_64.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.

Files changed (1636) hide show
  1. AUTHORS.rst +51 -0
  2. CHANGES.md +1732 -0
  3. CONTRIBUTING.md +3 -0
  4. Cargo.lock +1923 -0
  5. Cargo.toml +6 -0
  6. INSTALL.md +7 -0
  7. LICENSE-AGPL-3.0 +661 -0
  8. LICENSE-COMMERCIAL +6 -0
  9. UPGRADE.rst +7 -0
  10. book.toml +47 -0
  11. changelog.d/.gitignore +1 -0
  12. demo/.gitignore +4 -0
  13. demo/clean.sh +22 -0
  14. demo/start.sh +173 -0
  15. demo/stop.sh +14 -0
  16. docs/.sample_config_header.yaml +12 -0
  17. docs/CAPTCHA_SETUP.md +37 -0
  18. docs/README.md +86 -0
  19. docs/SUMMARY.md +126 -0
  20. docs/admin_api/README.rst +13 -0
  21. docs/admin_api/account_validity.md +47 -0
  22. docs/admin_api/client_server_api_extensions.md +67 -0
  23. docs/admin_api/event_reports.md +185 -0
  24. docs/admin_api/experimental_features.md +52 -0
  25. docs/admin_api/fetch_event.md +53 -0
  26. docs/admin_api/media_admin_api.md +372 -0
  27. docs/admin_api/purge_history_api.md +77 -0
  28. docs/admin_api/register_api.md +92 -0
  29. docs/admin_api/room_membership.md +35 -0
  30. docs/admin_api/rooms.md +1190 -0
  31. docs/admin_api/scheduled_tasks.md +54 -0
  32. docs/admin_api/server_notices.md +48 -0
  33. docs/admin_api/statistics.md +132 -0
  34. docs/admin_api/user_admin_api.md +1602 -0
  35. docs/admin_api/version_api.md +23 -0
  36. docs/ancient_architecture_notes.md +81 -0
  37. docs/application_services.md +36 -0
  38. docs/architecture.md +65 -0
  39. docs/auth_chain_diff.dot +32 -0
  40. docs/auth_chain_diff.dot.png +0 -0
  41. docs/auth_chain_difference_algorithm.md +141 -0
  42. docs/changelogs/CHANGES-2019.md +1039 -0
  43. docs/changelogs/CHANGES-2020.md +2145 -0
  44. docs/changelogs/CHANGES-2021.md +2573 -0
  45. docs/changelogs/CHANGES-2022.md +2766 -0
  46. docs/changelogs/CHANGES-2023.md +2202 -0
  47. docs/changelogs/CHANGES-2024.md +1586 -0
  48. docs/changelogs/CHANGES-pre-1.0.md +3641 -0
  49. docs/changelogs/README.md +1 -0
  50. docs/code_style.md +119 -0
  51. docs/consent_tracking.md +197 -0
  52. docs/delegate.md +111 -0
  53. docs/deprecation_policy.md +89 -0
  54. docs/development/cas.md +64 -0
  55. docs/development/contributing_guide.md +554 -0
  56. docs/development/database_schema.md +404 -0
  57. docs/development/demo.md +42 -0
  58. docs/development/dependencies.md +326 -0
  59. docs/development/experimental_features.md +37 -0
  60. docs/development/git.md +148 -0
  61. docs/development/img/git/branches.jpg +0 -0
  62. docs/development/img/git/clean.png +0 -0
  63. docs/development/img/git/squash.png +0 -0
  64. docs/development/internal_documentation/README.md +12 -0
  65. docs/development/internal_documentation/release_notes_review_checklist.md +12 -0
  66. docs/development/releases.md +37 -0
  67. docs/development/reviews.md +41 -0
  68. docs/development/room-dag-concepts.md +115 -0
  69. docs/development/saml.md +40 -0
  70. docs/development/synapse_architecture/cancellation.md +392 -0
  71. docs/development/synapse_architecture/faster_joins.md +375 -0
  72. docs/development/synapse_architecture/streams.md +198 -0
  73. docs/element_logo_white_bg.svg +94 -0
  74. docs/favicon.png +0 -0
  75. docs/favicon.svg +58 -0
  76. docs/federate.md +67 -0
  77. docs/jwt.md +105 -0
  78. docs/log_contexts.md +566 -0
  79. docs/manhole.md +101 -0
  80. docs/media_repository.md +78 -0
  81. docs/message_retention_policies.md +207 -0
  82. docs/metrics-howto.md +315 -0
  83. docs/modules/account_data_callbacks.md +106 -0
  84. docs/modules/account_validity_callbacks.md +57 -0
  85. docs/modules/add_extra_fields_to_client_events_unsigned.md +32 -0
  86. docs/modules/background_update_controller_callbacks.md +71 -0
  87. docs/modules/index.md +53 -0
  88. docs/modules/media_repository_callbacks.md +131 -0
  89. docs/modules/password_auth_provider_callbacks.md +270 -0
  90. docs/modules/porting_legacy_module.md +20 -0
  91. docs/modules/presence_router_callbacks.md +112 -0
  92. docs/modules/ratelimit_callbacks.md +43 -0
  93. docs/modules/spam_checker_callbacks.md +517 -0
  94. docs/modules/third_party_rules_callbacks.md +350 -0
  95. docs/modules/writing_a_module.md +141 -0
  96. docs/openid.md +783 -0
  97. docs/opentracing.md +99 -0
  98. docs/other/running_synapse_on_single_board_computers.md +75 -0
  99. docs/password_auth_providers.md +129 -0
  100. docs/postgres.md +269 -0
  101. docs/presence_router_module.md +247 -0
  102. docs/privacy_policy_templates/en/1.0.html +26 -0
  103. docs/privacy_policy_templates/en/success.html +11 -0
  104. docs/replication.md +36 -0
  105. docs/reverse_proxy.md +327 -0
  106. docs/room_and_user_statistics.md +22 -0
  107. docs/sample_config.yaml +47 -0
  108. docs/sample_log_config.yaml +75 -0
  109. docs/server_notices.md +66 -0
  110. docs/setup/forward_proxy.md +89 -0
  111. docs/setup/installation.md +656 -0
  112. docs/setup/security.md +41 -0
  113. docs/setup/turn/coturn.md +197 -0
  114. docs/setup/turn/eturnal.md +170 -0
  115. docs/spam_checker.md +122 -0
  116. docs/sso_mapping_providers.md +208 -0
  117. docs/structured_logging.md +80 -0
  118. docs/synctl_workers.md +36 -0
  119. docs/systemd-with-workers/README.md +101 -0
  120. docs/systemd-with-workers/system/matrix-synapse-worker@.service +26 -0
  121. docs/systemd-with-workers/system/matrix-synapse.service +23 -0
  122. docs/systemd-with-workers/system/matrix-synapse.target +6 -0
  123. docs/systemd-with-workers/workers/background_worker.yaml +4 -0
  124. docs/systemd-with-workers/workers/event_persister.yaml +20 -0
  125. docs/systemd-with-workers/workers/federation_sender.yaml +4 -0
  126. docs/systemd-with-workers/workers/generic_worker.yaml +11 -0
  127. docs/systemd-with-workers/workers/media_worker.yaml +11 -0
  128. docs/systemd-with-workers/workers/pusher_worker.yaml +4 -0
  129. docs/tcp_replication.md +258 -0
  130. docs/templates.md +254 -0
  131. docs/turn-howto.md +168 -0
  132. docs/upgrade.md +2876 -0
  133. docs/usage/administration/README.md +7 -0
  134. docs/usage/administration/admin_api/README.md +47 -0
  135. docs/usage/administration/admin_api/background_updates.md +109 -0
  136. docs/usage/administration/admin_api/federation.md +212 -0
  137. docs/usage/administration/admin_api/registration_tokens.md +298 -0
  138. docs/usage/administration/admin_faq.md +294 -0
  139. docs/usage/administration/backups.md +125 -0
  140. docs/usage/administration/database_maintenance_tools.md +18 -0
  141. docs/usage/administration/monitoring/reporting_homeserver_usage_statistics.md +77 -0
  142. docs/usage/administration/monthly_active_users.md +84 -0
  143. docs/usage/administration/request_log.md +44 -0
  144. docs/usage/administration/state_groups.md +25 -0
  145. docs/usage/administration/understanding_synapse_through_grafana_graphs.md +83 -0
  146. docs/usage/administration/useful_sql_for_admins.md +216 -0
  147. docs/usage/configuration/README.md +4 -0
  148. docs/usage/configuration/config_documentation.md +4768 -0
  149. docs/usage/configuration/homeserver_sample_config.md +17 -0
  150. docs/usage/configuration/logging_sample_config.md +19 -0
  151. docs/usage/configuration/user_authentication/README.md +15 -0
  152. docs/usage/configuration/user_authentication/refresh_tokens.md +139 -0
  153. docs/usage/configuration/user_authentication/single_sign_on/README.md +5 -0
  154. docs/usage/configuration/user_authentication/single_sign_on/cas.md +8 -0
  155. docs/usage/configuration/user_authentication/single_sign_on/saml.md +8 -0
  156. docs/user_directory.md +130 -0
  157. docs/website_files/README.md +35 -0
  158. docs/website_files/indent-section-headers.css +7 -0
  159. docs/website_files/remove-nav-buttons.css +8 -0
  160. docs/website_files/table-of-contents.css +47 -0
  161. docs/website_files/table-of-contents.js +148 -0
  162. docs/website_files/theme/index.hbs +324 -0
  163. docs/website_files/version-picker.css +78 -0
  164. docs/website_files/version-picker.js +147 -0
  165. docs/website_files/version.js +1 -0
  166. docs/welcome_and_overview.md +67 -0
  167. docs/workers.md +897 -0
  168. matrix_synapse-1.145.0rc2.dist-info/METADATA +260 -0
  169. matrix_synapse-1.145.0rc2.dist-info/RECORD +1636 -0
  170. matrix_synapse-1.145.0rc2.dist-info/WHEEL +5 -0
  171. matrix_synapse-1.145.0rc2.dist-info/entry_points.txt +13 -0
  172. matrix_synapse-1.145.0rc2.dist-info/licenses/AUTHORS.rst +51 -0
  173. matrix_synapse-1.145.0rc2.dist-info/licenses/LICENSE-AGPL-3.0 +661 -0
  174. matrix_synapse-1.145.0rc2.dist-info/licenses/LICENSE-COMMERCIAL +6 -0
  175. mypy.ini +115 -0
  176. rust/Cargo.toml +63 -0
  177. rust/build.rs +45 -0
  178. scripts-dev/build_debian_packages.py +228 -0
  179. scripts-dev/check-newsfragment.sh +62 -0
  180. scripts-dev/check_line_terminators.sh +29 -0
  181. scripts-dev/check_locked_deps_have_sdists.py +64 -0
  182. scripts-dev/check_schema_delta.py +240 -0
  183. scripts-dev/complement.sh +332 -0
  184. scripts-dev/config-lint.sh +15 -0
  185. scripts-dev/database-save.sh +15 -0
  186. scripts-dev/docker_update_debian_changelog.sh +70 -0
  187. scripts-dev/dump_macaroon.py +25 -0
  188. scripts-dev/federation_client.py +428 -0
  189. scripts-dev/gen_config_documentation.py +510 -0
  190. scripts-dev/generate_sample_config.sh +28 -0
  191. scripts-dev/lint.sh +141 -0
  192. scripts-dev/make_full_schema.sh +310 -0
  193. scripts-dev/mypy_synapse_plugin.py +918 -0
  194. scripts-dev/next_github_number.sh +9 -0
  195. scripts-dev/release.py +986 -0
  196. scripts-dev/schema_versions.py +182 -0
  197. scripts-dev/sign_json.py +172 -0
  198. synapse/__init__.py +97 -0
  199. synapse/_scripts/__init__.py +0 -0
  200. synapse/_scripts/export_signing_key.py +109 -0
  201. synapse/_scripts/generate_config.py +83 -0
  202. synapse/_scripts/generate_log_config.py +56 -0
  203. synapse/_scripts/generate_signing_key.py +55 -0
  204. synapse/_scripts/generate_workers_map.py +318 -0
  205. synapse/_scripts/hash_password.py +95 -0
  206. synapse/_scripts/move_remote_media_to_new_store.py +128 -0
  207. synapse/_scripts/register_new_matrix_user.py +402 -0
  208. synapse/_scripts/review_recent_signups.py +212 -0
  209. synapse/_scripts/synapse_port_db.py +1604 -0
  210. synapse/_scripts/synctl.py +365 -0
  211. synapse/_scripts/update_synapse_database.py +130 -0
  212. synapse/api/__init__.py +20 -0
  213. synapse/api/auth/__init__.py +207 -0
  214. synapse/api/auth/base.py +406 -0
  215. synapse/api/auth/internal.py +299 -0
  216. synapse/api/auth/mas.py +436 -0
  217. synapse/api/auth/msc3861_delegated.py +617 -0
  218. synapse/api/auth_blocking.py +144 -0
  219. synapse/api/constants.py +379 -0
  220. synapse/api/errors.py +913 -0
  221. synapse/api/filtering.py +537 -0
  222. synapse/api/presence.py +102 -0
  223. synapse/api/ratelimiting.py +481 -0
  224. synapse/api/room_versions.py +535 -0
  225. synapse/api/urls.py +118 -0
  226. synapse/app/__init__.py +62 -0
  227. synapse/app/_base.py +906 -0
  228. synapse/app/admin_cmd.py +388 -0
  229. synapse/app/appservice.py +30 -0
  230. synapse/app/client_reader.py +30 -0
  231. synapse/app/complement_fork_starter.py +206 -0
  232. synapse/app/event_creator.py +29 -0
  233. synapse/app/federation_reader.py +30 -0
  234. synapse/app/federation_sender.py +30 -0
  235. synapse/app/frontend_proxy.py +30 -0
  236. synapse/app/generic_worker.py +475 -0
  237. synapse/app/homeserver.py +505 -0
  238. synapse/app/media_repository.py +30 -0
  239. synapse/app/phone_stats_home.py +292 -0
  240. synapse/app/pusher.py +30 -0
  241. synapse/app/synchrotron.py +30 -0
  242. synapse/app/user_dir.py +31 -0
  243. synapse/appservice/__init__.py +458 -0
  244. synapse/appservice/api.py +567 -0
  245. synapse/appservice/scheduler.py +565 -0
  246. synapse/config/__init__.py +27 -0
  247. synapse/config/__main__.py +62 -0
  248. synapse/config/_base.py +1154 -0
  249. synapse/config/_base.pyi +216 -0
  250. synapse/config/_util.py +99 -0
  251. synapse/config/account_validity.py +116 -0
  252. synapse/config/api.py +141 -0
  253. synapse/config/appservice.py +210 -0
  254. synapse/config/auth.py +80 -0
  255. synapse/config/auto_accept_invites.py +43 -0
  256. synapse/config/background_updates.py +44 -0
  257. synapse/config/cache.py +231 -0
  258. synapse/config/captcha.py +90 -0
  259. synapse/config/cas.py +116 -0
  260. synapse/config/consent.py +73 -0
  261. synapse/config/database.py +184 -0
  262. synapse/config/emailconfig.py +367 -0
  263. synapse/config/experimental.py +601 -0
  264. synapse/config/federation.py +114 -0
  265. synapse/config/homeserver.py +141 -0
  266. synapse/config/jwt.py +55 -0
  267. synapse/config/key.py +447 -0
  268. synapse/config/logger.py +390 -0
  269. synapse/config/mas.py +192 -0
  270. synapse/config/matrixrtc.py +66 -0
  271. synapse/config/metrics.py +93 -0
  272. synapse/config/modules.py +40 -0
  273. synapse/config/oembed.py +185 -0
  274. synapse/config/oidc.py +509 -0
  275. synapse/config/password_auth_providers.py +82 -0
  276. synapse/config/push.py +64 -0
  277. synapse/config/ratelimiting.py +260 -0
  278. synapse/config/redis.py +74 -0
  279. synapse/config/registration.py +296 -0
  280. synapse/config/repository.py +311 -0
  281. synapse/config/retention.py +162 -0
  282. synapse/config/room.py +88 -0
  283. synapse/config/room_directory.py +165 -0
  284. synapse/config/saml2.py +251 -0
  285. synapse/config/server.py +1139 -0
  286. synapse/config/server_notices.py +84 -0
  287. synapse/config/spam_checker.py +66 -0
  288. synapse/config/sso.py +121 -0
  289. synapse/config/stats.py +54 -0
  290. synapse/config/third_party_event_rules.py +40 -0
  291. synapse/config/tls.py +192 -0
  292. synapse/config/tracer.py +71 -0
  293. synapse/config/user_directory.py +47 -0
  294. synapse/config/user_types.py +42 -0
  295. synapse/config/voip.py +59 -0
  296. synapse/config/workers.py +642 -0
  297. synapse/crypto/__init__.py +20 -0
  298. synapse/crypto/context_factory.py +278 -0
  299. synapse/crypto/event_signing.py +194 -0
  300. synapse/crypto/keyring.py +980 -0
  301. synapse/event_auth.py +1266 -0
  302. synapse/events/__init__.py +667 -0
  303. synapse/events/auto_accept_invites.py +216 -0
  304. synapse/events/builder.py +387 -0
  305. synapse/events/presence_router.py +243 -0
  306. synapse/events/snapshot.py +559 -0
  307. synapse/events/utils.py +924 -0
  308. synapse/events/validator.py +305 -0
  309. synapse/federation/__init__.py +22 -0
  310. synapse/federation/federation_base.py +382 -0
  311. synapse/federation/federation_client.py +2133 -0
  312. synapse/federation/federation_server.py +1543 -0
  313. synapse/federation/persistence.py +70 -0
  314. synapse/federation/send_queue.py +532 -0
  315. synapse/federation/sender/__init__.py +1165 -0
  316. synapse/federation/sender/per_destination_queue.py +886 -0
  317. synapse/federation/sender/transaction_manager.py +210 -0
  318. synapse/federation/transport/__init__.py +28 -0
  319. synapse/federation/transport/client.py +1199 -0
  320. synapse/federation/transport/server/__init__.py +334 -0
  321. synapse/federation/transport/server/_base.py +429 -0
  322. synapse/federation/transport/server/federation.py +910 -0
  323. synapse/federation/units.py +133 -0
  324. synapse/handlers/__init__.py +20 -0
  325. synapse/handlers/account.py +162 -0
  326. synapse/handlers/account_data.py +360 -0
  327. synapse/handlers/account_validity.py +362 -0
  328. synapse/handlers/admin.py +615 -0
  329. synapse/handlers/appservice.py +989 -0
  330. synapse/handlers/auth.py +2482 -0
  331. synapse/handlers/cas.py +413 -0
  332. synapse/handlers/deactivate_account.py +363 -0
  333. synapse/handlers/delayed_events.py +607 -0
  334. synapse/handlers/device.py +1869 -0
  335. synapse/handlers/devicemessage.py +399 -0
  336. synapse/handlers/directory.py +545 -0
  337. synapse/handlers/e2e_keys.py +1835 -0
  338. synapse/handlers/e2e_room_keys.py +455 -0
  339. synapse/handlers/event_auth.py +390 -0
  340. synapse/handlers/events.py +203 -0
  341. synapse/handlers/federation.py +2042 -0
  342. synapse/handlers/federation_event.py +2420 -0
  343. synapse/handlers/identity.py +812 -0
  344. synapse/handlers/initial_sync.py +528 -0
  345. synapse/handlers/jwt.py +120 -0
  346. synapse/handlers/message.py +2357 -0
  347. synapse/handlers/oidc.py +1801 -0
  348. synapse/handlers/pagination.py +811 -0
  349. synapse/handlers/password_policy.py +102 -0
  350. synapse/handlers/presence.py +2634 -0
  351. synapse/handlers/profile.py +656 -0
  352. synapse/handlers/push_rules.py +164 -0
  353. synapse/handlers/read_marker.py +79 -0
  354. synapse/handlers/receipts.py +351 -0
  355. synapse/handlers/register.py +1059 -0
  356. synapse/handlers/relations.py +623 -0
  357. synapse/handlers/reports.py +98 -0
  358. synapse/handlers/room.py +2449 -0
  359. synapse/handlers/room_list.py +632 -0
  360. synapse/handlers/room_member.py +2366 -0
  361. synapse/handlers/room_member_worker.py +146 -0
  362. synapse/handlers/room_policy.py +186 -0
  363. synapse/handlers/room_summary.py +1057 -0
  364. synapse/handlers/saml.py +524 -0
  365. synapse/handlers/search.py +723 -0
  366. synapse/handlers/send_email.py +209 -0
  367. synapse/handlers/set_password.py +71 -0
  368. synapse/handlers/sliding_sync/__init__.py +1961 -0
  369. synapse/handlers/sliding_sync/extensions.py +969 -0
  370. synapse/handlers/sliding_sync/room_lists.py +2317 -0
  371. synapse/handlers/sliding_sync/store.py +126 -0
  372. synapse/handlers/sso.py +1291 -0
  373. synapse/handlers/state_deltas.py +82 -0
  374. synapse/handlers/stats.py +322 -0
  375. synapse/handlers/sync.py +3096 -0
  376. synapse/handlers/thread_subscriptions.py +190 -0
  377. synapse/handlers/typing.py +612 -0
  378. synapse/handlers/ui_auth/__init__.py +48 -0
  379. synapse/handlers/ui_auth/checkers.py +332 -0
  380. synapse/handlers/user_directory.py +786 -0
  381. synapse/handlers/worker_lock.py +371 -0
  382. synapse/http/__init__.py +105 -0
  383. synapse/http/additional_resource.py +62 -0
  384. synapse/http/client.py +1377 -0
  385. synapse/http/connectproxyclient.py +316 -0
  386. synapse/http/federation/__init__.py +19 -0
  387. synapse/http/federation/matrix_federation_agent.py +490 -0
  388. synapse/http/federation/srv_resolver.py +196 -0
  389. synapse/http/federation/well_known_resolver.py +368 -0
  390. synapse/http/matrixfederationclient.py +1874 -0
  391. synapse/http/proxy.py +290 -0
  392. synapse/http/proxyagent.py +497 -0
  393. synapse/http/replicationagent.py +203 -0
  394. synapse/http/request_metrics.py +309 -0
  395. synapse/http/server.py +1111 -0
  396. synapse/http/servlet.py +1018 -0
  397. synapse/http/site.py +952 -0
  398. synapse/http/types.py +27 -0
  399. synapse/logging/__init__.py +31 -0
  400. synapse/logging/_remote.py +261 -0
  401. synapse/logging/_terse_json.py +95 -0
  402. synapse/logging/context.py +1209 -0
  403. synapse/logging/formatter.py +62 -0
  404. synapse/logging/handlers.py +99 -0
  405. synapse/logging/loggers.py +25 -0
  406. synapse/logging/opentracing.py +1132 -0
  407. synapse/logging/scopecontextmanager.py +160 -0
  408. synapse/media/_base.py +831 -0
  409. synapse/media/filepath.py +417 -0
  410. synapse/media/media_repository.py +1595 -0
  411. synapse/media/media_storage.py +703 -0
  412. synapse/media/oembed.py +277 -0
  413. synapse/media/preview_html.py +556 -0
  414. synapse/media/storage_provider.py +195 -0
  415. synapse/media/thumbnailer.py +833 -0
  416. synapse/media/url_previewer.py +884 -0
  417. synapse/metrics/__init__.py +748 -0
  418. synapse/metrics/_gc.py +219 -0
  419. synapse/metrics/_reactor_metrics.py +171 -0
  420. synapse/metrics/_types.py +38 -0
  421. synapse/metrics/background_process_metrics.py +555 -0
  422. synapse/metrics/common_usage_metrics.py +95 -0
  423. synapse/metrics/jemalloc.py +248 -0
  424. synapse/module_api/__init__.py +2131 -0
  425. synapse/module_api/callbacks/__init__.py +50 -0
  426. synapse/module_api/callbacks/account_validity_callbacks.py +106 -0
  427. synapse/module_api/callbacks/media_repository_callbacks.py +157 -0
  428. synapse/module_api/callbacks/ratelimit_callbacks.py +78 -0
  429. synapse/module_api/callbacks/spamchecker_callbacks.py +991 -0
  430. synapse/module_api/callbacks/third_party_event_rules_callbacks.py +592 -0
  431. synapse/module_api/errors.py +42 -0
  432. synapse/notifier.py +969 -0
  433. synapse/push/__init__.py +212 -0
  434. synapse/push/bulk_push_rule_evaluator.py +635 -0
  435. synapse/push/clientformat.py +126 -0
  436. synapse/push/emailpusher.py +334 -0
  437. synapse/push/httppusher.py +565 -0
  438. synapse/push/mailer.py +1009 -0
  439. synapse/push/presentable_names.py +216 -0
  440. synapse/push/push_tools.py +114 -0
  441. synapse/push/push_types.py +141 -0
  442. synapse/push/pusher.py +87 -0
  443. synapse/push/pusherpool.py +501 -0
  444. synapse/push/rulekinds.py +33 -0
  445. synapse/py.typed +0 -0
  446. synapse/replication/__init__.py +20 -0
  447. synapse/replication/http/__init__.py +68 -0
  448. synapse/replication/http/_base.py +469 -0
  449. synapse/replication/http/account_data.py +297 -0
  450. synapse/replication/http/deactivate_account.py +81 -0
  451. synapse/replication/http/delayed_events.py +62 -0
  452. synapse/replication/http/devices.py +254 -0
  453. synapse/replication/http/federation.py +334 -0
  454. synapse/replication/http/login.py +106 -0
  455. synapse/replication/http/membership.py +364 -0
  456. synapse/replication/http/presence.py +133 -0
  457. synapse/replication/http/push.py +156 -0
  458. synapse/replication/http/register.py +172 -0
  459. synapse/replication/http/send_events.py +182 -0
  460. synapse/replication/http/state.py +82 -0
  461. synapse/replication/http/streams.py +101 -0
  462. synapse/replication/tcp/__init__.py +56 -0
  463. synapse/replication/tcp/client.py +553 -0
  464. synapse/replication/tcp/commands.py +569 -0
  465. synapse/replication/tcp/context.py +41 -0
  466. synapse/replication/tcp/external_cache.py +156 -0
  467. synapse/replication/tcp/handler.py +922 -0
  468. synapse/replication/tcp/protocol.py +611 -0
  469. synapse/replication/tcp/redis.py +510 -0
  470. synapse/replication/tcp/resource.py +349 -0
  471. synapse/replication/tcp/streams/__init__.py +96 -0
  472. synapse/replication/tcp/streams/_base.py +765 -0
  473. synapse/replication/tcp/streams/events.py +287 -0
  474. synapse/replication/tcp/streams/federation.py +92 -0
  475. synapse/replication/tcp/streams/partial_state.py +80 -0
  476. synapse/res/providers.json +29 -0
  477. synapse/res/templates/_base.html +29 -0
  478. synapse/res/templates/account_previously_renewed.html +6 -0
  479. synapse/res/templates/account_renewed.html +6 -0
  480. synapse/res/templates/add_threepid.html +8 -0
  481. synapse/res/templates/add_threepid.txt +6 -0
  482. synapse/res/templates/add_threepid_failure.html +7 -0
  483. synapse/res/templates/add_threepid_success.html +6 -0
  484. synapse/res/templates/already_in_use.html +12 -0
  485. synapse/res/templates/already_in_use.txt +10 -0
  486. synapse/res/templates/auth_success.html +21 -0
  487. synapse/res/templates/invalid_token.html +6 -0
  488. synapse/res/templates/mail-Element.css +7 -0
  489. synapse/res/templates/mail-Vector.css +7 -0
  490. synapse/res/templates/mail-expiry.css +4 -0
  491. synapse/res/templates/mail.css +156 -0
  492. synapse/res/templates/notice_expiry.html +46 -0
  493. synapse/res/templates/notice_expiry.txt +7 -0
  494. synapse/res/templates/notif.html +51 -0
  495. synapse/res/templates/notif.txt +22 -0
  496. synapse/res/templates/notif_mail.html +59 -0
  497. synapse/res/templates/notif_mail.txt +10 -0
  498. synapse/res/templates/password_reset.html +10 -0
  499. synapse/res/templates/password_reset.txt +7 -0
  500. synapse/res/templates/password_reset_confirmation.html +15 -0
  501. synapse/res/templates/password_reset_failure.html +7 -0
  502. synapse/res/templates/password_reset_success.html +6 -0
  503. synapse/res/templates/recaptcha.html +42 -0
  504. synapse/res/templates/registration.html +12 -0
  505. synapse/res/templates/registration.txt +10 -0
  506. synapse/res/templates/registration_failure.html +6 -0
  507. synapse/res/templates/registration_success.html +6 -0
  508. synapse/res/templates/registration_token.html +18 -0
  509. synapse/res/templates/room.html +33 -0
  510. synapse/res/templates/room.txt +9 -0
  511. synapse/res/templates/sso.css +129 -0
  512. synapse/res/templates/sso_account_deactivated.html +25 -0
  513. synapse/res/templates/sso_auth_account_details.html +186 -0
  514. synapse/res/templates/sso_auth_account_details.js +116 -0
  515. synapse/res/templates/sso_auth_bad_user.html +26 -0
  516. synapse/res/templates/sso_auth_confirm.html +27 -0
  517. synapse/res/templates/sso_auth_success.html +26 -0
  518. synapse/res/templates/sso_error.html +71 -0
  519. synapse/res/templates/sso_footer.html +19 -0
  520. synapse/res/templates/sso_login_idp_picker.html +60 -0
  521. synapse/res/templates/sso_new_user_consent.html +30 -0
  522. synapse/res/templates/sso_partial_profile.html +19 -0
  523. synapse/res/templates/sso_redirect_confirm.html +39 -0
  524. synapse/res/templates/style.css +33 -0
  525. synapse/res/templates/terms.html +27 -0
  526. synapse/rest/__init__.py +197 -0
  527. synapse/rest/admin/__init__.py +395 -0
  528. synapse/rest/admin/_base.py +72 -0
  529. synapse/rest/admin/background_updates.py +171 -0
  530. synapse/rest/admin/devices.py +221 -0
  531. synapse/rest/admin/event_reports.py +173 -0
  532. synapse/rest/admin/events.py +69 -0
  533. synapse/rest/admin/experimental_features.py +137 -0
  534. synapse/rest/admin/federation.py +243 -0
  535. synapse/rest/admin/media.py +540 -0
  536. synapse/rest/admin/registration_tokens.py +358 -0
  537. synapse/rest/admin/rooms.py +1092 -0
  538. synapse/rest/admin/scheduled_tasks.py +70 -0
  539. synapse/rest/admin/server_notice_servlet.py +132 -0
  540. synapse/rest/admin/statistics.py +132 -0
  541. synapse/rest/admin/username_available.py +58 -0
  542. synapse/rest/admin/users.py +1634 -0
  543. synapse/rest/client/__init__.py +20 -0
  544. synapse/rest/client/_base.py +113 -0
  545. synapse/rest/client/account.py +937 -0
  546. synapse/rest/client/account_data.py +319 -0
  547. synapse/rest/client/account_validity.py +103 -0
  548. synapse/rest/client/appservice_ping.py +125 -0
  549. synapse/rest/client/auth.py +218 -0
  550. synapse/rest/client/auth_metadata.py +122 -0
  551. synapse/rest/client/capabilities.py +121 -0
  552. synapse/rest/client/delayed_events.py +165 -0
  553. synapse/rest/client/devices.py +587 -0
  554. synapse/rest/client/directory.py +211 -0
  555. synapse/rest/client/events.py +116 -0
  556. synapse/rest/client/filter.py +112 -0
  557. synapse/rest/client/initial_sync.py +65 -0
  558. synapse/rest/client/keys.py +678 -0
  559. synapse/rest/client/knock.py +104 -0
  560. synapse/rest/client/login.py +750 -0
  561. synapse/rest/client/login_token_request.py +127 -0
  562. synapse/rest/client/logout.py +93 -0
  563. synapse/rest/client/matrixrtc.py +52 -0
  564. synapse/rest/client/media.py +307 -0
  565. synapse/rest/client/mutual_rooms.py +145 -0
  566. synapse/rest/client/notifications.py +137 -0
  567. synapse/rest/client/openid.py +109 -0
  568. synapse/rest/client/password_policy.py +69 -0
  569. synapse/rest/client/presence.py +131 -0
  570. synapse/rest/client/profile.py +291 -0
  571. synapse/rest/client/push_rule.py +331 -0
  572. synapse/rest/client/pusher.py +181 -0
  573. synapse/rest/client/read_marker.py +104 -0
  574. synapse/rest/client/receipts.py +165 -0
  575. synapse/rest/client/register.py +1072 -0
  576. synapse/rest/client/relations.py +138 -0
  577. synapse/rest/client/rendezvous.py +76 -0
  578. synapse/rest/client/reporting.py +207 -0
  579. synapse/rest/client/room.py +1763 -0
  580. synapse/rest/client/room_keys.py +426 -0
  581. synapse/rest/client/room_upgrade_rest_servlet.py +112 -0
  582. synapse/rest/client/sendtodevice.py +85 -0
  583. synapse/rest/client/sync.py +1131 -0
  584. synapse/rest/client/tags.py +129 -0
  585. synapse/rest/client/thirdparty.py +130 -0
  586. synapse/rest/client/thread_subscriptions.py +247 -0
  587. synapse/rest/client/tokenrefresh.py +52 -0
  588. synapse/rest/client/transactions.py +150 -0
  589. synapse/rest/client/user_directory.py +99 -0
  590. synapse/rest/client/versions.py +193 -0
  591. synapse/rest/client/voip.py +88 -0
  592. synapse/rest/consent/__init__.py +0 -0
  593. synapse/rest/consent/consent_resource.py +210 -0
  594. synapse/rest/health.py +38 -0
  595. synapse/rest/key/__init__.py +20 -0
  596. synapse/rest/key/v2/__init__.py +40 -0
  597. synapse/rest/key/v2/local_key_resource.py +125 -0
  598. synapse/rest/key/v2/remote_key_resource.py +302 -0
  599. synapse/rest/media/__init__.py +0 -0
  600. synapse/rest/media/config_resource.py +53 -0
  601. synapse/rest/media/create_resource.py +90 -0
  602. synapse/rest/media/download_resource.py +110 -0
  603. synapse/rest/media/media_repository_resource.py +113 -0
  604. synapse/rest/media/preview_url_resource.py +77 -0
  605. synapse/rest/media/thumbnail_resource.py +142 -0
  606. synapse/rest/media/upload_resource.py +187 -0
  607. synapse/rest/media/v1/__init__.py +39 -0
  608. synapse/rest/media/v1/_base.py +23 -0
  609. synapse/rest/media/v1/media_storage.py +23 -0
  610. synapse/rest/media/v1/storage_provider.py +23 -0
  611. synapse/rest/synapse/__init__.py +20 -0
  612. synapse/rest/synapse/client/__init__.py +93 -0
  613. synapse/rest/synapse/client/federation_whitelist.py +66 -0
  614. synapse/rest/synapse/client/jwks.py +77 -0
  615. synapse/rest/synapse/client/new_user_consent.py +115 -0
  616. synapse/rest/synapse/client/oidc/__init__.py +45 -0
  617. synapse/rest/synapse/client/oidc/backchannel_logout_resource.py +42 -0
  618. synapse/rest/synapse/client/oidc/callback_resource.py +48 -0
  619. synapse/rest/synapse/client/password_reset.py +129 -0
  620. synapse/rest/synapse/client/pick_idp.py +107 -0
  621. synapse/rest/synapse/client/pick_username.py +153 -0
  622. synapse/rest/synapse/client/rendezvous.py +58 -0
  623. synapse/rest/synapse/client/saml2/__init__.py +42 -0
  624. synapse/rest/synapse/client/saml2/metadata_resource.py +46 -0
  625. synapse/rest/synapse/client/saml2/response_resource.py +52 -0
  626. synapse/rest/synapse/client/sso_register.py +56 -0
  627. synapse/rest/synapse/client/unsubscribe.py +88 -0
  628. synapse/rest/synapse/mas/__init__.py +71 -0
  629. synapse/rest/synapse/mas/_base.py +55 -0
  630. synapse/rest/synapse/mas/devices.py +239 -0
  631. synapse/rest/synapse/mas/users.py +469 -0
  632. synapse/rest/well_known.py +148 -0
  633. synapse/server.py +1279 -0
  634. synapse/server_notices/__init__.py +0 -0
  635. synapse/server_notices/consent_server_notices.py +136 -0
  636. synapse/server_notices/resource_limits_server_notices.py +215 -0
  637. synapse/server_notices/server_notices_manager.py +388 -0
  638. synapse/server_notices/server_notices_sender.py +67 -0
  639. synapse/server_notices/worker_server_notices_sender.py +46 -0
  640. synapse/spam_checker_api/__init__.py +31 -0
  641. synapse/state/__init__.py +1023 -0
  642. synapse/state/v1.py +369 -0
  643. synapse/state/v2.py +985 -0
  644. synapse/static/client/login/index.html +47 -0
  645. synapse/static/client/login/js/jquery-3.4.1.min.js +2 -0
  646. synapse/static/client/login/js/login.js +291 -0
  647. synapse/static/client/login/spinner.gif +0 -0
  648. synapse/static/client/login/style.css +79 -0
  649. synapse/static/index.html +63 -0
  650. synapse/storage/__init__.py +43 -0
  651. synapse/storage/_base.py +245 -0
  652. synapse/storage/admin_client_config.py +25 -0
  653. synapse/storage/background_updates.py +1189 -0
  654. synapse/storage/controllers/__init__.py +57 -0
  655. synapse/storage/controllers/persist_events.py +1237 -0
  656. synapse/storage/controllers/purge_events.py +456 -0
  657. synapse/storage/controllers/state.py +950 -0
  658. synapse/storage/controllers/stats.py +119 -0
  659. synapse/storage/database.py +2720 -0
  660. synapse/storage/databases/__init__.py +175 -0
  661. synapse/storage/databases/main/__init__.py +420 -0
  662. synapse/storage/databases/main/account_data.py +1073 -0
  663. synapse/storage/databases/main/appservice.py +473 -0
  664. synapse/storage/databases/main/cache.py +912 -0
  665. synapse/storage/databases/main/censor_events.py +226 -0
  666. synapse/storage/databases/main/client_ips.py +816 -0
  667. synapse/storage/databases/main/delayed_events.py +577 -0
  668. synapse/storage/databases/main/deviceinbox.py +1272 -0
  669. synapse/storage/databases/main/devices.py +2579 -0
  670. synapse/storage/databases/main/directory.py +212 -0
  671. synapse/storage/databases/main/e2e_room_keys.py +689 -0
  672. synapse/storage/databases/main/end_to_end_keys.py +1894 -0
  673. synapse/storage/databases/main/event_federation.py +2511 -0
  674. synapse/storage/databases/main/event_push_actions.py +1936 -0
  675. synapse/storage/databases/main/events.py +3765 -0
  676. synapse/storage/databases/main/events_bg_updates.py +2910 -0
  677. synapse/storage/databases/main/events_forward_extremities.py +126 -0
  678. synapse/storage/databases/main/events_worker.py +2787 -0
  679. synapse/storage/databases/main/experimental_features.py +130 -0
  680. synapse/storage/databases/main/filtering.py +231 -0
  681. synapse/storage/databases/main/keys.py +291 -0
  682. synapse/storage/databases/main/lock.py +554 -0
  683. synapse/storage/databases/main/media_repository.py +1068 -0
  684. synapse/storage/databases/main/metrics.py +461 -0
  685. synapse/storage/databases/main/monthly_active_users.py +443 -0
  686. synapse/storage/databases/main/openid.py +60 -0
  687. synapse/storage/databases/main/presence.py +509 -0
  688. synapse/storage/databases/main/profile.py +539 -0
  689. synapse/storage/databases/main/purge_events.py +521 -0
  690. synapse/storage/databases/main/push_rule.py +970 -0
  691. synapse/storage/databases/main/pusher.py +793 -0
  692. synapse/storage/databases/main/receipts.py +1341 -0
  693. synapse/storage/databases/main/registration.py +3071 -0
  694. synapse/storage/databases/main/rejections.py +37 -0
  695. synapse/storage/databases/main/relations.py +1116 -0
  696. synapse/storage/databases/main/room.py +2779 -0
  697. synapse/storage/databases/main/roommember.py +2132 -0
  698. synapse/storage/databases/main/search.py +939 -0
  699. synapse/storage/databases/main/session.py +152 -0
  700. synapse/storage/databases/main/signatures.py +94 -0
  701. synapse/storage/databases/main/sliding_sync.py +842 -0
  702. synapse/storage/databases/main/state.py +1002 -0
  703. synapse/storage/databases/main/state_deltas.py +360 -0
  704. synapse/storage/databases/main/stats.py +789 -0
  705. synapse/storage/databases/main/stream.py +2589 -0
  706. synapse/storage/databases/main/tags.py +360 -0
  707. synapse/storage/databases/main/task_scheduler.py +225 -0
  708. synapse/storage/databases/main/thread_subscriptions.py +589 -0
  709. synapse/storage/databases/main/transactions.py +676 -0
  710. synapse/storage/databases/main/ui_auth.py +420 -0
  711. synapse/storage/databases/main/user_directory.py +1330 -0
  712. synapse/storage/databases/main/user_erasure_store.py +117 -0
  713. synapse/storage/databases/state/__init__.py +22 -0
  714. synapse/storage/databases/state/bg_updates.py +497 -0
  715. synapse/storage/databases/state/deletion.py +557 -0
  716. synapse/storage/databases/state/store.py +948 -0
  717. synapse/storage/engines/__init__.py +70 -0
  718. synapse/storage/engines/_base.py +154 -0
  719. synapse/storage/engines/postgres.py +261 -0
  720. synapse/storage/engines/sqlite.py +199 -0
  721. synapse/storage/invite_rule.py +152 -0
  722. synapse/storage/keys.py +40 -0
  723. synapse/storage/prepare_database.py +730 -0
  724. synapse/storage/push_rule.py +28 -0
  725. synapse/storage/roommember.py +88 -0
  726. synapse/storage/schema/README.md +4 -0
  727. synapse/storage/schema/__init__.py +186 -0
  728. synapse/storage/schema/common/delta/25/00background_updates.sql +40 -0
  729. synapse/storage/schema/common/delta/35/00background_updates_add_col.sql +36 -0
  730. synapse/storage/schema/common/delta/58/00background_update_ordering.sql +38 -0
  731. synapse/storage/schema/common/full_schemas/72/full.sql.postgres +8 -0
  732. synapse/storage/schema/common/full_schemas/72/full.sql.sqlite +6 -0
  733. synapse/storage/schema/common/schema_version.sql +60 -0
  734. synapse/storage/schema/main/delta/12/v12.sql +82 -0
  735. synapse/storage/schema/main/delta/13/v13.sql +38 -0
  736. synapse/storage/schema/main/delta/14/v14.sql +42 -0
  737. synapse/storage/schema/main/delta/15/appservice_txns.sql +50 -0
  738. synapse/storage/schema/main/delta/15/presence_indices.sql +2 -0
  739. synapse/storage/schema/main/delta/15/v15.sql +24 -0
  740. synapse/storage/schema/main/delta/16/events_order_index.sql +4 -0
  741. synapse/storage/schema/main/delta/16/remote_media_cache_index.sql +2 -0
  742. synapse/storage/schema/main/delta/16/remove_duplicates.sql +9 -0
  743. synapse/storage/schema/main/delta/16/room_alias_index.sql +3 -0
  744. synapse/storage/schema/main/delta/16/unique_constraints.sql +72 -0
  745. synapse/storage/schema/main/delta/16/users.sql +56 -0
  746. synapse/storage/schema/main/delta/17/drop_indexes.sql +37 -0
  747. synapse/storage/schema/main/delta/17/server_keys.sql +43 -0
  748. synapse/storage/schema/main/delta/17/user_threepids.sql +9 -0
  749. synapse/storage/schema/main/delta/18/server_keys_bigger_ints.sql +51 -0
  750. synapse/storage/schema/main/delta/19/event_index.sql +38 -0
  751. synapse/storage/schema/main/delta/20/dummy.sql +1 -0
  752. synapse/storage/schema/main/delta/20/pushers.py +93 -0
  753. synapse/storage/schema/main/delta/21/end_to_end_keys.sql +53 -0
  754. synapse/storage/schema/main/delta/21/receipts.sql +57 -0
  755. synapse/storage/schema/main/delta/22/receipts_index.sql +41 -0
  756. synapse/storage/schema/main/delta/22/user_threepids_unique.sql +19 -0
  757. synapse/storage/schema/main/delta/24/stats_reporting.sql +37 -0
  758. synapse/storage/schema/main/delta/25/fts.py +81 -0
  759. synapse/storage/schema/main/delta/25/guest_access.sql +44 -0
  760. synapse/storage/schema/main/delta/25/history_visibility.sql +44 -0
  761. synapse/storage/schema/main/delta/25/tags.sql +57 -0
  762. synapse/storage/schema/main/delta/26/account_data.sql +36 -0
  763. synapse/storage/schema/main/delta/27/account_data.sql +55 -0
  764. synapse/storage/schema/main/delta/27/forgotten_memberships.sql +45 -0
  765. synapse/storage/schema/main/delta/27/ts.py +61 -0
  766. synapse/storage/schema/main/delta/28/event_push_actions.sql +46 -0
  767. synapse/storage/schema/main/delta/28/events_room_stream.sql +39 -0
  768. synapse/storage/schema/main/delta/28/public_roms_index.sql +39 -0
  769. synapse/storage/schema/main/delta/28/receipts_user_id_index.sql +41 -0
  770. synapse/storage/schema/main/delta/28/upgrade_times.sql +40 -0
  771. synapse/storage/schema/main/delta/28/users_is_guest.sql +41 -0
  772. synapse/storage/schema/main/delta/29/push_actions.sql +54 -0
  773. synapse/storage/schema/main/delta/30/alias_creator.sql +35 -0
  774. synapse/storage/schema/main/delta/30/as_users.py +82 -0
  775. synapse/storage/schema/main/delta/30/deleted_pushers.sql +44 -0
  776. synapse/storage/schema/main/delta/30/presence_stream.sql +49 -0
  777. synapse/storage/schema/main/delta/30/public_rooms.sql +42 -0
  778. synapse/storage/schema/main/delta/30/push_rule_stream.sql +57 -0
  779. synapse/storage/schema/main/delta/30/threepid_guest_access_tokens.sql +43 -0
  780. synapse/storage/schema/main/delta/31/invites.sql +61 -0
  781. synapse/storage/schema/main/delta/31/local_media_repository_url_cache.sql +46 -0
  782. synapse/storage/schema/main/delta/31/pushers_0.py +92 -0
  783. synapse/storage/schema/main/delta/31/pushers_index.sql +41 -0
  784. synapse/storage/schema/main/delta/31/search_update.py +65 -0
  785. synapse/storage/schema/main/delta/32/events.sql +35 -0
  786. synapse/storage/schema/main/delta/32/openid.sql +9 -0
  787. synapse/storage/schema/main/delta/32/pusher_throttle.sql +42 -0
  788. synapse/storage/schema/main/delta/32/remove_indices.sql +52 -0
  789. synapse/storage/schema/main/delta/32/reports.sql +44 -0
  790. synapse/storage/schema/main/delta/33/access_tokens_device_index.sql +36 -0
  791. synapse/storage/schema/main/delta/33/devices.sql +40 -0
  792. synapse/storage/schema/main/delta/33/devices_for_e2e_keys.sql +38 -0
  793. synapse/storage/schema/main/delta/33/devices_for_e2e_keys_clear_unknown_device.sql +39 -0
  794. synapse/storage/schema/main/delta/33/event_fields.py +61 -0
  795. synapse/storage/schema/main/delta/33/remote_media_ts.py +43 -0
  796. synapse/storage/schema/main/delta/33/user_ips_index.sql +36 -0
  797. synapse/storage/schema/main/delta/34/appservice_stream.sql +42 -0
  798. synapse/storage/schema/main/delta/34/cache_stream.py +50 -0
  799. synapse/storage/schema/main/delta/34/device_inbox.sql +43 -0
  800. synapse/storage/schema/main/delta/34/push_display_name_rename.sql +39 -0
  801. synapse/storage/schema/main/delta/34/received_txn_purge.py +36 -0
  802. synapse/storage/schema/main/delta/35/contains_url.sql +36 -0
  803. synapse/storage/schema/main/delta/35/device_outbox.sql +58 -0
  804. synapse/storage/schema/main/delta/35/device_stream_id.sql +40 -0
  805. synapse/storage/schema/main/delta/35/event_push_actions_index.sql +36 -0
  806. synapse/storage/schema/main/delta/35/public_room_list_change_stream.sql +52 -0
  807. synapse/storage/schema/main/delta/35/stream_order_to_extrem.sql +56 -0
  808. synapse/storage/schema/main/delta/36/readd_public_rooms.sql +45 -0
  809. synapse/storage/schema/main/delta/37/remove_auth_idx.py +89 -0
  810. synapse/storage/schema/main/delta/37/user_threepids.sql +71 -0
  811. synapse/storage/schema/main/delta/38/postgres_fts_gist.sql +38 -0
  812. synapse/storage/schema/main/delta/39/appservice_room_list.sql +48 -0
  813. synapse/storage/schema/main/delta/39/device_federation_stream_idx.sql +35 -0
  814. synapse/storage/schema/main/delta/39/event_push_index.sql +36 -0
  815. synapse/storage/schema/main/delta/39/federation_out_position.sql +41 -0
  816. synapse/storage/schema/main/delta/39/membership_profile.sql +39 -0
  817. synapse/storage/schema/main/delta/40/current_state_idx.sql +36 -0
  818. synapse/storage/schema/main/delta/40/device_inbox.sql +40 -0
  819. synapse/storage/schema/main/delta/40/device_list_streams.sql +79 -0
  820. synapse/storage/schema/main/delta/40/event_push_summary.sql +57 -0
  821. synapse/storage/schema/main/delta/40/pushers.sql +58 -0
  822. synapse/storage/schema/main/delta/41/device_list_stream_idx.sql +36 -0
  823. synapse/storage/schema/main/delta/41/device_outbound_index.sql +35 -0
  824. synapse/storage/schema/main/delta/41/event_search_event_id_idx.sql +36 -0
  825. synapse/storage/schema/main/delta/41/ratelimit.sql +41 -0
  826. synapse/storage/schema/main/delta/42/current_state_delta.sql +48 -0
  827. synapse/storage/schema/main/delta/42/device_list_last_id.sql +52 -0
  828. synapse/storage/schema/main/delta/42/event_auth_state_only.sql +36 -0
  829. synapse/storage/schema/main/delta/42/user_dir.py +88 -0
  830. synapse/storage/schema/main/delta/43/blocked_rooms.sql +40 -0
  831. synapse/storage/schema/main/delta/43/quarantine_media.sql +36 -0
  832. synapse/storage/schema/main/delta/43/url_cache.sql +35 -0
  833. synapse/storage/schema/main/delta/43/user_share.sql +52 -0
  834. synapse/storage/schema/main/delta/44/expire_url_cache.sql +60 -0
  835. synapse/storage/schema/main/delta/45/group_server.sql +186 -0
  836. synapse/storage/schema/main/delta/45/profile_cache.sql +47 -0
  837. synapse/storage/schema/main/delta/46/drop_refresh_tokens.sql +36 -0
  838. synapse/storage/schema/main/delta/46/drop_unique_deleted_pushers.sql +54 -0
  839. synapse/storage/schema/main/delta/46/group_server.sql +51 -0
  840. synapse/storage/schema/main/delta/46/local_media_repository_url_idx.sql +43 -0
  841. synapse/storage/schema/main/delta/46/user_dir_null_room_ids.sql +54 -0
  842. synapse/storage/schema/main/delta/46/user_dir_typos.sql +43 -0
  843. synapse/storage/schema/main/delta/47/last_access_media.sql +35 -0
  844. synapse/storage/schema/main/delta/47/postgres_fts_gin.sql +36 -0
  845. synapse/storage/schema/main/delta/47/push_actions_staging.sql +47 -0
  846. synapse/storage/schema/main/delta/48/add_user_consent.sql +37 -0
  847. synapse/storage/schema/main/delta/48/add_user_ips_last_seen_index.sql +36 -0
  848. synapse/storage/schema/main/delta/48/deactivated_users.sql +44 -0
  849. synapse/storage/schema/main/delta/48/group_unique_indexes.py +67 -0
  850. synapse/storage/schema/main/delta/48/groups_joinable.sql +41 -0
  851. synapse/storage/schema/main/delta/49/add_user_consent_server_notice_sent.sql +39 -0
  852. synapse/storage/schema/main/delta/49/add_user_daily_visits.sql +40 -0
  853. synapse/storage/schema/main/delta/49/add_user_ips_last_seen_only_index.sql +36 -0
  854. synapse/storage/schema/main/delta/50/add_creation_ts_users_index.sql +38 -0
  855. synapse/storage/schema/main/delta/50/erasure_store.sql +40 -0
  856. synapse/storage/schema/main/delta/50/make_event_content_nullable.py +102 -0
  857. synapse/storage/schema/main/delta/51/e2e_room_keys.sql +58 -0
  858. synapse/storage/schema/main/delta/51/monthly_active_users.sql +46 -0
  859. synapse/storage/schema/main/delta/52/add_event_to_state_group_index.sql +38 -0
  860. synapse/storage/schema/main/delta/52/device_list_streams_unique_idx.sql +55 -0
  861. synapse/storage/schema/main/delta/52/e2e_room_keys.sql +72 -0
  862. synapse/storage/schema/main/delta/53/add_user_type_to_users.sql +38 -0
  863. synapse/storage/schema/main/delta/53/drop_sent_transactions.sql +35 -0
  864. synapse/storage/schema/main/delta/53/event_format_version.sql +35 -0
  865. synapse/storage/schema/main/delta/53/user_dir_populate.sql +49 -0
  866. synapse/storage/schema/main/delta/53/user_ips_index.sql +49 -0
  867. synapse/storage/schema/main/delta/53/user_share.sql +63 -0
  868. synapse/storage/schema/main/delta/53/user_threepid_id.sql +48 -0
  869. synapse/storage/schema/main/delta/53/users_in_public_rooms.sql +47 -0
  870. synapse/storage/schema/main/delta/54/account_validity_with_renewal.sql +49 -0
  871. synapse/storage/schema/main/delta/54/add_validity_to_server_keys.sql +42 -0
  872. synapse/storage/schema/main/delta/54/delete_forward_extremities.sql +42 -0
  873. synapse/storage/schema/main/delta/54/drop_legacy_tables.sql +49 -0
  874. synapse/storage/schema/main/delta/54/drop_presence_list.sql +35 -0
  875. synapse/storage/schema/main/delta/54/relations.sql +46 -0
  876. synapse/storage/schema/main/delta/54/stats.sql +99 -0
  877. synapse/storage/schema/main/delta/54/stats2.sql +47 -0
  878. synapse/storage/schema/main/delta/55/access_token_expiry.sql +37 -0
  879. synapse/storage/schema/main/delta/55/track_threepid_validations.sql +50 -0
  880. synapse/storage/schema/main/delta/55/users_alter_deactivated.sql +38 -0
  881. synapse/storage/schema/main/delta/56/add_spans_to_device_lists.sql +39 -0
  882. synapse/storage/schema/main/delta/56/current_state_events_membership.sql +41 -0
  883. synapse/storage/schema/main/delta/56/current_state_events_membership_mk2.sql +43 -0
  884. synapse/storage/schema/main/delta/56/delete_keys_from_deleted_backups.sql +44 -0
  885. synapse/storage/schema/main/delta/56/destinations_failure_ts.sql +44 -0
  886. synapse/storage/schema/main/delta/56/destinations_retry_interval_type.sql.postgres +18 -0
  887. synapse/storage/schema/main/delta/56/device_stream_id_insert.sql +39 -0
  888. synapse/storage/schema/main/delta/56/devices_last_seen.sql +43 -0
  889. synapse/storage/schema/main/delta/56/drop_unused_event_tables.sql +39 -0
  890. synapse/storage/schema/main/delta/56/event_expiry.sql +40 -0
  891. synapse/storage/schema/main/delta/56/event_labels.sql +49 -0
  892. synapse/storage/schema/main/delta/56/event_labels_background_update.sql +36 -0
  893. synapse/storage/schema/main/delta/56/fix_room_keys_index.sql +37 -0
  894. synapse/storage/schema/main/delta/56/hidden_devices.sql +37 -0
  895. synapse/storage/schema/main/delta/56/hidden_devices_fix.sql.sqlite +42 -0
  896. synapse/storage/schema/main/delta/56/nuke_empty_communities_from_db.sql +48 -0
  897. synapse/storage/schema/main/delta/56/public_room_list_idx.sql +35 -0
  898. synapse/storage/schema/main/delta/56/redaction_censor.sql +35 -0
  899. synapse/storage/schema/main/delta/56/redaction_censor2.sql +41 -0
  900. synapse/storage/schema/main/delta/56/redaction_censor3_fix_update.sql.postgres +25 -0
  901. synapse/storage/schema/main/delta/56/redaction_censor4.sql +35 -0
  902. synapse/storage/schema/main/delta/56/remove_tombstoned_rooms_from_directory.sql +38 -0
  903. synapse/storage/schema/main/delta/56/room_key_etag.sql +36 -0
  904. synapse/storage/schema/main/delta/56/room_membership_idx.sql +37 -0
  905. synapse/storage/schema/main/delta/56/room_retention.sql +52 -0
  906. synapse/storage/schema/main/delta/56/signing_keys.sql +75 -0
  907. synapse/storage/schema/main/delta/56/signing_keys_nonunique_signatures.sql +41 -0
  908. synapse/storage/schema/main/delta/56/stats_separated.sql +175 -0
  909. synapse/storage/schema/main/delta/56/unique_user_filter_index.py +46 -0
  910. synapse/storage/schema/main/delta/56/user_external_ids.sql +43 -0
  911. synapse/storage/schema/main/delta/56/users_in_public_rooms_idx.sql +36 -0
  912. synapse/storage/schema/main/delta/57/delete_old_current_state_events.sql +41 -0
  913. synapse/storage/schema/main/delta/57/device_list_remote_cache_stale.sql +44 -0
  914. synapse/storage/schema/main/delta/57/local_current_membership.py +111 -0
  915. synapse/storage/schema/main/delta/57/remove_sent_outbound_pokes.sql +40 -0
  916. synapse/storage/schema/main/delta/57/rooms_version_column.sql +43 -0
  917. synapse/storage/schema/main/delta/57/rooms_version_column_2.sql.postgres +35 -0
  918. synapse/storage/schema/main/delta/57/rooms_version_column_2.sql.sqlite +22 -0
  919. synapse/storage/schema/main/delta/57/rooms_version_column_3.sql.postgres +39 -0
  920. synapse/storage/schema/main/delta/57/rooms_version_column_3.sql.sqlite +23 -0
  921. synapse/storage/schema/main/delta/58/02remove_dup_outbound_pokes.sql +41 -0
  922. synapse/storage/schema/main/delta/58/03persist_ui_auth.sql +55 -0
  923. synapse/storage/schema/main/delta/58/05cache_instance.sql.postgres +30 -0
  924. synapse/storage/schema/main/delta/58/06dlols_unique_idx.py +83 -0
  925. synapse/storage/schema/main/delta/58/07add_method_to_thumbnail_constraint.sql.postgres +33 -0
  926. synapse/storage/schema/main/delta/58/07add_method_to_thumbnail_constraint.sql.sqlite +44 -0
  927. synapse/storage/schema/main/delta/58/07persist_ui_auth_ips.sql +44 -0
  928. synapse/storage/schema/main/delta/58/08_media_safe_from_quarantine.sql.postgres +18 -0
  929. synapse/storage/schema/main/delta/58/08_media_safe_from_quarantine.sql.sqlite +18 -0
  930. synapse/storage/schema/main/delta/58/09shadow_ban.sql +37 -0
  931. synapse/storage/schema/main/delta/58/10_pushrules_enabled_delete_obsolete.sql +47 -0
  932. synapse/storage/schema/main/delta/58/10drop_local_rejections_stream.sql +41 -0
  933. synapse/storage/schema/main/delta/58/10federation_pos_instance_name.sql +41 -0
  934. synapse/storage/schema/main/delta/58/11dehydration.sql +39 -0
  935. synapse/storage/schema/main/delta/58/11fallback.sql +43 -0
  936. synapse/storage/schema/main/delta/58/11user_id_seq.py +38 -0
  937. synapse/storage/schema/main/delta/58/12room_stats.sql +51 -0
  938. synapse/storage/schema/main/delta/58/13remove_presence_allow_inbound.sql +36 -0
  939. synapse/storage/schema/main/delta/58/14events_instance_name.sql +35 -0
  940. synapse/storage/schema/main/delta/58/14events_instance_name.sql.postgres +28 -0
  941. synapse/storage/schema/main/delta/58/15_catchup_destination_rooms.sql +61 -0
  942. synapse/storage/schema/main/delta/58/15unread_count.sql +45 -0
  943. synapse/storage/schema/main/delta/58/16populate_stats_process_rooms_fix.sql +41 -0
  944. synapse/storage/schema/main/delta/58/17_catchup_last_successful.sql +40 -0
  945. synapse/storage/schema/main/delta/58/18stream_positions.sql +41 -0
  946. synapse/storage/schema/main/delta/58/19instance_map.sql.postgres +25 -0
  947. synapse/storage/schema/main/delta/58/19txn_id.sql +59 -0
  948. synapse/storage/schema/main/delta/58/20instance_name_event_tables.sql +36 -0
  949. synapse/storage/schema/main/delta/58/20user_daily_visits.sql +37 -0
  950. synapse/storage/schema/main/delta/58/21as_device_stream.sql +36 -0
  951. synapse/storage/schema/main/delta/58/21drop_device_max_stream_id.sql +1 -0
  952. synapse/storage/schema/main/delta/58/22puppet_token.sql +36 -0
  953. synapse/storage/schema/main/delta/58/22users_have_local_media.sql +2 -0
  954. synapse/storage/schema/main/delta/58/23e2e_cross_signing_keys_idx.sql +36 -0
  955. synapse/storage/schema/main/delta/58/24drop_event_json_index.sql +38 -0
  956. synapse/storage/schema/main/delta/58/25user_external_ids_user_id_idx.sql +36 -0
  957. synapse/storage/schema/main/delta/58/26access_token_last_validated.sql +37 -0
  958. synapse/storage/schema/main/delta/58/27local_invites.sql +37 -0
  959. synapse/storage/schema/main/delta/58/28drop_last_used_column.sql.postgres +16 -0
  960. synapse/storage/schema/main/delta/58/28drop_last_used_column.sql.sqlite +62 -0
  961. synapse/storage/schema/main/delta/59/01ignored_user.py +85 -0
  962. synapse/storage/schema/main/delta/59/02shard_send_to_device.sql +37 -0
  963. synapse/storage/schema/main/delta/59/03shard_send_to_device_sequence.sql.postgres +25 -0
  964. synapse/storage/schema/main/delta/59/04_event_auth_chains.sql +71 -0
  965. synapse/storage/schema/main/delta/59/04_event_auth_chains.sql.postgres +16 -0
  966. synapse/storage/schema/main/delta/59/04drop_account_data.sql +36 -0
  967. synapse/storage/schema/main/delta/59/05cache_invalidation.sql +36 -0
  968. synapse/storage/schema/main/delta/59/06chain_cover_index.sql +36 -0
  969. synapse/storage/schema/main/delta/59/06shard_account_data.sql +39 -0
  970. synapse/storage/schema/main/delta/59/06shard_account_data.sql.postgres +32 -0
  971. synapse/storage/schema/main/delta/59/07shard_account_data_fix.sql +37 -0
  972. synapse/storage/schema/main/delta/59/08delete_pushers_for_deactivated_accounts.sql +39 -0
  973. synapse/storage/schema/main/delta/59/08delete_stale_pushers.sql +39 -0
  974. synapse/storage/schema/main/delta/59/09rejected_events_metadata.sql +45 -0
  975. synapse/storage/schema/main/delta/59/10delete_purged_chain_cover.sql +36 -0
  976. synapse/storage/schema/main/delta/59/11add_knock_members_to_stats.sql +39 -0
  977. synapse/storage/schema/main/delta/59/11drop_thumbnail_constraint.sql.postgres +22 -0
  978. synapse/storage/schema/main/delta/59/12account_validity_token_used_ts_ms.sql +37 -0
  979. synapse/storage/schema/main/delta/59/12presence_stream_instance.sql +37 -0
  980. synapse/storage/schema/main/delta/59/12presence_stream_instance_seq.sql.postgres +20 -0
  981. synapse/storage/schema/main/delta/59/13users_to_send_full_presence_to.sql +53 -0
  982. synapse/storage/schema/main/delta/59/14refresh_tokens.sql +53 -0
  983. synapse/storage/schema/main/delta/59/15locks.sql +56 -0
  984. synapse/storage/schema/main/delta/59/16federation_inbound_staging.sql +51 -0
  985. synapse/storage/schema/main/delta/60/01recreate_stream_ordering.sql.postgres +45 -0
  986. synapse/storage/schema/main/delta/60/02change_stream_ordering_columns.sql.postgres +30 -0
  987. synapse/storage/schema/main/delta/61/01change_appservices_txns.sql.postgres +23 -0
  988. synapse/storage/schema/main/delta/61/01insertion_event_lookups.sql +68 -0
  989. synapse/storage/schema/main/delta/61/02drop_redundant_room_depth_index.sql +37 -0
  990. synapse/storage/schema/main/delta/61/03recreate_min_depth.py +74 -0
  991. synapse/storage/schema/main/delta/62/01insertion_event_extremities.sql +43 -0
  992. synapse/storage/schema/main/delta/63/01create_registration_tokens.sql +42 -0
  993. synapse/storage/schema/main/delta/63/02delete_unlinked_email_pushers.sql +39 -0
  994. synapse/storage/schema/main/delta/63/02populate-rooms-creator.sql +36 -0
  995. synapse/storage/schema/main/delta/63/03session_store.sql +42 -0
  996. synapse/storage/schema/main/delta/63/04add_presence_stream_not_offline_index.sql +37 -0
  997. synapse/storage/schema/main/delta/64/01msc2716_chunk_to_batch_rename.sql.postgres +23 -0
  998. synapse/storage/schema/main/delta/64/01msc2716_chunk_to_batch_rename.sql.sqlite +37 -0
  999. synapse/storage/schema/main/delta/65/01msc2716_insertion_event_edges.sql +38 -0
  1000. synapse/storage/schema/main/delta/65/03remove_hidden_devices_from_device_inbox.sql +41 -0
  1001. synapse/storage/schema/main/delta/65/04_local_group_updates.sql +37 -0
  1002. synapse/storage/schema/main/delta/65/05_remove_room_stats_historical_and_user_stats_historical.sql +38 -0
  1003. synapse/storage/schema/main/delta/65/06remove_deleted_devices_from_device_inbox.sql +53 -0
  1004. synapse/storage/schema/main/delta/65/07_arbitrary_relations.sql +37 -0
  1005. synapse/storage/schema/main/delta/65/08_device_inbox_background_updates.sql +37 -0
  1006. synapse/storage/schema/main/delta/65/10_expirable_refresh_tokens.sql +47 -0
  1007. synapse/storage/schema/main/delta/65/11_devices_auth_provider_session.sql +46 -0
  1008. synapse/storage/schema/main/delta/67/01drop_public_room_list_stream.sql +37 -0
  1009. synapse/storage/schema/main/delta/68/01event_columns.sql +45 -0
  1010. synapse/storage/schema/main/delta/68/02_msc2409_add_device_id_appservice_stream_type.sql +40 -0
  1011. synapse/storage/schema/main/delta/68/03_delete_account_data_for_deactivated_accounts.sql +39 -0
  1012. synapse/storage/schema/main/delta/68/04_refresh_tokens_index_next_token_id.sql +47 -0
  1013. synapse/storage/schema/main/delta/68/04partial_state_rooms.sql +60 -0
  1014. synapse/storage/schema/main/delta/68/05_delete_non_strings_from_event_search.sql.sqlite +22 -0
  1015. synapse/storage/schema/main/delta/68/05partial_state_rooms_triggers.py +80 -0
  1016. synapse/storage/schema/main/delta/68/06_msc3202_add_device_list_appservice_stream_type.sql +42 -0
  1017. synapse/storage/schema/main/delta/69/01as_txn_seq.py +54 -0
  1018. synapse/storage/schema/main/delta/69/01device_list_oubound_by_room.sql +57 -0
  1019. synapse/storage/schema/main/delta/69/02cache_invalidation_index.sql +37 -0
  1020. synapse/storage/schema/main/delta/70/01clean_table_purged_rooms.sql +39 -0
  1021. synapse/storage/schema/main/delta/71/01rebuild_event_edges.sql.postgres +43 -0
  1022. synapse/storage/schema/main/delta/71/01rebuild_event_edges.sql.sqlite +47 -0
  1023. synapse/storage/schema/main/delta/71/01remove_noop_background_updates.sql +80 -0
  1024. synapse/storage/schema/main/delta/71/02event_push_summary_unique.sql +37 -0
  1025. synapse/storage/schema/main/delta/72/01add_room_type_to_state_stats.sql +38 -0
  1026. synapse/storage/schema/main/delta/72/01event_push_summary_receipt.sql +54 -0
  1027. synapse/storage/schema/main/delta/72/02event_push_actions_index.sql +38 -0
  1028. synapse/storage/schema/main/delta/72/03bg_populate_events_columns.py +57 -0
  1029. synapse/storage/schema/main/delta/72/03drop_event_reference_hashes.sql +36 -0
  1030. synapse/storage/schema/main/delta/72/03remove_groups.sql +50 -0
  1031. synapse/storage/schema/main/delta/72/04drop_column_application_services_state_last_txn.sql.postgres +17 -0
  1032. synapse/storage/schema/main/delta/72/04drop_column_application_services_state_last_txn.sql.sqlite +40 -0
  1033. synapse/storage/schema/main/delta/72/05receipts_event_stream_ordering.sql +38 -0
  1034. synapse/storage/schema/main/delta/72/05remove_unstable_private_read_receipts.sql +38 -0
  1035. synapse/storage/schema/main/delta/72/06add_consent_ts_to_users.sql +35 -0
  1036. synapse/storage/schema/main/delta/72/06thread_notifications.sql +49 -0
  1037. synapse/storage/schema/main/delta/72/07force_update_current_state_events_membership.py +67 -0
  1038. synapse/storage/schema/main/delta/72/07thread_receipts.sql.postgres +30 -0
  1039. synapse/storage/schema/main/delta/72/07thread_receipts.sql.sqlite +70 -0
  1040. synapse/storage/schema/main/delta/72/08begin_cache_invalidation_seq_at_2.sql.postgres +23 -0
  1041. synapse/storage/schema/main/delta/72/08thread_receipts.sql +39 -0
  1042. synapse/storage/schema/main/delta/72/09partial_indices.sql.sqlite +56 -0
  1043. synapse/storage/schema/main/delta/73/01event_failed_pull_attempts.sql +48 -0
  1044. synapse/storage/schema/main/delta/73/02add_pusher_enabled.sql +35 -0
  1045. synapse/storage/schema/main/delta/73/02room_id_indexes_for_purging.sql +41 -0
  1046. synapse/storage/schema/main/delta/73/03pusher_device_id.sql +39 -0
  1047. synapse/storage/schema/main/delta/73/03users_approved_column.sql +39 -0
  1048. synapse/storage/schema/main/delta/73/04partial_join_details.sql +42 -0
  1049. synapse/storage/schema/main/delta/73/04pending_device_list_updates.sql +47 -0
  1050. synapse/storage/schema/main/delta/73/05old_push_actions.sql.postgres +22 -0
  1051. synapse/storage/schema/main/delta/73/05old_push_actions.sql.sqlite +24 -0
  1052. synapse/storage/schema/main/delta/73/06thread_notifications_thread_id_idx.sql +42 -0
  1053. synapse/storage/schema/main/delta/73/08thread_receipts_non_null.sql.postgres +23 -0
  1054. synapse/storage/schema/main/delta/73/08thread_receipts_non_null.sql.sqlite +76 -0
  1055. synapse/storage/schema/main/delta/73/09partial_joined_via_destination.sql +37 -0
  1056. synapse/storage/schema/main/delta/73/09threads_table.sql +49 -0
  1057. synapse/storage/schema/main/delta/73/10_update_sqlite_fts4_tokenizer.py +71 -0
  1058. synapse/storage/schema/main/delta/73/10login_tokens.sql +54 -0
  1059. synapse/storage/schema/main/delta/73/11event_search_room_id_n_distinct.sql.postgres +33 -0
  1060. synapse/storage/schema/main/delta/73/12refactor_device_list_outbound_pokes.sql +72 -0
  1061. synapse/storage/schema/main/delta/73/13add_device_lists_index.sql +39 -0
  1062. synapse/storage/schema/main/delta/73/20_un_partial_stated_room_stream.sql +51 -0
  1063. synapse/storage/schema/main/delta/73/21_un_partial_stated_room_stream_seq.sql.postgres +20 -0
  1064. synapse/storage/schema/main/delta/73/22_rebuild_user_dir_stats.sql +48 -0
  1065. synapse/storage/schema/main/delta/73/22_un_partial_stated_event_stream.sql +53 -0
  1066. synapse/storage/schema/main/delta/73/23_fix_thread_index.sql +52 -0
  1067. synapse/storage/schema/main/delta/73/23_un_partial_stated_room_stream_seq.sql.postgres +20 -0
  1068. synapse/storage/schema/main/delta/73/24_events_jump_to_date_index.sql +36 -0
  1069. synapse/storage/schema/main/delta/73/25drop_presence.sql +36 -0
  1070. synapse/storage/schema/main/delta/74/01_user_directory_stale_remote_users.sql +58 -0
  1071. synapse/storage/schema/main/delta/74/02_set_device_id_for_pushers_bg_update.sql +38 -0
  1072. synapse/storage/schema/main/delta/74/03_membership_tables_event_stream_ordering.sql.postgres +29 -0
  1073. synapse/storage/schema/main/delta/74/03_membership_tables_event_stream_ordering.sql.sqlite +23 -0
  1074. synapse/storage/schema/main/delta/74/03_room_membership_index.sql +38 -0
  1075. synapse/storage/schema/main/delta/74/04_delete_e2e_backup_keys_for_deactivated_users.sql +36 -0
  1076. synapse/storage/schema/main/delta/74/04_membership_tables_event_stream_ordering_triggers.py +87 -0
  1077. synapse/storage/schema/main/delta/74/05_events_txn_id_device_id.sql +72 -0
  1078. synapse/storage/schema/main/delta/74/90COMMENTS_destinations.sql.postgres +52 -0
  1079. synapse/storage/schema/main/delta/76/01_add_profiles_full_user_id_column.sql +39 -0
  1080. synapse/storage/schema/main/delta/76/02_add_user_filters_full_user_id_column.sql +39 -0
  1081. synapse/storage/schema/main/delta/76/03_per_user_experimental_features.sql +46 -0
  1082. synapse/storage/schema/main/delta/76/04_add_room_forgetter.sql +43 -0
  1083. synapse/storage/schema/main/delta/77/01_add_profiles_not_valid_check.sql.postgres +16 -0
  1084. synapse/storage/schema/main/delta/77/02_add_user_filters_not_valid_check.sql.postgres +16 -0
  1085. synapse/storage/schema/main/delta/77/03bg_populate_full_user_id_profiles.sql +35 -0
  1086. synapse/storage/schema/main/delta/77/04bg_populate_full_user_id_user_filters.sql +35 -0
  1087. synapse/storage/schema/main/delta/77/05thread_notifications_backfill.sql +67 -0
  1088. synapse/storage/schema/main/delta/77/06thread_notifications_not_null.sql.sqlite +102 -0
  1089. synapse/storage/schema/main/delta/77/06thread_notifications_not_null_event_push_actions.sql.postgres +27 -0
  1090. synapse/storage/schema/main/delta/77/06thread_notifications_not_null_event_push_actions_staging.sql.postgres +27 -0
  1091. synapse/storage/schema/main/delta/77/06thread_notifications_not_null_event_push_summary.sql.postgres +29 -0
  1092. synapse/storage/schema/main/delta/77/14bg_indices_event_stream_ordering.sql +39 -0
  1093. synapse/storage/schema/main/delta/78/01_validate_and_update_profiles.py +99 -0
  1094. synapse/storage/schema/main/delta/78/02_validate_and_update_user_filters.py +100 -0
  1095. synapse/storage/schema/main/delta/78/03_remove_unused_indexes_user_filters.py +72 -0
  1096. synapse/storage/schema/main/delta/78/03event_extremities_constraints.py +65 -0
  1097. synapse/storage/schema/main/delta/78/04_add_full_user_id_index_user_filters.py +32 -0
  1098. synapse/storage/schema/main/delta/79/03_read_write_locks_triggers.sql.postgres +102 -0
  1099. synapse/storage/schema/main/delta/79/03_read_write_locks_triggers.sql.sqlite +72 -0
  1100. synapse/storage/schema/main/delta/79/04_mitigate_stream_ordering_update_race.py +70 -0
  1101. synapse/storage/schema/main/delta/79/05_read_write_locks_triggers.sql.postgres +69 -0
  1102. synapse/storage/schema/main/delta/79/05_read_write_locks_triggers.sql.sqlite +65 -0
  1103. synapse/storage/schema/main/delta/80/01_users_alter_locked.sql +35 -0
  1104. synapse/storage/schema/main/delta/80/02_read_write_locks_unlogged.sql.postgres +30 -0
  1105. synapse/storage/schema/main/delta/80/02_scheduled_tasks.sql +47 -0
  1106. synapse/storage/schema/main/delta/80/03_read_write_locks_triggers.sql.postgres +37 -0
  1107. synapse/storage/schema/main/delta/80/04_read_write_locks_deadlock.sql.postgres +71 -0
  1108. synapse/storage/schema/main/delta/82/02_scheduled_tasks_index.sql +35 -0
  1109. synapse/storage/schema/main/delta/82/04_add_indices_for_purging_rooms.sql +39 -0
  1110. synapse/storage/schema/main/delta/82/05gaps.sql +44 -0
  1111. synapse/storage/schema/main/delta/83/01_drop_old_tables.sql +43 -0
  1112. synapse/storage/schema/main/delta/83/03_instance_name_receipts.sql.sqlite +17 -0
  1113. synapse/storage/schema/main/delta/83/05_cross_signing_key_update_grant.sql +34 -0
  1114. synapse/storage/schema/main/delta/83/06_event_push_summary_room.sql +36 -0
  1115. synapse/storage/schema/main/delta/84/01_auth_links_stats.sql.postgres +20 -0
  1116. synapse/storage/schema/main/delta/84/02_auth_links_index.sql +16 -0
  1117. synapse/storage/schema/main/delta/84/03_auth_links_analyze.sql.postgres +16 -0
  1118. synapse/storage/schema/main/delta/84/04_access_token_index.sql +15 -0
  1119. synapse/storage/schema/main/delta/85/01_add_suspended.sql +14 -0
  1120. synapse/storage/schema/main/delta/85/02_add_instance_names.sql +27 -0
  1121. synapse/storage/schema/main/delta/85/03_new_sequences.sql.postgres +54 -0
  1122. synapse/storage/schema/main/delta/85/04_cleanup_device_federation_outbox.sql +15 -0
  1123. synapse/storage/schema/main/delta/85/05_add_instance_names_converted_pos.sql +16 -0
  1124. synapse/storage/schema/main/delta/85/06_add_room_reports.sql +20 -0
  1125. synapse/storage/schema/main/delta/86/01_authenticate_media.sql +15 -0
  1126. synapse/storage/schema/main/delta/86/02_receipts_event_id_index.sql +15 -0
  1127. synapse/storage/schema/main/delta/87/01_sliding_sync_memberships.sql +169 -0
  1128. synapse/storage/schema/main/delta/87/02_per_connection_state.sql +81 -0
  1129. synapse/storage/schema/main/delta/87/03_current_state_index.sql +19 -0
  1130. synapse/storage/schema/main/delta/88/01_add_delayed_events.sql +43 -0
  1131. synapse/storage/schema/main/delta/88/01_custom_profile_fields.sql +15 -0
  1132. synapse/storage/schema/main/delta/88/02_fix_sliding_sync_membership_snapshots_forgotten_column.sql +21 -0
  1133. synapse/storage/schema/main/delta/88/03_add_otk_ts_added_index.sql +18 -0
  1134. synapse/storage/schema/main/delta/88/04_current_state_delta_index.sql +18 -0
  1135. synapse/storage/schema/main/delta/88/05_drop_old_otks.sql.postgres +19 -0
  1136. synapse/storage/schema/main/delta/88/05_drop_old_otks.sql.sqlite +19 -0
  1137. synapse/storage/schema/main/delta/88/05_sliding_sync_room_config_index.sql +20 -0
  1138. synapse/storage/schema/main/delta/88/06_events_received_ts_index.sql +17 -0
  1139. synapse/storage/schema/main/delta/89/01_sliding_sync_membership_snapshot_index.sql +15 -0
  1140. synapse/storage/schema/main/delta/90/01_add_column_participant_room_memberships_table.sql +16 -0
  1141. synapse/storage/schema/main/delta/91/01_media_hash.sql +28 -0
  1142. synapse/storage/schema/main/delta/92/01_remove_trigger.sql.postgres +16 -0
  1143. synapse/storage/schema/main/delta/92/01_remove_trigger.sql.sqlite +16 -0
  1144. synapse/storage/schema/main/delta/92/02_remove_populate_participant_bg_update.sql +17 -0
  1145. synapse/storage/schema/main/delta/92/04_ss_membership_snapshot_idx.sql +16 -0
  1146. synapse/storage/schema/main/delta/92/04_thread_subscriptions.sql +59 -0
  1147. synapse/storage/schema/main/delta/92/04_thread_subscriptions_seq.sql.postgres +19 -0
  1148. synapse/storage/schema/main/delta/92/05_fixup_max_depth_cap.sql +17 -0
  1149. synapse/storage/schema/main/delta/92/05_thread_subscriptions_comments.sql.postgres +18 -0
  1150. synapse/storage/schema/main/delta/92/06_device_federation_inbox_index.sql +16 -0
  1151. synapse/storage/schema/main/delta/92/06_threads_last_sent_stream_ordering_comments.sql.postgres +24 -0
  1152. synapse/storage/schema/main/delta/92/07_add_user_reports.sql +22 -0
  1153. synapse/storage/schema/main/delta/92/07_event_txn_id_device_id_txn_id2.sql +15 -0
  1154. synapse/storage/schema/main/delta/92/08_room_ban_redactions.sql +21 -0
  1155. synapse/storage/schema/main/delta/92/08_thread_subscriptions_seq_fixup.sql.postgres +19 -0
  1156. synapse/storage/schema/main/delta/92/09_thread_subscriptions_update.sql +20 -0
  1157. synapse/storage/schema/main/delta/92/09_thread_subscriptions_update.sql.postgres +18 -0
  1158. synapse/storage/schema/main/delta/93/01_add_delayed_events.sql +15 -0
  1159. synapse/storage/schema/main/delta/93/02_sliding_sync_members.sql +60 -0
  1160. synapse/storage/schema/main/delta/93/03_sss_pos_last_used.sql +27 -0
  1161. synapse/storage/schema/main/full_schemas/72/full.sql.postgres +1344 -0
  1162. synapse/storage/schema/main/full_schemas/72/full.sql.sqlite +646 -0
  1163. synapse/storage/schema/state/delta/23/drop_state_index.sql +35 -0
  1164. synapse/storage/schema/state/delta/32/remove_state_indices.sql +38 -0
  1165. synapse/storage/schema/state/delta/35/add_state_index.sql +36 -0
  1166. synapse/storage/schema/state/delta/35/state.sql +41 -0
  1167. synapse/storage/schema/state/delta/35/state_dedupe.sql +36 -0
  1168. synapse/storage/schema/state/delta/47/state_group_seq.py +38 -0
  1169. synapse/storage/schema/state/delta/56/state_group_room_idx.sql +36 -0
  1170. synapse/storage/schema/state/delta/61/02state_groups_state_n_distinct.sql.postgres +34 -0
  1171. synapse/storage/schema/state/delta/70/08_state_group_edges_unique.sql +36 -0
  1172. synapse/storage/schema/state/delta/89/01_state_groups_deletion.sql +39 -0
  1173. synapse/storage/schema/state/delta/90/02_delete_unreferenced_state_groups.sql +16 -0
  1174. synapse/storage/schema/state/delta/90/03_remove_old_deletion_bg_update.sql +15 -0
  1175. synapse/storage/schema/state/full_schemas/72/full.sql.postgres +30 -0
  1176. synapse/storage/schema/state/full_schemas/72/full.sql.sqlite +20 -0
  1177. synapse/storage/types.py +183 -0
  1178. synapse/storage/util/__init__.py +20 -0
  1179. synapse/storage/util/id_generators.py +928 -0
  1180. synapse/storage/util/partial_state_events_tracker.py +194 -0
  1181. synapse/storage/util/sequence.py +315 -0
  1182. synapse/streams/__init__.py +43 -0
  1183. synapse/streams/config.py +91 -0
  1184. synapse/streams/events.py +203 -0
  1185. synapse/synapse_rust/__init__.pyi +3 -0
  1186. synapse/synapse_rust/acl.pyi +20 -0
  1187. synapse/synapse_rust/events.pyi +136 -0
  1188. synapse/synapse_rust/http_client.pyi +32 -0
  1189. synapse/synapse_rust/push.pyi +86 -0
  1190. synapse/synapse_rust/rendezvous.pyi +30 -0
  1191. synapse/synapse_rust/segmenter.pyi +1 -0
  1192. synapse/synapse_rust.abi3.so +0 -0
  1193. synapse/types/__init__.py +1600 -0
  1194. synapse/types/handlers/__init__.py +93 -0
  1195. synapse/types/handlers/policy_server.py +16 -0
  1196. synapse/types/handlers/sliding_sync.py +1004 -0
  1197. synapse/types/rest/__init__.py +25 -0
  1198. synapse/types/rest/client/__init__.py +413 -0
  1199. synapse/types/state.py +634 -0
  1200. synapse/types/storage/__init__.py +66 -0
  1201. synapse/util/__init__.py +160 -0
  1202. synapse/util/async_helpers.py +1048 -0
  1203. synapse/util/background_queue.py +142 -0
  1204. synapse/util/batching_queue.py +203 -0
  1205. synapse/util/caches/__init__.py +300 -0
  1206. synapse/util/caches/cached_call.py +143 -0
  1207. synapse/util/caches/deferred_cache.py +530 -0
  1208. synapse/util/caches/descriptors.py +692 -0
  1209. synapse/util/caches/dictionary_cache.py +346 -0
  1210. synapse/util/caches/expiringcache.py +250 -0
  1211. synapse/util/caches/lrucache.py +976 -0
  1212. synapse/util/caches/response_cache.py +323 -0
  1213. synapse/util/caches/stream_change_cache.py +370 -0
  1214. synapse/util/caches/treecache.py +189 -0
  1215. synapse/util/caches/ttlcache.py +197 -0
  1216. synapse/util/cancellation.py +63 -0
  1217. synapse/util/check_dependencies.py +335 -0
  1218. synapse/util/clock.py +592 -0
  1219. synapse/util/daemonize.py +165 -0
  1220. synapse/util/distributor.py +157 -0
  1221. synapse/util/duration.py +117 -0
  1222. synapse/util/events.py +134 -0
  1223. synapse/util/file_consumer.py +164 -0
  1224. synapse/util/frozenutils.py +57 -0
  1225. synapse/util/gai_resolver.py +178 -0
  1226. synapse/util/hash.py +38 -0
  1227. synapse/util/httpresourcetree.py +108 -0
  1228. synapse/util/iterutils.py +190 -0
  1229. synapse/util/json.py +56 -0
  1230. synapse/util/linked_list.py +156 -0
  1231. synapse/util/logcontext.py +46 -0
  1232. synapse/util/logformatter.py +28 -0
  1233. synapse/util/macaroons.py +325 -0
  1234. synapse/util/manhole.py +191 -0
  1235. synapse/util/metrics.py +339 -0
  1236. synapse/util/module_loader.py +116 -0
  1237. synapse/util/msisdn.py +51 -0
  1238. synapse/util/patch_inline_callbacks.py +250 -0
  1239. synapse/util/pydantic_models.py +63 -0
  1240. synapse/util/ratelimitutils.py +422 -0
  1241. synapse/util/retryutils.py +339 -0
  1242. synapse/util/rlimit.py +42 -0
  1243. synapse/util/rust.py +164 -0
  1244. synapse/util/sentinel.py +21 -0
  1245. synapse/util/stringutils.py +293 -0
  1246. synapse/util/task_scheduler.py +494 -0
  1247. synapse/util/templates.py +126 -0
  1248. synapse/util/threepids.py +123 -0
  1249. synapse/util/wheel_timer.py +112 -0
  1250. synapse/visibility.py +869 -0
  1251. synmark/__init__.py +47 -0
  1252. synmark/__main__.py +128 -0
  1253. synmark/suites/__init__.py +9 -0
  1254. synmark/suites/logging.py +154 -0
  1255. synmark/suites/lrucache.py +48 -0
  1256. synmark/suites/lrucache_evict.py +49 -0
  1257. sytest-blacklist +33 -0
  1258. tests/__init__.py +29 -0
  1259. tests/api/__init__.py +0 -0
  1260. tests/api/test_auth.py +548 -0
  1261. tests/api/test_errors.py +46 -0
  1262. tests/api/test_filtering.py +622 -0
  1263. tests/api/test_ratelimiting.py +505 -0
  1264. tests/api/test_urls.py +81 -0
  1265. tests/app/__init__.py +0 -0
  1266. tests/app/test_homeserver_shutdown.py +271 -0
  1267. tests/app/test_homeserver_start.py +49 -0
  1268. tests/app/test_openid_listener.py +139 -0
  1269. tests/app/test_phone_stats_home.py +248 -0
  1270. tests/appservice/__init__.py +20 -0
  1271. tests/appservice/test_api.py +253 -0
  1272. tests/appservice/test_appservice.py +259 -0
  1273. tests/appservice/test_scheduler.py +477 -0
  1274. tests/config/__init__.py +20 -0
  1275. tests/config/test___main__.py +38 -0
  1276. tests/config/test_api.py +146 -0
  1277. tests/config/test_appservice.py +48 -0
  1278. tests/config/test_background_update.py +65 -0
  1279. tests/config/test_base.py +151 -0
  1280. tests/config/test_cache.py +193 -0
  1281. tests/config/test_database.py +42 -0
  1282. tests/config/test_generate.py +72 -0
  1283. tests/config/test_load.py +322 -0
  1284. tests/config/test_oauth_delegation.py +454 -0
  1285. tests/config/test_ratelimiting.py +77 -0
  1286. tests/config/test_registration_config.py +203 -0
  1287. tests/config/test_room_directory.py +203 -0
  1288. tests/config/test_server.py +248 -0
  1289. tests/config/test_tls.py +209 -0
  1290. tests/config/test_util.py +59 -0
  1291. tests/config/test_workers.py +332 -0
  1292. tests/config/utils.py +66 -0
  1293. tests/crypto/__init__.py +20 -0
  1294. tests/crypto/test_event_signing.py +109 -0
  1295. tests/crypto/test_keyring.py +737 -0
  1296. tests/events/__init__.py +0 -0
  1297. tests/events/test_auto_accept_invites.py +827 -0
  1298. tests/events/test_presence_router.py +540 -0
  1299. tests/events/test_snapshot.py +121 -0
  1300. tests/events/test_utils.py +986 -0
  1301. tests/federation/__init__.py +0 -0
  1302. tests/federation/test_complexity.py +257 -0
  1303. tests/federation/test_federation_catch_up.py +585 -0
  1304. tests/federation/test_federation_client.py +316 -0
  1305. tests/federation/test_federation_devices.py +161 -0
  1306. tests/federation/test_federation_media.py +295 -0
  1307. tests/federation/test_federation_out_of_band_membership.py +671 -0
  1308. tests/federation/test_federation_sender.py +956 -0
  1309. tests/federation/test_federation_server.py +631 -0
  1310. tests/federation/transport/__init__.py +0 -0
  1311. tests/federation/transport/server/__init__.py +20 -0
  1312. tests/federation/transport/server/test__base.py +156 -0
  1313. tests/federation/transport/test_client.py +157 -0
  1314. tests/federation/transport/test_knocking.py +323 -0
  1315. tests/federation/transport/test_server.py +74 -0
  1316. tests/handlers/__init__.py +0 -0
  1317. tests/handlers/oidc_test_key.p8 +5 -0
  1318. tests/handlers/oidc_test_key.pub.pem +4 -0
  1319. tests/handlers/test_admin.py +361 -0
  1320. tests/handlers/test_appservice.py +1336 -0
  1321. tests/handlers/test_auth.py +248 -0
  1322. tests/handlers/test_cas.py +239 -0
  1323. tests/handlers/test_deactivate_account.py +485 -0
  1324. tests/handlers/test_device.py +665 -0
  1325. tests/handlers/test_directory.py +613 -0
  1326. tests/handlers/test_e2e_keys.py +2025 -0
  1327. tests/handlers/test_e2e_room_keys.py +569 -0
  1328. tests/handlers/test_federation.py +794 -0
  1329. tests/handlers/test_federation_event.py +1181 -0
  1330. tests/handlers/test_message.py +322 -0
  1331. tests/handlers/test_oauth_delegation.py +1314 -0
  1332. tests/handlers/test_oidc.py +1688 -0
  1333. tests/handlers/test_password_providers.py +987 -0
  1334. tests/handlers/test_presence.py +2144 -0
  1335. tests/handlers/test_profile.py +401 -0
  1336. tests/handlers/test_receipts.py +342 -0
  1337. tests/handlers/test_register.py +880 -0
  1338. tests/handlers/test_room.py +108 -0
  1339. tests/handlers/test_room_list.py +93 -0
  1340. tests/handlers/test_room_member.py +764 -0
  1341. tests/handlers/test_room_policy.py +468 -0
  1342. tests/handlers/test_room_summary.py +1248 -0
  1343. tests/handlers/test_saml.py +427 -0
  1344. tests/handlers/test_send_email.py +230 -0
  1345. tests/handlers/test_sliding_sync.py +5065 -0
  1346. tests/handlers/test_sso.py +152 -0
  1347. tests/handlers/test_stats.py +594 -0
  1348. tests/handlers/test_sync.py +1275 -0
  1349. tests/handlers/test_typing.py +557 -0
  1350. tests/handlers/test_user_directory.py +1435 -0
  1351. tests/handlers/test_worker_lock.py +126 -0
  1352. tests/http/__init__.py +196 -0
  1353. tests/http/ca.crt +19 -0
  1354. tests/http/ca.key +27 -0
  1355. tests/http/federation/__init__.py +19 -0
  1356. tests/http/federation/test_matrix_federation_agent.py +1855 -0
  1357. tests/http/federation/test_srv_resolver.py +220 -0
  1358. tests/http/server/__init__.py +20 -0
  1359. tests/http/server/_base.py +621 -0
  1360. tests/http/server.key +27 -0
  1361. tests/http/test_additional_resource.py +76 -0
  1362. tests/http/test_client.py +422 -0
  1363. tests/http/test_endpoint.py +62 -0
  1364. tests/http/test_matrixfederationclient.py +1092 -0
  1365. tests/http/test_proxy.py +75 -0
  1366. tests/http/test_proxyagent.py +1008 -0
  1367. tests/http/test_servlet.py +145 -0
  1368. tests/http/test_simple_client.py +188 -0
  1369. tests/http/test_site.py +247 -0
  1370. tests/logging/__init__.py +42 -0
  1371. tests/logging/test_loggers.py +127 -0
  1372. tests/logging/test_opentracing.py +524 -0
  1373. tests/logging/test_remote_handler.py +184 -0
  1374. tests/logging/test_terse_json.py +253 -0
  1375. tests/media/__init__.py +20 -0
  1376. tests/media/test_base.py +88 -0
  1377. tests/media/test_filepath.py +602 -0
  1378. tests/media/test_html_preview.py +565 -0
  1379. tests/media/test_media_retention.py +299 -0
  1380. tests/media/test_media_storage.py +1401 -0
  1381. tests/media/test_oembed.py +172 -0
  1382. tests/media/test_url_previewer.py +120 -0
  1383. tests/metrics/__init__.py +0 -0
  1384. tests/metrics/test_background_process_metrics.py +21 -0
  1385. tests/metrics/test_metrics.py +407 -0
  1386. tests/metrics/test_phone_home_stats.py +263 -0
  1387. tests/module_api/__init__.py +0 -0
  1388. tests/module_api/test_account_data_manager.py +171 -0
  1389. tests/module_api/test_api.py +1035 -0
  1390. tests/module_api/test_event_unsigned_addition.py +66 -0
  1391. tests/module_api/test_spamchecker.py +286 -0
  1392. tests/push/__init__.py +0 -0
  1393. tests/push/test_bulk_push_rule_evaluator.py +652 -0
  1394. tests/push/test_email.py +570 -0
  1395. tests/push/test_http.py +1247 -0
  1396. tests/push/test_presentable_names.py +238 -0
  1397. tests/push/test_push_rule_evaluator.py +1069 -0
  1398. tests/replication/__init__.py +20 -0
  1399. tests/replication/_base.py +619 -0
  1400. tests/replication/http/__init__.py +20 -0
  1401. tests/replication/http/test__base.py +113 -0
  1402. tests/replication/storage/__init__.py +20 -0
  1403. tests/replication/storage/_base.py +85 -0
  1404. tests/replication/storage/test_events.py +299 -0
  1405. tests/replication/tcp/__init__.py +19 -0
  1406. tests/replication/tcp/streams/__init__.py +19 -0
  1407. tests/replication/tcp/streams/test_account_data.py +133 -0
  1408. tests/replication/tcp/streams/test_events.py +565 -0
  1409. tests/replication/tcp/streams/test_federation.py +117 -0
  1410. tests/replication/tcp/streams/test_partial_state.py +72 -0
  1411. tests/replication/tcp/streams/test_receipts.py +110 -0
  1412. tests/replication/tcp/streams/test_thread_subscriptions.py +157 -0
  1413. tests/replication/tcp/streams/test_to_device.py +112 -0
  1414. tests/replication/tcp/streams/test_typing.py +223 -0
  1415. tests/replication/tcp/test_commands.py +50 -0
  1416. tests/replication/tcp/test_handler.py +211 -0
  1417. tests/replication/test_auth.py +120 -0
  1418. tests/replication/test_client_reader_shard.py +101 -0
  1419. tests/replication/test_federation_ack.py +88 -0
  1420. tests/replication/test_federation_sender_shard.py +352 -0
  1421. tests/replication/test_module_cache_invalidation.py +89 -0
  1422. tests/replication/test_multi_media_repo.py +496 -0
  1423. tests/replication/test_pusher_shard.py +192 -0
  1424. tests/replication/test_sharded_event_persister.py +332 -0
  1425. tests/replication/test_sharded_receipts.py +250 -0
  1426. tests/rest/__init__.py +20 -0
  1427. tests/rest/admin/__init__.py +19 -0
  1428. tests/rest/admin/test_admin.py +614 -0
  1429. tests/rest/admin/test_background_updates.py +375 -0
  1430. tests/rest/admin/test_device.py +600 -0
  1431. tests/rest/admin/test_event.py +74 -0
  1432. tests/rest/admin/test_event_reports.py +781 -0
  1433. tests/rest/admin/test_federation.py +863 -0
  1434. tests/rest/admin/test_jwks.py +106 -0
  1435. tests/rest/admin/test_media.py +1091 -0
  1436. tests/rest/admin/test_registration_tokens.py +729 -0
  1437. tests/rest/admin/test_room.py +3626 -0
  1438. tests/rest/admin/test_scheduled_tasks.py +192 -0
  1439. tests/rest/admin/test_server_notice.py +753 -0
  1440. tests/rest/admin/test_statistics.py +523 -0
  1441. tests/rest/admin/test_user.py +6061 -0
  1442. tests/rest/admin/test_username_available.py +82 -0
  1443. tests/rest/client/__init__.py +20 -0
  1444. tests/rest/client/sliding_sync/__init__.py +13 -0
  1445. tests/rest/client/sliding_sync/test_connection_tracking.py +505 -0
  1446. tests/rest/client/sliding_sync/test_extension_account_data.py +1056 -0
  1447. tests/rest/client/sliding_sync/test_extension_e2ee.py +459 -0
  1448. tests/rest/client/sliding_sync/test_extension_receipts.py +934 -0
  1449. tests/rest/client/sliding_sync/test_extension_thread_subscriptions.py +497 -0
  1450. tests/rest/client/sliding_sync/test_extension_to_device.py +294 -0
  1451. tests/rest/client/sliding_sync/test_extension_typing.py +500 -0
  1452. tests/rest/client/sliding_sync/test_extensions.py +306 -0
  1453. tests/rest/client/sliding_sync/test_lists_filters.py +1975 -0
  1454. tests/rest/client/sliding_sync/test_room_subscriptions.py +303 -0
  1455. tests/rest/client/sliding_sync/test_rooms_invites.py +528 -0
  1456. tests/rest/client/sliding_sync/test_rooms_meta.py +1338 -0
  1457. tests/rest/client/sliding_sync/test_rooms_required_state.py +2247 -0
  1458. tests/rest/client/sliding_sync/test_rooms_timeline.py +718 -0
  1459. tests/rest/client/sliding_sync/test_sliding_sync.py +1688 -0
  1460. tests/rest/client/test_account.py +1543 -0
  1461. tests/rest/client/test_account_data.py +81 -0
  1462. tests/rest/client/test_auth.py +1508 -0
  1463. tests/rest/client/test_auth_metadata.py +145 -0
  1464. tests/rest/client/test_capabilities.py +318 -0
  1465. tests/rest/client/test_consent.py +138 -0
  1466. tests/rest/client/test_delayed_events.py +553 -0
  1467. tests/rest/client/test_devices.py +634 -0
  1468. tests/rest/client/test_directory.py +249 -0
  1469. tests/rest/client/test_ephemeral_message.py +113 -0
  1470. tests/rest/client/test_events.py +165 -0
  1471. tests/rest/client/test_filter.py +124 -0
  1472. tests/rest/client/test_identity.py +67 -0
  1473. tests/rest/client/test_keys.py +516 -0
  1474. tests/rest/client/test_login.py +1881 -0
  1475. tests/rest/client/test_login_token_request.py +175 -0
  1476. tests/rest/client/test_matrixrtc.py +105 -0
  1477. tests/rest/client/test_media.py +3156 -0
  1478. tests/rest/client/test_models.py +83 -0
  1479. tests/rest/client/test_mutual_rooms.py +235 -0
  1480. tests/rest/client/test_notifications.py +231 -0
  1481. tests/rest/client/test_owned_state.py +308 -0
  1482. tests/rest/client/test_password_policy.py +186 -0
  1483. tests/rest/client/test_power_levels.py +295 -0
  1484. tests/rest/client/test_presence.py +149 -0
  1485. tests/rest/client/test_profile.py +925 -0
  1486. tests/rest/client/test_push_rule_attrs.py +510 -0
  1487. tests/rest/client/test_read_marker.py +151 -0
  1488. tests/rest/client/test_receipts.py +287 -0
  1489. tests/rest/client/test_redactions.py +657 -0
  1490. tests/rest/client/test_register.py +1314 -0
  1491. tests/rest/client/test_relations.py +1954 -0
  1492. tests/rest/client/test_rendezvous.py +468 -0
  1493. tests/rest/client/test_reporting.py +324 -0
  1494. tests/rest/client/test_retention.py +389 -0
  1495. tests/rest/client/test_rooms.py +5486 -0
  1496. tests/rest/client/test_sendtodevice.py +271 -0
  1497. tests/rest/client/test_shadow_banned.py +335 -0
  1498. tests/rest/client/test_sync.py +1147 -0
  1499. tests/rest/client/test_tags.py +161 -0
  1500. tests/rest/client/test_third_party_rules.py +1076 -0
  1501. tests/rest/client/test_thread_subscriptions.py +351 -0
  1502. tests/rest/client/test_transactions.py +204 -0
  1503. tests/rest/client/test_typing.py +114 -0
  1504. tests/rest/client/test_upgrade_room.py +433 -0
  1505. tests/rest/client/utils.py +985 -0
  1506. tests/rest/key/__init__.py +0 -0
  1507. tests/rest/key/v2/__init__.py +0 -0
  1508. tests/rest/key/v2/test_remote_key_resource.py +282 -0
  1509. tests/rest/media/__init__.py +19 -0
  1510. tests/rest/media/test_domain_blocking.py +148 -0
  1511. tests/rest/media/test_url_preview.py +1445 -0
  1512. tests/rest/synapse/__init__.py +12 -0
  1513. tests/rest/synapse/client/__init__.py +12 -0
  1514. tests/rest/synapse/client/test_federation_whitelist.py +118 -0
  1515. tests/rest/synapse/mas/__init__.py +12 -0
  1516. tests/rest/synapse/mas/_base.py +43 -0
  1517. tests/rest/synapse/mas/test_devices.py +693 -0
  1518. tests/rest/synapse/mas/test_users.py +1399 -0
  1519. tests/rest/test_health.py +35 -0
  1520. tests/rest/test_well_known.py +155 -0
  1521. tests/scripts/__init__.py +0 -0
  1522. tests/scripts/test_new_matrix_user.py +172 -0
  1523. tests/server.py +1374 -0
  1524. tests/server_notices/__init__.py +241 -0
  1525. tests/server_notices/test_consent.py +111 -0
  1526. tests/server_notices/test_resource_limits_server_notices.py +409 -0
  1527. tests/state/__init__.py +0 -0
  1528. tests/state/test_v2.py +1096 -0
  1529. tests/state/test_v21.py +506 -0
  1530. tests/storage/__init__.py +0 -0
  1531. tests/storage/databases/__init__.py +20 -0
  1532. tests/storage/databases/main/__init__.py +20 -0
  1533. tests/storage/databases/main/test_cache.py +124 -0
  1534. tests/storage/databases/main/test_deviceinbox.py +323 -0
  1535. tests/storage/databases/main/test_end_to_end_keys.py +127 -0
  1536. tests/storage/databases/main/test_events_worker.py +594 -0
  1537. tests/storage/databases/main/test_lock.py +499 -0
  1538. tests/storage/databases/main/test_metrics.py +88 -0
  1539. tests/storage/databases/main/test_receipts.py +218 -0
  1540. tests/storage/databases/main/test_room.py +192 -0
  1541. tests/storage/test__base.py +178 -0
  1542. tests/storage/test_account_data.py +186 -0
  1543. tests/storage/test_appservice.py +568 -0
  1544. tests/storage/test_background_update.py +671 -0
  1545. tests/storage/test_base.py +813 -0
  1546. tests/storage/test_cleanup_extrems.py +396 -0
  1547. tests/storage/test_client_ips.py +788 -0
  1548. tests/storage/test_database.py +288 -0
  1549. tests/storage/test_devices.py +353 -0
  1550. tests/storage/test_directory.py +74 -0
  1551. tests/storage/test_e2e_room_keys.py +87 -0
  1552. tests/storage/test_end_to_end_keys.py +120 -0
  1553. tests/storage/test_event_chain.py +826 -0
  1554. tests/storage/test_event_federation.py +1433 -0
  1555. tests/storage/test_event_push_actions.py +809 -0
  1556. tests/storage/test_events.py +591 -0
  1557. tests/storage/test_events_bg_updates.py +156 -0
  1558. tests/storage/test_id_generators.py +791 -0
  1559. tests/storage/test_invite_rule.py +171 -0
  1560. tests/storage/test_main.py +56 -0
  1561. tests/storage/test_monthly_active_users.py +500 -0
  1562. tests/storage/test_profile.py +134 -0
  1563. tests/storage/test_purge.py +459 -0
  1564. tests/storage/test_receipts.py +309 -0
  1565. tests/storage/test_redaction.py +462 -0
  1566. tests/storage/test_registration.py +277 -0
  1567. tests/storage/test_relations.py +118 -0
  1568. tests/storage/test_rollback_worker.py +132 -0
  1569. tests/storage/test_room.py +69 -0
  1570. tests/storage/test_room_search.py +383 -0
  1571. tests/storage/test_roommember.py +812 -0
  1572. tests/storage/test_sliding_sync_tables.py +5187 -0
  1573. tests/storage/test_state.py +959 -0
  1574. tests/storage/test_state_deletion.py +475 -0
  1575. tests/storage/test_stream.py +1533 -0
  1576. tests/storage/test_thread_subscriptions.py +369 -0
  1577. tests/storage/test_transactions.py +77 -0
  1578. tests/storage/test_txn_limit.py +49 -0
  1579. tests/storage/test_unsafe_locale.py +67 -0
  1580. tests/storage/test_user_directory.py +691 -0
  1581. tests/storage/test_user_filters.py +101 -0
  1582. tests/storage/util/__init__.py +20 -0
  1583. tests/storage/util/test_partial_state_events_tracker.py +181 -0
  1584. tests/synapse_rust/__init__.py +11 -0
  1585. tests/synapse_rust/test_http_client.py +225 -0
  1586. tests/test_distributor.py +74 -0
  1587. tests/test_event_auth.py +921 -0
  1588. tests/test_mau.py +347 -0
  1589. tests/test_phone_home.py +102 -0
  1590. tests/test_rust.py +11 -0
  1591. tests/test_server.py +557 -0
  1592. tests/test_state.py +902 -0
  1593. tests/test_terms_auth.py +128 -0
  1594. tests/test_types.py +201 -0
  1595. tests/test_utils/__init__.py +161 -0
  1596. tests/test_utils/event_injection.py +150 -0
  1597. tests/test_utils/html_parsers.py +59 -0
  1598. tests/test_utils/logging_setup.py +74 -0
  1599. tests/test_utils/oidc.py +370 -0
  1600. tests/test_visibility.py +712 -0
  1601. tests/types/__init__.py +0 -0
  1602. tests/types/test_init.py +51 -0
  1603. tests/types/test_state.py +627 -0
  1604. tests/unittest.py +1108 -0
  1605. tests/util/__init__.py +20 -0
  1606. tests/util/caches/__init__.py +20 -0
  1607. tests/util/caches/test_cached_call.py +168 -0
  1608. tests/util/caches/test_deferred_cache.py +317 -0
  1609. tests/util/caches/test_descriptors.py +1110 -0
  1610. tests/util/caches/test_response_cache.py +225 -0
  1611. tests/util/caches/test_ttlcache.py +90 -0
  1612. tests/util/test_async_helpers.py +808 -0
  1613. tests/util/test_background_queue.py +117 -0
  1614. tests/util/test_batching_queue.py +252 -0
  1615. tests/util/test_check_dependencies.py +243 -0
  1616. tests/util/test_dict_cache.py +130 -0
  1617. tests/util/test_events.py +118 -0
  1618. tests/util/test_expiring_cache.py +113 -0
  1619. tests/util/test_file_consumer.py +199 -0
  1620. tests/util/test_itertools.py +190 -0
  1621. tests/util/test_linearizer.py +264 -0
  1622. tests/util/test_logcontext.py +715 -0
  1623. tests/util/test_logformatter.py +44 -0
  1624. tests/util/test_lrucache.py +479 -0
  1625. tests/util/test_macaroons.py +126 -0
  1626. tests/util/test_mutable_overlay_mapping.py +189 -0
  1627. tests/util/test_ratelimitutils.py +146 -0
  1628. tests/util/test_retryutils.py +314 -0
  1629. tests/util/test_rwlock.py +401 -0
  1630. tests/util/test_stream_change_cache.py +304 -0
  1631. tests/util/test_stringutils.py +86 -0
  1632. tests/util/test_task_scheduler.py +227 -0
  1633. tests/util/test_threepids.py +55 -0
  1634. tests/util/test_treecache.py +93 -0
  1635. tests/util/test_wheel_timer.py +82 -0
  1636. tests/utils.py +342 -0
docs/upgrade.md ADDED
@@ -0,0 +1,2876 @@
1
+ # Upgrading Synapse
2
+
3
+ Before upgrading check if any special steps are required to upgrade from
4
+ the version you currently have installed to the current version of
5
+ Synapse. The extra instructions that may be required are listed later in
6
+ this document.
7
+
8
+ - Check that your versions of Python and PostgreSQL are still
9
+ supported.
10
+
11
+ Synapse follows upstream lifecycles for [Python](https://endoflife.date/python) and
12
+ [PostgreSQL](https://endoflife.date/postgresql), and removes support for versions
13
+ which are no longer maintained.
14
+
15
+ The website <https://endoflife.date> also offers convenient
16
+ summaries.
17
+
18
+ - If Synapse was installed using [prebuilt packages](setup/installation.md#prebuilt-packages),
19
+ you will need to follow the normal process for upgrading those packages.
20
+
21
+ - If Synapse was installed using pip then upgrade to the latest
22
+ version by running:
23
+
24
+ ```bash
25
+ pip install --upgrade matrix-synapse
26
+ ```
27
+
28
+ - If Synapse was installed from source, then:
29
+
30
+ 1. Obtain the latest version of the source code. Git users can run
31
+ `git pull` to do this.
32
+
33
+ 2. If you're running Synapse in a virtualenv, make sure to activate it before
34
+ upgrading. For example, if Synapse is installed in a virtualenv in `~/synapse/env` then
35
+ run:
36
+
37
+ ```bash
38
+ source ~/synapse/env/bin/activate
39
+ pip install --upgrade .
40
+ ```
41
+ Include any relevant extras between square brackets, e.g. `pip install --upgrade ".[postgres,oidc]"`.
42
+
43
+ 3. If you're using `poetry` to manage a Synapse installation, run:
44
+ ```bash
45
+ poetry install
46
+ ```
47
+ Include any relevant extras with `--extras`, e.g. `poetry install --extras postgres --extras oidc`.
48
+ It's probably easiest to run `poetry install --extras all`.
49
+
50
+ 4. Restart Synapse:
51
+
52
+ ```bash
53
+ synctl restart
54
+ ```
55
+
56
+ To check whether your update was successful, you can check the running
57
+ server version with:
58
+
59
+ ```bash
60
+ # you may need to replace 'localhost:8008' if synapse is not configured
61
+ # to listen on port 8008.
62
+
63
+ curl http://localhost:8008/_synapse/admin/v1/server_version
64
+ ```
65
+
66
+ ## Rolling back to older versions
67
+
68
+ Rolling back to previous releases can be difficult, due to database
69
+ schema changes between releases. Where we have been able to test the
70
+ rollback process, this will be noted below.
71
+
72
+ In general, you will need to undo any changes made during the upgrade
73
+ process, for example:
74
+
75
+ - pip:
76
+
77
+ ```bash
78
+ source env/bin/activate
79
+ # replace `1.3.0` accordingly:
80
+ pip install matrix-synapse==1.3.0
81
+ ```
82
+
83
+ - Debian:
84
+
85
+ ```bash
86
+ # replace `1.3.0` and `stretch` accordingly:
87
+ wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
88
+ dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
89
+ ```
90
+
91
+ Generally Synapse database schemas are compatible across multiple versions, but once
92
+ a version of Synapse is deployed you may not be able to roll back automatically.
93
+ The following table gives the version ranges and the earliest version they can
94
+ be rolled back to. E.g. Synapse versions v1.58.0 through v1.61.1 can be rolled
95
+ back safely to v1.57.0, but starting with v1.62.0 it is only safe to roll back to
96
+ v1.61.0.
97
+
98
+ <!-- REPLACE_WITH_SCHEMA_VERSIONS -->
99
+
100
+ ## Upgrading from a very old version
101
+
102
+ You need to read all of the upgrade notes for each version between your current
103
+ version and the latest so that you can update your dependencies, environment,
104
+ config files, etc. if necessary. But you do not need to perform an
105
+ upgrade to each individual version that was missed.
106
+
107
+ We do not have a list of which versions must be installed. Instead, we recommend
108
+ that you upgrade through each incompatible database schema version, which would
109
+ give you the ability to roll back the maximum number of versions should anything
110
+ go wrong. See [Rolling back to older versions](#rolling-back-to-older-versions)
111
+ above.
112
+
113
+ Additionally, new versions of Synapse will occasionally run database migrations
114
+ and background updates to update the database. Synapse will not start until
115
+ database migrations are complete. You should wait until background updates from
116
+ each upgrade are complete before moving on to the next upgrade, to avoid
117
+ stacking them up. You can monitor the currently running background updates with
118
+ [the Admin API](usage/administration/admin_api/background_updates.html#status).
119
+
120
+ # Upgrading to v1.144.0
121
+
122
+ ## Worker support for unstable MSC4140 `/restart` endpoint
123
+
124
+ The following unstable endpoint pattern may now be routed to worker processes:
125
+
126
+ ```
127
+ ^/_matrix/client/unstable/org.matrix.msc4140/delayed_events/.*/restart$
128
+ ```
129
+
130
+ ## Unstable mutual rooms endpoint is now behind an experimental feature flag
131
+
132
+ The unstable mutual rooms endpoint from
133
+ [MSC2666](https://github.com/matrix-org/matrix-spec-proposals/pull/2666)
134
+ (`/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms`) is now
135
+ disabled by default. If you rely on this unstable endpoint, you must now set
136
+ `experimental_features.msc2666_enabled: true` in your configuration to keep
137
+ using it.
138
+
139
+ # Upgrading to v1.143.0
140
+
141
+ ## Dropping support for PostgreSQL 13
142
+
143
+ In line with our [deprecation policy](deprecation_policy.md), we've dropped
144
+ support for PostgreSQL 13, as it is no longer supported upstream.
145
+ This release of Synapse requires PostgreSQL 14+.
146
+
147
+ # Upgrading to v1.142.0
148
+
149
+ ## Python 3.10+ is now required
150
+
151
+ The minimum supported Python version has been increased from v3.9 to v3.10.
152
+ You will need Python 3.10+ to run Synapse v1.142.0.
153
+
154
+ If you use current versions of the
155
+ [matrixorg/synapse](setup/installation.html#docker-images-and-ansible-playbooks)
156
+ Docker images, no action is required.
157
+
158
+ ## SQLite 3.40.0+ is now required
159
+
160
+ The minimum supported SQLite version has been increased from 3.27.0 to 3.40.0.
161
+
162
+ If you use current versions of the
163
+ [matrixorg/synapse](setup/installation.html#docker-images-and-ansible-playbooks)
164
+ Docker images, no action is required.
165
+
166
+
167
+ # Upgrading to v1.141.0
168
+
169
+ ## Docker images now based on Debian `trixie` with Python 3.13
170
+
171
+ The Docker images are now based on Debian `trixie` and use Python 3.13. If you
172
+ are using the Docker images as a base image you may need to e.g. adjust the
173
+ paths you mount any additional Python packages at.
174
+
175
+ # Upgrading to v1.140.0
176
+
177
+ ## Users of `synapse-s3-storage-provider` must update the module to `v1.6.0`
178
+
179
+ Deployments that make use of the
180
+ [synapse-s3-storage-provider](https://github.com/matrix-org/synapse-s3-storage-provider/)
181
+ module must update it to
182
+ [v1.6.0](https://github.com/matrix-org/synapse-s3-storage-provider/releases/tag/v1.6.0),
183
+ otherwise users will be unable to upload or download media.
184
+
185
+ # Upgrading to v1.139.0
186
+
187
+ ## `/register` requests from old application service implementations may break when using MAS
188
+
189
+ Application Services that do not set `inhibit_login=true` when calling `POST
190
+ /_matrix/client/v3/register` will receive the error
191
+ `IO.ELEMENT.MSC4190.M_APPSERVICE_LOGIN_UNSUPPORTED` in response. This is a
192
+ result of [MSC4190: Device management for application
193
+ services](https://github.com/matrix-org/matrix-spec-proposals/pull/4190) which
194
+ adds new endpoints for application services to create encryption-ready devices
195
+ with other than `/login` or `/register` without `inhibit_login=true`.
196
+
197
+ If an application service you use starts to fail with the mentioned error,
198
+ ensure it is up to date. If it is, then kindly let the author know that they
199
+ need to update their implementation to call `/register` with
200
+ `inhibit_login=true`.
201
+
202
+ # Upgrading to v1.138.2
203
+
204
+ ## Drop support for Ubuntu 24.10 Oracular Oriole, and add support for Ubuntu 25.04 Plucky Puffin
205
+
206
+ Ubuntu 24.10 Oracular Oriole [has been end-of-life since 10 Jul
207
+ 2025](https://endoflife.date/ubuntu). This release drops support for Ubuntu
208
+ 24.10, and in its place adds support for Ubuntu 25.04 Plucky Puffin.
209
+
210
+ This notice also applies to the v1.139.0 release.
211
+
212
+ # Upgrading to v1.136.0
213
+
214
+ ## Deprecate `run_as_background_process` exported as part of the module API interface in favor of `ModuleApi.run_as_background_process`
215
+
216
+ The `run_as_background_process` function is now a method of the `ModuleApi` class. If
217
+ you were using the function directly from the module API, it will continue to work fine
218
+ but the background process metrics will not include an accurate `server_name` label.
219
+ This kind of metric labeling isn't relevant for many use cases and is used to
220
+ differentiate Synapse instances running in the same Python process (relevant to Synapse
221
+ Pro: Small Hosts). We recommend updating your usage to use the new
222
+ `ModuleApi.run_as_background_process` method to stay on top of future changes.
223
+
224
+ <details>
225
+ <summary>Example <code>run_as_background_process</code> upgrade</summary>
226
+
227
+ Before:
228
+ ```python
229
+ class MyModule:
230
+ def __init__(self, module_api: ModuleApi) -> None:
231
+ run_as_background_process(__name__ + ":setup_database", self.setup_database)
232
+ ```
233
+
234
+ After:
235
+ ```python
236
+ class MyModule:
237
+ def __init__(self, module_api: ModuleApi) -> None:
238
+ module_api.run_as_background_process(__name__ + ":setup_database", self.setup_database)
239
+ ```
240
+
241
+ </details>
242
+
243
+ ## Metric labels have changed on `synapse_federation_last_received_pdu_time` and `synapse_federation_last_sent_pdu_time`
244
+
245
+ Previously, the `synapse_federation_last_received_pdu_time` and
246
+ `synapse_federation_last_sent_pdu_time` metrics both used the `server_name` label to
247
+ differentiate between different servers that we send and receive events from.
248
+
249
+ Since we're now using the `server_name` label to differentiate between different Synapse
250
+ homeserver instances running in the same process, these metrics have been changed as follows:
251
+
252
+ - `synapse_federation_last_received_pdu_time` now uses the `origin_server_name` label
253
+ - `synapse_federation_last_sent_pdu_time` now uses the `destination_server_name` label
254
+
255
+ The Grafana dashboard JSON in `contrib/grafana/synapse.json` has been updated to reflect
256
+ this change but you will need to manually update your own existing Grafana dashboards
257
+ using these metrics.
258
+
259
+ ## Stable integration with Matrix Authentication Service
260
+
261
+ Support for [Matrix Authentication Service (MAS)](https://github.com/element-hq/matrix-authentication-service) is now stable, with a simplified configuration.
262
+ This stable integration requires MAS 0.20.0 or later.
263
+
264
+ The existing `experimental_features.msc3861` configuration option is now deprecated and will be removed in Synapse v1.137.0.
265
+
266
+ Synapse deployments already using MAS should now use the new configuration options:
267
+
268
+ ```yaml
269
+ matrix_authentication_service:
270
+ # Enable the MAS integration
271
+ enabled: true
272
+ # The base URL where Synapse will contact MAS
273
+ endpoint: http://localhost:8080
274
+ # The shared secret used to authenticate MAS requests, must be the same as `matrix.secret` in the MAS configuration
275
+ # See https://element-hq.github.io/matrix-authentication-service/reference/configuration.html#matrix
276
+ secret: "asecurerandomsecretstring"
277
+ ```
278
+
279
+ They must remove the `experimental_features.msc3861` configuration option from their configuration.
280
+
281
+ They can also remove the client previously used by Synapse [in the MAS configuration](https://element-hq.github.io/matrix-authentication-service/reference/configuration.html#clients) as it is no longer in use.
282
+
283
+ # Upgrading to v1.135.0
284
+
285
+ ## `on_user_registration` module API callback may now run on any worker
286
+
287
+ Previously, the `on_user_registration` callback would only run on the main
288
+ process. Modules relying on this callback must assume that they may now be
289
+ called from any worker, not just the main process.
290
+
291
+ # Upgrading to v1.134.0
292
+
293
+ ## ICU bundled with Synapse
294
+
295
+ Synapse now uses the Rust `icu` library for improved user search. Installing the
296
+ native ICU library on your system is no longer required.
297
+
298
+ # Upgrading to v1.130.0
299
+
300
+ ## Documented endpoint which can be delegated to a federation worker
301
+
302
+ The endpoint `^/_matrix/federation/v1/version$` can be delegated to a federation
303
+ worker. This is not new behaviour, but had not been documented yet. The
304
+ [list of delegatable endpoints](workers.md#synapseappgeneric_worker) has
305
+ been updated to include it. Make sure to check your reverse proxy rules if you
306
+ are using workers.
307
+
308
+ # Upgrading to v1.126.0
309
+
310
+ ## Room list publication rules change
311
+
312
+ The default [`room_list_publication_rules`] setting was changed to disallow
313
+ anyone (except server admins) from publishing to the room list by default.
314
+
315
+ This is in line with Synapse policy of locking down features by default that can
316
+ be abused without moderation.
317
+
318
+ To keep the previous behavior of allowing publication by default, add the
319
+ following to the config:
320
+
321
+ ```yaml
322
+ room_list_publication_rules:
323
+ - "action": "allow"
324
+ ```
325
+
326
+ [`room_list_publication_rules`]: usage/configuration/config_documentation.md#room_list_publication_rules
327
+
328
+ ## Change of signing key expiry date for the Debian/Ubuntu package repository
329
+
330
+ Administrators using the Debian/Ubuntu packages from `packages.matrix.org`,
331
+ please be aware that we have recently updated the expiry date on the repository's GPG signing key,
332
+ but this change must be imported into your keyring.
333
+
334
+ If you have the `matrix-org-archive-keyring` package installed and it updates before the current key expires, this should
335
+ happen automatically.
336
+
337
+ Otherwise, if you see an error similar to `The following signatures were invalid: EXPKEYSIG F473DD4473365DE1`, you
338
+ will need to get a fresh copy of the keys. You can do so with:
339
+
340
+ ```sh
341
+ sudo wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
342
+ ```
343
+
344
+ The old version of the key will expire on `2025-03-15`.
345
+
346
+ # Upgrading to v1.122.0
347
+
348
+ ## Dropping support for PostgreSQL 11 and 12
349
+
350
+ In line with our [deprecation policy](deprecation_policy.md), we've dropped
351
+ support for PostgreSQL 11 and 12, as they are no longer supported upstream.
352
+ This release of Synapse requires PostgreSQL 13+.
353
+
354
+ # Upgrading to v1.120.0
355
+
356
+ ## Removal of experimental MSC3886 feature
357
+
358
+ [MSC3886](https://github.com/matrix-org/matrix-spec-proposals/pull/3886)
359
+ has been closed (and will not enter the Matrix spec). As such, we are
360
+ removing the experimental support for it in this release.
361
+
362
+ The `experimental_features.msc3886_endpoint` configuration option has
363
+ been removed.
364
+
365
+ ## Authenticated media is now enforced by default
366
+
367
+ The [`enable_authenticated_media`] configuration option now defaults to true.
368
+
369
+ This means that clients and remote (federated) homeservers now need to use
370
+ the authenticated media endpoints in order to download media from your
371
+ homeserver.
372
+
373
+ As an exception, existing media that was stored on the server prior to
374
+ this option changing to `true` will still be accessible over the
375
+ unauthenticated endpoints.
376
+
377
+ The matrix.org homeserver has already been running with this option enabled
378
+ since September 2024, so most common clients and homeservers should already
379
+ be compatible.
380
+
381
+ With that said, administrators who wish to disable this feature for broader
382
+ compatibility can still do so by manually configuring
383
+ `enable_authenticated_media: False`.
384
+
385
+ [`enable_authenticated_media`]: usage/configuration/config_documentation.md#enable_authenticated_media
386
+
387
+
388
+ # Upgrading to v1.119.0
389
+
390
+ ## Minimum supported Python version
391
+
392
+ The minimum supported Python version has been increased from v3.8 to v3.9.
393
+ You will need Python 3.9+ to run Synapse v1.119.0 (due out Nov 7th, 2024).
394
+
395
+ If you use current versions of the Matrix.org-distributed Docker images, no action is required.
396
+ Please note that support for Ubuntu `focal` was dropped as well since it uses Python 3.8.
397
+
398
+
399
+ # Upgrading to v1.111.0
400
+
401
+ ## New worker endpoints for authenticated client and federation media
402
+
403
+ [Media repository workers](./workers.md#synapseappmedia_repository) handling
404
+ Media APIs can now handle the following endpoint patterns:
405
+
406
+ ```
407
+ ^/_matrix/client/v1/media/.*$
408
+ ^/_matrix/federation/v1/media/.*$
409
+ ```
410
+
411
+ Please update your reverse proxy configuration.
412
+
413
+ # Upgrading to v1.106.0
414
+
415
+ ## Minimum supported Rust version
416
+ The minimum supported Rust version has been increased from v1.65.0 to v1.66.0.
417
+ Users building from source will need to ensure their `rustc` version is up to
418
+ date.
419
+
420
+
421
+ # Upgrading to v1.100.0
422
+
423
+ ## Minimum supported Rust version
424
+ The minimum supported Rust version has been increased from v1.61.0 to v1.65.0.
425
+ Users building from source will need to ensure their `rustc` version is up to
426
+ date.
427
+
428
+
429
+ # Upgrading to v1.93.0
430
+
431
+ ## Minimum supported Rust version
432
+ The minimum supported Rust version has been increased from v1.60.0 to v1.61.0.
433
+ Users building from source will need to ensure their `rustc` version is up to
434
+ date.
435
+
436
+
437
+ # Upgrading to v1.90.0
438
+
439
+ ## App service query parameter authorization is now a configuration option
440
+
441
+ Synapse v1.81.0 deprecated application service authorization via query parameters as this is
442
+ considered insecure - and from Synapse v1.71.0 forwards the application service token has also been sent via
443
+ [the `Authorization` header](https://spec.matrix.org/v1.6/application-service-api/#authorization)], making the insecure
444
+ query parameter authorization redundant. Since removing the ability to continue to use query parameters could break
445
+ backwards compatibility it has now been put behind a configuration option, `use_appservice_legacy_authorization`.
446
+ This option defaults to false, but can be activated by adding
447
+ ```yaml
448
+ use_appservice_legacy_authorization: true
449
+ ```
450
+ to your configuration.
451
+
452
+ # Upgrading to v1.89.0
453
+
454
+ ## Removal of unspecced `user` property for `/register`
455
+
456
+ Application services can no longer call `/register` with a `user` property to create new users.
457
+ The standard `username` property should be used instead. See the
458
+ [Application Service specification](https://spec.matrix.org/v1.7/application-service-api/#server-admin-style-permissions)
459
+ for more information.
460
+
461
+ # Upgrading to v1.88.0
462
+
463
+ ## Minimum supported Python version
464
+
465
+ The minimum supported Python version has been increased from v3.7 to v3.8.
466
+ You will need Python 3.8 to run Synapse v1.88.0 (due out July 18th, 2023).
467
+
468
+ If you use current versions of the Matrix.org-distributed Debian
469
+ packages or Docker images, no action is required.
470
+
471
+ ## Removal of `worker_replication_*` settings
472
+
473
+ As mentioned previously in [Upgrading to v1.84.0](#upgrading-to-v1840), the following deprecated settings
474
+ are being removed in this release of Synapse:
475
+
476
+ * [`worker_replication_host`](https://element-hq.github.io/synapse/v1.86/usage/configuration/config_documentation.html#worker_replication_host)
477
+ * [`worker_replication_http_port`](https://element-hq.github.io/synapse/v1.86/usage/configuration/config_documentation.html#worker_replication_http_port)
478
+ * [`worker_replication_http_tls`](https://element-hq.github.io/synapse/v1.86/usage/configuration/config_documentation.html#worker_replication_http_tls)
479
+
480
+ Please ensure that you have migrated to using `main` on your shared configuration's `instance_map`
481
+ (or create one if necessary). This is required if you have ***any*** workers at all;
482
+ administrators of single-process (monolith) installations don't need to do anything.
483
+
484
+ For an illustrative example, please see [Upgrading to v1.84.0](#upgrading-to-v1840) below.
485
+
486
+
487
+ # Upgrading to v1.86.0
488
+
489
+ ## Minimum supported Rust version
490
+
491
+ The minimum supported Rust version has been increased from v1.58.1 to v1.60.0.
492
+ Users building from source will need to ensure their `rustc` version is up to
493
+ date.
494
+
495
+
496
+ # Upgrading to v1.85.0
497
+
498
+ ## Application service registration with "user" property deprecation
499
+
500
+ Application services should ensure they call the `/register` endpoint with a
501
+ `username` property. The legacy `user` property is considered deprecated and
502
+ should no longer be included.
503
+
504
+ A future version of Synapse (v1.88.0 or later) will remove support for legacy
505
+ application service login.
506
+
507
+ # Upgrading to v1.84.0
508
+
509
+ ## Deprecation of `worker_replication_*` configuration settings
510
+
511
+ When using workers,
512
+
513
+ * `worker_replication_host`
514
+ * `worker_replication_http_port`
515
+ * `worker_replication_http_tls`
516
+
517
+ should now be removed from individual worker YAML configurations and the main process should instead be added to the `instance_map`
518
+ in the shared YAML configuration, using the name `main`.
519
+
520
+ The old `worker_replication_*` settings are now considered deprecated and are expected to be removed in Synapse v1.88.0.
521
+
522
+
523
+ ### Example change
524
+
525
+ #### Before:
526
+
527
+ Shared YAML
528
+ ```yaml
529
+ instance_map:
530
+ generic_worker1:
531
+ host: localhost
532
+ port: 5678
533
+ tls: false
534
+ ```
535
+
536
+ Worker YAML
537
+ ```yaml
538
+ worker_app: synapse.app.generic_worker
539
+ worker_name: generic_worker1
540
+
541
+ worker_replication_host: localhost
542
+ worker_replication_http_port: 3456
543
+ worker_replication_http_tls: false
544
+
545
+ worker_listeners:
546
+ - type: http
547
+ port: 1234
548
+ resources:
549
+ - names: [client, federation]
550
+ - type: http
551
+ port: 5678
552
+ resources:
553
+ - names: [replication]
554
+
555
+ worker_log_config: /etc/matrix-synapse/generic-worker-log.yaml
556
+ ```
557
+
558
+
559
+ #### After:
560
+
561
+ Shared YAML
562
+ ```yaml
563
+ instance_map:
564
+ main:
565
+ host: localhost
566
+ port: 3456
567
+ tls: false
568
+ generic_worker1:
569
+ host: localhost
570
+ port: 5678
571
+ tls: false
572
+ ```
573
+
574
+ Worker YAML
575
+ ```yaml
576
+ worker_app: synapse.app.generic_worker
577
+ worker_name: generic_worker1
578
+
579
+ worker_listeners:
580
+ - type: http
581
+ port: 1234
582
+ resources:
583
+ - names: [client, federation]
584
+ - type: http
585
+ port: 5678
586
+ resources:
587
+ - names: [replication]
588
+
589
+ worker_log_config: /etc/matrix-synapse/generic-worker-log.yaml
590
+
591
+ ```
592
+ Notes:
593
+ * `tls` is optional but mirrors the functionality of `worker_replication_http_tls`
594
+
595
+
596
+ # Upgrading to v1.81.0
597
+
598
+ ## Application service path & authentication deprecations
599
+
600
+ Synapse now attempts the versioned appservice paths before falling back to the
601
+ [legacy paths](https://spec.matrix.org/v1.6/application-service-api/#legacy-routes).
602
+ Usage of the legacy routes should be considered deprecated.
603
+
604
+ Additionally, Synapse has supported sending the application service access token
605
+ via [the `Authorization` header](https://spec.matrix.org/v1.6/application-service-api/#authorization)
606
+ since v1.70.0. For backwards compatibility it is *also* sent as the `access_token`
607
+ query parameter. This is insecure and should be considered deprecated.
608
+
609
+ A future version of Synapse (v1.88.0 or later) will remove support for legacy
610
+ application service routes and query parameter authorization.
611
+
612
+ # Upgrading to v1.80.0
613
+
614
+ ## Reporting events error code change
615
+
616
+ Before this update, the
617
+ [`POST /_matrix/client/v3/rooms/{roomId}/report/{eventId}`](https://spec.matrix.org/v1.6/client-server-api/#post_matrixclientv3roomsroomidreporteventid)
618
+ endpoint would return a `403` if a user attempted to report an event that they did not have access to.
619
+ This endpoint will now return a `404` in this case instead.
620
+
621
+ Clients that implement event reporting should check that their error handling code will handle this
622
+ change.
623
+
624
+ # Upgrading to v1.79.0
625
+
626
+ ## The `on_threepid_bind` module callback method has been deprecated
627
+
628
+ Synapse v1.79.0 deprecates the
629
+ [`on_threepid_bind`](modules/third_party_rules_callbacks.md#on_threepid_bind)
630
+ "third-party rules" Synapse module callback method in favour of a new module method,
631
+ [`on_add_user_third_party_identifier`](modules/third_party_rules_callbacks.md#on_add_user_third_party_identifier).
632
+ `on_threepid_bind` will be removed in a future version of Synapse. You should check whether any Synapse
633
+ modules in use in your deployment are making use of `on_threepid_bind`, and update them where possible.
634
+
635
+ The arguments and functionality of the new method are the same.
636
+
637
+ The justification behind the name change is that the old method's name, `on_threepid_bind`, was
638
+ misleading. A user is considered to "bind" their third-party ID to their Matrix ID only if they
639
+ do so via an [identity server](https://spec.matrix.org/latest/identity-service-api/)
640
+ (so that users on other homeservers may find them). But this method was not called in that case -
641
+ it was only called when a user added a third-party identifier on the local homeserver.
642
+
643
+ Module developers may also be interested in the related
644
+ [`on_remove_user_third_party_identifier`](modules/third_party_rules_callbacks.md#on_remove_user_third_party_identifier)
645
+ module callback method that was also added in Synapse v1.79.0. This new method is called when a
646
+ user removes a third-party identifier from their account.
647
+
648
+ # Upgrading to v1.78.0
649
+
650
+ ## Deprecate the `/_synapse/admin/v1/media/<server_name>/delete` admin API
651
+
652
+ Synapse 1.78.0 replaces the `/_synapse/admin/v1/media/<server_name>/delete`
653
+ admin API with an identical endpoint at `/_synapse/admin/v1/media/delete`. Please
654
+ update your tooling to use the new endpoint. The deprecated version will be removed
655
+ in a future release.
656
+
657
+ # Upgrading to v1.76.0
658
+
659
+ ## Faster joins are enabled by default
660
+
661
+ When joining a room for the first time, Synapse 1.76.0 will request a partial join from the other server by default. Previously, server admins had to opt-in to this using an experimental config flag.
662
+
663
+ Server admins can opt out of this feature for the time being by setting
664
+
665
+ ```yaml
666
+ experimental:
667
+ faster_joins: false
668
+ ```
669
+
670
+ in their server config.
671
+
672
+ ## Changes to the account data replication streams
673
+
674
+ Synapse has changed the format of the account data and devices replication
675
+ streams (between workers). This is a forwards- and backwards-incompatible
676
+ change: v1.75 workers cannot process account data replicated by v1.76 workers,
677
+ and vice versa.
678
+
679
+ Once all workers are upgraded to v1.76 (or downgraded to v1.75), account data
680
+ and device replication will resume as normal.
681
+
682
+ ## Minimum version of Poetry is now 1.3.2
683
+
684
+ The minimum supported version of Poetry is now 1.3.2 (previously 1.2.0, [since
685
+ Synapse 1.67](#upgrading-to-v1670)). If you have used `poetry install` to
686
+ install Synapse from a source checkout, you should upgrade poetry: see its
687
+ [installation instructions](https://python-poetry.org/docs/#installation).
688
+ For all other installation methods, no acction is required.
689
+
690
+ # Upgrading to v1.74.0
691
+
692
+ ## Unicode support in user search
693
+
694
+ This version introduces optional support for an [improved user search dealing with Unicode characters](https://github.com/matrix-org/synapse/pull/14464).
695
+
696
+ If you want to take advantage of this feature you need to install PyICU,
697
+ the ICU native dependency and its development headers
698
+ so that PyICU can build since no prebuilt wheels are available.
699
+
700
+ You can follow [the PyICU documentation](https://pypi.org/project/PyICU/) to do so,
701
+ and then do `pip install matrix-synapse[user-search]` for a PyPI install.
702
+
703
+ Docker images and Debian packages need nothing specific as they already
704
+ include or specify ICU as an explicit dependency.
705
+
706
+
707
+ ## User directory rebuild
708
+
709
+ Synapse 1.74 queues a background update
710
+ [to rebuild the user directory](https://github.com/matrix-org/synapse/pull/14643),
711
+ in order to fix missing or erroneous entries.
712
+
713
+ When this update begins, the user directory will be cleared out and rebuilt from
714
+ scratch. User directory lookups will be incomplete until the rebuild completes.
715
+ Admins can monitor the rebuild's progress by using the
716
+ [Background update Admin API](usage/administration/admin_api/background_updates.md#status).
717
+
718
+ # Upgrading to v1.73.0
719
+
720
+ ## Legacy Prometheus metric names have now been removed
721
+
722
+ Synapse v1.69.0 included the deprecation of legacy Prometheus metric names
723
+ and offered an option to disable them.
724
+ Synapse v1.71.0 disabled legacy Prometheus metric names by default.
725
+
726
+ This version, v1.73.0, removes those legacy Prometheus metric names entirely.
727
+ This also means that the `enable_legacy_metrics` configuration option has been
728
+ removed; it will no longer be possible to re-enable the legacy metric names.
729
+
730
+ If you use metrics and have not yet updated your Grafana dashboard(s),
731
+ Prometheus console(s) or alerting rule(s), please consider doing so when upgrading
732
+ to this version.
733
+ Note that the included Grafana dashboard was updated in v1.72.0 to correct some
734
+ metric names which were missed when legacy metrics were disabled by default.
735
+
736
+ See [v1.69.0: Deprecation of legacy Prometheus metric names](#deprecation-of-legacy-prometheus-metric-names)
737
+ for more context.
738
+
739
+
740
+ # Upgrading to v1.72.0
741
+
742
+ ## Dropping support for PostgreSQL 10
743
+
744
+ In line with our [deprecation policy](deprecation_policy.md), we've dropped
745
+ support for PostgreSQL 10, as it is no longer supported upstream.
746
+
747
+ This release of Synapse requires PostgreSQL 11+.
748
+
749
+
750
+ # Upgrading to v1.71.0
751
+
752
+ ## Removal of the `generate_short_term_login_token` module API method
753
+
754
+ As announced with the release of [Synapse 1.69.0](#deprecation-of-the-generate_short_term_login_token-module-api-method), the deprecated `generate_short_term_login_token` module method has been removed.
755
+
756
+ Modules relying on it can instead use the `create_login_token` method.
757
+
758
+
759
+ ## Changes to the events received by application services (interest)
760
+
761
+ To align with spec (changed in
762
+ [MSC3905](https://github.com/matrix-org/matrix-spec-proposals/pull/3905)), Synapse now
763
+ only considers local users to be interesting. In other words, the `users` namespace
764
+ regex is only be applied against local users of the homeserver.
765
+
766
+ Please note, this probably doesn't affect the expected behavior of your application
767
+ service, since an interesting local user in a room still means all messages in the room
768
+ (from local or remote users) will still be considered interesting. And matching a room
769
+ with the `rooms` or `aliases` namespace regex will still consider all events sent in the
770
+ room to be interesting to the application service.
771
+
772
+ If one of your application service's `users` regex was intending to match a remote user,
773
+ this will no longer match as you expect. The behavioral mismatch between matching all
774
+ local users and some remote users is why the spec was changed/clarified and this
775
+ caveat is no longer supported.
776
+
777
+
778
+ ## Legacy Prometheus metric names are now disabled by default
779
+
780
+ Synapse v1.71.0 disables legacy Prometheus metric names by default.
781
+ For administrators that still rely on them and have not yet had chance to update their
782
+ uses of the metrics, it's still possible to specify `enable_legacy_metrics: true` in
783
+ the configuration to re-enable them temporarily.
784
+
785
+ Synapse v1.73.0 will **remove legacy metric names altogether** and at that point,
786
+ it will no longer be possible to re-enable them.
787
+
788
+ If you do not use metrics or you have already updated your Grafana dashboard(s),
789
+ Prometheus console(s) and alerting rule(s), there is no action needed.
790
+
791
+ See [v1.69.0: Deprecation of legacy Prometheus metric names](#deprecation-of-legacy-prometheus-metric-names).
792
+
793
+
794
+ # Upgrading to v1.69.0
795
+
796
+ ## Changes to the receipts replication streams
797
+
798
+ Synapse now includes information indicating if a receipt applies to a thread when
799
+ replicating it to other workers. This is a forwards- and backwards-incompatible
800
+ change: v1.68 and workers cannot process receipts replicated by v1.69 workers, and
801
+ vice versa.
802
+
803
+ Once all workers are upgraded to v1.69 (or downgraded to v1.68), receipts
804
+ replication will resume as normal.
805
+
806
+
807
+ ## Deprecation of legacy Prometheus metric names
808
+
809
+ In current versions of Synapse, some Prometheus metrics are emitted under two different names,
810
+ with one of the names being older but non-compliant with OpenMetrics and Prometheus conventions
811
+ and one of the names being newer but compliant.
812
+
813
+ Synapse v1.71.0 will turn the old metric names off *by default*.
814
+ For administrators that still rely on them and have not had chance to update their
815
+ uses of the metrics, it's possible to specify `enable_legacy_metrics: true` in
816
+ the configuration to re-enable them temporarily.
817
+
818
+ Synapse v1.73.0 will **remove legacy metric names altogether** and it will no longer
819
+ be possible to re-enable them.
820
+
821
+ The Grafana dashboard, Prometheus recording rules and Prometheus Consoles included
822
+ in the `contrib` directory in the Synapse repository have been updated to no longer
823
+ rely on the legacy names. These can be used on a current version of Synapse
824
+ because current versions of Synapse emit both old and new names.
825
+
826
+ You may need to update your alerting rules or any other rules that depend on
827
+ the names of Prometheus metrics.
828
+ If you want to test your changes before legacy names are disabled by default,
829
+ you may specify `enable_legacy_metrics: false` in your homeserver configuration.
830
+
831
+ A list of affected metrics is available on the [Metrics How-to page](https://element-hq.github.io/synapse/v1.69/metrics-howto.html?highlight=metrics%20deprecated#renaming-of-metrics--deprecation-of-old-names-in-12).
832
+
833
+
834
+ ## Deprecation of the `generate_short_term_login_token` module API method
835
+
836
+ The following method of the module API has been deprecated, and is scheduled to
837
+ be remove in v1.71.0:
838
+
839
+ ```python
840
+ def generate_short_term_login_token(
841
+ self,
842
+ user_id: str,
843
+ duration_in_ms: int = (2 * 60 * 1000),
844
+ auth_provider_id: str = "",
845
+ auth_provider_session_id: Optional[str] = None,
846
+ ) -> str:
847
+ ...
848
+ ```
849
+
850
+ It has been replaced by an asynchronous equivalent:
851
+
852
+ ```python
853
+ async def create_login_token(
854
+ self,
855
+ user_id: str,
856
+ duration_in_ms: int = (2 * 60 * 1000),
857
+ auth_provider_id: Optional[str] = None,
858
+ auth_provider_session_id: Optional[str] = None,
859
+ ) -> str:
860
+ ...
861
+ ```
862
+
863
+ Synapse will log a warning when a module uses the deprecated method, to help
864
+ administrators find modules using it.
865
+
866
+
867
+ # Upgrading to v1.68.0
868
+
869
+ Two changes announced in the upgrade notes for v1.67.0 have now landed in v1.68.0.
870
+
871
+ ## SQLite version requirement
872
+
873
+ Synapse now requires a SQLite version of 3.27.0 or higher if SQLite is configured as
874
+ Synapse's database.
875
+
876
+ Installations using
877
+
878
+ - Docker images [from `matrixdotorg`](https://hub.docker.com/r/matrixdotorg/synapse),
879
+ - Debian packages [from Matrix.org](https://packages.matrix.org/), or
880
+ - a PostgreSQL database
881
+
882
+ are not affected.
883
+
884
+ ## Rust requirement when building from source.
885
+
886
+ Building from a source checkout of Synapse now requires a recent Rust compiler
887
+ (currently Rust 1.58.1, but see also the
888
+ [Platform Dependency Policy](https://element-hq.github.io/synapse/latest/deprecation_policy.html)).
889
+
890
+ Installations using
891
+
892
+ - Docker images [from `matrixdotorg`](https://hub.docker.com/r/matrixdotorg/synapse),
893
+ - Debian packages [from Matrix.org](https://packages.matrix.org/), or
894
+ - PyPI wheels via `pip install matrix-synapse` (on supported platforms and architectures)
895
+
896
+ will not be affected.
897
+
898
+ # Upgrading to v1.67.0
899
+
900
+ ## Direct TCP replication is no longer supported: migrate to Redis
901
+
902
+ Redis support was added in v1.13.0 with it becoming the recommended method in
903
+ v1.18.0. It replaced the old direct TCP connections (which was deprecated as of
904
+ v1.18.0) to the main process. With Redis, rather than all the workers connecting
905
+ to the main process, all the workers and the main process connect to Redis,
906
+ which relays replication commands between processes. This can give a significant
907
+ CPU saving on the main process and is a prerequisite for upcoming
908
+ performance improvements.
909
+
910
+ To migrate to Redis add the [`redis` config](./workers.md#shared-configuration),
911
+ and remove the TCP `replication` listener from config of the master and
912
+ `worker_replication_port` from worker config. Note that a HTTP listener with a
913
+ `replication` resource is still required.
914
+
915
+ ## Minimum version of Poetry is now v1.2.0
916
+
917
+ The minimum supported version of poetry is now 1.2. This should only affect
918
+ those installing from a source checkout.
919
+
920
+ ## Rust requirement in the next release
921
+
922
+ From the next major release (v1.68.0) installing Synapse from a source checkout
923
+ will require a recent Rust compiler. Those using packages or
924
+ `pip install matrix-synapse` will not be affected.
925
+
926
+ The simplest way of installing Rust is via [rustup.rs](https://rustup.rs/)
927
+
928
+ ## SQLite version requirement in the next release
929
+
930
+ From the next major release (v1.68.0) Synapse will require SQLite 3.27.0 or
931
+ higher. Synapse v1.67.0 will be the last major release supporting SQLite
932
+ versions 3.22 to 3.26.
933
+
934
+ Those using Docker images or Debian packages from Matrix.org will not be
935
+ affected. If you have installed from source, you should check the version of
936
+ SQLite used by Python with:
937
+
938
+ ```shell
939
+ python -c "import sqlite3; print(sqlite3.sqlite_version)"
940
+ ```
941
+
942
+ If this is too old, refer to your distribution for advice on upgrading.
943
+
944
+
945
+ # Upgrading to v1.66.0
946
+
947
+ ## Delegation of email validation no longer supported
948
+
949
+ As of this version, Synapse no longer allows the tasks of verifying email address
950
+ ownership, and password reset confirmation, to be delegated to an identity server.
951
+ This removal was previously planned for Synapse 1.64.0, but was
952
+ [delayed](https://github.com/matrix-org/synapse/issues/13421) until now to give
953
+ homeserver administrators more notice of the change.
954
+
955
+ To continue to allow users to add email addresses to their homeserver accounts,
956
+ and perform password resets, make sure that Synapse is configured with a working
957
+ email server in the [`email` configuration
958
+ section](https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#email)
959
+ (including, at a minimum, a `notif_from` setting.)
960
+
961
+ Specifying an `email` setting under `account_threepid_delegates` will now cause
962
+ an error at startup.
963
+
964
+ # Upgrading to v1.64.0
965
+
966
+ ## Deprecation of the ability to delegate e-mail verification to identity servers
967
+
968
+ Synapse v1.66.0 will remove the ability to delegate the tasks of verifying email address ownership, and password reset confirmation, to an identity server.
969
+
970
+ If you require your homeserver to verify e-mail addresses or to support password resets via e-mail, please configure your homeserver with SMTP access so that it can send e-mails on its own behalf.
971
+ [Consult the configuration documentation for more information.](https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#email)
972
+
973
+ The option that will be removed is `account_threepid_delegates.email`.
974
+
975
+
976
+ ## Changes to the event replication streams
977
+
978
+ Synapse now includes a flag indicating if an event is an outlier when
979
+ replicating it to other workers. This is a forwards- and backwards-incompatible
980
+ change: v1.63 and workers cannot process events replicated by v1.64 workers, and
981
+ vice versa.
982
+
983
+ Once all workers are upgraded to v1.64 (or downgraded to v1.63), event
984
+ replication will resume as normal.
985
+
986
+ ## frozendict release
987
+
988
+ [frozendict 2.3.3](https://github.com/Marco-Sulla/python-frozendict/releases/tag/v2.3.3)
989
+ has recently been released, which fixes a memory leak that occurs during `/sync`
990
+ requests. We advise server administrators who installed Synapse via pip to upgrade
991
+ frozendict with `pip install --upgrade frozendict`. The Docker image
992
+ `matrixdotorg/synapse` and the Debian packages from `packages.matrix.org` already
993
+ include the updated library.
994
+
995
+ # Upgrading to v1.62.0
996
+
997
+ ## New signatures for spam checker callbacks
998
+
999
+ As a followup to changes in v1.60.0, the following spam-checker callbacks have changed signature:
1000
+
1001
+ - `user_may_join_room`
1002
+ - `user_may_invite`
1003
+ - `user_may_send_3pid_invite`
1004
+ - `user_may_create_room`
1005
+ - `user_may_create_room_alias`
1006
+ - `user_may_publish_room`
1007
+ - `check_media_file_for_spam`
1008
+
1009
+ For each of these methods, the previous callback signature has been deprecated.
1010
+
1011
+ Whereas callbacks used to return `bool`, they should now return `Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]`.
1012
+
1013
+ For instance, if your module implements `user_may_join_room` as follows:
1014
+
1015
+ ```python
1016
+ async def user_may_join_room(self, user_id: str, room_id: str, is_invited: bool)
1017
+ if ...:
1018
+ # Request is spam
1019
+ return False
1020
+ # Request is not spam
1021
+ return True
1022
+ ```
1023
+
1024
+ you should rewrite it as follows:
1025
+
1026
+ ```python
1027
+ async def user_may_join_room(self, user_id: str, room_id: str, is_invited: bool)
1028
+ if ...:
1029
+ # Request is spam, mark it as forbidden (you may use some more precise error
1030
+ # code if it is useful).
1031
+ return synapse.module_api.errors.Codes.FORBIDDEN
1032
+ # Request is not spam, mark it as such.
1033
+ return synapse.module_api.NOT_SPAM
1034
+ ```
1035
+
1036
+ # Upgrading to v1.61.0
1037
+
1038
+ ## Removal of deprecated community/groups
1039
+
1040
+ This release of Synapse will remove deprecated community/groups from codebase.
1041
+
1042
+ ### Worker endpoints
1043
+
1044
+ For those who have deployed workers, following worker endpoints will no longer
1045
+ exist and they can be removed from the reverse proxy configuration:
1046
+
1047
+ - `^/_matrix/federation/v1/get_groups_publicised$`
1048
+ - `^/_matrix/client/(r0|v3|unstable)/joined_groups$`
1049
+ - `^/_matrix/client/(r0|v3|unstable)/publicised_groups$`
1050
+ - `^/_matrix/client/(r0|v3|unstable)/publicised_groups/`
1051
+ - `^/_matrix/federation/v1/groups/`
1052
+ - `^/_matrix/client/(r0|v3|unstable)/groups/`
1053
+
1054
+ # Upgrading to v1.60.0
1055
+
1056
+ ## Adding a new unique index to `state_group_edges` could fail if your database is corrupted
1057
+
1058
+ This release of Synapse will add a unique index to the `state_group_edges` table, in order
1059
+ to prevent accidentally introducing duplicate information (for example, because a database
1060
+ backup was restored multiple times).
1061
+
1062
+ Duplicate rows being present in this table could cause drastic performance problems; see
1063
+ [issue 11779](https://github.com/matrix-org/synapse/issues/11779) for more details.
1064
+
1065
+ If your Synapse database already has had duplicate rows introduced into this table,
1066
+ this could fail, with either of these errors:
1067
+
1068
+
1069
+ **On Postgres:**
1070
+ ```
1071
+ synapse.storage.background_updates - 623 - INFO - background_updates-0 - Adding index state_group_edges_unique_idx to state_group_edges
1072
+ synapse.storage.background_updates - 282 - ERROR - background_updates-0 - Error doing update
1073
+ ...
1074
+ psycopg2.errors.UniqueViolation: could not create unique index "state_group_edges_unique_idx"
1075
+ DETAIL: Key (state_group, prev_state_group)=(2, 1) is duplicated.
1076
+ ```
1077
+ (The numbers may be different.)
1078
+
1079
+ **On SQLite:**
1080
+ ```
1081
+ synapse.storage.background_updates - 623 - INFO - background_updates-0 - Adding index state_group_edges_unique_idx to state_group_edges
1082
+ synapse.storage.background_updates - 282 - ERROR - background_updates-0 - Error doing update
1083
+ ...
1084
+ sqlite3.IntegrityError: UNIQUE constraint failed: state_group_edges.state_group, state_group_edges.prev_state_group
1085
+ ```
1086
+
1087
+
1088
+ <details>
1089
+ <summary><b>Expand this section for steps to resolve this problem</b></summary>
1090
+
1091
+ ### On Postgres
1092
+
1093
+ Connect to your database with `psql`.
1094
+
1095
+ ```sql
1096
+ BEGIN;
1097
+ DELETE FROM state_group_edges WHERE (ctid, state_group, prev_state_group) IN (
1098
+ SELECT row_id, state_group, prev_state_group
1099
+ FROM (
1100
+ SELECT
1101
+ ctid AS row_id,
1102
+ MIN(ctid) OVER (PARTITION BY state_group, prev_state_group) AS min_row_id,
1103
+ state_group,
1104
+ prev_state_group
1105
+ FROM state_group_edges
1106
+ ) AS t1
1107
+ WHERE row_id <> min_row_id
1108
+ );
1109
+ COMMIT;
1110
+ ```
1111
+
1112
+
1113
+ ### On SQLite
1114
+
1115
+ At the command-line, use `sqlite3 path/to/your-homeserver-database.db`:
1116
+
1117
+ ```sql
1118
+ BEGIN;
1119
+ DELETE FROM state_group_edges WHERE (rowid, state_group, prev_state_group) IN (
1120
+ SELECT row_id, state_group, prev_state_group
1121
+ FROM (
1122
+ SELECT
1123
+ rowid AS row_id,
1124
+ MIN(rowid) OVER (PARTITION BY state_group, prev_state_group) AS min_row_id,
1125
+ state_group,
1126
+ prev_state_group
1127
+ FROM state_group_edges
1128
+ )
1129
+ WHERE row_id <> min_row_id
1130
+ );
1131
+ COMMIT;
1132
+ ```
1133
+
1134
+
1135
+ ### For more details
1136
+
1137
+ [This comment on issue 11779](https://github.com/matrix-org/synapse/issues/11779#issuecomment-1131545970)
1138
+ has queries that can be used to check a database for this problem in advance.
1139
+
1140
+ </details>
1141
+
1142
+ ## New signature for the spam checker callback `check_event_for_spam`
1143
+
1144
+ The previous signature has been deprecated.
1145
+
1146
+ Whereas `check_event_for_spam` callbacks used to return `Union[str, bool]`, they should now return `Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]`.
1147
+
1148
+ This is part of an ongoing refactoring of the SpamChecker API to make it less ambiguous and more powerful.
1149
+
1150
+ If your module implements `check_event_for_spam` as follows:
1151
+
1152
+ ```python
1153
+ async def check_event_for_spam(event):
1154
+ if ...:
1155
+ # Event is spam
1156
+ return True
1157
+ # Event is not spam
1158
+ return False
1159
+ ```
1160
+
1161
+ you should rewrite it as follows:
1162
+
1163
+ ```python
1164
+ async def check_event_for_spam(event):
1165
+ if ...:
1166
+ # Event is spam, mark it as forbidden (you may use some more precise error
1167
+ # code if it is useful).
1168
+ return synapse.module_api.errors.Codes.FORBIDDEN
1169
+ # Event is not spam, mark it as such.
1170
+ return synapse.module_api.NOT_SPAM
1171
+ ```
1172
+
1173
+ # Upgrading to v1.59.0
1174
+
1175
+ ## Device name lookup over federation has been disabled by default
1176
+
1177
+ The names of user devices are no longer visible to users on other homeservers by default.
1178
+ Device IDs are unaffected, as these are necessary to facilitate end-to-end encryption.
1179
+
1180
+ To re-enable this functionality, set the
1181
+ [`allow_device_name_lookup_over_federation`](https://element-hq.github.io/synapse/v1.59/usage/configuration/config_documentation.html#federation)
1182
+ homeserver config option to `true`.
1183
+
1184
+
1185
+ ## Deprecation of the `synapse.app.appservice` and `synapse.app.user_dir` worker application types
1186
+
1187
+ The `synapse.app.appservice` worker application type allowed you to configure a
1188
+ single worker to use to notify application services of new events, as long
1189
+ as this functionality was disabled on the main process with `notify_appservices: False`.
1190
+ Further, the `synapse.app.user_dir` worker application type allowed you to configure
1191
+ a single worker to be responsible for updating the user directory, as long as this
1192
+ was disabled on the main process with `update_user_directory: False`.
1193
+
1194
+ To unify Synapse's worker types, the `synapse.app.appservice` worker application
1195
+ type and the `notify_appservices` configuration option have been deprecated.
1196
+ The `synapse.app.user_dir` worker application type and `update_user_directory`
1197
+ configuration option have also been deprecated.
1198
+
1199
+ To get the same functionality as was provided by the deprecated options, it's now recommended that the `synapse.app.generic_worker`
1200
+ worker application type is used and that the `notify_appservices_from_worker` and/or
1201
+ `update_user_directory_from_worker` options are set to the name of a worker.
1202
+
1203
+ For the time being, the old options can be used alongside the new options to make
1204
+ it easier to transition between the two configurations, however please note that:
1205
+
1206
+ - the options must not contradict each other (otherwise Synapse won't start); and
1207
+ - the `notify_appservices` and `update_user_directory` options will be removed in a future release of Synapse.
1208
+
1209
+ Please see the [*Notifying Application Services*][v1_59_notify_ases_from] and
1210
+ [*Updating the User Directory*][v1_59_update_user_dir] sections of the worker
1211
+ documentation for more information.
1212
+
1213
+ [v1_59_notify_ases_from]: workers.md#notifying-application-services
1214
+ [v1_59_update_user_dir]: workers.md#updating-the-user-directory
1215
+
1216
+
1217
+ # Upgrading to v1.58.0
1218
+
1219
+ ## Groups/communities feature has been disabled by default
1220
+
1221
+ The non-standard groups/communities feature in Synapse has been disabled by default
1222
+ and will be removed in Synapse v1.61.0.
1223
+
1224
+
1225
+ # Upgrading to v1.57.0
1226
+
1227
+ ## Changes to database schema for application services
1228
+
1229
+ Synapse v1.57.0 includes a [change](https://github.com/matrix-org/synapse/pull/12209) to the
1230
+ way transaction IDs are managed for application services. If your deployment uses a dedicated
1231
+ worker for application service traffic, **it must be stopped** when the database is upgraded
1232
+ (which normally happens when the main process is upgraded), to ensure the change is made safely
1233
+ without any risk of reusing transaction IDs.
1234
+
1235
+ Deployments which do not use separate worker processes can be upgraded as normal. Similarly,
1236
+ deployments where no application services are in use can be upgraded as normal.
1237
+
1238
+ <details>
1239
+ <summary><b>Recovering from an incorrect upgrade</b></summary>
1240
+
1241
+ If the database schema is upgraded *without* stopping the worker responsible
1242
+ for AS traffic, then the following error may be given when attempting to start
1243
+ a Synapse worker or master process:
1244
+
1245
+ ```
1246
+ **********************************************************************************
1247
+ Error during initialisation:
1248
+
1249
+ Postgres sequence 'application_services_txn_id_seq' is inconsistent with associated
1250
+ table 'application_services_txns'. This can happen if Synapse has been downgraded and
1251
+ then upgraded again, or due to a bad migration.
1252
+
1253
+ To fix this error, shut down Synapse (including any and all workers)
1254
+ and run the following SQL:
1255
+
1256
+ SELECT setval('application_services_txn_id_seq', (
1257
+ SELECT GREATEST(MAX(txn_id), 0) FROM application_services_txns
1258
+ ));
1259
+
1260
+ See docs/postgres.md for more information.
1261
+
1262
+ There may be more information in the logs.
1263
+ **********************************************************************************
1264
+ ```
1265
+
1266
+ This error may also be seen if Synapse is *downgraded* to an earlier version,
1267
+ and then upgraded again to v1.57.0 or later.
1268
+
1269
+ In either case:
1270
+
1271
+ 1. Ensure that the worker responsible for AS traffic is stopped.
1272
+ 2. Run the SQL command given in the error message via `psql`.
1273
+
1274
+ Synapse should then start correctly.
1275
+ </details>
1276
+
1277
+ # Upgrading to v1.56.0
1278
+
1279
+ ## Open registration without verification is now disabled by default
1280
+
1281
+ Synapse will refuse to start if registration is enabled without email, captcha, or token-based verification unless the new config
1282
+ flag `enable_registration_without_verification` is set to "true".
1283
+
1284
+ ## Groups/communities feature has been deprecated
1285
+
1286
+ The non-standard groups/communities feature in Synapse has been deprecated and will
1287
+ be disabled by default in Synapse v1.58.0.
1288
+
1289
+ You can test disabling it by adding the following to your homeserver configuration:
1290
+
1291
+ ```yaml
1292
+ experimental_features:
1293
+ groups_enabled: false
1294
+ ```
1295
+
1296
+ ## Change in behaviour for PostgreSQL databases with unsafe locale
1297
+
1298
+ Synapse now refuses to start when using PostgreSQL with non-`C` values for `COLLATE` and
1299
+ `CTYPE` unless the config flag `allow_unsafe_locale`, found in the database section of
1300
+ the configuration file, is set to `true`. See the [PostgreSQL documentation](https://element-hq.github.io/synapse/latest/postgres.html#fixing-incorrect-collate-or-ctype)
1301
+ for more information and instructions on how to fix a database with incorrect values.
1302
+
1303
+ # Upgrading to v1.55.0
1304
+
1305
+ ## `synctl` script has been moved
1306
+
1307
+ The `synctl` script
1308
+ [has been made](https://github.com/matrix-org/synapse/pull/12140) an
1309
+ [entry point](https://packaging.python.org/en/latest/specifications/entry-points/)
1310
+ and no longer exists at the root of Synapse's source tree. If you wish to use
1311
+ `synctl` to manage your homeserver, you should invoke `synctl` directly, e.g.
1312
+ `synctl start` instead of `./synctl start` or `/path/to/synctl start`.
1313
+
1314
+ You will need to ensure `synctl` is on your `PATH`.
1315
+ - This is automatically the case when using
1316
+ [Debian packages](https://packages.matrix.org/debian/) or
1317
+ [docker images](https://hub.docker.com/r/matrixdotorg/synapse)
1318
+ provided by Matrix.org.
1319
+ - When installing from a wheel, sdist, or PyPI, a `synctl` executable is added
1320
+ to your Python installation's `bin`. This should be on your `PATH`
1321
+ automatically, though you might need to activate a virtual environment
1322
+ depending on how you installed Synapse.
1323
+
1324
+
1325
+ ## Compatibility dropped for Mjolnir 1.3.1 and earlier
1326
+
1327
+ Synapse v1.55.0 drops support for Mjolnir 1.3.1 and earlier.
1328
+ If you use the Mjolnir module to moderate your homeserver,
1329
+ please upgrade Mjolnir to version 1.3.2 or later before upgrading Synapse.
1330
+
1331
+
1332
+ # Upgrading to v1.54.0
1333
+
1334
+ ## Legacy structured logging configuration removal
1335
+
1336
+ This release removes support for the `structured: true` logging configuration
1337
+ which was deprecated in Synapse v1.23.0. If your logging configuration contains
1338
+ `structured: true` then it should be modified based on the
1339
+ [structured logging documentation](https://element-hq.github.io/synapse/v1.56/structured_logging.html#upgrading-from-legacy-structured-logging-configuration).
1340
+
1341
+ # Upgrading to v1.53.0
1342
+
1343
+ ## Dropping support for `webclient` listeners and non-HTTP(S) `web_client_location`
1344
+
1345
+ Per the deprecation notice in Synapse v1.51.0, listeners of type `webclient`
1346
+ are no longer supported and configuring them is a now a configuration error.
1347
+
1348
+ Configuring a non-HTTP(S) `web_client_location` configuration is is now a
1349
+ configuration error. Since the `webclient` listener is no longer supported, this
1350
+ setting only applies to the root path `/` of Synapse's web server and no longer
1351
+ the `/_matrix/client/` path.
1352
+
1353
+ ## Stablisation of MSC3231
1354
+
1355
+ The unstable validity-check endpoint for the
1356
+ [Registration Tokens](https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv1registermloginregistration_tokenvalidity)
1357
+ feature has been stabilised and moved from:
1358
+
1359
+ `/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity`
1360
+
1361
+ to:
1362
+
1363
+ `/_matrix/client/v1/register/m.login.registration_token/validity`
1364
+
1365
+ Please update any relevant reverse proxy or firewall configurations appropriately.
1366
+
1367
+ ## Time-based cache expiry is now enabled by default
1368
+
1369
+ Formerly, entries in the cache were not evicted regardless of whether they were accessed after storing.
1370
+ This behavior has now changed. By default entries in the cache are now evicted after 30m of not being accessed.
1371
+ To change the default behavior, go to the `caches` section of the config and change the `expire_caches` and
1372
+ `cache_entry_ttl` flags as necessary. Please note that these flags replace the `expiry_time` flag in the config.
1373
+ The `expiry_time` flag will still continue to work, but it has been deprecated and will be removed in the future.
1374
+
1375
+ ## Deprecation of `capability` `org.matrix.msc3283.*`
1376
+
1377
+ The `capabilities` of MSC3283 from the REST API `/_matrix/client/r0/capabilities`
1378
+ becomes stable.
1379
+
1380
+ The old `capabilities`
1381
+ - `org.matrix.msc3283.set_displayname`,
1382
+ - `org.matrix.msc3283.set_avatar_url` and
1383
+ - `org.matrix.msc3283.3pid_changes`
1384
+
1385
+ are deprecated and scheduled to be removed in Synapse v1.54.0.
1386
+
1387
+ The new `capabilities`
1388
+ - `m.set_displayname`,
1389
+ - `m.set_avatar_url` and
1390
+ - `m.3pid_changes`
1391
+
1392
+ are now active by default.
1393
+
1394
+ ## Removal of `user_may_create_room_with_invites`
1395
+
1396
+ As announced with the release of [Synapse 1.47.0](#deprecation-of-the-user_may_create_room_with_invites-module-callback),
1397
+ the deprecated `user_may_create_room_with_invites` module callback has been removed.
1398
+
1399
+ Modules relying on it can instead implement [`user_may_invite`](https://element-hq.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite)
1400
+ and use the [`get_room_state`](https://github.com/element-hq/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876)
1401
+ module API to infer whether the invite is happening while creating a room (see [this function](https://github.com/matrix-org/synapse-domain-rule-checker/blob/e7d092dd9f2a7f844928771dbfd9fd24c2332e48/synapse_domain_rule_checker/__init__.py#L56-L89)
1402
+ as an example). Alternately, modules can also implement [`on_create_room`](https://element-hq.github.io/synapse/latest/modules/third_party_rules_callbacks.html#on_create_room).
1403
+
1404
+
1405
+ # Upgrading to v1.52.0
1406
+
1407
+ ## Twisted security release
1408
+
1409
+ Note that [Twisted 22.1.0](https://github.com/twisted/twisted/releases/tag/twisted-22.1.0)
1410
+ has recently been released, which fixes a [security issue](https://github.com/twisted/twisted/security/advisories/GHSA-92x2-jw7w-xvvx)
1411
+ within the Twisted library. We do not believe Synapse is affected by this vulnerability,
1412
+ though we advise server administrators who installed Synapse via pip to upgrade Twisted
1413
+ with `pip install --upgrade Twisted treq` as a matter of good practice. The Docker image
1414
+ `matrixdotorg/synapse` and the Debian packages from `packages.matrix.org` are using the
1415
+ updated library.
1416
+
1417
+ # Upgrading to v1.51.0
1418
+
1419
+ ## Deprecation of `webclient` listeners and non-HTTP(S) `web_client_location`
1420
+
1421
+ Listeners of type `webclient` are deprecated and scheduled to be removed in
1422
+ Synapse v1.53.0.
1423
+
1424
+ Similarly, a non-HTTP(S) `web_client_location` configuration is deprecated and
1425
+ will become a configuration error in Synapse v1.53.0.
1426
+
1427
+
1428
+ # Upgrading to v1.50.0
1429
+
1430
+ ## Dropping support for old Python and Postgres versions
1431
+
1432
+ In line with our [deprecation policy](deprecation_policy.md),
1433
+ we've dropped support for Python 3.6 and PostgreSQL 9.6, as they are no
1434
+ longer supported upstream.
1435
+
1436
+ This release of Synapse requires Python 3.7+ and PostgreSQL 10+.
1437
+
1438
+
1439
+ # Upgrading to v1.47.0
1440
+
1441
+ ## Removal of old Room Admin API
1442
+
1443
+ The following admin APIs were deprecated in [Synapse 1.34](https://github.com/matrix-org/synapse/blob/v1.34.0/CHANGES.md#deprecations-and-removals)
1444
+ (released on 2021-05-17) and have now been removed:
1445
+
1446
+ - `POST /_synapse/admin/v1/<room_id>/delete`
1447
+
1448
+ Any scripts still using the above APIs should be converted to use the
1449
+ [Delete Room API](https://element-hq.github.io/synapse/latest/admin_api/rooms.html#delete-room-api).
1450
+
1451
+ ## Deprecation of the `user_may_create_room_with_invites` module callback
1452
+
1453
+ The `user_may_create_room_with_invites` is deprecated and will be removed in a future
1454
+ version of Synapse. Modules implementing this callback can instead implement
1455
+ [`user_may_invite`](https://element-hq.github.io/synapse/latest/modules/spam_checker_callbacks.html#user_may_invite)
1456
+ and use the [`get_room_state`](https://github.com/element-hq/synapse/blob/872f23b95fa980a61b0866c1475e84491991fa20/synapse/module_api/__init__.py#L869-L876)
1457
+ module API method to infer whether the invite is happening in the context of creating a
1458
+ room.
1459
+
1460
+ We plan to remove this callback in January 2022.
1461
+
1462
+ # Upgrading to v1.45.0
1463
+
1464
+ ## Changes required to media storage provider modules when reading from the Synapse configuration object
1465
+
1466
+ Media storage provider modules that read from the Synapse configuration object (i.e. that
1467
+ read the value of `hs.config.[...]`) now need to specify the configuration section they're
1468
+ reading from. This means that if a module reads the value of e.g. `hs.config.media_store_path`,
1469
+ it needs to replace it with `hs.config.media.media_store_path`.
1470
+
1471
+ # Upgrading to v1.44.0
1472
+
1473
+ ## The URL preview cache is no longer mirrored to storage providers
1474
+ The `url_cache/` and `url_cache_thumbnails/` directories in the media store are
1475
+ no longer mirrored to storage providers. These two directories can be safely
1476
+ deleted from any configured storage providers to reclaim space.
1477
+
1478
+ # Upgrading to v1.43.0
1479
+
1480
+ ## The spaces summary APIs can now be handled by workers
1481
+
1482
+ The [available worker applications documentation](https://element-hq.github.io/synapse/latest/workers.html#available-worker-applications)
1483
+ has been updated to reflect that calls to the `/spaces`, `/hierarchy`, and
1484
+ `/summary` endpoints can now be routed to workers for both client API and
1485
+ federation requests.
1486
+
1487
+ # Upgrading to v1.42.0
1488
+
1489
+ ## Removal of old Room Admin API
1490
+
1491
+ The following admin APIs were deprecated in [Synapse 1.25](https://github.com/matrix-org/synapse/blob/v1.25.0/CHANGES.md#removal-warning)
1492
+ (released on 2021-01-13) and have now been removed:
1493
+
1494
+ - `POST /_synapse/admin/v1/purge_room`
1495
+ - `POST /_synapse/admin/v1/shutdown_room/<room_id>`
1496
+
1497
+ Any scripts still using the above APIs should be converted to use the
1498
+ [Delete Room API](https://element-hq.github.io/synapse/latest/admin_api/rooms.html#delete-room-api).
1499
+
1500
+ ## User-interactive authentication fallback templates can now display errors
1501
+
1502
+ This may affect you if you make use of custom HTML templates for the
1503
+ [reCAPTCHA (`synapse/res/templates/recaptcha.html`)](https://github.com/element-hq/synapse/tree/develop/synapse/res/templates/recaptcha.html) or
1504
+ [terms (`synapse/res/templates/terms.html`)](https://github.com/element-hq/synapse/tree/develop/synapse/res/templates/terms.html) fallback pages.
1505
+
1506
+ The template is now provided an `error` variable if the authentication
1507
+ process failed. See the default templates linked above for an example.
1508
+
1509
+ ## Removal of out-of-date email pushers
1510
+
1511
+ Users will stop receiving message updates via email for addresses that were
1512
+ once, but not still, linked to their account.
1513
+
1514
+ # Upgrading to v1.41.0
1515
+
1516
+ ## Add support for routing outbound HTTP requests via a proxy for federation
1517
+
1518
+ Since Synapse 1.6.0 (2019-11-26) you can set a proxy for outbound HTTP requests via
1519
+ http_proxy/https_proxy environment variables. This proxy was set for:
1520
+ - push
1521
+ - url previews
1522
+ - phone-home stats
1523
+ - recaptcha validation
1524
+ - CAS auth validation
1525
+ - OpenID Connect
1526
+ - Federation (checking public key revocation)
1527
+
1528
+ In this version we have added support for outbound requests for:
1529
+ - Outbound federation
1530
+ - Downloading remote media
1531
+ - Fetching public keys of other servers
1532
+
1533
+ These requests use the same proxy configuration. If you have a proxy configuration we
1534
+ recommend to verify the configuration. It may be necessary to adjust the `no_proxy`
1535
+ environment variable.
1536
+
1537
+ See [using a forward proxy with Synapse documentation](setup/forward_proxy.md) for
1538
+ details.
1539
+
1540
+ ## Deprecation of `template_dir`
1541
+
1542
+ The `template_dir` settings in the `sso`, `account_validity` and `email` sections of the
1543
+ configuration file are now deprecated. Server admins should use the new
1544
+ `templates.custom_template_directory` setting in the configuration file and use one single
1545
+ custom template directory for all aforementioned features. Template file names remain
1546
+ unchanged. See [the related documentation](https://element-hq.github.io/synapse/latest/templates.html)
1547
+ for more information and examples.
1548
+
1549
+ We plan to remove support for these settings in October 2021.
1550
+
1551
+ ## `/_synapse/admin/v1/users/{userId}/media` must be handled by media workers
1552
+
1553
+ The [media repository worker documentation](https://element-hq.github.io/synapse/latest/workers.html#synapseappmedia_repository)
1554
+ has been updated to reflect that calls to `/_synapse/admin/v1/users/{userId}/media`
1555
+ must now be handled by media repository workers. This is due to the new `DELETE` method
1556
+ of this endpoint modifying the media store.
1557
+
1558
+ # Upgrading to v1.39.0
1559
+
1560
+ ## Deprecation of the current third-party rules module interface
1561
+
1562
+ The current third-party rules module interface is deprecated in favour of the new generic
1563
+ modules system introduced in Synapse v1.37.0. Authors of third-party rules modules can refer
1564
+ to [this documentation](modules/porting_legacy_module.md)
1565
+ to update their modules. Synapse administrators can refer to [this documentation](modules/index.md)
1566
+ to update their configuration once the modules they are using have been updated.
1567
+
1568
+ We plan to remove support for the current third-party rules interface in September 2021.
1569
+
1570
+
1571
+ # Upgrading to v1.38.0
1572
+
1573
+ ## Re-indexing of `events` table on Postgres databases
1574
+
1575
+ This release includes a database schema update which requires re-indexing one of
1576
+ the larger tables in the database, `events`. This could result in increased
1577
+ disk I/O for several hours or days after upgrading while the migration
1578
+ completes. Furthermore, because we have to keep the old indexes until the new
1579
+ indexes are ready, it could result in a significant, temporary, increase in
1580
+ disk space.
1581
+
1582
+ To get a rough idea of the disk space required, check the current size of one
1583
+ of the indexes. For example, from a `psql` shell, run the following sql:
1584
+
1585
+ ```sql
1586
+ SELECT pg_size_pretty(pg_relation_size('events_order_room'));
1587
+ ```
1588
+
1589
+ We need to rebuild **four** indexes, so you will need to multiply this result
1590
+ by four to give an estimate of the disk space required. For example, on one
1591
+ particular server:
1592
+
1593
+ ```
1594
+ synapse=# select pg_size_pretty(pg_relation_size('events_order_room'));
1595
+ pg_size_pretty
1596
+ ----------------
1597
+ 288 MB
1598
+ (1 row)
1599
+ ```
1600
+
1601
+ On this server, it would be wise to ensure that at least 1152MB are free.
1602
+
1603
+ The additional disk space will be freed once the migration completes.
1604
+
1605
+ SQLite databases are unaffected by this change.
1606
+
1607
+
1608
+ # Upgrading to v1.37.0
1609
+
1610
+ ## Deprecation of the current spam checker interface
1611
+
1612
+ The current spam checker interface is deprecated in favour of a new generic modules system.
1613
+ Authors of spam checker modules can refer to [this
1614
+ documentation](modules/porting_legacy_module.md
1615
+ to update their modules. Synapse administrators can refer to [this
1616
+ documentation](modules/index.md)
1617
+ to update their configuration once the modules they are using have been updated.
1618
+
1619
+ We plan to remove support for the current spam checker interface in August 2021.
1620
+
1621
+ More module interfaces will be ported over to this new generic system in future versions
1622
+ of Synapse.
1623
+
1624
+
1625
+ # Upgrading to v1.34.0
1626
+
1627
+ ## `room_invite_state_types` configuration setting
1628
+
1629
+ The `room_invite_state_types` configuration setting has been deprecated
1630
+ and replaced with `room_prejoin_state`. See the [sample configuration
1631
+ file](https://github.com/matrix-org/synapse/blob/v1.34.0/docs/sample_config.yaml#L1515).
1632
+
1633
+ If you have set `room_invite_state_types` to the default value you
1634
+ should simply remove it from your configuration file. The default value
1635
+ used to be:
1636
+
1637
+ ```yaml
1638
+ room_invite_state_types:
1639
+ - "m.room.join_rules"
1640
+ - "m.room.canonical_alias"
1641
+ - "m.room.avatar"
1642
+ - "m.room.encryption"
1643
+ - "m.room.name"
1644
+ ```
1645
+
1646
+ If you have customised this value, you should remove
1647
+ `room_invite_state_types` and configure `room_prejoin_state` instead.
1648
+
1649
+ # Upgrading to v1.33.0
1650
+
1651
+ ## Account Validity HTML templates can now display a user's expiration date
1652
+
1653
+ This may affect you if you have enabled the account validity feature,
1654
+ and have made use of a custom HTML template specified by the
1655
+ `account_validity.template_dir` or
1656
+ `account_validity.account_renewed_html_path` Synapse config options.
1657
+
1658
+ The template can now accept an `expiration_ts` variable, which
1659
+ represents the unix timestamp in milliseconds for the future date of
1660
+ which their account has been renewed until. See the [default
1661
+ template](https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_renewed.html)
1662
+ for an example of usage.
1663
+
1664
+ ALso note that a new HTML template, `account_previously_renewed.html`,
1665
+ has been added. This is is shown to users when they attempt to renew
1666
+ their account with a valid renewal token that has already been used
1667
+ before. The default template contents can been found
1668
+ [here](https://github.com/matrix-org/synapse/blob/release-v1.33.0/synapse/res/templates/account_previously_renewed.html),
1669
+ and can also accept an `expiration_ts` variable. This template replaces
1670
+ the error message users would previously see upon attempting to use a
1671
+ valid renewal token more than once.
1672
+
1673
+ # Upgrading to v1.32.0
1674
+
1675
+ ## Regression causing connected Prometheus instances to become overwhelmed
1676
+
1677
+ This release introduces [a
1678
+ regression](https://github.com/matrix-org/synapse/issues/9853) that can
1679
+ overwhelm connected Prometheus instances. This issue is not present in
1680
+ Synapse v1.32.0rc1.
1681
+
1682
+ If you have been affected, please downgrade to 1.31.0. You then may need
1683
+ to remove excess writeahead logs in order for Prometheus to recover.
1684
+ Instructions for doing so are provided
1685
+ [here](https://github.com/matrix-org/synapse/pull/9854#issuecomment-823472183).
1686
+
1687
+ ## Dropping support for old Python, Postgres and SQLite versions
1688
+
1689
+ In line with our [deprecation policy](deprecation_policy.md),
1690
+ we've dropped support for Python 3.5 and PostgreSQL 9.5, as they are no
1691
+ longer supported upstream.
1692
+
1693
+ This release of Synapse requires Python 3.6+ and PostgreSQL 9.6+ or
1694
+ SQLite 3.22+.
1695
+
1696
+ ## Removal of old List Accounts Admin API
1697
+
1698
+ The deprecated v1 "list accounts" admin API
1699
+ (`GET /_synapse/admin/v1/users/<user_id>`) has been removed in this
1700
+ version.
1701
+
1702
+ The [v2 list accounts API](admin_api/user_admin_api.md#list-accounts)
1703
+ has been available since Synapse 1.7.0 (2019-12-13), and is accessible
1704
+ under `GET /_synapse/admin/v2/users`.
1705
+
1706
+ The deprecation of the old endpoint was announced with Synapse 1.28.0
1707
+ (released on 2021-02-25).
1708
+
1709
+ ## Application Services must use type `m.login.application_service` when registering users
1710
+
1711
+ In compliance with the [Application Service
1712
+ spec](https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions),
1713
+ Application Services are now required to use the
1714
+ `m.login.application_service` type when registering users via the
1715
+ `/_matrix/client/r0/register` endpoint. This behaviour was deprecated in
1716
+ Synapse v1.30.0.
1717
+
1718
+ Please ensure your Application Services are up to date.
1719
+
1720
+ # Upgrading to v1.29.0
1721
+
1722
+ ## Requirement for X-Forwarded-Proto header
1723
+
1724
+ When using Synapse with a reverse proxy (in particular, when using the
1725
+ `x_forwarded` option on an HTTP listener), Synapse now
1726
+ expects to receive an `X-Forwarded-Proto` header on incoming
1727
+ HTTP requests. If it is not set, Synapse will log a warning on each
1728
+ received request.
1729
+
1730
+ To avoid the warning, administrators using a reverse proxy should ensure
1731
+ that the reverse proxy sets `X-Forwarded-Proto` header to
1732
+ `https` or `http` to indicate the protocol used
1733
+ by the client.
1734
+
1735
+ Synapse also requires the `Host` header to be preserved.
1736
+
1737
+ See the [reverse proxy documentation](reverse_proxy.md), where the
1738
+ example configurations have been updated to show how to set these
1739
+ headers.
1740
+
1741
+ (Users of [Caddy](https://caddyserver.com/) are unaffected, since we
1742
+ believe it sets `X-Forwarded-Proto` by default.)
1743
+
1744
+ # Upgrading to v1.27.0
1745
+
1746
+ ## Changes to callback URI for OAuth2 / OpenID Connect and SAML2
1747
+
1748
+ This version changes the URI used for callbacks from OAuth2 and SAML2
1749
+ identity providers:
1750
+
1751
+ - If your server is configured for single sign-on via an OpenID
1752
+ Connect or OAuth2 identity provider, you will need to add
1753
+ `[synapse public baseurl]/_synapse/client/oidc/callback` to the list
1754
+ of permitted "redirect URIs" at the identity provider.
1755
+
1756
+ See the [OpenID docs](openid.md) for more information on setting
1757
+ up OpenID Connect.
1758
+
1759
+ - If your server is configured for single sign-on via a SAML2 identity
1760
+ provider, you will need to add
1761
+ `[synapse public baseurl]/_synapse/client/saml2/authn_response` as a
1762
+ permitted "ACS location" (also known as "allowed callback URLs")
1763
+ at the identity provider.
1764
+
1765
+ The "Issuer" in the "AuthnRequest" to the SAML2 identity
1766
+ provider is also updated to
1767
+ `[synapse public baseurl]/_synapse/client/saml2/metadata.xml`. If
1768
+ your SAML2 identity provider uses this property to validate or
1769
+ otherwise identify Synapse, its configuration will need to be
1770
+ updated to use the new URL. Alternatively you could create a new,
1771
+ separate "EntityDescriptor" in your SAML2 identity provider with
1772
+ the new URLs and leave the URLs in the existing "EntityDescriptor"
1773
+ as they were.
1774
+
1775
+ ## Changes to HTML templates
1776
+
1777
+ The HTML templates for SSO and email notifications now have [Jinja2's
1778
+ autoescape](https://jinja.palletsprojects.com/en/2.11.x/api/#autoescaping)
1779
+ enabled for files ending in `.html`, `.htm`, and `.xml`. If you have
1780
+ customised these templates and see issues when viewing them you might
1781
+ need to update them. It is expected that most configurations will need
1782
+ no changes.
1783
+
1784
+ If you have customised the templates *names* for these templates, it is
1785
+ recommended to verify they end in `.html` to ensure autoescape is
1786
+ enabled.
1787
+
1788
+ The above applies to the following templates:
1789
+
1790
+ - `add_threepid.html`
1791
+ - `add_threepid_failure.html`
1792
+ - `add_threepid_success.html`
1793
+ - `notice_expiry.html`
1794
+ - `notice_expiry.html`
1795
+ - `notif_mail.html` (which, by default, includes `room.html` and
1796
+ `notif.html`)
1797
+ - `password_reset.html`
1798
+ - `password_reset_confirmation.html`
1799
+ - `password_reset_failure.html`
1800
+ - `password_reset_success.html`
1801
+ - `registration.html`
1802
+ - `registration_failure.html`
1803
+ - `registration_success.html`
1804
+ - `sso_account_deactivated.html`
1805
+ - `sso_auth_bad_user.html`
1806
+ - `sso_auth_confirm.html`
1807
+ - `sso_auth_success.html`
1808
+ - `sso_error.html`
1809
+ - `sso_login_idp_picker.html`
1810
+ - `sso_redirect_confirm.html`
1811
+
1812
+ # Upgrading to v1.26.0
1813
+
1814
+ ## Rolling back to v1.25.0 after a failed upgrade
1815
+
1816
+ v1.26.0 includes a lot of large changes. If something problematic
1817
+ occurs, you may want to roll-back to a previous version of Synapse.
1818
+ Because v1.26.0 also includes a new database schema version, reverting
1819
+ that version is also required alongside the generic rollback
1820
+ instructions mentioned above. In short, to roll back to v1.25.0 you need
1821
+ to:
1822
+
1823
+ 1. Stop the server
1824
+
1825
+ 2. Decrease the schema version in the database:
1826
+
1827
+ ```sql
1828
+ UPDATE schema_version SET version = 58;
1829
+ ```
1830
+
1831
+ 3. Delete the ignored users & chain cover data:
1832
+
1833
+ ```sql
1834
+ DROP TABLE IF EXISTS ignored_users;
1835
+ UPDATE rooms SET has_auth_chain_index = false;
1836
+ ```
1837
+
1838
+ For PostgreSQL run:
1839
+
1840
+ ```sql
1841
+ TRUNCATE event_auth_chain_links;
1842
+ TRUNCATE event_auth_chains;
1843
+ ```
1844
+
1845
+ For SQLite run:
1846
+
1847
+ ```sql
1848
+ DELETE FROM event_auth_chain_links;
1849
+ DELETE FROM event_auth_chains;
1850
+ ```
1851
+
1852
+ 4. Mark the deltas as not run (so they will re-run on upgrade).
1853
+
1854
+ ```sql
1855
+ DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/01ignored_user.py";
1856
+ DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/06chain_cover_index.sql";
1857
+ ```
1858
+
1859
+ 5. Downgrade Synapse by following the instructions for your
1860
+ installation method in the "Rolling back to older versions"
1861
+ section above.
1862
+
1863
+ # Upgrading to v1.25.0
1864
+
1865
+ ## Last release supporting Python 3.5
1866
+
1867
+ This is the last release of Synapse which guarantees support with Python
1868
+ 3.5, which passed its upstream End of Life date several months ago.
1869
+
1870
+ We will attempt to maintain support through March 2021, but without
1871
+ guarantees.
1872
+
1873
+ In the future, Synapse will follow upstream schedules for ending support
1874
+ of older versions of Python and PostgreSQL. Please upgrade to at least
1875
+ Python 3.6 and PostgreSQL 9.6 as soon as possible.
1876
+
1877
+ ## Blacklisting IP ranges
1878
+
1879
+ Synapse v1.25.0 includes new settings, `ip_range_blacklist` and
1880
+ `ip_range_whitelist`, for controlling outgoing requests from Synapse for
1881
+ federation, identity servers, push, and for checking key validity for
1882
+ third-party invite events. The previous setting,
1883
+ `federation_ip_range_blacklist`, is deprecated. The new
1884
+ `ip_range_blacklist` defaults to private IP ranges if it is not defined.
1885
+
1886
+ If you have never customised `federation_ip_range_blacklist` it is
1887
+ recommended that you remove that setting.
1888
+
1889
+ If you have customised `federation_ip_range_blacklist` you should update
1890
+ the setting name to `ip_range_blacklist`.
1891
+
1892
+ If you have a custom push server that is reached via private IP space
1893
+ you may need to customise `ip_range_blacklist` or `ip_range_whitelist`.
1894
+
1895
+ # Upgrading to v1.24.0
1896
+
1897
+ ## Custom OpenID Connect mapping provider breaking change
1898
+
1899
+ This release allows the OpenID Connect mapping provider to perform
1900
+ normalisation of the localpart of the Matrix ID. This allows for the
1901
+ mapping provider to specify different algorithms, instead of the
1902
+ [default
1903
+ way](<https://matrix.org/docs/spec/appendices#mapping-from-other-character-sets>).
1904
+
1905
+ If your Synapse configuration uses a custom mapping provider
1906
+ (`oidc_config.user_mapping_provider.module` is specified and
1907
+ not equal to
1908
+ `synapse.handlers.oidc_handler.JinjaOidcMappingProvider`)
1909
+ then you *must* ensure that `map_user_attributes` of the
1910
+ mapping provider performs some normalisation of the
1911
+ `localpart` returned. To match previous behaviour you can
1912
+ use the `map_username_to_mxid_localpart` function provided
1913
+ by Synapse. An example is shown below:
1914
+
1915
+ ```python
1916
+ from synapse.types import map_username_to_mxid_localpart
1917
+
1918
+ class MyMappingProvider:
1919
+ def map_user_attributes(self, userinfo, token):
1920
+ # ... your custom logic ...
1921
+ sso_user_id = ...
1922
+ localpart = map_username_to_mxid_localpart(sso_user_id)
1923
+
1924
+ return {"localpart": localpart}
1925
+ ```
1926
+
1927
+ ## Removal historical Synapse Admin API
1928
+
1929
+ Historically, the Synapse Admin API has been accessible under:
1930
+
1931
+ - `/_matrix/client/api/v1/admin`
1932
+ - `/_matrix/client/unstable/admin`
1933
+ - `/_matrix/client/r0/admin`
1934
+ - `/_synapse/admin/v1`
1935
+
1936
+ The endpoints with `/_matrix/client/*` prefixes have been removed as of
1937
+ v1.24.0. The Admin API is now only accessible under:
1938
+
1939
+ - `/_synapse/admin/v1`
1940
+
1941
+ The only exception is the `/admin/whois` endpoint, which is
1942
+ [also available via the client-server
1943
+ API](https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid).
1944
+
1945
+ The deprecation of the old endpoints was announced with Synapse 1.20.0
1946
+ (released on 2020-09-22) and makes it easier for homeserver admins to
1947
+ lock down external access to the Admin API endpoints.
1948
+
1949
+ # Upgrading to v1.23.0
1950
+
1951
+ ## Structured logging configuration breaking changes
1952
+
1953
+ This release deprecates use of the `structured: true` logging
1954
+ configuration for structured logging. If your logging configuration
1955
+ contains `structured: true` then it should be modified based on the
1956
+ [structured logging documentation](https://element-hq.github.io/synapse/v1.56/structured_logging.html#upgrading-from-legacy-structured-logging-configuration).
1957
+
1958
+ The `structured` and `drains` logging options are now deprecated and
1959
+ should be replaced by standard logging configuration of `handlers` and
1960
+ `formatters`.
1961
+
1962
+ A future will release of Synapse will make using `structured: true` an
1963
+ error.
1964
+
1965
+ # Upgrading to v1.22.0
1966
+
1967
+ ## ThirdPartyEventRules breaking changes
1968
+
1969
+ This release introduces a backwards-incompatible change to modules
1970
+ making use of `ThirdPartyEventRules` in Synapse. If you make use of a
1971
+ module defined under the `third_party_event_rules` config option, please
1972
+ make sure it is updated to handle the below change:
1973
+
1974
+ The `http_client` argument is no longer passed to modules as they are
1975
+ initialised. Instead, modules are expected to make use of the
1976
+ `http_client` property on the `ModuleApi` class. Modules are now passed
1977
+ a `module_api` argument during initialisation, which is an instance of
1978
+ `ModuleApi`. `ModuleApi` instances have a `http_client` property which
1979
+ acts the same as the `http_client` argument previously passed to
1980
+ `ThirdPartyEventRules` modules.
1981
+
1982
+ # Upgrading to v1.21.0
1983
+
1984
+ ## Forwarding `/_synapse/client` through your reverse proxy
1985
+
1986
+ The [reverse proxy documentation](reverse_proxy.md)
1987
+ has been updated to include reverse proxy directives for
1988
+ `/_synapse/client/*` endpoints. As the user password reset flow now uses
1989
+ endpoints under this prefix, **you must update your reverse proxy
1990
+ configurations for user password reset to work**.
1991
+
1992
+ Additionally, note that the [Synapse worker documentation](workers.md) has been updated to
1993
+
1994
+ : state that the `/_synapse/client/password_reset/email/submit_token`
1995
+ endpoint can be handled
1996
+
1997
+ by all workers. If you make use of Synapse's worker feature, please
1998
+ update your reverse proxy configuration to reflect this change.
1999
+
2000
+ ## New HTML templates
2001
+
2002
+ A new HTML template,
2003
+ [password_reset_confirmation.html](https://github.com/element-hq/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html),
2004
+ has been added to the `synapse/res/templates` directory. If you are
2005
+ using a custom template directory, you may want to copy the template
2006
+ over and modify it.
2007
+
2008
+ Note that as of v1.20.0, templates do not need to be included in custom
2009
+ template directories for Synapse to start. The default templates will be
2010
+ used if a custom template cannot be found.
2011
+
2012
+ This page will appear to the user after clicking a password reset link
2013
+ that has been emailed to them.
2014
+
2015
+ To complete password reset, the page must include a way to make a
2016
+ `POST` request to
2017
+ `/_synapse/client/password_reset/{medium}/submit_token` with the query
2018
+ parameters from the original link, presented as a URL-encoded form. See
2019
+ the file itself for more details.
2020
+
2021
+ ## Updated Single Sign-on HTML Templates
2022
+
2023
+ The `saml_error.html` template was removed from Synapse and replaced
2024
+ with the `sso_error.html` template. If your Synapse is configured to use
2025
+ SAML and a custom `sso_redirect_confirm_template_dir` configuration then
2026
+ any customisations of the `saml_error.html` template will need to be
2027
+ merged into the `sso_error.html` template. These templates are similar,
2028
+ but the parameters are slightly different:
2029
+
2030
+ - The `msg` parameter should be renamed to `error_description`.
2031
+ - There is no longer a `code` parameter for the response code.
2032
+ - A string `error` parameter is available that includes a short hint
2033
+ of why a user is seeing the error page.
2034
+
2035
+ # Upgrading to v1.18.0
2036
+
2037
+ ## Docker `-py3` suffix will be removed in future versions
2038
+
2039
+ From 10th August 2020, we will no longer publish Docker images with the
2040
+ `-py3` tag suffix. The images tagged with the
2041
+ `-py3` suffix have been identical to the non-suffixed tags
2042
+ since release 0.99.0, and the suffix is obsolete.
2043
+
2044
+ On 10th August, we will remove the `latest-py3` tag.
2045
+ Existing per-release tags (such as `v1.18.0-py3` will not
2046
+ be removed, but no new `-py3` tags will be added.
2047
+
2048
+ Scripts relying on the `-py3` suffix will need to be
2049
+ updated.
2050
+
2051
+ ## Redis replication is now recommended in lieu of TCP replication
2052
+
2053
+ When setting up worker processes, we now recommend the use of a Redis
2054
+ server for replication. **The old direct TCP connection method is
2055
+ deprecated and will be removed in a future release.** See
2056
+ the [worker documentation](https://element-hq.github.io/synapse/v1.66/workers.html) for more details.
2057
+
2058
+ # Upgrading to v1.14.0
2059
+
2060
+ This version includes a database update which is run as part of the
2061
+ upgrade, and which may take a couple of minutes in the case of a large
2062
+ server. Synapse will not respond to HTTP requests while this update is
2063
+ taking place.
2064
+
2065
+ # Upgrading to v1.13.0
2066
+
2067
+ ## Incorrect database migration in old synapse versions
2068
+
2069
+ A bug was introduced in Synapse 1.4.0 which could cause the room
2070
+ directory to be incomplete or empty if Synapse was upgraded directly
2071
+ from v1.2.1 or earlier, to versions between v1.4.0 and v1.12.x.
2072
+
2073
+ This will *not* be a problem for Synapse installations which were:
2074
+
2075
+ : - created at v1.4.0 or later,
2076
+ - upgraded via v1.3.x, or
2077
+ - upgraded straight from v1.2.1 or earlier to v1.13.0 or later.
2078
+
2079
+ If completeness of the room directory is a concern, installations which
2080
+ are affected can be repaired as follows:
2081
+
2082
+ 1. Run the following sql from a `psql` or
2083
+ `sqlite3` console:
2084
+
2085
+ ```sql
2086
+ INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
2087
+ ('populate_stats_process_rooms', '{}', 'current_state_events_membership');
2088
+
2089
+ INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
2090
+ ('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
2091
+ ```
2092
+
2093
+ 2. Restart synapse.
2094
+
2095
+ ## New Single Sign-on HTML Templates
2096
+
2097
+ New templates (`sso_auth_confirm.html`, `sso_auth_success.html`, and
2098
+ `sso_account_deactivated.html`) were added to Synapse. If your Synapse
2099
+ is configured to use SSO and a custom
2100
+ `sso_redirect_confirm_template_dir` configuration then these templates
2101
+ will need to be copied from
2102
+ [`synapse/res/templates`](https://github.com/element-hq/synapse/tree/develop/synapse/res/templates) into that directory.
2103
+
2104
+ ## Synapse SSO Plugins Method Deprecation
2105
+
2106
+ Plugins using the `complete_sso_login` method of
2107
+ `synapse.module_api.ModuleApi` should update to using the async/await
2108
+ version `complete_sso_login_async` which includes additional checks. The
2109
+ non-async version is considered deprecated.
2110
+
2111
+ ## Rolling back to v1.12.4 after a failed upgrade
2112
+
2113
+ v1.13.0 includes a lot of large changes. If something problematic
2114
+ occurs, you may want to roll-back to a previous version of Synapse.
2115
+ Because v1.13.0 also includes a new database schema version, reverting
2116
+ that version is also required alongside the generic rollback
2117
+ instructions mentioned above. In short, to roll back to v1.12.4 you need
2118
+ to:
2119
+
2120
+ 1. Stop the server
2121
+
2122
+ 2. Decrease the schema version in the database:
2123
+
2124
+ ```sql
2125
+ UPDATE schema_version SET version = 57;
2126
+ ```
2127
+
2128
+ 3. Downgrade Synapse by following the instructions for your
2129
+ installation method in the "Rolling back to older versions"
2130
+ section above.
2131
+
2132
+ # Upgrading to v1.12.0
2133
+
2134
+ This version includes a database update which is run as part of the
2135
+ upgrade, and which may take some time (several hours in the case of a
2136
+ large server). Synapse will not respond to HTTP requests while this
2137
+ update is taking place.
2138
+
2139
+ This is only likely to be a problem in the case of a server which is
2140
+ participating in many rooms.
2141
+
2142
+ 0. As with all upgrades, it is recommended that you have a recent
2143
+ backup of your database which can be used for recovery in the event
2144
+ of any problems.
2145
+
2146
+ 1. As an initial check to see if you will be affected, you can try
2147
+ running the following query from the `psql` or
2148
+ `sqlite3` console. It is safe to run it while Synapse is
2149
+ still running.
2150
+
2151
+ ```sql
2152
+ SELECT MAX(q.v) FROM (
2153
+ SELECT (
2154
+ SELECT ej.json AS v
2155
+ FROM state_events se INNER JOIN event_json ej USING (event_id)
2156
+ WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
2157
+ LIMIT 1
2158
+ ) FROM rooms WHERE rooms.room_version IS NULL
2159
+ ) q;
2160
+ ```
2161
+
2162
+ This query will take about the same amount of time as the upgrade
2163
+ process: ie, if it takes 5 minutes, then it is likely that Synapse
2164
+ will be unresponsive for 5 minutes during the upgrade.
2165
+
2166
+ If you consider an outage of this duration to be acceptable, no
2167
+ further action is necessary and you can simply start Synapse 1.12.0.
2168
+
2169
+ If you would prefer to reduce the downtime, continue with the steps
2170
+ below.
2171
+
2172
+ 2. The easiest workaround for this issue is to manually create a new
2173
+ index before upgrading. On PostgreSQL, his can be done as follows:
2174
+
2175
+ ```sql
2176
+ CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
2177
+ ON state_events(room_id) WHERE type = 'm.room.create';
2178
+ ```
2179
+
2180
+ The above query may take some time, but is also safe to run while
2181
+ Synapse is running.
2182
+
2183
+ We assume that no SQLite users have databases large enough to be
2184
+ affected. If you *are* affected, you can run a similar query,
2185
+ omitting the `CONCURRENTLY` keyword. Note however that this
2186
+ operation may in itself cause Synapse to stop running for some time.
2187
+ Synapse admins are reminded that [SQLite is not recommended for use
2188
+ outside a test environment](postgres.md).
2189
+
2190
+ 3. Once the index has been created, the `SELECT` query in step 1 above
2191
+ should complete quickly. It is therefore safe to upgrade to Synapse
2192
+ 1.12.0.
2193
+
2194
+ 4. Once Synapse 1.12.0 has successfully started and is responding to
2195
+ HTTP requests, the temporary index can be removed:
2196
+
2197
+ ```sql
2198
+ DROP INDEX tmp_upgrade_1_12_0_index;
2199
+ ```
2200
+
2201
+ # Upgrading to v1.10.0
2202
+
2203
+ Synapse will now log a warning on start up if used with a PostgreSQL
2204
+ database that has a non-recommended locale set.
2205
+
2206
+ See [Postgres](postgres.md) for details.
2207
+
2208
+ # Upgrading to v1.8.0
2209
+
2210
+ Specifying a `log_file` config option will now cause Synapse to refuse
2211
+ to start, and should be replaced by with the `log_config` option.
2212
+ Support for the `log_file` option was removed in v1.3.0 and has since
2213
+ had no effect.
2214
+
2215
+ # Upgrading to v1.7.0
2216
+
2217
+ In an attempt to configure Synapse in a privacy preserving way, the
2218
+ default behaviours of `allow_public_rooms_without_auth` and
2219
+ `allow_public_rooms_over_federation` have been inverted. This means that
2220
+ by default, only authenticated users querying the Client/Server API will
2221
+ be able to query the room directory, and relatedly that the server will
2222
+ not share room directory information with other servers over federation.
2223
+
2224
+ If your installation does not explicitly set these settings one way or
2225
+ the other and you want either setting to be `true` then it will
2226
+ necessary to update your homeserver configuration file accordingly.
2227
+
2228
+ For more details on the surrounding context see our
2229
+ [explainer](https://matrix.org/blog/2019/11/09/avoiding-unwelcome-visitors-on-private-matrix-servers).
2230
+
2231
+ # Upgrading to v1.5.0
2232
+
2233
+ This release includes a database migration which may take several
2234
+ minutes to complete if there are a large number (more than a million or
2235
+ so) of entries in the `devices` table. This is only likely to a be a
2236
+ problem on very large installations.
2237
+
2238
+ # Upgrading to v1.4.0
2239
+
2240
+ ## New custom templates
2241
+
2242
+ If you have configured a custom template directory with the
2243
+ `email.template_dir` option, be aware that there are new templates
2244
+ regarding registration and threepid management (see below) that must be
2245
+ included.
2246
+
2247
+ - `registration.html` and `registration.txt`
2248
+ - `registration_success.html` and `registration_failure.html`
2249
+ - `add_threepid.html` and `add_threepid.txt`
2250
+ - `add_threepid_failure.html` and `add_threepid_success.html`
2251
+
2252
+ Synapse will expect these files to exist inside the configured template
2253
+ directory, and **will fail to start** if they are absent. To view the
2254
+ default templates, see
2255
+ [synapse/res/templates](https://github.com/element-hq/synapse/tree/master/synapse/res/templates).
2256
+
2257
+ ## 3pid verification changes
2258
+
2259
+ **Note: As of this release, users will be unable to add phone numbers or
2260
+ email addresses to their accounts, without changes to the Synapse
2261
+ configuration. This includes adding an email address during
2262
+ registration.**
2263
+
2264
+ It is possible for a user to associate an email address or phone number
2265
+ with their account, for a number of reasons:
2266
+
2267
+ - for use when logging in, as an alternative to the user id.
2268
+ - in the case of email, as an alternative contact to help with account
2269
+ recovery.
2270
+ - in the case of email, to receive notifications of missed messages.
2271
+
2272
+ Before an email address or phone number can be added to a user's
2273
+ account, or before such an address is used to carry out a
2274
+ password-reset, Synapse must confirm the operation with the owner of the
2275
+ email address or phone number. It does this by sending an email or text
2276
+ giving the user a link or token to confirm receipt. This process is
2277
+ known as '3pid verification'. ('3pid', or 'threepid', stands for
2278
+ third-party identifier, and we use it to refer to external identifiers
2279
+ such as email addresses and phone numbers.)
2280
+
2281
+ Previous versions of Synapse delegated the task of 3pid verification to
2282
+ an identity server by default. In most cases this server is `vector.im`
2283
+ or `matrix.org`.
2284
+
2285
+ In Synapse 1.4.0, for security and privacy reasons, the homeserver will
2286
+ no longer delegate this task to an identity server by default. Instead,
2287
+ the server administrator will need to explicitly decide how they would
2288
+ like the verification messages to be sent.
2289
+
2290
+ In the medium term, the `vector.im` and `matrix.org` identity servers
2291
+ will disable support for delegated 3pid verification entirely. However,
2292
+ in order to ease the transition, they will retain the capability for a
2293
+ limited period. Delegated email verification will be disabled on Monday
2294
+ 2nd December 2019 (giving roughly 2 months notice). Disabling delegated
2295
+ SMS verification will follow some time after that once SMS verification
2296
+ support lands in Synapse.
2297
+
2298
+ Once delegated 3pid verification support has been disabled in the
2299
+ `vector.im` and `matrix.org` identity servers, all Synapse versions that
2300
+ depend on those instances will be unable to verify email and phone
2301
+ numbers through them. There are no imminent plans to remove delegated
2302
+ 3pid verification from Sydent generally. (Sydent is the identity server
2303
+ project that backs the `vector.im` and `matrix.org` instances).
2304
+
2305
+ ### Email
2306
+
2307
+ Following upgrade, to continue verifying email (e.g. as part of the
2308
+ registration process), admins can either:-
2309
+
2310
+ - Configure Synapse to use an email server.
2311
+ - Run or choose an identity server which allows delegated email
2312
+ verification and delegate to it.
2313
+
2314
+ #### Configure SMTP in Synapse
2315
+
2316
+ To configure an SMTP server for Synapse, modify the configuration
2317
+ section headed `email`, and be sure to have at least the
2318
+ `smtp_host, smtp_port` and `notif_from` fields filled out.
2319
+
2320
+ You may also need to set `smtp_user`, `smtp_pass`, and
2321
+ `require_transport_security`.
2322
+
2323
+ See the [sample configuration file](usage/configuration/homeserver_sample_config.md)
2324
+ for more details on these settings.
2325
+
2326
+ #### Delegate email to an identity server
2327
+
2328
+ Some admins will wish to continue using email verification as part of
2329
+ the registration process, but will not immediately have an appropriate
2330
+ SMTP server at hand.
2331
+
2332
+ To this end, we will continue to support email verification delegation
2333
+ via the `vector.im` and `matrix.org` identity servers for two months.
2334
+ Support for delegated email verification will be disabled on Monday 2nd
2335
+ December.
2336
+
2337
+ The `account_threepid_delegates` dictionary defines whether the
2338
+ homeserver should delegate an external server (typically an [identity
2339
+ server](https://matrix.org/docs/spec/identity_service/r0.2.1)) to handle
2340
+ sending confirmation messages via email and SMS.
2341
+
2342
+ So to delegate email verification, in `homeserver.yaml`, set
2343
+ `account_threepid_delegates.email` to the base URL of an identity
2344
+ server. For example:
2345
+
2346
+ ```yaml
2347
+ account_threepid_delegates:
2348
+ email: https://example.com # Delegate email sending to example.com
2349
+ ```
2350
+
2351
+ Note that `account_threepid_delegates.email` replaces the deprecated
2352
+ `email.trust_identity_server_for_password_resets`: if
2353
+ `email.trust_identity_server_for_password_resets` is set to `true`, and
2354
+ `account_threepid_delegates.email` is not set, then the first entry in
2355
+ `trusted_third_party_id_servers` will be used as the
2356
+ `account_threepid_delegate` for email. This is to ensure compatibility
2357
+ with existing Synapse installs that set up external server handling for
2358
+ these tasks before v1.4.0. If
2359
+ `email.trust_identity_server_for_password_resets` is `true` and no
2360
+ trusted identity server domains are configured, Synapse will report an
2361
+ error and refuse to start.
2362
+
2363
+ If `email.trust_identity_server_for_password_resets` is `false` or
2364
+ absent and no `email` delegate is configured in
2365
+ `account_threepid_delegates`, then Synapse will send email verification
2366
+ messages itself, using the configured SMTP server (see above). that
2367
+ type.
2368
+
2369
+ ### Phone numbers
2370
+
2371
+ Synapse does not support phone-number verification itself, so the only
2372
+ way to maintain the ability for users to add phone numbers to their
2373
+ accounts will be by continuing to delegate phone number verification to
2374
+ the `matrix.org` and `vector.im` identity servers (or another identity
2375
+ server that supports SMS sending).
2376
+
2377
+ The `account_threepid_delegates` dictionary defines whether the
2378
+ homeserver should delegate an external server (typically an [identity
2379
+ server](https://matrix.org/docs/spec/identity_service/r0.2.1)) to handle
2380
+ sending confirmation messages via email and SMS.
2381
+
2382
+ So to delegate phone number verification, in `homeserver.yaml`, set
2383
+ `account_threepid_delegates.msisdn` to the base URL of an identity
2384
+ server. For example:
2385
+
2386
+ ```yaml
2387
+ account_threepid_delegates:
2388
+ msisdn: https://example.com # Delegate sms sending to example.com
2389
+ ```
2390
+
2391
+ The `matrix.org` and `vector.im` identity servers will continue to
2392
+ support delegated phone number verification via SMS until such time as
2393
+ it is possible for admins to configure their servers to perform phone
2394
+ number verification directly. More details will follow in a future
2395
+ release.
2396
+
2397
+ ## Rolling back to v1.3.1
2398
+
2399
+ If you encounter problems with v1.4.0, it should be possible to roll
2400
+ back to v1.3.1, subject to the following:
2401
+
2402
+ - The 'room statistics' engine was heavily reworked in this release
2403
+ (see [#5971](https://github.com/matrix-org/synapse/pull/5971)),
2404
+ including significant changes to the database schema, which are not
2405
+ easily reverted. This will cause the room statistics engine to stop
2406
+ updating when you downgrade.
2407
+
2408
+ The room statistics are essentially unused in v1.3.1 (in future
2409
+ versions of Synapse, they will be used to populate the room
2410
+ directory), so there should be no loss of functionality. However,
2411
+ the statistics engine will write errors to the logs, which can be
2412
+ avoided by setting the following in `homeserver.yaml`:
2413
+
2414
+ ```yaml
2415
+ stats:
2416
+ enabled: false
2417
+ ```
2418
+
2419
+ Don't forget to re-enable it when you upgrade again, in preparation
2420
+ for its use in the room directory!
2421
+
2422
+ # Upgrading to v1.2.0
2423
+
2424
+ Some counter metrics have been renamed, with the old names deprecated.
2425
+ See [the metrics
2426
+ documentation](metrics-howto.md#renaming-of-metrics--deprecation-of-old-names-in-12)
2427
+ for details.
2428
+
2429
+ # Upgrading to v1.1.0
2430
+
2431
+ Synapse v1.1.0 removes support for older Python and PostgreSQL versions,
2432
+ as outlined in [our deprecation
2433
+ notice](https://matrix.org/blog/2019/04/08/synapse-deprecating-postgres-9-4-and-python-2-x).
2434
+
2435
+ ## Minimum Python Version
2436
+
2437
+ Synapse v1.1.0 has a minimum Python requirement of Python 3.5. Python
2438
+ 3.6 or Python 3.7 are recommended as they have improved internal string
2439
+ handling, significantly reducing memory usage.
2440
+
2441
+ If you use current versions of the Matrix.org-distributed Debian
2442
+ packages or Docker images, action is not required.
2443
+
2444
+ If you install Synapse in a Python virtual environment, please see
2445
+ "Upgrading to v0.34.0" for notes on setting up a new virtualenv under
2446
+ Python 3.
2447
+
2448
+ ## Minimum PostgreSQL Version
2449
+
2450
+ If using PostgreSQL under Synapse, you will need to use PostgreSQL 9.5
2451
+ or above. Please see the [PostgreSQL
2452
+ documentation](https://www.postgresql.org/docs/11/upgrading.html) for
2453
+ more details on upgrading your database.
2454
+
2455
+ # Upgrading to v1.0
2456
+
2457
+ ## Validation of TLS certificates
2458
+
2459
+ Synapse v1.0 is the first release to enforce validation of TLS
2460
+ certificates for the federation API. It is therefore essential that your
2461
+ certificates are correctly configured.
2462
+
2463
+ Note, v1.0 installations will also no longer be able to federate with
2464
+ servers that have not correctly configured their certificates.
2465
+
2466
+ In rare cases, it may be desirable to disable certificate checking: for
2467
+ example, it might be essential to be able to federate with a given
2468
+ legacy server in a closed federation. This can be done in one of two
2469
+ ways:-
2470
+
2471
+ - Configure the global switch `federation_verify_certificates` to
2472
+ `false`.
2473
+ - Configure a whitelist of server domains to trust via
2474
+ `federation_certificate_verification_whitelist`.
2475
+
2476
+ See the [sample configuration file](usage/configuration/homeserver_sample_config.md)
2477
+ for more details on these settings.
2478
+
2479
+ ## Email
2480
+
2481
+ When a user requests a password reset, Synapse will send an email to the
2482
+ user to confirm the request.
2483
+
2484
+ Previous versions of Synapse delegated the job of sending this email to
2485
+ an identity server. If the identity server was somehow malicious or
2486
+ became compromised, it would be theoretically possible to hijack an
2487
+ account through this means.
2488
+
2489
+ Therefore, by default, Synapse v1.0 will send the confirmation email
2490
+ itself. If Synapse is not configured with an SMTP server, password reset
2491
+ via email will be disabled.
2492
+
2493
+ To configure an SMTP server for Synapse, modify the configuration
2494
+ section headed `email`, and be sure to have at least the `smtp_host`,
2495
+ `smtp_port` and `notif_from` fields filled out. You may also need to set
2496
+ `smtp_user`, `smtp_pass`, and `require_transport_security`.
2497
+
2498
+ If you are absolutely certain that you wish to continue using an
2499
+ identity server for password resets, set
2500
+ `trust_identity_server_for_password_resets` to `true`.
2501
+
2502
+ See the [sample configuration file](usage/configuration/homeserver_sample_config.md)
2503
+ for more details on these settings.
2504
+
2505
+ ## New email templates
2506
+
2507
+ Some new templates have been added to the default template directory for the purpose of
2508
+ the homeserver sending its own password reset emails. If you have configured a
2509
+ custom `template_dir` in your Synapse config, these files will need to be added.
2510
+
2511
+ `password_reset.html` and `password_reset.txt` are HTML and plain text
2512
+ templates respectively that contain the contents of what will be emailed
2513
+ to the user upon attempting to reset their password via email.
2514
+ `password_reset_success.html` and `password_reset_failure.html` are HTML
2515
+ files that the content of which (assuming no redirect URL is set) will
2516
+ be shown to the user after they attempt to click the link in the email
2517
+ sent to them.
2518
+
2519
+ # Upgrading to v0.99.0
2520
+
2521
+ Please be aware that, before Synapse v1.0 is released around March 2019,
2522
+ you will need to replace any self-signed certificates with those
2523
+ verified by a root CA. Information on how to do so can be found at the
2524
+ ACME docs.
2525
+
2526
+ # Upgrading to v0.34.0
2527
+
2528
+ 1. This release is the first to fully support Python 3. Synapse will
2529
+ now run on Python versions 3.5, or 3.6 (as well as 2.7). We
2530
+ recommend switching to Python 3, as it has been shown to give
2531
+ performance improvements.
2532
+
2533
+ For users who have installed Synapse into a virtualenv, we recommend
2534
+ doing this by creating a new virtualenv. For example:
2535
+
2536
+ ```sh
2537
+ virtualenv -p python3 ~/synapse/env3
2538
+ source ~/synapse/env3/bin/activate
2539
+ pip install matrix-synapse
2540
+ ```
2541
+
2542
+ You can then start synapse as normal, having activated the new
2543
+ virtualenv:
2544
+
2545
+ ```sh
2546
+ cd ~/synapse
2547
+ source env3/bin/activate
2548
+ synctl start
2549
+ ```
2550
+
2551
+ Users who have installed from distribution packages should see the
2552
+ relevant package documentation. See below for notes on Debian
2553
+ packages.
2554
+
2555
+ - When upgrading to Python 3, you **must** make sure that your log
2556
+ files are configured as UTF-8, by adding `encoding: utf8` to the
2557
+ `RotatingFileHandler` configuration (if you have one) in your
2558
+ `<server>.log.config` file. For example, if your `log.config`
2559
+ file contains:
2560
+
2561
+ ```yaml
2562
+ handlers:
2563
+ file:
2564
+ class: logging.handlers.RotatingFileHandler
2565
+ formatter: precise
2566
+ filename: homeserver.log
2567
+ maxBytes: 104857600
2568
+ backupCount: 10
2569
+ filters: [context]
2570
+ console:
2571
+ class: logging.StreamHandler
2572
+ formatter: precise
2573
+ filters: [context]
2574
+ ```
2575
+
2576
+ Then you should update this to be:
2577
+
2578
+ ```yaml
2579
+ handlers:
2580
+ file:
2581
+ class: logging.handlers.RotatingFileHandler
2582
+ formatter: precise
2583
+ filename: homeserver.log
2584
+ maxBytes: 104857600
2585
+ backupCount: 10
2586
+ filters: [context]
2587
+ encoding: utf8
2588
+ console:
2589
+ class: logging.StreamHandler
2590
+ formatter: precise
2591
+ filters: [context]
2592
+ ```
2593
+
2594
+ There is no need to revert this change if downgrading to
2595
+ Python 2.
2596
+
2597
+ We are also making available Debian packages which will run Synapse
2598
+ on Python 3. You can switch to these packages with
2599
+ `apt-get install matrix-synapse-py3`, however, please read
2600
+ [debian/NEWS](https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS)
2601
+ before doing so. The existing `matrix-synapse` packages will
2602
+ continue to use Python 2 for the time being.
2603
+
2604
+ 2. This release removes the `riot.im` from the default list of trusted
2605
+ identity servers.
2606
+
2607
+ If `riot.im` is in your homeserver's list of
2608
+ `trusted_third_party_id_servers`, you should remove it. It was added
2609
+ in case a hypothetical future identity server was put there. If you
2610
+ don't remove it, users may be unable to deactivate their accounts.
2611
+
2612
+ 3. This release no longer installs the (unmaintained) Matrix Console
2613
+ web client as part of the default installation. It is possible to
2614
+ re-enable it by installing it separately and setting the
2615
+ `web_client_location` config option, but please consider switching
2616
+ to another client.
2617
+
2618
+ # Upgrading to v0.33.7
2619
+
2620
+ This release removes the example email notification templates from
2621
+ `res/templates` (they are now internal to the python package). This
2622
+ should only affect you if you (a) deploy your Synapse instance from a
2623
+ git checkout or a github snapshot URL, and (b) have email notifications
2624
+ enabled.
2625
+
2626
+ If you have email notifications enabled, you should ensure that
2627
+ `email.template_dir` is either configured to point at a directory where
2628
+ you have installed customised templates, or leave it unset to use the
2629
+ default templates.
2630
+
2631
+ # Upgrading to v0.27.3
2632
+
2633
+ This release expands the anonymous usage stats sent if the opt-in
2634
+ `report_stats` configuration is set to `true`. We now capture RSS memory
2635
+ and cpu use at a very coarse level. This requires administrators to
2636
+ install the optional `psutil` python module.
2637
+
2638
+ We would appreciate it if you could assist by ensuring this module is
2639
+ available and `report_stats` is enabled. This will let us see if
2640
+ performance changes to synapse are having an impact to the general
2641
+ community.
2642
+
2643
+ # Upgrading to v0.15.0
2644
+
2645
+ If you want to use the new URL previewing API
2646
+ (`/_matrix/media/r0/preview_url`) then you have to explicitly enable it
2647
+ in the config and update your dependencies dependencies. See README.rst
2648
+ for details.
2649
+
2650
+ # Upgrading to v0.11.0
2651
+
2652
+ This release includes the option to send anonymous usage stats to
2653
+ matrix.org, and requires that administrators explicitly opt in or out by
2654
+ setting the `report_stats` option to either `true` or `false`.
2655
+
2656
+ We would really appreciate it if you could help our project out by
2657
+ reporting anonymized usage statistics from your homeserver. Only very
2658
+ basic aggregate data (e.g. number of users) will be reported, but it
2659
+ helps us to track the growth of the Matrix community, and helps us to
2660
+ make Matrix a success, as well as to convince other networks that they
2661
+ should peer with us.
2662
+
2663
+ # Upgrading to v0.9.0
2664
+
2665
+ Application services have had a breaking API change in this version.
2666
+
2667
+ They can no longer register themselves with a home server using the AS
2668
+ HTTP API. This decision was made because a compromised application
2669
+ service with free reign to register any regex in effect grants full
2670
+ read/write access to the home server if a regex of `.*` is used. An
2671
+ attack where a compromised AS re-registers itself with `.*` was deemed
2672
+ too big of a security risk to ignore, and so the ability to register
2673
+ with the HS remotely has been removed.
2674
+
2675
+ It has been replaced by specifying a list of application service
2676
+ registrations in `homeserver.yaml`:
2677
+
2678
+ ```yaml
2679
+ app_service_config_files: ["registration-01.yaml", "registration-02.yaml"]
2680
+ ```
2681
+
2682
+ Where `registration-01.yaml` looks like:
2683
+
2684
+ ```yaml
2685
+ url: <String> # e.g. "https://my.application.service.com"
2686
+ as_token: <String>
2687
+ hs_token: <String>
2688
+ sender_localpart: <String> # This is a new field which denotes the user_id localpart when using the AS token
2689
+ namespaces:
2690
+ users:
2691
+ - exclusive: <Boolean>
2692
+ regex: <String> # e.g. "@prefix_.*"
2693
+ aliases:
2694
+ - exclusive: <Boolean>
2695
+ regex: <String>
2696
+ rooms:
2697
+ - exclusive: <Boolean>
2698
+ regex: <String>
2699
+ ```
2700
+
2701
+ # Upgrading to v0.8.0
2702
+
2703
+ Servers which use captchas will need to add their public key to:
2704
+
2705
+ static/client/register/register_config.js
2706
+
2707
+ window.matrixRegistrationConfig = {
2708
+ recaptcha_public_key: "YOUR_PUBLIC_KEY"
2709
+ };
2710
+
2711
+ This is required in order to support registration fallback (typically
2712
+ used on mobile devices).
2713
+
2714
+ # Upgrading to v0.7.0
2715
+
2716
+ New dependencies are:
2717
+
2718
+ - pydenticon
2719
+ - simplejson
2720
+ - syutil
2721
+ - matrix-angular-sdk
2722
+
2723
+ To pull in these dependencies in a virtual env, run:
2724
+
2725
+ python synapse/python_dependencies.py | xargs -n 1 pip install
2726
+
2727
+ # Upgrading to v0.6.0
2728
+
2729
+ To pull in new dependencies, run:
2730
+
2731
+ python setup.py develop --user
2732
+
2733
+ This update includes a change to the database schema. To upgrade you
2734
+ first need to upgrade the database by running:
2735
+
2736
+ python scripts/upgrade_db_to_v0.6.0.py <db> <server_name> <signing_key>
2737
+
2738
+ Where `<db>` is the location of the database,
2739
+ `<server_name>` is the server name as specified in the
2740
+ synapse configuration, and `<signing_key>` is the location
2741
+ of the signing key as specified in the synapse configuration.
2742
+
2743
+ This may take some time to complete. Failures of signatures and content
2744
+ hashes can safely be ignored.
2745
+
2746
+ # Upgrading to v0.5.1
2747
+
2748
+ Depending on precisely when you installed v0.5.0 you may have ended up
2749
+ with a stale release of the reference matrix webclient installed as a
2750
+ python module. To uninstall it and ensure you are depending on the
2751
+ latest module, please run:
2752
+
2753
+ $ pip uninstall syweb
2754
+
2755
+ # Upgrading to v0.5.0
2756
+
2757
+ The webclient has been split out into a separate repository/package in
2758
+ this release. Before you restart your homeserver you will need to pull
2759
+ in the webclient package by running:
2760
+
2761
+ python setup.py develop --user
2762
+
2763
+ This release completely changes the database schema and so requires
2764
+ upgrading it before starting the new version of the homeserver.
2765
+
2766
+ The script "database-prepare-for-0.5.0.sh" should be used to upgrade
2767
+ the database. This will save all user information, such as logins and
2768
+ profiles, but will otherwise purge the database. This includes messages,
2769
+ which rooms the home server was a member of and room alias mappings.
2770
+
2771
+ If you would like to keep your history, please take a copy of your
2772
+ database file and ask for help in #matrix:matrix.org. The upgrade
2773
+ process is, unfortunately, non trivial and requires human intervention
2774
+ to resolve any resulting conflicts during the upgrade process.
2775
+
2776
+ Before running the command the homeserver should be first completely
2777
+ shutdown. To run it, simply specify the location of the database, e.g.:
2778
+
2779
+ > ./scripts/database-prepare-for-0.5.0.sh "homeserver.db"
2780
+
2781
+ Once this has successfully completed it will be safe to restart the
2782
+ homeserver. You may notice that the homeserver takes a few seconds
2783
+ longer to restart than usual as it reinitializes the database.
2784
+
2785
+ On startup of the new version, users can either rejoin remote rooms
2786
+ using room aliases or by being reinvited. Alternatively, if any other
2787
+ homeserver sends a message to a room that the homeserver was previously
2788
+ in the local HS will automatically rejoin the room.
2789
+
2790
+ # Upgrading to v0.4.0
2791
+
2792
+ This release needs an updated syutil version. Run:
2793
+
2794
+ python setup.py develop
2795
+
2796
+ You will also need to upgrade your configuration as the signing key
2797
+ format has changed. Run:
2798
+
2799
+ python -m synapse.app.homeserver --config-path <CONFIG> --generate-config
2800
+
2801
+ # Upgrading to v0.3.0
2802
+
2803
+ This registration API now closely matches the login API. This introduces
2804
+ a bit more backwards and forwards between the HS and the client, but
2805
+ this improves the overall flexibility of the API. You can now GET on
2806
+ /register to retrieve a list of valid registration flows. Upon choosing
2807
+ one, they are submitted in the same way as login, e.g:
2808
+
2809
+ {
2810
+ type: m.login.password,
2811
+ user: foo,
2812
+ password: bar
2813
+ }
2814
+
2815
+ The default HS supports 2 flows, with and without Identity Server email
2816
+ authentication. Enabling captcha on the HS will add in an extra step to
2817
+ all flows: `m.login.recaptcha` which must be completed before you can
2818
+ transition to the next stage. There is a new login type:
2819
+ `m.login.email.identity` which contains the `threepidCreds` key which
2820
+ were previously sent in the original register request. For more
2821
+ information on this, see the specification.
2822
+
2823
+ ## Web Client
2824
+
2825
+ The VoIP specification has changed between v0.2.0 and v0.3.0. Users
2826
+ should refresh any browser tabs to get the latest web client code. Users
2827
+ on v0.2.0 of the web client will not be able to call those on v0.3.0 and
2828
+ vice versa.
2829
+
2830
+ # Upgrading to v0.2.0
2831
+
2832
+ The home server now requires setting up of SSL config before it can run.
2833
+ To automatically generate default config use:
2834
+
2835
+ $ python synapse/app/homeserver.py \
2836
+ --server-name machine.my.domain.name \
2837
+ --bind-port 8448 \
2838
+ --config-path homeserver.config \
2839
+ --generate-config
2840
+
2841
+ This config can be edited if desired, for example to specify a different
2842
+ SSL certificate to use. Once done you can run the home server using:
2843
+
2844
+ $ python synapse/app/homeserver.py --config-path homeserver.config
2845
+
2846
+ See the README.rst for more information.
2847
+
2848
+ Also note that some config options have been renamed, including:
2849
+
2850
+ - "host" to "server-name"
2851
+ - "database" to "database-path"
2852
+ - "port" to "bind-port" and "unsecure-port"
2853
+
2854
+ # Upgrading to v0.0.1
2855
+
2856
+ This release completely changes the database schema and so requires
2857
+ upgrading it before starting the new version of the homeserver.
2858
+
2859
+ The script "database-prepare-for-0.0.1.sh" should be used to upgrade
2860
+ the database. This will save all user information, such as logins and
2861
+ profiles, but will otherwise purge the database. This includes messages,
2862
+ which rooms the home server was a member of and room alias mappings.
2863
+
2864
+ Before running the command the homeserver should be first completely
2865
+ shutdown. To run it, simply specify the location of the database, e.g.:
2866
+
2867
+ > ./scripts/database-prepare-for-0.0.1.sh "homeserver.db"
2868
+
2869
+ Once this has successfully completed it will be safe to restart the
2870
+ homeserver. You may notice that the homeserver takes a few seconds
2871
+ longer to restart than usual as it reinitializes the database.
2872
+
2873
+ On startup of the new version, users can either rejoin remote rooms
2874
+ using room aliases or by being reinvited. Alternatively, if any other
2875
+ homeserver sends a message to a room that the homeserver was previously
2876
+ in the local HS will automatically rejoin the room.