summary refs log tree commit diff
path: root/synapse/rest/client (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add login spam checker API (#15838)Erik Johnston2023-06-261-4/+48
|
* Remove experimental MSC2716 implementation to incrementally import history ↵Eric Eastwood2023-06-162-256/+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.
* 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.
* Make AS tokens work & allow ASes to /registerQuentin Gliech2023-05-301-0/+69
|
* Refactor config to be an experimental featureHugh Nimmo-Smith2023-05-306-10/+10
| | | | Also enforce you can't combine it with incompatible config options
* Disable account related endpoints when using OAuth delegationQuentin Gliech2023-05-306-15/+59
|
* 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 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-121-0/+1
| | | | | | | 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
|
* 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
|
* Factor out an `is_mine_server_name` method (#15542)Sean Quah2023-05-051-2/+2
| | | | | | | | | | | | 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>
* 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 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 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.
* Experimental support for MSC3970: per-device transaction IDs (#15318)Quentin Gliech2023-04-251-0/+13
|
* Load `/capabilities` endpoint on workers (#15436)Dirk Klimpel2023-04-141-0/+1
|
* Load `/directory/room/{roomAlias}` endpoint on workers (#15333)Dirk Klimpel2023-04-141-2/+4
| | | | | | | | | * Enable `directory` * move to worker store * newsfile * disable `ClientDirectoryListServer` and `ClientAppserviceDirectoryListServer` for workers
* Implement MSC2174: move redacts to a content property. (#15395)Patrick Cloke2023-04-131-9/+26
| | | | | | | This moves `redacts` from being a top-level property to a `content` property in a new room version. MSC2176 (which was previously implemented) states to not `redact` this property.
* Only load the SSO redirect servlet if SSO is enabled. (#15421)Dirk Klimpel2023-04-131-1/+6
|
* Disable loading `RefreshTokenServlet` on workers (#15428)Dirk Klimpel2023-04-131-1/+4
|
* Load `/password_policy` endpoint on workers. (#15331)Dirk Klimpel2023-03-271-0/+1
|
* Make cleaning up pushers depend on the device_id instead of the token_id ↵Quentin Gliech2023-03-241-1/+0
| | | | | | | | | | | | | | (#15280) This makes it so that we rely on the `device_id` to delete pushers on logout, instead of relying on the `access_token_id`. This ensures we're not removing pushers on token refresh, and prepares for a world without access token IDs (also known as the OIDC). This actually runs the `set_device_id_for_pushers` background update, which was forgotten in #13831. Note that for backwards compatibility it still deletes pushers based on the `access_token` until the background update finishes.
* Add a primitive helper script for listing worker endpoints. (#15243)reivilibre2023-03-2326-12/+90
| | | | Co-authored-by: Patrick Cloke <patrickc@matrix.org>
* Make `POST /_matrix/client/v3/rooms/{roomId}/report/{eventId}` endpoint ↵Andrew Morgan2023-03-211-5/+11
| | | | return 404 if event exists, but the user lacks access (#15300)
* Add /versions flag for MSC3952. (#15293)Patrick Cloke2023-03-201-0/+2
|
* Load `/register/available` endpoint on workers (#15268)Jason Little2023-03-171-1/+1
|
* Implement MSC2659: application service ping endpoint (#15249)Tulir Asokan2023-03-162-0/+117
| | | Signed-off-by: Tulir Asokan <tulir@maunium.net>
* Pass the Requester down to the HttpTransactionCache. (#15200)Quentin Gliech2023-03-073-105/+149
|
* Pass the requester during event serialization. (#15174)Quentin Gliech2023-03-064-21/+35
| | | | This allows Synapse to properly include the transaction ID in the unsigned data of events.
* Stop applying edits to event contents (MSC3925). (#15193)Patrick Cloke2023-03-061-1/+1
| | | | | | | | | | | Enables MSC3925 support by default, which: * Includes the full edit event in the bundled aggregations of an edited event. * Stops modifying the original event's content to return the new content from the edit event. This is a backwards-incompatible change that is considered to be "correct" by the spec.
* Remove unspecced and buggy `PUT` method on the unstable ↵Quentin Gliech2023-03-031-15/+1
| | | | `/rooms/<room_id>/batch_send` endpoint. (#15199)
* Add support for knocking to workers. (#15133)Dirk Klimpel2023-03-022-2/+1
|
* Remove the unspecced and bugged PUT /knock/{roomIdOrAlias} endpoint (#15189)Quentin Gliech2023-03-021-15/+1
|
* Fix conflicting URLs for dehydrated devices. (#15180)Patrick Cloke2023-03-021-1/+1
|
* Implementation of MSC3967: Don't require UIA for initial upload of cross ↵Hugh Nimmo-Smith2023-03-021-9/+23
| | | | signing keys (#15077)
* Fix a long-standing bug where an initial sync would not respond to changes ↵reivilibre2023-02-281-2/+23
| | | | to the list of ignored users if there was an initial sync cached. (#15163)
* Add module API callbacks for adding and deleting local 3PID associations (#15044Andrew Morgan2023-02-271-1/+8
|
* Bump black from 22.12.0 to 23.1.0 (#15103)dependabot[bot]2023-02-223-9/+11
|
* Remove unused `room_alias` field from `/createRoom` response (#15093)David Robertson2023-02-221-2/+2
| | | | | | | | | | | | | | * Change `create_room` return type * Don't return room alias from /createRoom * Update other callsites * Fix up mypy complaints It looks like new_room_user_id is None iff new_room_id is None. It's a shame we haven't expressed this in a way that mypy can understand. * Changelog
* Prevent clients from reporting nonexistent events. (#13779)reivilibre2023-02-141-1/+10
|
* Refactor arguments of `try_unbind_threepid(_with_id_server)` from dict to ↵Andrew Morgan2023-02-131-6/+1
| | | | separate args (#15053)
* Apply logging from hotfixes branch to develop (#15054)David Robertson2023-02-131-0/+3
| | | | | | | | | * Apply logging from hotfixes branch to develop Part of #4826. Originally added in #11882. * Changelog
* Respond correctly to unknown methods on known endpoints (#14605)Patrick Cloke2023-02-092-17/+35
| | | | Respond with a 405 error if a request is received on a known endpoint, but to an unknown method, per MSC3743.
* Add helper to parse an enum from query args & use it. (#14956)Patrick Cloke2023-02-012-3/+5
| | | | | | | | The `parse_enum` helper pulls an enum value from the query string (by delegating down to the parse_string helper with values generated from the enum). This is used to pull out "f" and "b" in most places and then we thread the resulting Direction enum throughout more code.
* Prefer `type(x) is int` to `isinstance(x, int)` (#14945)David Robertson2023-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Perfer `type(x) is int` to `isinstance(x, int)` This covered all additional instances I could see where `x` was user-controlled. The remaining cases are ``` $ rg -s 'isinstance.*[^_]int' tests/replication/_base.py 576: if isinstance(obj, int): synapse/util/caches/stream_change_cache.py 136: assert isinstance(stream_pos, int) 214: assert isinstance(stream_pos, int) 246: assert isinstance(stream_pos, int) 267: assert isinstance(stream_pos, int) synapse/replication/tcp/external_cache.py 133: if isinstance(result, int): synapse/metrics/__init__.py 100: if isinstance(calls, (int, float)): synapse/handlers/appservice.py 262: assert isinstance(new_token, int) synapse/config/_util.py 62: if isinstance(p, int): ``` which cover metrics, logic related to `jsonschema`, and replication and data streams. AFAICS these are all internal to Synapse * Changelog
* Add missing type hints in tests (#14879)Patrick Cloke2023-01-261-1/+2
| | | | * FIx-up type hints in tests.logging. * Add missing type hints to test_transactions.
* Use StrCollection in place of Collection[str] in (most) handlers code. (#14922)Patrick Cloke2023-01-261-2/+2
| | | | Due to the increased safety of StrCollection over Collection[str] and Sequence[str].
* Remove unnecessary reactor reference from `_PerHostRatelimiter` (#14842)Sean Quah2023-01-161-1/+0
| | | | | Fix up #14812 to avoid introducing a reference to the reactor. Signed-off-by: Sean Quah <seanq@matrix.org>
* Fix stack overflow in `_PerHostRatelimiter` due to synchronous requests (#14812)Sean Quah2023-01-131-0/+1
| | | | | | | | | | | | | | | | | | When there are many synchronous requests waiting on a `_PerHostRatelimiter`, each request will be started recursively just after the previous request has completed. Under the right conditions, this leads to stack exhaustion. A common way for requests to become synchronous is when the remote client disconnects early, because the homeserver is overloaded and slow to respond. Avoid stack exhaustion under these conditions by deferring subsequent requests until the next reactor tick. Fixes #14480. Signed-off-by: Sean Quah <seanq@matrix.org>
* Disable sending confirmation email when 3pid is disabled #14682 (#14725)Jeyachandran Rathnam2023-01-091-0/+5
| | | | | | | | | | | * Fixes #12277 :Disable sending confirmation email when 3pid is disabled * Fix test_add_email_if_disabled test case to reflect changes to enable_3pid_changes flag * Add changelog file * Rename newsfragment. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Add experimental support for MSC3391: deleting account data (#14714)Andrew Morgan2023-01-011-0/+115
|
* Move `StateFilter` to `synapse.types` (#14668)David Robertson2022-12-121-1/+1
| | | | | * Move `StateFilter` to `synapse.types` * Changelog
* Reject receipt requests with invalid room or event IDs. (#14632)Nick Mills-Barrett2022-12-071-1/+4
| | | | If the room or event IDs are empty or of an invalid form they should be rejected.
* Fix a long-standing bug where the user directory would return 1 more row ↵reivilibre2022-12-071-2/+2
| | | | than requested. (#14631)
* Improve logging and opentracing for to-device message handling (#14598)Richard van der Hoff2022-12-061-1/+0
| | | | | | | A batch of changes intended to make it easier to trace to-device messages through the system. The intention here is that a client can set a property org.matrix.msgid in any to-device message it sends. That ID is then included in any tracing or logging related to the message. (Suggestions as to where this field should be documented welcome. I'm not enthusiastic about speccing it - it's very much an optional extra to help with debugging.) I've also generally improved the data we send to opentracing for these messages.
* Suppress empty body warnings in room servelets (#14600)David Robertson2022-12-051-12/+2
| | | | | | | | | * Suppress empty body warnings in room servelets We've already decided to allow empty bodies for backwards compat. The change here stops us from emitting a misleading warning; see also https://github.com/matrix-org/synapse/issues/14478#issuecomment-1319157105 * Changelog
* Use ClientRestResource on both the main process and workers. (#14528)Patrick Cloke2022-12-025-26/+30
| | | | | | | Add logic to ClientRestResource to decide whether to mount servlets or not based on whether the current process is a worker. This is clearer to see what a worker runs than the completely separate / copy & pasted list of servlets being mounted for workers.
* Advertise support for Matrix v1.5. (#14576)Patrick Cloke2022-11-291-0/+1
| | | | All features of Matrix v1.5 were already supported: this was mostly a maintenance release.
* Move MSC3030 `/timestamp_to_event` endpoint to stable v1 location (#14471)Eric Eastwood2022-11-282-9/+3
| | | | | | | | Fix https://github.com/matrix-org/synapse/issues/14390 - Client API: `/_matrix/client/unstable/org.matrix.msc3030/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction>` -> `/_matrix/client/v1/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction>` - Federation API: `/_matrix/federation/unstable/org.matrix.msc3030/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>` -> `/_matrix/federation/v1/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction>` Complement test changes: https://github.com/matrix-org/complement/pull/559
* Add a type hint for `get_device_handler()` and fix incorrect types. (#14055)Patrick Cloke2022-11-222-6/+20
| | | | | This was the last untyped handler from the HomeServer object. Since it was being treated as Any (and thus unchecked) it was being used incorrectly in a few places.
* Remove need for `worker_main_http_uri` setting to use /keys/upload. (#14400)realtyem2022-11-161-18/+50
|
* Remove redundant types from comments. (#14412)Patrick Cloke2022-11-161-1/+1
| | | | | | | Remove type hints from comments which have been added as Python type hints. This helps avoid drift between comments and reality, as well as removing redundant information. Also adds some missing type hints which were simple to fill in.
* Fix /refresh endpoint version (#14364)Tulir Asokan2022-11-041-1/+1
|
* Implement MSC3912: Relation-based redactions (#14260)Brendan Abolivier2022-11-032-14/+45
| | | Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Fix dehydrated device REST checks (#14336)David Robertson2022-10-311-3/+2
|
* Reject history insertion during partial joins (#14291)David Robertson2022-10-271-0/+7
|
* Save login tokens in database (#13844)Quentin Gliech2022-10-262-5/+3
| | | | | | | | | | | * Save login tokens in database Signed-off-by: Quentin Gliech <quenting@element.io> * Add upgrade notes * Track login token reuse in a Prometheus metric Signed-off-by: Quentin Gliech <quenting@element.io>
* Implementation for MSC3664: Pushrules for relations (#11804)DeepBlueV7.X2022-10-251-0/+5
|
* Return NOT_JSON if decode fails and defer set_timeline_upper_limit ca… ↵Ryan Miguel2022-10-241-4/+4
| | | | | | | (#14262) * Return NOT_JSON if decode fails and defer set_timeline_upper_limit call until after check_valid_filter. Fixes #13661. Signed-off-by: Ryan Miguel <miguel.ryanj@gmail.com>. * Reword changelog
* Implementation of HTTP 307 response for MSC3886 POST endpoint (#14018)Hugh Nimmo-Smith2022-10-182-0/+77
| | | | Co-authored-by: reivilibre <olivier@librepush.net> Co-authored-by: Andrew Morgan <andrewm@element.io>
* Support filtering the /messages API by relation type (MSC3874). (#14148)Patrick Cloke2022-10-171-0/+2
| | | Gated behind an experimental configuration flag.
* Use Pydantic when PUTting room aliases (#14179)David Robertson2022-10-171-23/+35
|
* Accept threaded receipts for events related to the root event. (#14174)Patrick Cloke2022-10-141-2/+42
| | | | | | | | | The root node of a thread (and events related to it) are considered "part of a thread" when validating receipts. This allows clients which show the root node in both the main timeline and the threaded timeline to easily send receipts in either. Note that threaded notifications are not created for these events, these events created notifications on the main timeline.
* Advertise support for Matrix 1.4. (#14184)Patrick Cloke2022-10-141-0/+1
| | | | All features / changes in Matrix 1.4 are now supported in Synapse.
* Do not allow a None-limit on PaginationConfig. (#14146)Patrick Cloke2022-10-143-3/+9
| | | | | | | The callers either set a default limit or manually handle a None-limit later on (by setting a default value). Update the callers to always instantiate PaginationConfig with a default limit and then assume the limit is non-None.
* Stabilize the threads API. (#14175)Patrick Cloke2022-10-141-7/+2
| | | | | | | Stabilize the threads API (MSC3856) by supporting (only) the v1 path for the endpoint. This also marks the API as safe for workers since it is a read-only API.
* Add an API for listing threads in a room. (#13394)Patrick Cloke2022-10-131-1/+49
| | | | | | | | | Implement the /threads endpoint from MSC3856. This is currently unstable and behind an experimental configuration flag. It includes a background update to backfill data, results from the /threads endpoint will be partial until that finishes.
* Remove support for the unstable dir flag on relations. (#14106)Patrick Cloke2022-10-071-35/+10
| | | | | | From MSC3715, this was unused by clients (and there was no way for clients to know it was supported). Matrix 1.4 defines the stable field.
* Use stable identifiers for MSC3771 & MSC3773. (#14050)Patrick Cloke2022-10-073-29/+30
| | | | | These are both part of Matrix 1.4 which has now been released. For now, support both the unstable and stable identifiers.
* Use Pydantic to validate /devices endpoints (#14054)David Robertson2022-10-071-46/+52
|
* Recursively fetch the thread for receipts & notifications. (#13824)Patrick Cloke2022-10-041-2/+20
| | | | | | Consider an event to be part of a thread if you can follow a chain of relations up to a thread root. Part of MSC3773 & MSC3771.
* Advertise supporting version 1.3 of the Matrix spec. (#14032)Patrick Cloke2022-10-041-0/+1
| | | Now that all features / changes in 1.3 are supported in Synapse.
* Track notification counts per thread (implement MSC3773). (#13776)Patrick Cloke2022-10-042-1/+6
| | | | | | | | When retrieving counts of notifications segment the results based on the thread ID, but choose whether to return them as individual threads or as a single summed field by letting the client opt-in via a sync flag. The summarization code is also updated to be per thread, instead of per room.
* Do not return unspecced original_event field when using the stable ↵Patrick Cloke2022-10-031-0/+6
| | | | | | | | | | /relations endpoint. (#14025) Keep the old behavior (of including the original_event field) for any requests to the /unstable version of the endpoint, but do not include the field when the /v1 version is used. This should avoid new clients from depending on this field, but will not help with current dependencies.
* Add query parameter `ts` to allow appservices set the `origin_server_ts` for ↵lukasdenk2022-10-031-13/+21
| | | | | | | state events. (#11866) MSC3316 declares that both /rooms/{roomId}/send and /rooms/{roomId}/state should accept a ts parameter for appservices. This change expands support to /state and adds tests.
* Allow admins to require a manual approval process before new accounts can be ↵Brendan Abolivier2022-09-292-5/+54
| | | | used (using MSC3866) (#13556)
* Expose MSC3882 only be under an unstable endpoint. (#13868)Hugh Nimmo-Smith2022-09-291-1/+3
|
* Support the stable dir parameter for /relations. (#13920)Patrick Cloke2022-09-271-9/+15
| | | | | | | Since MSC3715 has passed FCP, the stable parameter can be used. This currently falls back to the unstable parameter if the stable parameter is not provided (and MSC3715 support is enabled in the configuration).
* Accept & store thread IDs for receipts (implement MSC3771). (#13782)Patrick Cloke2022-09-233-1/+17
| | | | Updates the `/receipts` endpoint and receipt EDU handler to parse a `thread_id` from the body and insert it in the database.
* Last batch of Pydantic for synapse/rest/client/account.py (#13832)David Robertson2022-09-211-6/+13
| | | | | | | * Validation for `/add_threepid/msisdn/submit_token` * Don't validate deprecated endpoint * Changelog
* Add version flag for MSC3881 (#13860)Brendan Abolivier2022-09-211-0/+2
|
* Track device IDs for pushers (#13831)Brendan Abolivier2022-09-211-0/+3
| | | Second half of the MSC3881 implementation
* Implementation of MSC3882 login token request (#13722)Hugh Nimmo-Smith2022-09-212-0/+96
|
* Support enabling/disabling pushers (from MSC3881) (#13799)Brendan Abolivier2022-09-211-3/+15
| | | Partial implementation of MSC3881
* A third batch of Pydantic validation for rest/client/account.py (#13736)David Robertson2022-09-152-42/+51
|
* A second batch of Pydantic models for rest/client/account.py (#13687)David Robertson2022-09-072-32/+46
|
* Cancel the processing of key query requests when they time out. (#13680)reivilibre2022-09-071-2/+4
|
* Remove support for unstable private read receipts (#13653)Šimon Brandner2022-09-014-6/+0
| | | Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Drop support for calling `/_matrix/client/v3/rooms/{roomId}/invite` without ↵Jacek Kuśnierz2022-08-311-8/+12
| | | | | | | an `id_access_token` (#13241) Fixes #13206 Signed-off-by: Jacek Kusnierz jacek.kusnierz@tum.de
* Generalise the `@cancellable` annotation so it can be used on functions ↵reivilibre2022-08-311-1/+2
| | | | other than just servlet methods. (#13662)
* Drop support for delegating email validation, round 2 (#13596)David Robertson2022-08-232-112/+55
|
* Fix Prometheus metrics being negative (mixed up start/end) (#13584)Eric Eastwood2022-08-231-1/+5
| | | | | | | Fix: - https://github.com/matrix-org/synapse/pull/13535#discussion_r949582508 - https://github.com/matrix-org/synapse/pull/13533#discussion_r949577244
* `synapse.api.auth.Auth` cleanup: make permission-related methods use ↵Quentin Gliech2022-08-223-13/+7
| | | | | | | | | `Requester` instead of the `UserID` (#13024) Part of #13019 This changes all the permission-related methods to rely on the Requester instead of the UserID. This is a first step towards enabling scoped access tokens at some point, since I expect the Requester to have scope-related informations in it. It also changes methods which figure out the user/device/appservice out of the access token to return a Requester instead of something else. This avoids having store-related objects in the methods signatures.
* Remove redundant opentracing spans for `/sendToDevice` and `/keys/upload` ↵Andrew Morgan2022-08-222-4/+2
| | | | (#13574)
* Implement MSC3852: Expose `last_seen_user_agent` to users for their own ↵Andrew Morgan2022-08-191-0/+27
| | | | devices; also expose to Admin API (#13549)
* Fix validation problem that occurs when a user tries to deactivate their ↵reivilibre2022-08-191-3/+3
| | | | account or change their password. (#13563)
* Add metrics to track `/messages` response time by room size (#13545)Eric Eastwood2022-08-181-2/+53
| | | | | Follow-up to https://github.com/matrix-org/synapse/pull/13533 Part of https://github.com/matrix-org/synapse/issues/13356
* Add specific metric to time long-running `/messages` requests (#13533)Eric Eastwood2022-08-171-0/+32
|
* Use Pydantic to systematically validate a first batch of endpoints in ↵David Robertson2022-08-152-85/+132
| | | | `synapse.rest.client.account`. (#13188)
* Support stable identifiers for MSC2285: private read receipts. (#13273)Šimon Brandner2022-08-054-7/+19
| | | | | This adds support for the stable identifiers of MSC2285 while continuing to support the unstable identifiers behind the configuration flag. These will be removed in a future version.
* Rename `RateLimitConfig` to `RatelimitSettings` (#13442)Dirk Klimpel2022-08-031-2/+2
|
* Merge tag 'v1.64.0rc2' into developRichard van der Hoff2022-07-292-54/+111
|\ | | | | | | | | | | | | Synapse 1.64.0rc2 (2022-07-29) ============================== This RC reintroduces support for `account_threepid_delegates.email`, which was removed in 1.64.0rc1. It remains deprecated and will be removed altogether in a future release. ([\#13406](https://github.com/matrix-org/synapse/issues/13406))
| * Revert "Drop support for delegating email validation (#13192)" (#13406)3nprob2022-07-292-54/+111
| | | | | | | | | | Reverts commit fa71bb18b527d1a3e2629b48640ea67fff2f8c59, and tweaks documentation. Signed-off-by: 3nprob <git@3n.anonaddy.com>
* | Use stable prefixes for MSC3827: filtering of `/publicRooms` by room type ↵Šimon Brandner2022-07-271-2/+2
|/ | | | | | (#13370) Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Add missing types to opentracing. (#13345)Patrick Cloke2022-07-211-1/+3
| | | After this change `synapse.logging` is fully typed.
* Add type annotations to `trace` decorator. (#13328)Patrick Cloke2022-07-194-15/+18
| | | | Functions that are decorated with `trace` are now properly typed and the type hints for them are fixed.
* Reduce duplicate code in receipts servlets. (#13198)Patrick Cloke2022-07-132-44/+32
|
* Drop support for calling `/_matrix/client/v3/account/3pid/bind` without an ↵Jacek Kuśnierz2022-07-121-2/+4
| | | | | | | `id_access_token` (#13239) Fixes #13201 Signed-off-by: Jacek Kusnierz jacek.kusnierz@tum.de
* Drop support for delegating email validation (#13192)Richard van der Hoff2022-07-122-112/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Drop support for delegating email validation Delegating email validation to an IS is insecure (since it allows the owner of the IS to do a password reset on your HS), and has long been deprecated. It will now cause a config error at startup. * Update unit test which checks for email verification Give it an `email` config instead of a threepid delegate * Remove unused method `requestEmailToken` * Simplify config handling for email verification Rather than an enum and a boolean, all we need here is a single bool, which says whether we are or are not doing email verification. * update docs * changelog * upgrade.md: fix typo * update version number this will be in 1.64, not 1.63 * update version number this one too
* Make the AS login method call `Auth.get_user_by_req` for checking the AS ↵Quentin Gliech2022-07-121-2/+8
| | | | | | | | token. (#13094) This gets rid of another usage of get_appservice_by_req, with all the benefits, including correctly tracking the appservice IP and setting the tracing attributes correctly. Signed-off-by: Quentin Gliech <quenting@element.io>
* Extra validation for rest/client/account_data (#13148)David Robertson2022-07-011-2/+17
| | | | | | | * Extra validation for rest/client/account_data This is a fairly simple endpoint and we did pretty well here. * Changelog
* Implement MSC3827: Filtering of `/publicRooms` by room type (#13031)Šimon Brandner2022-06-291-0/+2
| | | | Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
* Remove unspecced DELETE endpoint that modifies room visibility (#13123)santhoshivan232022-06-281-11/+0
|
* validate room alias before interacting with the room directory (#13106)santhoshivan232022-06-221-0/+6
|
* Simplify the alias deletion logic as an application service. (#13093)Quentin Gliech2022-06-171-22/+13
|
* Allow MSC3030 'timestamp_to_event' calls from anyone on world-readable ↵Quentin Gliech2022-06-171-1/+3
| | | | | rooms. (#13062) Signed-off-by: Quentin Gliech <quenting@element.io>
* Replace pyjwt with authlib in `org.matrix.login.jwt` (#13011)Hannes Lerchl2022-06-151-8/+38
|
* Fix `destination_is` errors seen in sentry. (#13041)David Robertson2022-06-141-4/+16
| | | | | | * Rename test_fedclient to match its source file * Require at least one destination to be truthy * Explicitly validate user ID in profile endpoint GETs Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Move the "email unsubscribe" resource, refactor the macaroon generator & ↵Quentin Gliech2022-06-141-38/+12
| | | | | | | | | | | | | | | | | | | | | simplify the access token verification logic. (#12986) This simplifies the access token verification logic by removing the `rights` parameter which was only ever used for the unsubscribe link in email notifications. The latter has been moved under the `/_synapse` namespace, since it is not a standard API. This also makes the email verification link more secure, by embedding the app_id and pushkey in the macaroon and verifying it. This prevents the user from tampering the query parameters of that unsubscribe link. Macaroon generation is refactored: - Centralised all macaroon generation and verification logic to the `MacaroonGenerator` - Moved to `synapse.utils` - Changed the constructor to require only a `Clock`, hostname, and a secret key (instead of a full `Homeserver`). - Added tests for all methods.
* Move the (unstable) `dir` parameter for /relations behind an experimental ↵Patrick Cloke2022-06-081-3/+10
| | | | | | flag. (#12984) MSC3715 defines this parameter, but the unstable version of it should be behind an experimental flag.
* Consolidate the logic of delete_device/delete_devices. (#12970)Patrick Cloke2022-06-072-3/+5
| | | | | | | | By always using delete_devices and sometimes passing a list with a single device ID. Previously these methods had gotten out of sync with each other and it seems there's little benefit to the single-device variant.
* Reduce the amount of state we pull from the DB (#12811)Erik Johnston2022-06-061-2/+5
|
* Mutual rooms: Remove dependency on user directory (#12836)Jonathan de Jong2022-05-301-13/+2
|
* Additional constants for EDU types. (#12884)Patrick Cloke2022-05-271-2/+2
| | | Instead of hard-coding strings in many places.
* Remove unstable APIs for /hierarchy. (#12851)Patrick Cloke2022-05-261-6/+1
| | | | Removes the unstable endpoint as well as a duplicated field which was modified during stabilization.
* Remove user-visible groups/communities code (#12553)Patrick Cloke2022-05-252-970/+0
| | | | | | | | | Makes it so that groups/communities no longer exist from a user-POV. E.g. we remove: * All API endpoints (including Client-Server, Server-Server, and admin). * Documented configuration options (and the experimental flag, which is now unused). * Special handling during room upgrades. * The `groups` section of the `/sync` response.
* Discard null-containing strings before updating the user directory (#12762)David Robertson2022-05-181-2/+2
|
* Add some type hints to datastore (#12717)Dirk Klimpel2022-05-171-2/+2
|
* Enable cancellation of `GET /members` and `GET /state` requests (#12708)Sean Quah2022-05-111-1/+5
| | | | | | | | Enable cancellation of `GET /rooms/$room_id/members`, `GET /rooms/$room_id/state` and `GET /rooms/$room_id/state/$state_key/*` requests. Signed-off-by: Sean Quah <seanq@element.io>
* No longer permit empty body when sending receipts (#12709)David Robertson2022-05-111-12/+1
|
* Use `ParamSpec` in a few places (#12667)David Robertson2022-05-092-10/+13
|
* Don't error on unknown receipt types (#12670)Erik Johnston2022-05-091-12/+15
| | | Fixes #12669
* Use `private` instead of `hidden` in MSC2285 related code. (#12635)Šimon Brandner2022-05-051-1/+1
|
* Fix typo in some instances of enable_registration_token_3pid_bypass. (#12639)Will Hunt2022-05-051-1/+1
|
* Use `getClientAddress` instead of `getClientIP`. (#12599)Patrick Cloke2022-05-043-10/+18
| | | | | getClientIP was deprecated in Twisted 18.4.0, which also added getClientAddress. The Synapse minimum version for Twisted is currently 18.9.0, so all supported versions have the new API.
* Implement changes to MSC2285 (hidden read receipts) (#12168)Šimon Brandner2022-05-043-31/+54
| | | | | * Changes hidden read receipts to be a separate receipt type (instead of a field on `m.read`). * Updates the `/receipts` endpoint to accept `m.fully_read`.
* Remove unstable/unspecced login types. (#12597)Patrick Cloke2022-05-041-11/+4
| | | | | | * `m.login.jwt`, which was never specced and has been deprecated since Synapse 1.16.0. (`org.matrix.login.jwt` can be used instead.) * `uk.half-shot.msc2778.login.application_service`, which was stabilized as part of the Matrix spec v1.2 release.
* Remove unstable identifiers for MSC3069. (#12596)Patrick Cloke2022-05-031-2/+0
|
* Add a module API to allow modules to edit push rule actions (#12406)Brendan Abolivier2022-04-271-95/+17
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add option to enable token registration without requiring 3pids (#12526)Will Hunt2022-04-271-1/+6
|
* Implement MSC2815: allow room moderators to view redacted event content (#12427)Tulir Asokan2022-04-202-1/+47
| | | | | | Implements matrix-org/matrix-spec-proposals#2815 Signed-off-by: Tulir Asokan <tulir@maunium.net>
* Fix `/room/.../event/...` to return the *original* event after any edits ↵Richard van der Hoff2022-04-191-1/+3
| | | | | | (#12476) This is what the MSC (now) requires. Fixes https://github.com/matrix-org/synapse/issues/10310.
* Limit `device_id` size to 512B (#12454)Shay2022-04-131-0/+9
| | | *
* Prevent a sync request from removing a user's busy presence status (#12213)David Baker2022-04-131-6/+3
| | | | | | | | | | In trying to use the MSC3026 busy presence status, the user's status would be set back to 'online' next time they synced. This change makes it so that syncing does not affect a user's presence status if it is currently set to 'busy': it must be removed through the presence API. The MSC defers to implementations on the behaviour of busy presence, so this ought to remain compatible with the MSC.
* Rename Mutual Rooms `unstable_features` flag to match MSC (#12445)Jonathan de Jong2022-04-131-1/+1
| | | Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
* Remove references to unstable identifiers from MSC3440. (#12382)Patrick Cloke2022-04-121-1/+0
| | | | | Removes references to unstable thread relation, unstable identifiers for filtering parameters, and the experimental config flag.
* Do not add groups to sync results if disabled. (#12408)Patrick Cloke2022-04-071-8/+7
|
* Support the v1 endpoint for `/relations`. (#12403)Patrick Cloke2022-04-071-1/+1
| | | | Now that MSC2675 has passed FCP and the implementation is compliant with the final version.
* Move MSC2654 support behind an experimental configuration flag. (#12295)Patrick Cloke2022-03-311-1/+3
| | | To match the current thinking on disabling experimental features by default.
* Remove the unused and unstable `/aggregations` endpoint. (#12293)Patrick Cloke2022-03-301-170/+0
| | | | | | | | | This endpoint was removed from MSC2675 before it was approved. It is currently unspecified (even in any MSCs) and therefore subject to removal. It is not implemented by any known clients. This also changes the bundled aggregation format for `m.annotation`, which previously included pagination tokens for the `/aggregations` endpoint, which are no longer useful.
* Room batch: fix up handling of unknown prev_event_ids (#12316)Richard van der Hoff2022-03-291-8/+13
|
* Refactor `create_new_client_event` to use a new parameter, ↵Eric Eastwood2022-03-251-9/+14
| | | | | | | `state_event_ids`, which accurately describes the usage with MSC2716 instead of abusing `auth_event_ids` (#12083) Spawned from https://github.com/matrix-org/synapse/pull/10975#discussion_r813183430 Part of [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716)
* Remove mutual_rooms `update_user_directory` check, and add extra ↵Jonathan de Jong2022-03-231-4/+6
| | | | | documentation (#12038) Resolves #10339
* Rename shared_rooms to mutual_rooms (#12036)Jonathan de Jong2022-03-231-5/+6
| | | Co-authored-by: reivilibre <olivier@librepush.net>
* Move get_bundled_aggregations to relations handler. (#12237)Patrick Cloke2022-03-181-1/+2
| | | | | The get_bundled_aggregations code is fairly high-level and uses a lot of store methods, we move it into the handler as that seems like a better fit.
* Correct `check_username_for_spam` annotations and docs (#12246)David Robertson2022-03-181-2/+2
| | | | | | | * Formally type the UserProfile in user searches * export UserProfile in synapse.module_api * Update docs Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Add a relations handler to avoid duplication. (#12227)Patrick Cloke2022-03-161-67/+8
| | | Adds a handler layer between the REST and datastore layers for relations.
* Support stable identifiers for MSC3440: Threading (#12151)Patrick Cloke2022-03-101-0/+1
| | | | The unstable identifiers are still supported if the experimental configuration flag is enabled. The unstable identifiers will be removed in a future release.
* Allow retrieving the relations of a redacted event. (#12130)Patrick Cloke2022-03-101-44/+38
| | | | | | | | | This is allowed per MSC2675, although the original implementation did not allow for it and would return an empty chunk / not bundle aggregations. The main thing to improve is that the various caches get cleared properly when an event is redacted, and that edits must not leak if the original event is redacted (as that would presumably leak something similar to the original event content).
* Remove backwards compatibility with RelationPaginationToken. (#12138)Patrick Cloke2022-03-041-41/+14
|
* Use the proper serialization format when bundling aggregations. (#12090)Patrick Cloke2022-03-032-96/+45
| | | | This ensures that the `latest_event` field of the bundled aggregation for threads uses the same format as the other events in the response.
* Remove the unstable `/spaces` endpoint. (#12073)Patrick Cloke2022-02-281-68/+0
| | | | | | | | ...and various code supporting it. The /spaces endpoint was from an old version of MSC2946 and included both a Client-Server and Server-Server API. Note that the unstable /hierarchy endpoint (from the final version of MSC2946) is not yet removed.
* Move experimental support for MSC3440 to /versions. (#12099)Patrick Cloke2022-02-282-3/+2
| | | | Instead of being part of /capabilities, this matches a change to MSC3440 to properly use these endpoints.
* Remove more references to `get_datastore` (#12067)Richard van der Hoff2022-02-231-3/+0
| | | | | These have snuck in since #12031 was started. Also a couple of other cleanups while we're in the area.
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-2320-46/+48
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Implement account status endpoints (MSC3720) (#12001)Brendan Abolivier2022-02-222-0/+38
| | | | | See matrix-org/matrix-doc#3720 Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Use v3 endpoints for fallback auth (Matrix 1.1) (#12019)Travis Ralston2022-02-221-4/+4
|
* Advertise Matrix 1.2 in `/_matrix/client/versions` (#12022)Travis Ralston2022-02-211-0/+1
| | | Co-authored-by: Patrick Cloke <patrickc@matrix.org>
* Advertise Matrix 1.1 in `/_matrix/client/versions` (#12020)Travis Ralston2022-02-181-0/+1
|
* Use stable MSC3069 `is_guest` flag on `/whoami`. (#12021)Travis Ralston2022-02-181-0/+2
| | | Keeping backwards compatibility with the unstable flag for now.
* Remove unstable MSC3283 flags (#12018)Erik Johnston2022-02-171-14/+0
| | | Fixes #11962
* Allow modules to set a display name on registration (#12009)Brendan Abolivier2022-02-171-0/+7
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Support the MSC3715 for `/relations`. (#11941)Patrick Cloke2022-02-111-0/+4
| | | | This adds an unstable org.matrix.msc3715.dir parameter which acts like dir on /mesages.
* Support the stable API endpoint for MSC3283: new settings in `/capabilities` ↵Dirk Klimpel2022-02-111-1/+14
| | | | endpoint (#11933)
* Support pagination tokens from /sync and /messages in the relations API. ↵Patrick Cloke2022-02-101-18/+39
| | | | (#11952)
* Add a callback to allow modules to deny 3PID (#11854)Brendan Abolivier2022-02-082-5/+7
| | | | | Part of the Tchap Synapse mainlining. This allows modules to implement extra logic to figure out whether a given 3PID can be added to the local homeserver. In the Tchap use case, this will allow a Synapse module to interface with the custom endpoint /internal_info.
* Fix historical messages backfilling in random order on remote homeservers ↵Eric Eastwood2022-02-071-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (MSC2716) (#11114) Fix https://github.com/matrix-org/synapse/issues/11091 Fix https://github.com/matrix-org/synapse/issues/10764 (side-stepping the issue because we no longer have to deal with `fake_prev_event_id`) 1. Made the `/backfill` response return messages in `(depth, stream_ordering)` order (previously only sorted by `depth`) - Technically, it shouldn't really matter how `/backfill` returns things but I'm just trying to make the `stream_ordering` a little more consistent from the origin to the remote homeservers in order to get the order of messages from `/messages` consistent ([sorted by `(topological_ordering, stream_ordering)`](https://github.com/matrix-org/synapse/blob/develop/docs/development/room-dag-concepts.md#depth-and-stream-ordering)). - Even now that we return backfilled messages in order, it still doesn't guarantee the same `stream_ordering` (and more importantly the [`/messages` order](https://github.com/matrix-org/synapse/blob/develop/docs/development/room-dag-concepts.md#depth-and-stream-ordering)) on the other server. For example, if a room has a bunch of history imported and someone visits a permalink to a historical message back in time, their homeserver will skip over the historical messages in between and insert the permalink as the next message in the `stream_order` and totally throw off the sort. - This will be even more the case when we add the [MSC3030 jump to date API endpoint](https://github.com/matrix-org/matrix-doc/pull/3030) so the static archives can navigate and jump to a certain date. - We're solving this in the future by switching to [online topological ordering](https://github.com/matrix-org/gomatrixserverlib/issues/187) and [chunking](https://github.com/matrix-org/synapse/issues/3785) which by its nature will apply retroactively to fix any inconsistencies introduced by people permalinking 2. As we're navigating `prev_events` to return in `/backfill`, we order by `depth` first (newest -> oldest) and now also tie-break based on the `stream_ordering` (newest -> oldest). This is technically important because MSC2716 inserts a bunch of historical messages at the same `depth` so it's best to be prescriptive about which ones we should process first. In reality, I think the code already looped over the historical messages as expected because the database is already in order. 3. Making the historical state chain and historical event chain float on their own by having no `prev_events` instead of a fake `prev_event` which caused backfill to get clogged with an unresolvable event. Fixes https://github.com/matrix-org/synapse/issues/11091 and https://github.com/matrix-org/synapse/issues/10764 4. We no longer find connected insertion events by finding a potential `prev_event` connection to the current event we're iterating over. We now solely rely on marker events which when processed, add the insertion event as an extremity and the federating homeserver can ask about it when time calls. - Related discussion, https://github.com/matrix-org/synapse/pull/11114#discussion_r741514793 Before | After --- | --- ![](https://user-images.githubusercontent.com/558581/139218681-b465c862-5c49-4702-a59e-466733b0cf45.png) | ![](https://user-images.githubusercontent.com/558581/146453159-a1609e0a-8324-439d-ae44-e4bce43ac6d1.png) #### Why aren't we sorting topologically when receiving backfill events? > The main reason we're going to opt to not sort topologically when receiving backfill events is because it's probably best to do whatever is easiest to make it just work. People will probably have opinions once they look at [MSC2716](https://github.com/matrix-org/matrix-doc/pull/2716) which could change whatever implementation anyway. > > As mentioned, ideally we would do this but code necessary to make the fake edges but it gets confusing and gives an impression of “just whyyyy” (feels icky). This problem also dissolves with online topological ordering. > > -- https://github.com/matrix-org/synapse/pull/11114#discussion_r741517138 See https://github.com/matrix-org/synapse/pull/11114#discussion_r739610091 for the technical difficulties
* Stabilise MSC3231 (Token Based Registration) (#11867)Jonathan de Jong2022-02-041-4/+3
|
* Revert experimental push rules from #7997. (#11884)Patrick Cloke2022-02-021-11/+2
| | | Manually reverts the merge from cdbb8e6d6e36e0b6bc36e676d8fe66c96986b399.
* Add a module callback to set username at registration (#11790)Brendan Abolivier2022-01-261-1/+11
| | | | | | This is in the context of mainlining the Tchap fork of Synapse. Currently in Tchap usernames are derived from the user's email address (extracted from the UIA results, more specifically the m.login.email.identity step). This change also exports the check_username method from the registration handler as part of the module API, so that a module can check if the username it's trying to generate is correct and doesn't conflict with an existing one, and fallback gracefully if not. Co-authored-by: David Robertson <davidr@element.io>
* Improvements to bundling aggregations. (#11815)Patrick Cloke2022-01-262-16/+26
| | | | | | | | | | | This is some odds and ends found during the review of #11791 and while continuing to work in this code: * Return attrs classes instead of dictionaries from some methods to improve type safety. * Call `get_bundled_aggregations` fewer times. * Adds a missing assertion in the tests. * Do not return empty bundled aggregations for an event (preferring to not include the bundle at all, as the docstring states).
* Add a config flag to inhibit `M_USER_IN_USE` during registration (#11743)Brendan Abolivier2022-01-261-0/+11
| | | | | | | This is mostly motivated by the tchap use case, where usernames are automatically generated from the user's email address (in a way that allows figuring out the email address from the username). Therefore, it's an issue if we respond to requests on /register and /register/available with M_USER_IN_USE, because it can potentially leak email addresses (which include the user's real name and place of work). This commit adds a flag to inhibit the M_USER_IN_USE errors that are raised both by /register/available, and when providing a username early into the registration process. This error will still be raised if the user completes the registration process but the username conflicts. This is particularly useful when using modules (https://github.com/matrix-org/synapse/pull/11790 adds a module callback to set the username of users at registration) or SSO, since they can ensure the username is unique. More context is available in the PR that introduced this behaviour to synapse-dinsic: matrix-org/synapse-dinsic#48 - as well as the issue in the matrix-dinsic repo: matrix-org/matrix-dinsic#476
* Do not try to serialize raw aggregations dict. (#11791)Patrick Cloke2022-01-211-7/+4
|
* Make the `get_global_account_data_by_type_for_user` cache be a tree-cache ↵reivilibre2022-01-211-1/+1
| | | | whose key is prefixed with the user ID (#11788)
* Include whether the requesting user has participated in a thread. (#11577)Patrick Cloke2022-01-182-2/+6
| | | | | | Per updates to MSC3440. This is implement as a separate method since it needs to be cached on a per-user basis, instead of a per-thread basis.
* Include bundled aggregations in the sync response cache. (#11659)Patrick Cloke2022-01-131-14/+3
|
* Merge branch 'release-v1.50' into developOlivier Wilkinson (reivilibre)2022-01-071-0/+3
|\
| * Include `io.element.thread` capability for MSC3440. (#11690)Patrick Cloke2022-01-051-0/+3
| |
* | Bundle aggregations outside of the serialization method. (#11612)Patrick Cloke2022-01-075-34/+48
| | | | | | | | | | | | | | | | This makes the serialization of events synchronous (and it no longer access the database), but we must manually calculate and provide the bundled aggregations. Overall this should cause no change in behavior, but is prep work for other improvements.
* | Remove the /send_relation endpoint. (#11682)Patrick Cloke2022-01-061-120/+5
|/ | | | This was removed from MSC2674 before that was approved and is not used by any known clients.
* Add type hints to event_push_actions. (#11594)Patrick Cloke2021-12-211-10/+10
|
* Various opentracing enhancements (#11619)Richard van der Hoff2021-12-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | * Wrap `auth.get_user_by_req` in an opentracing span give `get_user_by_req` its own opentracing span, since it can result in a non-trivial number of sub-spans which it is useful to group together. This requires a bit of reorganisation because it also sets some tags (and may force tracing) on the servlet span. * Emit opentracing span for encoding json responses This can be a significant time sink. * Rename all sync spans with a prefix * Write an opentracing span for encoding sync response * opentracing span to group generate_room_entries * opentracing spans within sync.encode_response * changelog * Use the `trace` decorator instead of context managers
* Do not bundle aggregations for APIs which shouldn't include them. (#11592)Patrick Cloke2021-12-202-5/+9
| | | | | And make bundling aggregations opt-in, instead of opt-out to avoid having APIs to include extraneous data (and being much heavier than necessary).
* Merge remote-tracking branch 'origin/release-v1.49' into developRichard van der Hoff2021-12-201-1/+9
|\
| * Disable aggregation bundling on `/sync` responses (#11583)Richard van der Hoff2021-12-201-1/+9
| | | | | | | | | | | | | | | | | | | | | | * Disable aggregation bundling on `/sync` responses A partial revert of #11478. This turns out to have had a significant CPU impact on initial-sync handling. For now, let's disable it, until we find a more efficient way of achieving this. * Fix tests. Co-authored-by: Patrick Cloke <patrickc@matrix.org>
* | Add MSC2716 and MSC3030 to `/versions` -> `unstable_features` (#11582)Eric Eastwood2021-12-161-0/+4
| | | | | | | | As suggested in https://github.com/matrix-org/matrix-react-sdk/pull/7372#discussion_r769523369
* | Make `get_device` return None if the device doesn't exist rather than ↵reivilibre2021-12-131-2/+4
| | | | | | | | | | raising an exception. (#11565) Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* | Do not allow cross-room relations, per MSC2674. (#11516)Patrick Cloke2021-12-091-1/+6
| |
* | Support unprefixed versions of fallback key property names. (#11541)Hubert Chathi2021-12-091-0/+3
| |
* | Allow guests to send state events (#11378)Robert Long2021-12-091-1/+1
| |
* | Add a constant for receipt types (m.read). (#11531)Patrick Cloke2021-12-083-6/+7
|/ | | And expand some type hints in the receipts storage module.
* Stabilise support for MSC2918 refresh tokens as they have now been merged ↵reivilibre2021-12-062-29/+23
| | | | into the Matrix specification. (#11435)
* Save the OIDC session ID (sid) with the device on login (#11482)Quentin Gliech2021-12-061-2/+5
| | | As a step towards allowing back-channel logout for OIDC.
* Include bundled aggregations in /sync and related fixes (#11478)Patrick Cloke2021-12-063-12/+8
| | | | | | | | Due to updates to MSC2675 this includes a few fixes: * Include bundled aggregations for /sync. * Do not include bundled aggregations for /initialSync and /events. * Do not bundle aggregations for state events. * Clarifies comments and variable names.
* Add MSC3030 experimental client and federation API endpoints to get the ↵Eric Eastwood2021-12-021-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | closest event to a given timestamp (#9445) MSC3030: https://github.com/matrix-org/matrix-doc/pull/3030 Client API endpoint. This will also go and fetch from the federation API endpoint if unable to find an event locally or we found an extremity with possibly a closer event we don't know about. ``` GET /_matrix/client/unstable/org.matrix.msc3030/rooms/<roomID>/timestamp_to_event?ts=<timestamp>&dir=<direction> { "event_id": ... "origin_server_ts": ... } ``` Federation API endpoint: ``` GET /_matrix/federation/unstable/org.matrix.msc3030/timestamp_to_event/<roomID>?ts=<timestamp>&dir=<direction> { "event_id": ... "origin_server_ts": ... } ``` Co-authored-by: Erik Johnston <erik@matrix.org>
* Register the login redirect endpoint for v3. (#11451)Patrick Cloke2021-12-012-3/+3
| | | As specified for Matrix v1.1.
* Bundle relations of relations into the `/relations` result. (#11284)Patrick Cloke2021-11-301-6/+3
| | | | | Per updates to MSC2675 which now states that bundled aggregations should be included from the `/relations` endpoint.
* Support the stable /hierarchy endpoint from MSC2946 (#11329)Patrick Cloke2021-11-291-4/+4
| | | | | | This also makes additional updates where the implementation had drifted from the approved MSC. Unstable endpoints will be removed at a later data.
* Update MSC2918 refresh token support to confirm with the latest revision: ↵reivilibre2021-11-262-8/+13
| | | | accept the `refresh_tokens` parameter in the request body rather than in the URL parameters. (#11430)
* Support expiry of refresh tokens and expiry of the overall session when ↵reivilibre2021-11-261-15/+37
| | | | refresh tokens are in use. (#11425)
* Rename unstable `access_token_lifetime` configuration option to ↵reivilibre2021-11-232-5/+13
| | | | `refreshable_access_token_lifetime` to make it clear it only concerns refreshable access tokens. (#11388)
* Refactor the code to inject bundled relations during serialization. (#11408)Patrick Cloke2021-11-233-5/+5
|
* Add config for customizing the claim used for JWT logins. (#11361)Kostas2021-11-221-1/+2
| | | | | Allows specifying a different claim (from the default "sub") to use when calculating the localpart of the Matrix ID used during the JWT login.
* Add support for `/_matrix/client/v3` APIs (#11318)Aaron R2021-11-162-3/+3
| | | | | This is one of the changes required to support Matrix 1.1 Signed-off-by: Aaron Raimist <aaron@raim.ist>
* Add support for the stable version of MSC2778 (#11335)Tulir Asokan2021-11-151-2/+7
| | | | | | | | | * Add support for the stable version of MSC2778 Signed-off-by: Tulir Asokan <tulir@maunium.net> * Expect m.login.application_service in login and password provider tests Signed-off-by: Tulir Asokan <tulir@maunium.net>
* Support filtering by relations per MSC3440 (#11236)Patrick Cloke2021-11-092-5/+11
| | | | Adds experimental support for `relation_types` and `relation_senders` fields for filters.
* Fix typo in `RelationAggregationPaginationServlet` error response (#11278)Andrew Morgan2021-11-091-1/+3
|
* Require body for read receipts with user-agent exceptions (#11157)rogersheu2021-11-091-1/+11
| | | Co-authored-by: reivilibre <olivier@librepush.net>
* Rename to more clear `get_insertion_event_id_by_batch_id` (MSC2716) (#11244)Eric Eastwood2021-11-081-1/+1
| | | | | `get_insertion_event_by_batch_id` -> `get_insertion_event_id_by_batch_id` Split out from https://github.com/matrix-org/synapse/pull/11114
* Enable passing typing stream writers as a list. (#11237)Nick Barrett2021-11-031-1/+1
| | | | This makes the typing stream writer config match the other stream writers that only currently support a single worker.
* Support sending no `state_events_at_start` in the MSC2716 `/batch_send` ↵Eric Eastwood2021-11-031-12/+17
| | | | | | | | endpoint (#11188) As brought up by @tulir, https://matrix.to/#/!SBYNQlpqkwJzFIdzxI:nevarro.space/$Gwnb2ZvXHc3poYXuBhho0cmoYq4KJ11Jh3m5s8kjNOM?via=nevarro.space&via=beeper.com&via=matrix.org This use case only works if the user is already joined in the current room state at the given `?prev_event_id`
* Add remaining type hints to `synapse.events`. (#11098)Patrick Cloke2021-11-021-1/+1
|
* Support Client-Server API r0.6.1 (#11097)Aaron R2021-11-011-0/+1
| | | | | Fixes #11064 Signed-off-by: Aaron Raimist <aaron@raim.ist>
* Add a thread relation type per MSC3440. (#11088)Patrick Cloke2021-10-211-1/+2
| | | | Adds experimental support for MSC3440's `io.element.thread` relation type (and the aggregation for it).
* Resolve and share `state_groups` for all historical events in batch ↵Eric Eastwood2021-10-131-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (MSC2716) (#10975) Resolve and share `state_groups` for all historical events in batch. This also helps for showing the appropriate avatar/displayname in Element and will work whenever `/messages` has one of the historical messages as the first message in the batch. This does have the flaw where if you just insert a single historical event somewhere, it probably won't resolve the state correctly from `/messages` or `/context` since it will grab a non historical event above or below with resolved state which never included the historical state back then. For the same reasions, this also does not work in Element between the transition from actual messages to historical messages. In the Gitter case, this isn't really a problem since all of the historical messages are in one big lump at the beginning of the room. For a future iteration, might be good to look at `/messages` and `/context` to additionally add the `state` for any historical messages in that batch. --- How are the `state_groups` shared? To illustrate the `state_group` sharing, see this example: **Before** (new `state_group` for every event 😬, very inefficient): ``` # Tests from https://github.com/matrix-org/complement/pull/206 $ COMPLEMENT_ALWAYS_PRINT_SERVER_LOGS=1 COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh TestBackfillingHistory/parallel/should_resolve_member_state_events_for_historical_events create_new_client_event m.room.member event=$_JXfwUDIWS6xKGG4SmZXjSFrizhARM7QblhATVWWUcA state_group=None create_new_client_event org.matrix.msc2716.insertion event=$1ZBfmBKEjg94d-vGYymKrVYeghwBOuGJ3wubU1-I9y0 state_group=9 create_new_client_event org.matrix.msc2716.insertion event=$Mq2JvRetTyclPuozRI682SAjYp3GqRuPc8_cH5-ezPY state_group=10 create_new_client_event m.room.message event=$MfmY4rBQkxrIp8jVwVMTJ4PKnxSigpG9E2cn7S0AtTo state_group=11 create_new_client_event m.room.message event=$uYOv6V8wiF7xHwOMt-60d1AoOIbqLgrDLz6ZIQDdWUI state_group=12 create_new_client_event m.room.message event=$PAbkJRMxb0bX4A6av463faiAhxkE3FEObM1xB4D0UG4 state_group=13 create_new_client_event org.matrix.msc2716.batch event=$Oy_S7AWN7rJQe_MYwGPEy6RtbYklrI-tAhmfiLrCaKI state_group=14 ``` **After** (all events in batch sharing `state_group=10`) (the base insertion event has `state_group=8` which matches the `prev_event` we're inserting next to): ``` # Tests from https://github.com/matrix-org/complement/pull/206 $ COMPLEMENT_ALWAYS_PRINT_SERVER_LOGS=1 COMPLEMENT_DIR=../complement ./scripts-dev/complement.sh TestBackfillingHistory/parallel/should_resolve_member_state_events_for_historical_events create_new_client_event m.room.member event=$PWomJ8PwENYEYuVNoG30gqtybuQQSZ55eldBUSs0i0U state_group=None create_new_client_event org.matrix.msc2716.insertion event=$e_mCU7Eah9ABF6nQU7lu4E1RxIWccNF05AKaTT5m3lw state_group=9 create_new_client_event org.matrix.msc2716.insertion event=$ui7A3_GdXIcJq0C8GpyrF8X7B3DTjMd_WGCjogax7xU state_group=10 create_new_client_event m.room.message event=$EnTIM5rEGVezQJiYl62uFBl6kJ7B-sMxWqe2D_4FX1I state_group=10 create_new_client_event m.room.message event=$LGx5jGONnBPuNhAuZqHeEoXChd9ryVkuTZatGisOPjk state_group=10 create_new_client_event m.room.message event=$wW0zwoN50lbLu1KoKbybVMxLbKUj7GV_olozIc5i3M0 state_group=10 create_new_client_event org.matrix.msc2716.batch event=$5ZB6dtzqFBCEuMRgpkU201Qhx3WtXZGTz_YgldL6JrQ state_group=10 ```
* Add type hints to synapse.events.*. (#11066)Patrick Cloke2021-10-131-4/+4
| | | Except `synapse/events/__init__.py`, which will be done in a follow-up.
* Refactor MSC2716 `/batch_send` endpoint into separate handler functions (#10974)Eric Eastwood2021-10-081-283/+56
|
* Require direct references to configuration variables. (#10985)Patrick Cloke2021-10-062-2/+4
| | | | | | This removes the magic allowing accessing configurable variables directly from the config object. It is now required that a specific configuration class is used (e.g. `config.foo` must be replaced with `config.server.foo`).
* Use direct references for configuration variables (part 7). (#10959)Patrick Cloke2021-10-045-32/+34
|
* Fix getTurnServer response: return an integer ttl (#10922)Lukas Lihotzki2021-09-301-1/+1
| | | | | | | | | `ttl` must be an integer according to the OpenAPI spec: https://github.com/matrix-org/matrix-doc/blob/old_master/data/api/client-server/voip.yaml#L70 True division (`/`) returns a float instead (`"ttl": 7200.0`). Floor division (`//`) returns an integer, so the response is spec compliant. Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
* Use direct references for configuration variables (part 6). (#10916)Patrick Cloke2021-09-298-17/+17
|