summary refs log tree commit diff
path: root/synapse/rest (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use create_and_send_new_client_events for bulk sending emma/patchesRory&2025-08-161-77/+27
|
* Further optimisation attemptsRory&2025-08-161-14/+25
|
* Try to optimise bulk sending some moreRory&2025-08-161-4/+38
|
* Add bulk send events endpointRory&2025-08-162-1/+119
|
* Expose tombstone in room admin apiRory&2025-08-162-1/+5
|
* Use parse_boolean for unredacted contentRory&2025-08-161-3/+2
|
* Make the Make Room Admin API choose to puppet the room creator in v12 rooms ↵Andrew Morgan2025-08-121-1/+1
| | | | (#18805)
* Support for room version 12Kegan Dougal2025-08-112-2/+21
|
* Set type of `user_id` on `is_server_admin` to str (#18786)Andrew Morgan2025-08-071-1/+1
|
* Update implementation of MSC4306: Thread Subscriptions to include automatic ↵reivilibre2025-08-051-6/+11
| | | | | | | | | | | | subscription conflict prevention as introduced in later drafts. (#18756) Follows: #18674 Implements new drafts of MSC4306 --------- Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org> Co-authored-by: Eric Eastwood <erice@element.io>
* Stabilise MAS integration (#18759)Quentin Gliech2025-08-0413-61/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | This can be reviewed commit by commit There are a few improvements over the experimental support: - authorisation of Synapse <-> MAS requests is simplified, with a single shared secret, removing the need for provisioning a client on the MAS side - the tests actually spawn a real server, allowing us to test the rust introspection layer - we now check that the device advertised in introspection actually exist, making it so that when a user logs out, the tokens are immediately invalidated, even if the cache doesn't expire - it doesn't rely on discovery anymore, rather on a static endpoint base. This means users don't have to override the introspection endpoint to avoid internet roundtrips - it doesn't depend on `authlib` anymore, as we simplified a lot the calls done from Synapse to MAS We still have to update the MAS documentation about the Synapse setup, but that can be done later. --------- Co-authored-by: reivilibre <oliverw@element.io>
* Merge branch 'release-v1.135' into developAndrew Morgan2025-07-301-9/+12
|\
| * Fix deactivation running off the main process (#18716)Quentin Gliech2025-07-241-9/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Best reviewed commit by commit. With the new dedicated MAS API (https://github.com/element-hq/synapse/pull/18520), it's possible that deactivation starts off the main process, which was not possible because of a few calls. I basically looked at everything that the deactivation handler was doing, reviewed whether it could run on workers or not, and find a workaround when possible --------- Co-authored-by: Eric Eastwood <erice@element.io>
* | Refactor `Histogram` metrics to be homeserver-scoped (#18724)Eric Eastwood2025-07-293-19/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bulk refactor `Histogram` metrics to be homeserver-scoped. We also add lints to make sure that new `Histogram` metrics don't sneak in without using the `server_name` label (`SERVER_NAME_LABEL`). Part of https://github.com/element-hq/synapse/issues/18592 ### Testing strategy 1. Add the `metrics` listener in your `homeserver.yaml` ```yaml listeners: # This is just showing how to configure metrics either way # # `http` `metrics` resource - port: 9322 type: http bind_addresses: ['127.0.0.1'] resources: - names: [metrics] compress: false # `metrics` listener - port: 9323 type: metrics bind_addresses: ['127.0.0.1'] ``` 1. Start the homeserver: `poetry run synapse_homeserver --config-path homeserver.yaml` 1. Fetch `http://localhost:9322/_synapse/metrics` and/or `http://localhost:9323/metrics` 1. Observe response includes the TODO metrics with the `server_name` label ### Todo - [x] Wait for https://github.com/element-hq/synapse/pull/18656 to merge ### Dev notes ``` LoggingDatabaseConnection make_conn make_pool make_fake_db_pool ``` ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
* | MSC4306: expose feature in the client version (#18722)Benjamin Bouvier2025-07-291-0/+2
| |
* | Refactor `Counter` metrics to be homeserver-scoped (#18656)Eric Eastwood2025-07-251-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bulk refactor `Counter` metrics to be homeserver-scoped. We also add lints to make sure that new `Counter` metrics don't sneak in without using the `server_name` label (`SERVER_NAME_LABEL`). All of the "Fill in" commits are just bulk refactor. Part of https://github.com/element-hq/synapse/issues/18592 ### Testing strategy 1. Add the `metrics` listener in your `homeserver.yaml` ```yaml listeners: # This is just showing how to configure metrics either way # # `http` `metrics` resource - port: 9322 type: http bind_addresses: ['127.0.0.1'] resources: - names: [metrics] compress: false # `metrics` listener - port: 9323 type: metrics bind_addresses: ['127.0.0.1'] ``` 1. Start the homeserver: `poetry run synapse_homeserver --config-path homeserver.yaml` 1. Fetch `http://localhost:9322/_synapse/metrics` and/or `http://localhost:9323/metrics` 1. Observe response includes the `synapse_user_registrations_total`, `synapse_http_server_response_count_total`, etc metrics with the `server_name` label
* | MSC4306: register the thread subscriptions servlet in the client servlet ↵Benjamin Bouvier2025-07-242-2/+6
| | | | | | | | | | | | section (#18726) The MSC4306 endpoints were never registered, and thus never made available, even if the experimental feature flag was enabled.
* | Refactor background process metrics to be homeserver-scoped (#18670)Eric Eastwood2025-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of https://github.com/element-hq/synapse/issues/18592 Separated out of https://github.com/element-hq/synapse/pull/18656 because it's a bigger, unique piece of the refactor ### Testing strategy 1. Add the `metrics` listener in your `homeserver.yaml` ```yaml listeners: # This is just showing how to configure metrics either way # # `http` `metrics` resource - port: 9322 type: http bind_addresses: ['127.0.0.1'] resources: - names: [metrics] compress: false # `metrics` listener - port: 9323 type: metrics bind_addresses: ['127.0.0.1'] ``` 1. Start the homeserver: `poetry run synapse_homeserver --config-path homeserver.yaml` 1. Fetch `http://localhost:9322/_synapse/metrics` and/or `http://localhost:9323/metrics` 1. Observe response includes the background processs metrics (`synapse_background_process_start_count`, `synapse_background_process_db_txn_count_total`, etc) with the `server_name` label
* | Add support for MSC4293 - Redact on Kick/Ban (#18540)Shay2025-07-231-12/+20
| |
* | Add debug log when `HMAC incorrect` (#18474)Eric Eastwood2025-07-221-0/+48
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Spawning from getting `HMAC incorrect` errors that seem unexplainable except for the `registration_shared_secret` being misconfigured. It's also possible my HMAC calculation is incorrect but every time I double-check the result with the [known-good Python example](https://github.com/element-hq/synapse/blob/553e124f766584456fbdb6d1aa37fdd12ad54dad/docs/admin_api/register_api.md) (which matches [Synapse's source](https://github.com/element-hq/synapse/blob/24e849e483820762fa2d231ad702e6aeaa23829c/synapse/rest/admin/users.py#L618-L633)), it's as expected. With these logs, we can actually debug whether `registration_shared_secret` is being configured correctly or not. It also helps specifically when using `registration_shared_secret_path` since the default Synapse behavior (of creating the file and secret if it doesn't exist) can mask deployment race condition where we would start up Synapse before the `registration_shared_secret_path` file was put in place: > **`registration_shared_secret_path`** > > [...] > > If this file does not exist, Synapse will create a new shared secret on startup and store it in this file. > > *-- [Synapse config docs](https://github.com/element-hq/synapse/blob/6521406a37a40a490a1a435f3616c02cfcbbac16/docs/usage/configuration/config_documentation.md#registration_shared_secret_path)* This only applies to the [`POST /_synapse/admin/v1/register`](https://github.com/element-hq/synapse/blob/553e124f766584456fbdb6d1aa37fdd12ad54dad/docs/admin_api/register_api.md) endpoint but does log very sensitive information so we've made it so you have to explicitly enable the logs by configuring `synapse.rest.admin.users.registration_debug` (does not inherit root log level) (via our new `ExplicitlyConfiguredLogger`) `homeserver.yaml` ```yaml log_config: "/myserver.log.config.yaml" ``` `myserver.log.config.yaml` ```yaml version: 1 formatters: precise: format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' handlers: # ... file/buffer handler (see `sample_log_config.yaml`) # A handler that writes logs to stderr. Unused by default, but can be used # instead of "buffer" and "file" in the logger handlers. console: class: logging.StreamHandler formatter: precise loggers: synapse.storage.SQL: # beware: increasing this to DEBUG will make synapse log sensitive # information such as access tokens. level: INFO # Has to be explicitly configured as such. Will not inherit from the root level even if it's set to DEBUG synapse.rest.admin.users.registration_debug: level: DEBUG root: level: INFO handlers: [console] disable_existing_loggers: false ```
* Add an option to issue redactions as admin user on admin redaction endpoint ↵Shay2025-07-211-2/+7
| | | | | | | | | (#18671) Currently the [admin redaction endpoint](https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html#redact-all-the-events-of-a-user) defaults to puppeting the user being redacted. This PR adds an optional param `use_admin`, which when provided issues the redactions as the admin user instead.
* Dedicated MAS API (#18520)Quentin Gliech2025-07-215-0/+825
| | | | | | | | | | | | | | | | | | | | | This introduces a dedicated API for MAS to consume. Companion PR on the MAS side: element-hq/matrix-authentication-service#4801 This has a few advantages over the previous admin API: - it works on workers (this will be documented once we stabilise MSC3861 as a whole) - it is more efficient because more focused - it propagates trace contexts from MAS - it is only accessible to MAS (through the shared secret) and will let us remove the weird hack that made this token 'admin' with a ghost '@__oidc_admin:' user The next MAS version should support it, but will be opt-in. The version after that should use this new API by default --------- Co-authored-by: Eric Eastwood <erice@element.io>
* Add experimental and incomplete support for MSC4306: Thread Subscriptions. ↵reivilibre2025-07-211-0/+98
| | | | | | | | | | | | (#18674) Implements: [MSC4306](https://github.com/matrix-org/matrix-spec-proposals/blob/rei/msc_thread_subscriptions/proposals/4306-thread-subscriptions.md) (partially) What's missing: - Changes to push rules Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
* Don't allow tagnames longer than 255 bytes (#18660)Alex Durham2025-07-181-1/+14
|
* Move device changes off the main process (#18581)Quentin Gliech2025-07-185-67/+17
| | | | | | | | | | | | | | | | | | | | | | | | | The main goal of this PR is to handle device list changes onto multiple writers, off the main process, so that we can have logins happening whilst Synapse is rolling-restarting. This is quite an intrusive change, so I would advise to review this commit by commit; I tried to keep the history as clean as possible. There are a few things to consider: - the `device_list_key` in stream tokens becomes a `MultiWriterStreamToken`, which has a few implications in sync and on the storage layer - we had a split between `DeviceHandler` and `DeviceWorkerHandler` for master vs. worker process. I've kept this split, but making it rather writer vs. non-writer worker, using method overrides for doing replication calls when needed - there are a few operations that need to happen on a single worker at a time. Instead of using cross-worker locks, for now I made them run on the first writer on the list --------- Co-authored-by: Eric Eastwood <erice@element.io>
* Stabilize support for custom profile fields. (#18635)Patrick Cloke2025-07-172-179/+41
|
* Include `event_id` when getting state with `?format=event` (#18675)Tulir Asokan2025-07-171-2/+14
|
* Refactor cache metrics to be homeserver-scoped (#18604)Eric Eastwood2025-07-162-1/+5
| | | | | (add `server_name` label to cache metrics). Part of https://github.com/element-hq/synapse/issues/18592
* Advertise support for Matrix v1.12 (#18647)Andrew Morgan2025-07-151-0/+1
|
* Add ability to limit amount uploaded by a user (#18527)Erik Johnston2025-07-101-3/+3
| | | | | | | You can now configure how much media can be uploaded by a user in a given time period. Note the first commit here is a refactor of create/upload content function
* Add experimental support for MSC4277: Harmonizing the reporting endpoints ↵Johannes Marbach2025-07-091-6/+19
| | | | | | (#18263) [MSC4277](https://github.com/matrix-org/matrix-spec-proposals/pull/4277): Harmonizing the reporting endpoints
* Forbid locked users from using `POST /login` (#18594)Andrew Ferrazzutti2025-07-021-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Discussed in the [Synapse Dev room](https://matrix.to/#/!vcyiEtMVHIhWXcJAfl:sw1v.org/$K4UojQtvaSpxSe35TWFXtKWGoAuHwHFcKo8qn2lwxSs?via=matrix.org&via=element.io&via=envs.net) ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
* Add `via` param to hierarchy enpoint (#18070)Krishan2025-06-301-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Pull Request Checklist Implementation of [MSC4235](https://github.com/matrix-org/matrix-spec-proposals/pull/4235) as per suggestion in [pull request 17750](https://github.com/element-hq/synapse/pull/17750#issuecomment-2411248598). <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Quentin Gliech <quenting@element.io>
* Add `forget_forced_upon_leave` capability as per MSC4267 (#18196)Johannes Marbach2025-06-271-0/+5
| | | | | | | This adds the capability from https://github.com/matrix-org/matrix-spec-proposals/pull/4267 under an experimental feature. Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Fix backwards compat for `DirectServeJsonResource` (#18600)Erik Johnston2025-06-2614-15/+15
| | | | | As that appears in the module API. Broke in #18595.
* Lift pausing on ratelimited requests to http layer (#18595)Erik Johnston2025-06-2514-15/+15
| | | | | | | | | | | | | | | | When a request gets ratelimited we (optionally) wait ~500ms before returning to mitigate clients that like to tightloop on request failures. However, this is currently implemented by pausing request processing when we check for ratelimits, which might be deep within request processing, and e.g. while locks are held. Instead, let's hoist the pause to the very top of the HTTP handler. Hopefully, this mitigates the issue where a user sending lots of events to a single room can see their requests time out due to the combination of the linearizer and the pausing of the request. Instead, they should see the requests 429 after ~500ms. The first commit is a refactor to pass the `Clock` to `AsyncResource`, the second commit is the behavioural change.
* Add report user API from MSC4260 (#18120)Travis Ralston2025-06-201-0/+38
| | | | | Co-authored-by: turt2live <1190097+turt2live@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* bugfix: assert we always pass the create event to get_user_power_level (#18545)Kegan Dougal2025-06-131-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The create event is required if there is no PL event, in which case the creator gets PL100. ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Enable `flake8-logging` and `flake8-logging-format` rules in Ruff and fix ↵Quentin Gliech2025-06-132-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | related issues throughout the codebase (#18542) This can be reviewed commit by commit. This enables the `flake8-logging` and `flake8-logging-format` rules in Ruff, as well as logging exception stack traces in a few places where it makes sense - https://docs.astral.sh/ruff/rules/#flake8-logging-log - https://docs.astral.sh/ruff/rules/#flake8-logging-format-g ### Linting to avoid pre-formatting log messages See [`adamchainz/flake8-logging` -> *LOG011 avoid pre-formatting log messages*](https://github.com/adamchainz/flake8-logging/blob/152db2f167355fb23e401bf68046c57cb128a2ae/README.rst#log011-avoid-pre-formatting-log-messages) Practically, this means prefer placeholders (`%s`) over f-strings for logging. This is because placeholders are passed as args to loggers, so they can do special handling of them. For example, Sentry will record the args separately in their logging integration: https://github.com/getsentry/sentry-python/blob/c15b390dfe1ca5c01b30dd56b35d693bb50b413c/sentry_sdk/integrations/logging.py#L280-L284 One theoretical small perf benefit is that log levels that aren't enabled won't get formatted, so it doesn't unnecessarily create formatted strings
* Recover an appservice if a successful ping occurs. (#18521)Will Hunt2025-06-061-1/+6
| | | | | | | | | | | | | | Fixes https://github.com/element-hq/synapse/issues/14240 This scratches an itch that i've had for years. We regularly run into the issue where (especially in development) appservices can go down for a period and them come back up. The ping endpoint was introduced some time ago which means Synapse can determine if an AS is up more or less immediately, so we might as well use that to schedule transaction redelivery. I believe transaction scheduling logic is largely implementation specific, so we should be in the clear to do this without any spec changes.
* Add support for MSC4155 Invite filtering (#18288)Will Hunt2025-06-051-0/+2
| | | | | | | | | | This implements https://github.com/matrix-org/matrix-spec-proposals/pull/4155, which adds support for a new account data type that blocks an invite based on some conditions in the event contents. --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add user_may_send_state_event callback to spam checker module API (#18455)Hugh Nimmo-Smith2025-06-041-0/+20
|
* Add media repository callbacks to module API to control media upload size ↵Hugh Nimmo-Smith2025-06-043-9/+37
| | | | | | | | (#18457) Adds new callbacks for media related functionality: - `get_media_config_for_user` - `is_user_allowed_to_upload_media_of_size`
* Make user_type extensible and allow default user_type to be set (#18456)Hugh Nimmo-Smith2025-06-031-3/+5
|
* Mark dehydrated devices in admin get devices endpoint (#18252)Hubert Chathi2025-05-281-0/+11
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Include room ID in room deletion status response (#18318)Dagfinn Ilmari Mannsåker2025-05-201-0/+1
| | | | When querying by `delete_id` it's handy to see which room the delete pertains to.
* Bump ruff from 0.7.3 to 0.11.10 (#18451)dependabot[bot]2025-05-204-11/+8
| | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Morgan <andrew@amorgan.xyz> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Return specific error code when email / phone not supported (#17578)David Baker2025-05-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements https://github.com/matrix-org/matrix-spec-proposals/pull/4178 If this would need tests, could you give some idea of what tests would be needed and how best to add them? ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [ ] Pull request is based on the develop branch * [ ] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [ ] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
* Allow a few admin APIs used by MAS to run on workers (#18313)Quentin Gliech2025-05-023-16/+40
| | | | | | | | | | | | This should be reviewed commit by commit. It adds a few admin servlets that are used by MAS when in delegation mode to workers --------- Co-authored-by: Olivier 'reivilibre <oliverw@matrix.org> Co-authored-by: Devon Hudson <devon.dmytro@gmail.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add an Admin API endpoint to fetch scheduled tasks (#18214)Shay2025-05-012-0/+72
|
* Slight performance increase when using the ratelimiter (#18369)Erik Johnston2025-04-291-4/+3
| | | See the commits.
* Allow /rooms/ admin API to be on workers (#18360)Erik Johnston2025-04-251-2/+3
| | | Tested by https://github.com/matrix-org/sytest/pull/1400
* Move GET /devices/ off main process (#18355)Erik Johnston2025-04-251-2/+18
| | | | | | | | We can't move PUT/DELETE as they do need to happen on main process (due to notification of device changes). --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Make sure we advertise registration as disabled when MSC3861 is enabled (#17661)Quentin Gliech2025-02-181-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | This has been a problem with Element Web, as it will proble /register with an empty body, which gave this error: ``` curl -d '{}' -HContent-Type:application/json /_matrix/client/v3/register {"errcode": "M_UNKNOWN", "error": "Invalid username"} ``` And Element Web would choke on it. This changes that so we reply instead: ``` {"errcode": "M_FORBIDDEN", "error": "Registration has been disabled. Only m.login.application_service registrations are allowed."} ``` Also adds a test for this. See https://github.com/element-hq/element-web/issues/27993 --------- Co-authored-by: Andrew Morgan <andrew@amorgan.xyz>
* Cleanup Python 3.8 leftovers (#17967)V024602025-02-103-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some small cleanups after Python3.8 became EOL. - Move some type imports from `typing_extensions` to `typing` - Remove the `abi3-py38` feature from pyo3 ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Quentin Gliech <quenting@element.io>
* Ratelimit presence updates (#18000)Sven Mäder2025-01-242-3/+38
|
* Support the new `/auth_metadata` endpoint defined in MSC2965. (#18093)Quentin Gliech2025-01-212-3/+40
| | | | | | | See the updated MSC2965 --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Implement MSC4133 to support custom profile fields. (#17488)Patrick Cloke2025-01-213-4/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementation of [MSC4133](https://github.com/matrix-org/matrix-spec-proposals/pull/4133) to support custom profile fields. It is behind an experimental flag and includes tests. ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add the ability to filter by state event type on admin room state endpoint ↵Shay2025-01-081-1/+13
| | | | | | | | | | (#18035) Adds a query param `type` to `/_synapse/admin/v1/rooms/{room_id}/state` that filters the state event query by state event type. --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Drop unstable MSC4151 implementation (#18052)Travis Ralston2025-01-072-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's been rotated out of known clients, and should be safe for removal now. Fixes https://github.com/element-hq/synapse/issues/17373 ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
* Refactor get_profile: do not return missing fields. (#18063)Patrick Cloke2025-01-031-8/+1
| | | | | | | | | | Refactor `get_profile` to avoid returning "empty" (`None` / `null`) fields. Currently this is not very important, but will be more useful once #17488 lands. It does update the servlet to use this now which has a minor change in behavior: additional fields served over federation will now be properly sent back to clients. It also adds constants for `avatar_url` / `displayname` although I did not attempt to use it everywhere possible.
* Bump mypy from 1.11.2 to 1.12.1 and fix new typechecking errors (#17999)Andrew Morgan2024-12-181-2/+2
| | | | | | | Supersedes https://github.com/element-hq/synapse/pull/17958. Awkwardly, the changes made to fix the mypy errors in 1.12.1 cause errors in 1.11.2. So you'll need to update your mypy version to 1.12.1 to eliminate typechecking errors during developing.
* Add some useful endpoints to Admin API (#17948)Shay2024-12-163-6/+61
| | | | | | | | | - Fetch the number of invites the provided user has sent after a given timestamp - Fetch the number of rooms the provided user has joined after a given timestamp, regardless if they have left/been banned from the rooms subsequently - Get report IDs of event reports where the provided user was the sender of the reported event
* Promote account suspension to stable (#17964)Travis Ralston2024-12-041-2/+1
| | | MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/3823
* Support for MSC4190: device management for application services (#17705)Quentin Gliech2024-12-042-23/+46
| | | | | | | | This is an implementation of MSC4190, which allows appservices to manage their user's devices without /login & /logout. --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Merge branch 'master' into developQuentin Gliech2024-12-031-2/+10
|\
| * Handle null invite and knock room stateErik Johnston2024-12-031-2/+10
| |
* | Consolidate SSO redirects through ↵Eric Eastwood2024-11-291-14/+15
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `/_matrix/client/v3/login/sso/redirect(/{idpId})` (#17972) Consolidate SSO redirects through `/_matrix/client/v3/login/sso/redirect(/{idpId})` Spawning from https://github.com/element-hq/sbg/pull/421#discussion_r1859497330 where we have a proxy that intercepts responses to `/_matrix/client/v3/login/sso/redirect(/{idpId})` in order to upgrade them to use OAuth 2.0 Pushed Authorization Requests (PAR). Instead of needing to intercept multiple endpoints that redirect to the authorization endpoint, it seems better to just have Synapse consolidate to a single flow. ### Testing strategy 1. Create a new OAuth application. I'll be using GitHub for example but there are [many options](https://github.com/matrix-org/synapse/blob/be65a8ec0195955c15fdb179c9158b187638e39a/docs/openid.md). Visit https://github.com/settings/developers -> **New OAuth App** - Application name: `Synapse local testing` - Homepage URL: `http://localhost:8008` - Authorization callback URL: `http://localhost:8008/_synapse/client/oidc/callback` 1. Update your Synapse `homeserver.yaml` ```yaml server_name: "my.synapse.server" public_baseurl: http://localhost:8008/ listeners: - port: 8008 bind_addresses: [ #'::1', '127.0.0.1' ] tls: false type: http x_forwarded: true resources: - names: [client, federation, metrics] compress: false # SSO login testing oidc_providers: - idp_id: github idp_name: Github idp_brand: "github" # optional: styling hint for clients discover: false issuer: "https://github.com/" client_id: "xxx" # TO BE FILLED client_secret: "xxx" # TO BE FILLED authorization_endpoint: "https://github.com/login/oauth/authorize" token_endpoint: "https://github.com/login/oauth/access_token" userinfo_endpoint: "https://api.github.com/user" scopes: ["read:user"] user_mapping_provider: config: subject_claim: "id" localpart_template: "{{ user.login }}" display_name_template: "{{ user.name }}" ``` 1. Start Synapse: `poetry run synapse_homeserver --config-path homeserver.yaml` 1. Visit `http://localhost:8008/_synapse/client/pick_idp?redirectUrl=http%3A%2F%2Fexample.com` 1. Choose GitHub 1. Notice that you're redirected to GitHub to sign in (`https://github.com/login/oauth/authorize?...`) Tested locally and works: 1. `http://localhost:8008/_synapse/client/pick_idp?idp=oidc-github&redirectUrl=http%3A//example.com` -> 1. `http://localhost:8008/_matrix/client/v3/login/sso/redirect/oidc-github?redirectUrl=http://example.com` -> 1. `https://github.com/login/oauth/authorize?response_type=code&client_id=xxx&redirect_uri=http%3A%2F%2Flocalhost%3A8008%2F_synapse%2Fclient%2Foidc%2Fcallback&scope=read%3Auser&state=xxx&nonce=xxx`
* Removal: Remove support for experimental msc3886 (#17638)Poruri Sai Rahul2024-11-132-51/+0
|
* Fix typo in error message when a media ID isn't known (#17865)Benjamin Bouvier2024-11-121-1/+1
|
* Add experimental support for MSC4222 (#17888)Erik Johnston2024-11-052-6/+42
| | | | | | | | | | | Basically, if the client sets a special query param on `/sync` v2 instead of responding with `state` at the *start* of the timeline, we instead respond with `state_after` at the *end* of the timeline. We do this by using the `current_state_delta_stream` table, which is actually reliable, rather than messing around with "state at" points on the timeline. c.f. MSC4222
* Support & use stable endpoints for MSC4151 (#17374)Travis Ralston2024-10-311-13/+22
| | | | | | | | | | | https://github.com/matrix-org/matrix-spec-proposals/pull/4151 has finished FCP. See https://github.com/element-hq/synapse/issues/17373 for unstable endpoint removal --------- Co-authored-by: Andrew Morgan <andrew@amorgan.xyz>
* Check if user is in room before being able to tag it (#17839)Lama2024-10-301-0/+7
| | | Fix #17819
* Added display_name_claim in jwt_config which sets the user's display name ↵Nathan2024-10-091-2/+7
| | | | upon registration (#17708)
* Improvements to admin redact api (#17792)Shay2024-10-081-23/+22
| | | | | | - better validation on user input - fix an early task completion - when checking membership in rooms, check for rooms user has been banned from as well
* Add missing license header (#17799)Andrew Ferrazzutti2024-10-081-0/+14
| | | | Co-authored-by: Erik Johnston <erik@matrix.org>
* Sliding sync: omit bump stamp when it is unchanged (#17788)Erik Johnston2024-10-081-1/+3
| | | This saves some DB lookups in rooms
* Don't say MSC4140 is supported when it's disabled (#17780)Andrew Ferrazzutti2024-10-041-1/+1
|
* Support MSC4140: Delayed events (Futures) (#17326)Andrew Ferrazzutti2024-09-234-7/+189
|
* Add an Admin API endpoint to redact all a user's events (#17506)Shay2024-09-182-1/+102
|
* Sliding Sync: Move filters tests to rest layer (#17703)Eric Eastwood2024-09-121-1/+1
| | | | | | | | | | | | | Move filters tests to rest layer in order to test the new (with sliding sync tables) and fallback paths that Sliding Sync can use. Also found a bug in the new path because it's not being tested which is also fixed in this PR. We now take into account `has_known_state` when filtering. Spawning from https://github.com/element-hq/synapse/pull/17662#discussion_r1755574791. This should have been done when we started using the new sliding sync tables in https://github.com/element-hq/synapse/pull/17630
* import pydantic objects from the `_pydantic_compat` module (#17667)Éloi Rivard2024-09-116-39/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR changes `from pydantic import BaseModel` to `from synapse._pydantic_compat import BaseModel` (as well as `constr`, `conbytes`, `conint`, `confloat`). It allows `check_pydantic_models.py` to mock those pydantic objects only in the synapse module, and not interfere with pydantic objects in external dependencies. This should solve the CI problems for #17144, which breaks because `check_pydantic_models.py` patches pydantic models from [scim2-models](https://scim2-models.readthedocs.io/). /cc @DMRobertson @gotmax23 fixes #17659 ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
* Enable guest access on new media endpoints, per MSC4189 (#17675)Travis Ralston2024-09-101-2/+2
|
* Sliding Sync: Speed up incremental sync by avoiding extra work (#17665)Eric Eastwood2024-09-091-2/+6
| | | | | Speed up incremental sync by avoiding extra work. We first look at the state delta changes and only fetch and calculate further derived things if they have changed.
* Stabilise MSC4156: `server_name` -> `via` (#17650)Johannes Marbach2024-09-052-16/+8
|
* Format files with Ruff (#17643)Quentin Gliech2024-09-0213-38/+34
| | | | | | I thought ruff check would also format, but it doesn't. This runs ruff format in CI and dev scripts. The first commit is just a run of `ruff format .` in the root directory.
* MSC3861: load the issuer and account management URLs from OIDC discovery ↵Quentin Gliech2024-08-305-29/+52
| | | | | | | | | | | | | | (#17407) This will help mitigating any discrepancies between the issuer configured and the one returned by the OIDC provider. This also removes the need for configuring the `account_management_url` explicitely, as it will now be loaded from the OIDC discovery, as per MSC2965. Because we may now fetch stuff for the .well-known/matrix/client endpoint, this also transforms the client well-known resource to be asynchronous.
* Use custom stage UIA error for MAS cross-signing reset (#17509)Michael Telatynski2024-08-302-8/+35
| | | | | | Rather than 501 M_UNRECOGNISED Client side implementation at https://github.com/matrix-org/matrix-react-sdk/pull/12892/
* Replace isort and black with ruff (#17620)Quentin Gliech2024-08-301-1/+1
| | | Ruff now has decent parity with black and isort, so this is going to just save us a bunch of time
* Sliding sync: factor out room list logic (#17622)Erik Johnston2024-08-281-2/+2
| | | | | | | | | Move calculating of the room lists out of the core handler. This should make it easier to switch things around to start using the tables in #17512. This is just moving code between files and methods. Reviewable commit-by-commit
* Sliding Sync: Handle timeline limit changes (take 2) (#17579)Erik Johnston2024-08-201-0/+5
| | | | | | | | | | | | | | | This supersedes #17503, given the per-connection state is being heavily rewritten it felt easier to recreate the PR on top of that work. This correctly handles the case of timeline limits going up and down. This does not handle changes in `required_state`, but that can be done as a separate PR. Based on #17575. --------- Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
* Add a flag to /versions about SSS support (#17571)Erik Johnston2024-08-161-0/+6
| | | | | So that clients can check for support. Note that if the feature is only enabled for some users, the `/versions` request must be authenticated to pick up that SSS is enabled for the user
* Add a utility function for generating fake event IDs (#17557)Andrew Morgan2024-08-131-4/+5
|
* Start handlers for new media endpoints when media resource configured (#17483)devonh2024-08-081-68/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is in response to issue #17473. Not all the necessary handlers to deal with media requests are started now when configuring synapse to use a media worker as per the [example config](https://element-hq.github.io/synapse/latest/workers.html#synapseappmedia_repository). The new media endpoints introduced with authenticated media fall under the `client` & `federation` handlers in synapse. This PR starts up handlers for the new media endpoints if a worker has been configured with only the `media` resource type. ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [X] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [X] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Sliding Sync: Add more tracing (#17514)Eric Eastwood2024-08-061-0/+9
| | | | | | | | | | | | Spawning from looking at a couple traces and wanting a little more info. Follow-up to github.com/element-hq/synapse/pull/17501 The changes in this PR allow you to find slow Sliding Sync traces ignoring the `wait_for_events` time. In Jaeger, you can now filter for the `current_sync_for_user` operation with `RESULT.result=true` indicating that it actually returned non-empty results. If you want to find traces for your own user, you can use `RESULT.result=true ARG.sync_config.user="@madlittlemods:matrix.org"`
* Sliding Sync: Add typing notification extension (MSC3961) (#17505)Eric Eastwood2024-07-311-1/+5
| | | | | | | [MSC3961](https://github.com/matrix-org/matrix-spec-proposals/pull/3961): Sliding Sync Extension: Typing Notifications Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Sliding Sync: Add receipts extension (MSC3960) (#17489)Eric Eastwood2024-07-301-0/+6
| | | | | | | [MSC3960](https://github.com/matrix-org/matrix-spec-proposals/pull/3960): Receipts extension Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Add some more opentracing to sliding sync (#17501)Erik Johnston2024-07-301-2/+18
| | | This will make it easier to see what it is doing in jaeger.
* Sliding Sync: Track whether we have sent rooms down to clients (#17447)Erik Johnston2024-07-291-3/+3
| | | | | | | | | | | | | | | | The basic idea is that we introduce a new token for a sliding sync connection, which stores the mapping of room to room "status" (i.e. have we sent the room down?). This token allows us to handle duplicate requests properly. In future it can be used to store more "per-connection" information safely. In future this should be migrated into the DB, so its important that we try to reduce the number of syncs where we need to update the per-connection information. In this PoC this only happens when we: a) send down a set of room for the first time, or b) we have previously sent down a room and there are updates but we are not sending the room down the sync (due to not falling in a list range) Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
* Sliding Sync: Add Account Data extension (MSC3959) (#17477)Eric Eastwood2024-07-241-1/+18
| | | | | | Extensions based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Use a new token format for sliding sync (#17452)Erik Johnston2024-07-241-2/+4
| | | | | | | This is in preparation for adding per-connection state. --------- Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
* Sliding Sync: Add E2EE extension (MSC3884) (#17454)Eric Eastwood2024-07-222-5/+37
| | | | | Spec: [MSC3884](https://github.com/matrix-org/matrix-spec-proposals/pull/3884) Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Prepare for authenticated media freeze (#17433)Shay2024-07-222-2/+6
| | | | | | As part of the rollout of [MSC3916](https://github.com/matrix-org/matrix-spec-proposals/blob/main/proposals/3916-authentication-for-media.md) this PR adds support for designating authenticated media and ensuring that authenticated media is not served over unauthenticated endpoints.
* Add `heroes` and room summary fields to Sliding Sync `/sync` (#17419)Eric Eastwood2024-07-111-5/+27
| | | | | | | Additional room summary fields: `joined_count`, `invited_count` Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Handle to-device extensions to Sliding Sync (#17416)Erik Johnston2024-07-101-1/+16
| | | | | | | Implements MSC3885 --------- Co-authored-by: Eric Eastwood <eric.eastwood@beta.gouv.fr>
* Fix new media APIs when using synapse.app.media_repository (#17420)Erik Johnston2024-07-091-1/+1
| | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Fix `/versions` requests (#17410)Erik Johnston2024-07-091-1/+6
| | | | | We need it to work on workers and allow guest access. Broke by #17392
* Add `rooms.bump_stamp` to Sliding Sync `/sync` for easier client-side ↵Eric Eastwood2024-07-081-0/+1
| | | | | | | | | | | | | | | sorting (#17395) `bump_stamp` corresponds to the `stream_ordering` of the latest `DEFAULT_BUMP_EVENT_TYPES` in the room. This helps clients sort more readily without them needing to pull in a bunch of the timeline to determine the last activity. `bump_event_types` is a thing because for example, we don't want display name changes to mark the room as unread and bump it to the top. For encrypted rooms, we just have to consider any activity as a bump because we can't see the content and the client has to figure it out for themselves. Outside of Synapse, `bump_stamp` is just a free-form counter so other implementations could use `received_ts`or `origin_server_ts` (see the [*Security considerations* section in MSC3575 about the potential pitfalls of using `origin_server_ts`](https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md#security-considerations)). It doesn't have any guarantee about always going up. In the Synapse case, it could go down if an event was redacted/removed (or purged in cases of retention policies). In the future, we could add `bump_event_types` as [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575) mentions if people need to customize the event types. --- In the Sliding Sync proxy, a similar [`timestamp` field was added](https://github.com/matrix-org/sliding-sync/pull/247) for the same purpose but the name is not obvious what it pertains to or what it's for. The `timestamp` field was also added to Ruma in https://github.com/ruma/ruma/pull/1622
* Declare support for Matrix 1.11 (#17403)Travis Ralston2024-07-081-0/+1
| | | | | | | | Previous: https://github.com/element-hq/synapse/pull/17082 Fixes https://github.com/element-hq/synapse/issues/17402 See https://github.com/element-hq/synapse/issues/17402 for context **Blocked on https://github.com/element-hq/synapse/pull/17388** (required for spec compliance)
* Support MSC3916 by adding a federation /thumbnail endpoint and authenticated ↵Shay2024-07-082-19/+43
| | | | | | | | | | | | | | `_matrix/client/v1/media/thumbnail` endpoint (#17388) [MSC3916](https://github.com/matrix-org/matrix-spec-proposals/pull/3916) added the endpoints `_matrix/federation/v1/media/thumbnail` and the authenticated `_matrix/client/v1/media/thumbnail`. This PR implements those endpoints, along with stabilizing `_matrix/client/v1/media/config` and `_matrix/client/v1/media/preview_url`. Complement tests are at https://github.com/matrix-org/complement/pull/728
* Allow enabling sliding sync per-user (#17393)Erik Johnston2024-07-052-5/+13
| | | Based on #17392
* Finish up work to allow per-user feature flags (#17392)Erik Johnston2024-07-053-17/+43
| | | | | | | Follows on from @H-Shay's great work at https://github.com/matrix-org/synapse/pull/15344 and MSC4026. Also enables its use for MSC3881, mainly as an easy but concrete example of how to use it.
* Add `rooms.required_state` to Sliding Sync `/sync` (#17342)Eric Eastwood2024-07-041-5/+5
| | | Also handles excluding rooms with partial state when people are asking for room membership events unless it's `$LAZY` room membership.
* Return some room data in Sliding Sync `/sync` (#17320)Eric Eastwood2024-07-021-13/+99
| | | | | | - Timeline events - Stripped `invite_state` Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync
* Support MSC3916 by adding `_matrix/client/v1/media/download` endpoint (#17365)Shay2024-07-023-8/+76
|
* Add support for MSC3823 - Account Suspension Part 2 (#17255)Shay2024-06-244-0/+82
|
* Tidy up integer parsing (#17339)Denis Kasak2024-06-245-26/+17
| | | | | | | | | | The parse_integer function was previously made to reject negative values by default in https://github.com/element-hq/synapse/pull/16920, but the documentation stated otherwise. This fixes the documentation and also: - Removes explicit negative=False parameters from call sites. - Brings the negative default of parse_integer_from_args in alignment with parse_integer.
* Register sliding sync under a different path (#17331)Erik Johnston2024-06-191-1/+1
| | | As the API is slightly incompatible.
* Filter added to Admin-API GET /rooms (#17276)Alexander Fechler2024-06-191-1/+12
|
* Require the 'from' parameter for `/notifications` be an integer (#17283)Andrew Morgan2024-06-191-1/+17
| | | | Co-authored-by: Erik Johnston <erikj@element.io>
* Add support for via query parameter from MSC4156 (#17322)Johannes Marbach2024-06-182-0/+16
| | | | This adds support for the `via` query parameter from https://github.com/matrix-org/matrix-spec-proposals/pull/4156.
* Enable cross-signing key upload without UIA (#17284)Richard van der Hoff2024-06-142-51/+29
| | | | | | Per MSC3967, which is now stable, we should not require UIA when uploading cross-signing keys for the first time. Fixes: #17227
* Clarify that MSC4151 is enabled on matrix.org (#17296)Quentin Gliech2024-06-131-1/+9
| | | | | This clarifies in the comments that the MSC is being used in matrix.org See #17270
* Add report room API (MSC4151) (#17270)Travis Ralston2024-06-123-3/+60
| | | | | | | | https://github.com/matrix-org/matrix-spec-proposals/pull/4151 This is intended to be enabled by default for immediate use. When FCP is complete, the unstable endpoint will be dropped and stable endpoint supported instead - no backwards compatibility is expected for the unstable endpoint.
* Reorganize Pydantic models and types used in handlers (#17279)Eric Eastwood2024-06-107-342/+8
| | | | | | Spawning from https://github.com/element-hq/synapse/pull/17187#discussion_r1619492779 around wanting to put `SlidingSyncBody` (parse the request in the rest layer), `SlidingSyncConfig` (from the rest layer, pass to the handler), `SlidingSyncResponse` (pass the response from the handler back to the rest layer to respond) somewhere that doesn't contaminate the imports and cause circular import issues. - Moved Pydantic parsing models to `synapse/types/rest` - Moved handler types to `synapse/types/handlers`
* Add Sliding Sync `/sync` endpoint (initial implementation) (#17187)Eric Eastwood2024-06-063-4/+420
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on [MSC3575](https://github.com/matrix-org/matrix-spec-proposals/pull/3575): Sliding Sync This iteration only focuses on returning the list of room IDs in the sliding window API (without sorting/filtering). Rooms appear in the Sliding sync response based on: - `invite`, `join`, `knock`, `ban` membership events - Kicks (`leave` membership events where `sender` is different from the `user_id`/`state_key`) - `newly_left` (rooms that were left during the given token range, > `from_token` and <= `to_token`) - In order for bans/kicks to not show up, you need to `/forget` those rooms. This doesn't modify the event itself though and only adds the `forgotten` flag to `room_memberships` in Synapse. There isn't a way to tell when a room was forgotten at the moment so we can't factor it into the from/to range. ### Example request `POST http://localhost:8008/_matrix/client/unstable/org.matrix.msc3575/sync` ```json { "lists": { "foo-list": { "ranges": [ [0, 99] ], "sort": [ "by_notification_level", "by_recency", "by_name" ], "required_state": [ ["m.room.join_rules", ""], ["m.room.history_visibility", ""], ["m.space.child", "*"] ], "timeline_limit": 100 } } } ``` Response: ```json { "next_pos": "s58_224_0_13_10_1_1_16_0_1", "lists": { "foo-list": { "count": 1, "ops": [ { "op": "SYNC", "range": [0, 99], "room_ids": [ "!MmgikIyFzsuvtnbvVG:my.synapse.linux.server" ] } ] } }, "rooms": {}, "extensions": {} } ```
* Handle OTK uploads off master (#17271)Erik Johnston2024-06-061-9/+4
| | | And fallback keys uploads. Only device keys need handling on master
* Ratelimiting of remote media downloads (#17256)Shay2024-06-053-1/+11
|
* Support MSC3916 by adding unstable media endpoints to `_matrix/client` (#17213)Shay2024-05-242-467/+214
| | | | | | | | | | [MSC3916](https://github.com/matrix-org/matrix-spec-proposals/blob/rav/authentication-for-media/proposals/3916-authentication-for-media.md) adds new media endpoints under `_matrix/client`. This PR adds the `/preview_url`, `/config`, and `/thumbnail` endpoints. `/download` will be added in a follow-up PR once the work for the federation `/download` endpoint is complete (see https://github.com/element-hq/synapse/pull/17172). Should be reviewable commit-by-commit.
* Add Sliding Sync `/sync/e2ee` endpoint for To-Device messages (#17167)Eric Eastwood2024-05-231-0/+171
| | | | | | | | | | | This is being introduced as part of Sliding Sync but doesn't have any sliding window component. It's just a way to get E2EE events without having to sit through a big initial sync (`/sync` v2). And we can avoid encryption events being backed up by the main sync response or vice-versa. Part of some Sliding Sync simplification/experimentation. See [this discussion](https://github.com/element-hq/synapse/pull/17167#discussion_r1610495866) for why it may not be as useful as we thought. Based on: - https://github.com/matrix-org/matrix-spec-proposals/pull/3575 - https://github.com/matrix-org/matrix-spec-proposals/pull/3885 - https://github.com/matrix-org/matrix-spec-proposals/pull/3884
* Removed `request_key` from the `SyncConfig` (moved outside as its own ↵Eric Eastwood2024-05-161-1/+1
| | | | | | | | | function parameter) (#17201) Removed `request_key` from the `SyncConfig` (moved outside as its own function parameter) so it doesn't have to flow into `_generate_sync_entry_for_xxx` methods. This way we can separate the concerns of caching from generating the response and reuse the `_generate_sync_entry_for_xxx` functions as we see fit. Plus caching doesn't really have anything to do with the config of sync. Split from https://github.com/element-hq/synapse/pull/17167 Spawning from https://github.com/element-hq/synapse/pull/17167#discussion_r1601497279
* Refactor Sync handler to be able to return different sync responses ↵Eric Eastwood2024-05-161-0/+2
| | | | | | | | | | | | | | (`SyncVersion`) (#17200) Refactor Sync handler to be able to be able to return different sync responses (`SyncVersion`). Preparation to be able support sync v2 and a new Sliding Sync `/sync/e2ee` endpoint which returns a subset of sync v2. Split upon request: https://github.com/element-hq/synapse/pull/17167#discussion_r1601497279 Split from https://github.com/element-hq/synapse/pull/17167 where we will add `SyncVersion.E2EE_SYNC` and a new type of sync response.
* Cache literal sync filter validation (#17186)Erik Johnston2024-05-141-1/+13
| | | | The sliding sync proxy (amongst other things) use literal json blobs as filters, and repeatedly validating them takes a bunch of CPU.
* An federation whitelist query endpoint extension (#16848)Erik Johnston2024-05-132-0/+70
| | | | | | | | | | This is to allow clients to query the configured federation whitelist. Disabled by default. --------- Co-authored-by: Devon Hudson <devonhudson@librem.one> Co-authored-by: devonh <devon.dmytro@gmail.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add note about MSC3886 being closed (#17151)Hugh Nimmo-Smith2024-05-081-0/+3
|
* Apply user `email` & `picture` during OIDC registration if present & ↵devonh2024-04-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | selected (#17120) This change will apply the `email` & `picture` provided by OIDC to the new user account when registering a new user via OIDC. If the user is directed to the account details form, this change makes sure they have been selected before applying them, otherwise they are omitted. In particular, this change ensures the values are carried through when Synapse has consent configured, and the redirect to the consent form/s are followed. I have tested everything manually. Including: - with/without consent configured - allowing/not allowing the use of email/avatar (via `sso_auth_account_details.html`) - with/without automatic account detail population (by un/commenting the `localpart_template` option in synapse config). ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [X] Pull request is based on the develop branch * [X] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [X] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters))
* Declare support for Matrix v1.10. (#17082)Patrick Cloke2024-04-291-0/+1
| | | | | Pretty straightforward. 😄 Fixes #17021
* Improve error message for cross signing reset with MSC3861 enabled (#17121)Michael Telatynski2024-04-261-5/+8
|
* Use recommended endpoint for MSC3266 requests (#17078)Andrew Ferrazzutti2024-04-261-0/+6
| | | | | Keep the existing endpoint for backwards compatibility Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>
* MSC4108 implementation (#17056)Quentin Gliech2024-04-254-2/+85
| | | | | | Co-authored-by: Hugh Nimmo-Smith <hughns@element.io> Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Send an email if the address is already bound to an user account (#16819)mcalinghee2024-04-231-2/+10
| | | | Co-authored-by: Mathieu Velten <mathieu.velten@beta.gouv.fr> Co-authored-by: Olivier D <odelcroi@gmail.com>
* Parse json validation (#16923)Gordan Trevis2024-04-182-47/+24
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Support for MSC4108 via delegation (#17086)Quentin Gliech2024-04-172-3/+30
| | | | | | | This adds support for MSC4108 via delegation, similar to what has been done for MSC3886 --------- Co-authored-by: Hugh Nimmo-Smith <hughns@element.io>
* Parse Integer negative value validation (#16920)Gordan Trevis2024-04-166-131/+20
|
* bugfix: make msc3967 idempotent (#16943)Kegan Dougal2024-04-151-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSC3967 was updated recently to make it more robust to network failures: > there is an existing cross-signing master key and it exactly matches the cross-signing master key provided in the request body. If there are any additional keys provided in the request (self signing key, user signing key) they MUST also match the existing keys stored on the server. In other words, the request contains no new keys. If there are new keys, UIA MUST be performed. https://github.com/matrix-org/matrix-spec-proposals/blob/hughns/device-signing-upload-uia/proposals/3967-device-signing-upload-uia.md#proposal This covers the case where the 200 OK is lost in transit so the client retries the upload, only to then get UIA'd. Complement tests: https://github.com/matrix-org/complement/pull/713 - passing example https://github.com/element-hq/synapse/actions/runs/7976948122/job/21778795094?pr=16943#step:7:8820 ### Pull Request Checklist <!-- Please read https://element-hq.github.io/synapse/latest/development/contributing_guide.html before submitting your pull request --> * [x] Pull request is based on the develop branch * [x] Pull request includes a [changelog file](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#changelog). The entry should: - Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from `EventStore` to `EventWorkerStore`.". - Use markdown where necessary, mostly for `code blocks`. - End with either a period (.) or an exclamation mark (!). - Start with a capital letter. - Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry. * [x] [Code style](https://element-hq.github.io/synapse/latest/code_style.html) is correct (run the [linters](https://element-hq.github.io/synapse/latest/development/contributing_guide.html#run-the-linters)) --------- Co-authored-by: reivilibre <oliverw@matrix.org>
* Stabilize support for MSC4010: push rules & account data. (#17022)Patrick Cloke2024-04-091-23/+6
| | | | | | | See [MSC4010](https://github.com/matrix-org/matrix-spec-proposals/pull/4010), but this is pretty much just removing an experimental flag. Part of #17021
* Stabliize support for MSC3981: recurse /relations (#17023)Patrick Cloke2024-04-092-8/+5
| | | | | | | See [MSC3981](https://github.com/matrix-org/matrix-spec-proposals/pull/3981), this pretty much just removes flags though. Part of #17021
* Fixups to new push stream (#17038)Erik Johnston2024-03-281-1/+3
| | | Follow on from #17037
* Add support for moving `/push_rules` off of main process (#17037)Erik Johnston2024-03-281-3/+3
|
* Bump black from 23.10.1 to 24.2.0 (#16936)dependabot[bot]2024-03-135-26/+30
|
* deactivated flag refactored to filter deactivated users. (#16874)Alexander Fechler2024-03-112-2/+21
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Accept unprefixed form of MSC3981 recurse parameter (#16842)David Baker2024-02-061-1/+1
| | | Now that the MSC3981 has passed FCP
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-2383-0/+98
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* feat: add msc4028 to versions api (#16787)Hanadi2024-01-161-0/+2
| | | | Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Search non ASCII display names using Admin API (#16767)Adam Jędrzejewski2024-01-041-1/+1
| | | | | Closes #16370 Signed-off-by: Adam Jedrzejewski <adamjedrzejewski@icloud.com>
* Fix email verification redirection (#16761)FadhlanR2024-01-021-1/+1
| | | | | | Previously, the response status of `HTMLResource` was hardcoded as `200`. However, for proper redirection after the user verifies their email, we require the status to be `302`. This PR addresses that issue by using `code` as response status.
* Enable user without password (#16770)Dirk Klimpel2024-01-021-9/+0
| | | | | | | | | | | Closes: - https://github.com/matrix-org/synapse/issues/10397 - #10397 An administrator should know whether he wants to set a password or not. There are many uses cases where a blank password is required. - Use of only some users with SSO. - Use of bots with password, users with SSO
* Merge remote-tracking branch 'gitlab/clokep/license-license' into new_developErik Johnston2023-12-1394-953/+1502
|\
| * Update license headersPatrick Cloke2023-11-2194-953/+1502
| |
* | Expose OIDC discovery information under the CSAPI (#16726)David Robertson2023-12-062-0/+65
| | | | | | | | Co-authored-by: Quentin Gliech <quenting@element.io>
* | Set response values to zero if None for ↵Will Hunt2023-12-051-2/+2
| | | | | | | | | | | | /_synapse/admin/v1/federation/destinations (#16729)
* | Implement MSC4069: Inhibit profile propagation (#16636)Travis Ralston2023-12-042-3/+30
| | | | | | MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4069
* | ModuleAPI SSO auth callbacks (#15207)Andrew Yasinishyn2023-12-011-0/+8
| | | | | | Signed-off-by: Andrii Yasynyshyn yasinishyn.a.n@gmail.com
* | Declare support for Matrix v1.7, v1.8, and v1.9. (#16707)Patrick Cloke2023-11-291-0/+3
| |
* | Enable refreshable tokens on the admin registration endpoint (#16642)Charles Wright2023-11-221-1/+9
|/ | | Signed-off-by: Charles Wright <cvwright@futo.org>
* Add an Admin API to temporarily grant the ability to update an existing ↵David Robertson2023-11-153-5/+53
| | | | cross-signing key without UIA (#16634)
* Asynchronous Uploads (#15503)Sumner Evans2023-11-155-42/+215
| | | Support asynchronous uploads as defined in MSC2246.
* Fix a long-standing bug where Synapse would not unbind third-party ↵reivilibre2023-11-091-11/+8
| | | | | | | | | | | | | | | identifiers for Application Service users when deactivated and would not emit a compliant response. (#16617) * Don't skip unbinding 3PIDs and returning success status when deactivating AS user Fixes #16608 * Newsfile Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org> --------- Signed-off-by: Olivier Wilkinson (reivilibre) <oliverw@matrix.org>
* Convert simple_select_one_txn and simple_select_one to return tuples. (#16612)Patrick Cloke2023-11-092-5/+5
|
* Return attrs for more media repo APIs. (#16611)Patrick Cloke2023-11-091-8/+8
|
* Remove remaining usage of cursor_to_dict. (#16564)Patrick Cloke2023-10-314-9/+31
|
* Add new module API for adding custom fields to events `unsigned` section ↵Erik Johnston2023-10-275-16/+16
| | | | (#16549)
* Remove more usages of cursor_to_dict. (#16551)Patrick Cloke2023-10-263-3/+36
| | | Mostly to improve type safety.
* Add a new module API to update user presence state. (#16544)Patrick Cloke2023-10-261-4/+2
| | | | | | | | | | This adds a module API which allows a module to update a user's presence state/status message. This is useful for controlling presence from an external system. To fully control presence from the module the presence.enabled config parameter gains a new state of "untracked" which disables internal tracking of presence changes via user actions, etc. Only updates from the module will be persisted and sent down sync properly).
* Convert user_get_threepids response to attrs. (#16468)Patrick Cloke2023-10-112-3/+4
| | | This improves type annotations by not having a dictionary of Any values.
* Inline simple_search_list/simple_search_list_txn. (#16434)Patrick Cloke2023-10-101-1/+12
| | | | This only has a single use and is over abstracted. Inline it so that we can improve type hints.
* Convert simple_select_list_paginate_txn to return tuples. (#16433)Patrick Cloke2023-10-061-1/+7
|
* Return ThumbnailInfo in more places (#16438)Patrick Cloke2023-10-061-56/+42
| | | | Improves type hints by using concrete types instead of dictionaries.
* Register media servlets via regex. (#16419)Patrick Cloke2023-10-066-72/+89
| | | | | This converts the media servlet URLs in the same way as (most) of the rest of Synapse. This will give more flexibility in the versions each endpoint exists under.
* Factor out `MultiWriter` token from `RoomStreamToken` (#16427)Erik Johnston2023-10-051-1/+1
|
* Remove Python version from `/_synapse/admin/v1/server_version` (#16380)MomentQYC2023-10-021-5/+1
| | | | There's no reason to expose the full Python version over what is frequently a public API.
* Add support for pydantic v2 via pydantic.v1 compat module (#16332)Maxwell G2023-09-256-6/+40
| | | While maintaining support with pydantic v1.
* Add missing license header. (#16359)Patrick Cloke2023-09-211-0/+13
|
* Convert more cached return values to immutable types (#16356)Patrick Cloke2023-09-201-2/+2
|
* Filter locked users in the admin API (#16328)Hanadi2023-09-181-1/+5
| | | | Co-authored-by: Hanadi Tamimi <hanadi.tamimi@sdui.de>
* Make cached account data/tags/admin types immutable (#16325)Patrick Cloke2023-09-182-9/+9
|
* Additional validation of receipts (#16327)Patrick Cloke2023-09-182-2/+2
| | | | Reject invalid receipts with a reasonable error message & expands tests for receipts.
* Add automatic purge after all users forget a room (#15488)Mathieu Velten2023-09-152-36/+62
| | | | | | Also add restore of purge/shutdown rooms after a synapse restart. Co-authored-by: Eric Eastwood <erice@matrix.org> Co-authored-by: Erik Johnston <erikj@matrix.org>
* Refactor `get_user_by_id` (#16316)Erik Johnston2023-09-141-1/+1
|
* Use StrCollection in additional places. (#16301)Patrick Cloke2023-09-131-2/+2
|
* Add the List-Unsubscribe header for notification emails. (#16274)Patrick Cloke2023-09-111-0/+17
| | | | | | | | Adds both the List-Unsubscribe (RFC2369) and List-Unsubscribe-Post (RFC8058) headers to push notification emails, which together should: * Show an "Unsubscribe" link in the MUA UI when viewing Synapse notification emails. * Enable "one-click" unsubscribe (the user never leaves their MUA, which automatically makes a POST request to the specified endpoint).
* Avoid temporary storage of sensitive information. (#16272)Patrick Cloke2023-09-081-2/+2
| | | | During the UI auth process, avoid storing sensitive information into the database.
* Reduce CPU overhead of change password endpoint (#16264)Erik Johnston2023-09-081-58/+54
|
* Add `/notifications` endpoint to workers (#16265)Erik Johnston2023-09-072-1/+3
|
* Merge remote-tracking branch 'origin/release-v1.91' into release-v1.92Patrick Cloke2023-09-062-58/+0
|\
| * Revert MSC3861 introspection cache, admin impersonation and account lock ↵Quentin Gliech2023-09-062-58/+0
| | | | | | | | (#16258)
* | Add last_seen_ts to the admin users API (#16218)Mathieu Velten2023-09-041-0/+1
| |
* | Describe which rate limiter was hit in logs (#16135)David Robertson2023-08-303-9/+10
| |
* | Bump ruff from 0.0.277 to 0.0.286 (#16198)dependabot[bot]2023-08-294-11/+21
| | | | | | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* | Pass the device ID around in the presence handler (#16171)Patrick Cloke2023-08-285-4/+11
| | | | | | | | | | | | Refactoring to pass the device ID (in addition to the user ID) through the presence handler (specifically the `user_syncing`, `set_state`, and `bump_presence_active_time` methods and their replication versions).
* | Validate input to POST /key/v2/query endpoint. (#16183)Patrick Cloke2023-08-251-10/+29
|/ | | To avoid 500 internal server errors with garbage input.
* Add an admin endpoint to allow authorizing server to signal token ↵Shay2023-08-222-0/+58
| | | | revocations (#16125)
* Allow filtering for admins in the list accounts admin API (#16114)Alexander Fechler2023-08-181-0/+3
|
* Add cache to `get_server_keys_json_for_remote` (#16123)Erik Johnston2023-08-181-19/+25
|
* Rename pagination&purge locks and add comments explaining them (#16112)Mathieu Velten2023-08-161-2/+2
|
* Add linearizer on user ID to push rule PUT/DELETE requests (#16052)Nick Mills-Barrett2023-08-111-6/+22
| | | | | See: #16053 Signed off by Nick @ Beeper (@Fizzadar)
* Implements admin API to lock an user (MSC3939) (#15870)Mathieu Velten2023-08-102-2/+23
|
* Support MSC3814: Dehydrated Devices Part 2 (#16010)Shay2023-08-081-15/+1
|
* Fix endpoint improperly declaring support for MSC3814 (#16068)Shay2023-08-071-10/+8
|
* Fix deletion for Dehydrated Devices (#16046)Shay2023-08-041-4/+10
|
* Stabilize support for MSC3970: updated transaction semantics (scope to ↵Patrick Cloke2023-08-041-6/+6
| | | | | | | `device_id`) (#15629) For now this maintains compatible with old Synapses by falling back to using transaction semantics on a per-access token. A future version of Synapse will drop support for this.
* Add ability to wait for locks and add locks to purge history / room deletion ↵Erik Johnston2023-07-311-3/+8
| | | | | (#15791) c.f. #13476
* Support MSC3814: Dehydrated Devices (#15929)Shay2023-07-241-6/+226
| | | | | | Signed-off-by: Nicolas Werner <n.werner@famedly.com> Co-authored-by: Nicolas Werner <n.werner@famedly.com> Co-authored-by: Nicolas Werner <89468146+nico-famedly@users.noreply.github.com> Co-authored-by: Hubert Chathi <hubert@uhoreg.ca>
* Support room version 11 (#15912)Patrick Cloke2023-07-181-2/+2
| | | | | And fix a bug in the implementation of the updated redaction format (MSC2174) where the top-level redacts field was not properly added for backwards-compatibility.
* Stop accepting 'user' parameter for application service registration. (#15928)Patrick Cloke2023-07-131-8/+4
| | | This is unspecced, but has existed for a very long time.
* Add not_user_type param to the list accounts admin API (#15844)Michael Weimann2023-07-041-0/+9
| | | Signed-off-by: Michael Weimann <michaelw@element.io>
* Add login spam checker API (#15838)Erik Johnston2023-06-261-4/+48
|
* Remove experimental MSC2716 implementation to incrementally import history ↵Eric Eastwood2023-06-163-258/+0
| | | | | | | | | | | | into existing rooms (#15748) Context for why we're removing the implementation: - https://github.com/matrix-org/matrix-spec-proposals/pull/2716#issuecomment-1487441010 - https://github.com/matrix-org/matrix-spec-proposals/pull/2716#issuecomment-1504262734 Anyone wanting to continue MSC2716, should also address these leftover tasks: https://github.com/matrix-org/synapse/issues/10737 Closes https://github.com/matrix-org/synapse/issues/10737 in the fact that it is not longer necessary to track those things.
* Remove some unused `server_name` fields (#15723)Sean Quah2023-06-061-1/+0
| | | Signed-off-by: Sean Quah <seanq@matrix.org>
* Stabilize support for MSC3952: Intentional mentions. (#15520)Patrick Cloke2023-06-061-2/+0
|
* `N + 3`: Read from column `full_user_id` rather than `user_id` of tables ↵Shay2023-06-022-2/+2
| | | | `profiles` and `user_filters` (#15649)
* Implement stable support for MSC3882 to allow an existing device/session to ↵Hugh Nimmo-Smith2023-06-014-23/+62
| | | | | | | | generate a login token for use on a new device/session (#15388) Implements stable support for MSC3882; this involves updating Synapse's support to match the MSC / the spec says. Continue to support the unstable version to allow clients to transition.
* Disable incompatible Admin API endpointsQuentin Gliech2023-05-302-8/+21
|
* Make AS tokens work & allow ASes to /registerQuentin Gliech2023-05-301-0/+69
|
* Refactor config to be an experimental featureHugh Nimmo-Smith2023-05-309-20/+19
| | | | Also enforce you can't combine it with incompatible config options
* Disable account related endpoints when using OAuth delegationQuentin Gliech2023-05-306-15/+59
|
* MSC2965: OIDC Provider discovery via well-known documentQuentin Gliech2023-05-301-0/+9
|
* Expose the public keys used for client authentication on an endpointQuentin Gliech2023-05-302-0/+78
|
* Add requesting user id parameter to key claim methods in ↵Shay2023-05-241-4/+4
| | | | `TransportLayerClient` (#15663)
* Consolidate logic to check for deactivated users. (#15634)Patrick Cloke2023-05-231-3/+20
| | | | | | | This moves the deactivated user check to the method which all login types call. Additionally updates the application service tests to be more realistic by removing invalid tests and fixing server names.
* Do not allow deactivated users to login with JWT. (#15624)Patrick Cloke2023-05-191-65/+12
| | | | | To improve the organization of this code it moves the JWT login checks to a separate handler and then fixes the bug (and a deprecation warning).
* Update Mutual Rooms (MSC2666) implementation (#15621)Jonathan de Jong2023-05-182-13/+32
| | | | | | | | To track changes in MSC2666: - The change from `/mutual_rooms/{user_id}` to `/mutual_rooms?user_id={user_id}`. - The addition of `next_batch_token` (and logic). - Unstable flag now being `uk.half-shot.msc2666.query_mutual_rooms`. - The error code when your own user is requested.
* Add a new admin API to create a new device for a user. (#15611)Quentin Gliech2023-05-171-0/+29
| | | | This allows an external service (e.g. the matrix-authentication-service) to create devices for users.
* Add an unstable feature flag for MSC3981 to the /versions endpoint (#15558)Michael Weimann2023-05-151-0/+2
| | | | Signed-off-by: Michael Weimann <michaelw@matrix.org> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Declare support for Matrix 1.6 (#15559)Patrick Cloke2023-05-123-1/+22
| | | | | | | Adds logging for key server requests which include a key ID. This is technically in violation of the 1.6 spec, but is the only way to remain backwards compatibly with earlier versions of Synapse (and possibly other homeservers) which *did* include the key ID.
* Add an unstable feature flag for MSC3391 to the /versions endpoint (#15562)Andrew Morgan2023-05-111-0/+2
|
* Stabilize MSC2659 support for AS ping endpoint. (#15528)Tulir Asokan2023-05-092-7/+5
|
* Add config option to prevent media downloads from listed domains. (#15197)Travis Ralston2023-05-091-0/+9
| | | | | | | This stops media (and thumbnails) from being accessed from the listed domains. It does not delete any already locally cached media, but will prevent accessing it. Note that admin APIs are unaffected by this change.
* Error if attempting to set m.push_rules account data, per MSC4010. (#15555)Patrick Cloke2023-05-092-22/+70
| | | | | m.push_rules, like m.fully_read, is a special account data type that cannot be set using the normal /account_data endpoint. Return an error instead of allowing data that will not be used to be stored.
* Use account data constants in more places. (#15554)Patrick Cloke2023-05-091-1/+2
|
* Clean up and clarify "Create or modify Account" Admin API documentation (#15544)Andrew Morgan2023-05-051-1/+1
|
* Factor out an `is_mine_server_name` method (#15542)Sean Quah2023-05-054-8/+8
| | | | | | | | | | | | Add an `is_mine_server_name` method, similar to `is_mine_id`. Ideally we would use this consistently, instead of sometimes comparing against `hs.hostname` and other times reaching into `hs.config.server.server_name`. Also fix a bug in the tests where `hs.hostname` would sometimes differ from `hs.config.server.server_name`. Signed-off-by: Sean Quah <seanq@matrix.org>
* Move ThirdPartyEventRules into module_api/callbacks (#15535)Andrew Morgan2023-05-041-1/+1
|
* Remove references to supporting per-user flag for msc2654 (#15522)Shay2023-05-021-1/+0
|
* Initial implementation of MSC3981: recursive relations API (#15315)Patrick Cloke2023-05-021-1/+9
| | | | | | | | | | | Adds an optional keyword argument to the /relations API which will recurse a limited number of event relationships. This will cause the API to return not just the events related to the parent event, but also events related to those related to the parent event, etc. This is disabled by default behind an experimental configuration flag and is currently implemented using prefixed parameters.
* Add an admin API endpoint to support per-user feature flags (#15344)Shay2023-04-282-0/+121
|
* Add support for claiming multiple OTKs at once. (#15468)Patrick Cloke2023-04-271-5/+37
| | | | | | | MSC3983 provides a way to request multiple OTKs at once from appservices, this extends this concept to the Client-Server API. Note that this will likely be spit out into a separate MSC, but is currently part of MSC3983.
* Add column `full_user_id` to tables `profiles` and `user_filters`. (#15458)Shay2023-04-261-1/+1
|
* Add admin endpoint to query room sizes (#15482)Erik Johnston2023-04-262-1/+30
|
* Add unstable /keys/claim endpoint which always returns fallback keys. (#15462)Patrick Cloke2023-04-251-1/+30
| | | | | | | | | | | | | It can be useful to always return the fallback key when attempting to claim keys. This adds an unstable endpoint for `/keys/claim` which always returns fallback keys in addition to one-time-keys. The fallback key(s) are not marked as "used" unless there are no corresponding OTKs. This is currently defined in MSC3983 (although likely to be split out to a separate MSC). The endpoint shape may change or be requested differently (i.e. a keyword parameter on the current endpoint), but the core logic should be reasonable.